text:
Q: Query: How to obtain the most recent message per one user conversations? I have a conversations table that is very simple but important (created_by is the code of the user who sent the message). Then, I have a conversations_messages table (sent_by is the code of the user who sent the message, message is my message text and created_at is the timestamp). Finally I have a conversations_users table that has the user_id (code of the user who received the message) and created_by (code of the user who sent the message).
I am trying to implement the functionality of inbox, I want to show the last message per conversation. user_id in conversations_users is the user who received the message and the user who is consulting his inbox.
I tried this query but I don't know how to deal with the created_at timestamp (in table conversations_messages) in order to get the most recent message per conversation.
select CM.id, CM.message, CM.created_at, C.id as 'conversation_id' from conversations_users CU
    join conversations C on CU.conversation_id = C.id join conversations_messages CM on C.id = CM.conversation_id where CU.user_id = 1 and CM.created_at = '2015-03-10 14:18:02'

I have to replace '2015-03-10 14:18:02' for some most recent created_at timestamp thats my problem.
My tables are:

*

*conversations_users: id, conversation_id, user_id, created_by

*conversations: id, created_by

*conversations_messages: id, conversation_id, sent_by, message, created_at

Thanks!

A: SELECT cm.*
FROM conversations_messages cm
JOIN conversations c ON cm.conversation_id = c.id
JOIN conversations_users cu ON cu.conversation_id = c.id
WHERE cu.user_id = 1
AND NOT EXISTS (    SELECT 'a'
                    FROM conversations_messages cm2
                    WHERE cm2.conversation_id = cm.conversation_id
                    AND cm2.created_at > cm.created_at
                    )
GROUP BY c.id

A: Here's one approach joining the table back to itself using the max aggregate, grouping by each conversation:
select CM.id, CM.message, CM.created_at, C.id as 'conversation_id'
from conversations_users CU
    join conversations C on CU.conversation_id = C.id
    join conversations_messages CM on C.id = CM.conversation_id
    join (
        select max(created_at) maxcreated_at, conversation_id
        from conversations
        group by conversation_id
    ) T on T.maxcreated_at = CM.created_at
           and T.conversation_id = CM.conversation_id
where CU.user_id = 1


text:
Q: Is there a consequence to being over data storage limit? Our organization is at about 170% of our data storage limit. Is there any consequences of this? Or will Salesforce just not care about the limit?

A: I believe If you do not get your storage use down to within the limit you will be contacted and asked to purchase additional storage and potentially you could be unable to perform any more DML until you are within the limits.
I am not sure of the tolerances and it is completely up to salesforce when they choose to enforce the limit.

A: I have seen bulk data loads fail when storage is > 100% - so if you are loading in data via Dataloader, you'll get an error...

redpajama_set_name: RedPajamaStackExchange


text:
Q: Multiple panel figure, with figures side by side I'm trying to create a multiple panel figure and I want the figures to by side by side (thre are 3 so I want two of them to be side by side and the other one below the first one).
However, I have only been able to get a figure where all three subfigures are one on top of the other
Here is my code
\documentclass{article}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-a.pdf}
\caption{Generic} \label{fig:timing1}
\end{subfigure}

\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-b.pdf}
\caption{Competitors} \label{fig:timing2}
\end{subfigure}

\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-c.pdf}
\caption{Price regulation} \label{fig:timing3}
 \end{subfigure}

 \caption{Some general caption of all the figures. In (\subref{fig:timing1}) you can see a  green square....}

\end{figure}

\end{document}

A: Do you mean something like this?

In order to have figure A and B on the same line there must be no blank lines between the subfigure environments. You can adjust the distance adding a \hfill (or a \hspace{}) between them. The vertical space before figure C can be adjusted changing the value of \vspace{}.
\documentclass{article}

\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}

\begin{document}
\begin{figure}
    \centering
    \begin{subfigure}[t]{0.45\textwidth}
        \centering
        \includegraphics[width=\linewidth]{example-image-a.pdf}
        \caption{Generic} \label{fig:timing1}
    \end{subfigure}
    \hfill
    \begin{subfigure}[t]{0.45\textwidth}
        \centering
        \includegraphics[width=\linewidth]{example-image-b.pdf}
        \caption{Competitors} \label{fig:timing2}
    \end{subfigure}

    \vspace{1cm}
    \begin{subfigure}[t]{\textwidth}
    \centering
        \includegraphics[width=\linewidth]{example-image-c.pdf}
        \caption{Price regulation} \label{fig:timing3}
    \end{subfigure}
    \caption{Some general caption of all the figures. In (\subref{fig:timing1}) you can see a  green square....}
\end{figure}
\end{document}

Of course you can change the width of all subfigures to get three images with the same dimensions:

I obtained this new figure setting the following widths:

*

*figure A: width=0.5\linewidth;

*figure B: width=0.5\linewidth;

*figure C: width=0.25\linewidth;

You can adjust these values in order to obtain the desired output (or using a different command like \includegraphics[scale=]{}).
EDIT: Re-reading the question I noticed:

...and the other one below the first one...

Therefore, if you want to put figure C below A, you only need this code:
\documentclass{article}

\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}

\begin{document}
\begin{figure}
    \centering
    \begin{subfigure}[t]{0.45\textwidth}
        \centering
        \includegraphics[width=0.5\linewidth]{example-image-a.pdf}
        \caption{Generic} \label{fig:timing1}
    \end{subfigure}
    \hfill
    \begin{subfigure}[t]{0.45\textwidth}
        \centering
        \includegraphics[width=0.5\linewidth]{example-image-b.pdf}
        \caption{Competitors} \label{fig:timing2}
    \end{subfigure}

    \vspace{1cm}
    \begin{subfigure}[t]{0.45\textwidth}
        \centering
        \includegraphics[width=0.5\linewidth]{example-image-c.pdf}
        \caption{Price regulation} \label{fig:timing3}
    \end{subfigure}
    \hfill
    \begin{subfigure}[t]{0.45\textwidth}
        % just an empty subfigure to shift C below A
    \end{subfigure}
    \caption{Some general caption of all the figures. In (\subref{fig:timing1}) you can see a  green square....}
\end{figure}
\end{document}

that produces:

A: try this:
\begin{figure}
\begin{subfigure}[b]{0.5\textwidth}
\includegraphics[width=\textwidth]{plots/1-a.png}
\centering
\caption{}
\label{1}
\end{subfigure}
\begin{subfigure}[b]{0.5\textwidth}
\includegraphics[width=\textwidth]{plots/1-b.png}
\centering
\caption{}
\label{2}
\end{subfigure}
\begin{subfigure}[b]{1\textwidth}
\includegraphics[width=0.5\textwidth]{plots/1-c.png}
\centering
\caption{}
\label{3}
\end{subfigure}
\caption{general caption ...}
\end{figure}
\begin{equation}


text:
Q: How to capture the IP address of Android Application end user  --> IP address of Android Application end user
I have searched allot over internet about how to capture the  IP ADDRESS of user who is actually using my ANDROID APPLICATION, but did not get the correct code which will work for me.
I am developing this android app on Eclipse.
on most of the forums i get this link which is not reachable at all:
http://www.droidnova.com/get-the-ip-address-of-your-device,304.html
Need your support guys.
Thanks

A: You can try the following code.
  public String getLocalIpAddress() {
    try {
      for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
         NetworkInterface intf = en.nextElement();
         for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
           InetAddress inetAddress = enumIpAddr.nextElement();
           if (!inetAddress.isLoopbackAddress()) {
             String ip = Formatter.formatIpAddress(inetAddress.hashCode());
             return ip;
           }
         }
      }
    } catch (SocketException ex) {
      //
    }
    return null;
  }

Don't forget to add the following permission in order to allow your application to open network sockets:
 <uses-permission android:name="android.permission.INTERNET" />

A: *

*try to open a connection to http://www.whatismyip.com and fetch the result.

*Make a HTTP POST ( or GET) to your app host and check there from which IP is coming the request.

*use SDK.

Edit: based on comment: that is the server side role to get the client IP, not the Android job.
Here is a sample how can you do it with PHP: $_SERVER['REMOTE_ADDR']

A: Or instead of requesting the IP from the Server, you can tell your phone to send the IP.
You can get the IP adress with the following code.
public String getLocalIpAddress() {
        try {
            for (Enumeration<NetworkInterface> en = NetworkInterface
                    .getNetworkInterfaces(); en.hasMoreElements();) {
                NetworkInterface intf = en.nextElement();
                for (Enumeration<InetAddress> enumIpAddr = intf
                        .getInetAddresses(); enumIpAddr.hasMoreElements();) {
                    InetAddress inetAddress = enumIpAddr.nextElement();
                    if (!inetAddress.isLoopbackAddress()) {
                        return inetAddress.getHostAddress().toString();
                    }
                }
            }
        } catch (SocketException ex) {
            Log.e(tag, ex.toString());
        }
        return "";
    }


text:
Q: SetKeyboardState not working in Windows 8 I'm trying to use a combination of attaching thread input to another thread and setting key states to send a shift+a combination (A) to Notepad. The problem is, the code below prints a instead of A.
I have tried debugging the code and holding down the shift while stepping through breakpoints and it works great when holding down shift. So I know that the thread attachment is working.
So it seems like the SetKeyboardState(...) command isn't working, though. What am I doing wrong?
Here is the code:
    [DllImport("user32.dll")]
    [return: MarshalAs(UnmanagedType.Bool)]
    static extern bool GetKeyboardState(byte[] lpKeyState);

    [DllImport("user32.dll")]
    static extern bool SetKeyboardState(byte[] lpKeyState);

    public static void simKeyPressWithModifier(IntPtr winHandle)
    {
        uint threadId = User32.GetWindowThreadProcessId(winHandle, IntPtr.Zero);
        byte[] keys = new byte[256];

        if (!GetKeyboardState(keys))
        {
            int err = Marshal.GetLastWin32Error();
            throw new Win32Exception(err);
        }
        User32.AttachThreadInput((uint)AppDomain.GetCurrentThreadId(), threadId, true);

        int sKey = (int)VK.VK_LSHIFT;
        keys[sKey] = 0xFF;

        if (!SetKeyboardState(keys))
        {
            int err = Marshal.GetLastWin32Error();
            throw new Win32Exception(err);
        }

        User32.PostMessage(winHandle, WM.WM_KEYDOWN, (IntPtr)Keys.A, IntPtr.Zero);

        keys[sKey] = 0;
        if (!SetKeyboardState(keys))
        {
            int err = Marshal.GetLastWin32Error();
            throw new Win32Exception(err);
        }
        User32.AttachThreadInput((uint)AppDomain.GetCurrentThreadId(), threadId, false);
    }

Update
Posting as four commands:
    public static void simKeyPressWithModifier(IntPtr winHandle)
    {

        User32.PostMessage(winHandle, WM.WM_KEYDOWN, (IntPtr)VK.VK_LSHIFT, IntPtr.Zero);
        User32.PostMessage(winHandle, WM.WM_KEYDOWN, (IntPtr)Keys.A, IntPtr.Zero);
        User32.PostMessage(winHandle, WM.WM_KEYUP, (IntPtr)Keys.A, IntPtr.Zero);
        User32.PostMessage(winHandle, WM.WM_KEYUP, (IntPtr)VK.VK_LSHIFT, IntPtr.Zero);
    }

Results in two lowercase as.
If I do SendMessage instead of PostMessage, nothing appears at all:
    public static void simKeyPressWithModifier(IntPtr winHandle)
    {

        User32.SendMessage(winHandle, WM.WM_KEYDOWN, (IntPtr)VK.VK_LSHIFT, IntPtr.Zero);
        User32.SendMessage(winHandle, WM.WM_KEYDOWN, (IntPtr)Keys.A, IntPtr.Zero);
        User32.SendMessage(winHandle, WM.WM_KEYUP, (IntPtr)Keys.A, IntPtr.Zero);
        User32.SendMessage(winHandle, WM.WM_KEYUP, (IntPtr)VK.VK_LSHIFT, IntPtr.Zero);

    }

Using .NET Framework 4 on Windows 8.1 in C#.

How I'm getting the context handle:
Process p = Process.Start("notepad");
IntPtr windowHandle = p.MainWindowHandle;
RECT bounds = new RECT();
User32.GetWindowRect(windowHandle, out bounds);

POINT currentContextLocation = new POINT();
currentContextLocation.x = bounds.left + 100;
currentContextLocation.y = bounds.top + 100;
IntPtr contextHandle = User32.WindowFromPoint(currentContextLocation);

simKeyPressWithModifier(contextHandle);


text:
Q: Centralize a Frame in Another Frame in QT Designer In the first picture I designed a prototype. The MainWindow includes widget and three frames. The center frame has another frame, and when I run in the application in full screen there is a size problem in the center frame, as you can see in the second picture. I want to center the frame in its frame. How can I do that?

A: You can do it easily from Qt Designer. Just add another Horizontal Layout into the middle Frame. Then add your Widget into the layout, go to the Object Manager, call context menu on your widget, click Layout Alignment and choose Center horizontally.
Here is the .ui file which I have just created to check your problem:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>965</width>
    <height>502</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <widget class="QWidget" name="centralWidget">
   <layout class="QHBoxLayout" name="horizontalLayout">
    <item>
     <layout class="QHBoxLayout" name="horizontalLayout_3">
      <item>
       <widget class="QFrame" name="frame_2">
        <property name="frameShape">
         <enum>QFrame::StyledPanel</enum>
        </property>
        <property name="frameShadow">
         <enum>QFrame::Raised</enum>
        </property>
       </widget>
      </item>
      <item>
       <widget class="QFrame" name="frame_3">
        <property name="frameShape">
         <enum>QFrame::StyledPanel</enum>
        </property>
        <property name="frameShadow">
         <enum>QFrame::Raised</enum>
        </property>
        <widget class="QWidget" name="horizontalLayoutWidget_2">
         <property name="geometry">
          <rect>
           <x>9</x>
           <y>9</y>
           <width>291</width>
           <height>411</height>
          </rect>
         </property>
         <layout class="QHBoxLayout" name="horizontalLayout_2">
          <item alignment="Qt::AlignHCenter|Qt::AlignVCenter">
           <widget class="QListWidget" name="listWidget"/>
          </item>
         </layout>
        </widget>
       </widget>
      </item>
      <item>
       <widget class="QFrame" name="frame">
        <property name="frameShape">
         <enum>QFrame::StyledPanel</enum>
        </property>
        <property name="frameShadow">
         <enum>QFrame::Raised</enum>
        </property>
       </widget>
      </item>
     </layout>
    </item>
   </layout>
  </widget>
  <widget class="QMenuBar" name="menuBar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>965</width>
     <height>23</height>
    </rect>
   </property>
  </widget>
  <widget class="QToolBar" name="mainToolBar">
   <attribute name="toolBarArea">
    <enum>TopToolBarArea</enum>
   </attribute>
   <attribute name="toolBarBreak">
    <bool>false</bool>
   </attribute>
  </widget>
  <widget class="QStatusBar" name="statusBar"/>
 </widget>
 <layoutdefault spacing="6" margin="11"/>
 <resources/>
 <connections/>
</ui>

Edition 1: Basically with above example I managed to reproduce your bug. I have added horizontal layout inside middle frame but while changing the size middle widget has aligned to the left side.
The answer on your question is here: Make QHorizontalLayout expand inside QFrame
You have to add Horizontal Layout into your middle Frame. Then you have to call context menu of the Middle Frame, click Layout -> Layout Horizontally. Add your widget in the layout. Most probably you widget will expand its width to the width of the Main Window. Change SizePolicy to fixed. At this point your problem should be solved.

A: you can create programatically like this:
overwrite this functions:  QSize sizeHint() and  QSize minimumSizeHint()
here an example:
.h
#ifndef LATERALBOARD_H
#define LATERALBOARD_H

#include <QBasicTimer>
#include <QFrame>
#include <QPointer>

QT_BEGIN_NAMESPACE
class QLabel;
QT_END_NAMESPACE

class LateralBoard : public QFrame
{
    Q_OBJECT

public:
    LateralBoard(QWidget *parent = nullptr);
    QSize sizeHint() const override;
    QSize minimumSizeHint() const override;
private:
    enum { BoardWidth = 10, BoardHeight = 12 };
};

#endif

.cpp
#include <QKeyEvent>
#include <QLabel>
#include <QPainter>

LateralBoard::LateralBoard(QWidget *parent)
    : QFrame(parent)
{
    setFrameStyle(QFrame::Panel | QFrame::Sunken);
    setFocusPolicy(Qt::StrongFocus);
}
QSize LateralBoard::sizeHint() const
{
    return QSize(100, 100);
}

QSize LateralBoard::minimumSizeHint() const
{
    return QSize(BoardWidth * 5 + frameWidth() * 2,
                 BoardHeight * 5 + frameWidth() * 2);
}

and in your main window you should use a layout to set the position
 QGridLayout *layout = new QGridLayout;
    LateralBoard *lateralBoard = new LateralBoard;
    layout->addWidget(lateralBoard, 2, 6);
    setLayout(layout);


text:
Q: Handling variable number of "type parameters" in TypeScript The goal is to create a completely type safe generic class such as a Table Class below which would allow to create a Table instance whose field types are given as type parameters (or any other possible means).
let userTable = new Table<number, string, string>(
  columnNames: ["id", "name", "address"],
  fields: [
    [0, "John", "225 Main"],
    [1, "Sam", "330 E Park"]
  ]);
let billsTable = new Table<number, Date, Date>(
  columnNames: ["custId", "invoiceDate", "dueDate", "balance"],
  fields: [ [1, new Date(), new Date()] ]);

The question is, with full type safety in focus, how would you define or implement such a generic type structure which could have unknown number of type parameters?

A: You can use tuples as your type parameters:
class Table<T extends string, U extends any[]> {
  constructor(columnNames: T[], fields: U[]) {
    /* Do something */
  }
}

If you provide type parameters explicitly, your arguments will be type-checked against them.
new Table<'custId' | 'invoiceDate', [string, number, Date]>(
  ['custId', 'invoiceDate'],
  [
    ['foo', 1, new Date()],
    ['bar', 2, new Date()],
  ]
)

Works with named parameters as well:
class Table<T extends string, U extends any[]> {
  constructor(configuration: { columnNames: T[], fields: U[]}) {
    /* Do something */
  }
}

new Table<'custId' | 'invoiceDate', [string, number, Date]>({
  columnNames: ['custId', 'invoiceDate'],
  fields:[
    ['foo', 1, new Date()],
    ['bar', 2, new Date()],
  ]
})


text:
Q: Django RF - nested serializers with ModelViewSet I have a problem with nested serializers.
In Shell everything works, but when I make an HTTP request i'ts always an error like "field required".
Models:
class Product(models.Model):
index = models.CharField(max_length=12, unique=True, db_index=True)
quantity = models.PositiveIntegerField(default=0)

def __str__(self):
    return self.index

class Name(models.Model):
    product = models.ForeignKey(Product, related_name='names', on_delete=models.CASCADE, null=True)
    language = models.CharField(max_length=50, default="name_pl")
    title = models.CharField(max_length=300, blank=True, null=True)

    def __str__(self):
        return self.language

Serializers:
class ProductSerializer(serializers.ModelSerializer):
names = NameSerializer(many=True)

class Meta:
    model = Product
    fields = ["index", "quantity", "names"]

def create(self, validated_data):
    names = validated_data.pop('names')
    product = Product.objects.create(**validated_data)
    for name in names:
        Name.objects.create(product=product, **name)
    return product

views:
class NameView(viewsets.ModelViewSet):
queryset = Name.objects.all()
serializer_class = NameSerializer
filter_backends = [DjangoFilterBackend, filters.SearchFilter]
filterset_fields = ('id',)
search_fields = ['id']

class ProductView(viewsets.ModelViewSet):
    queryset = Product.objects.all()
    serializer_class = ProductSerializer
    filter_backends = [DjangoFilterBackend, filters.SearchFilter]
    filterset_fields = ('id',)
    search_fields = ['id']
    permission_classes = (CustomDjangoModelPermissions,)

I'm trying to POST data:
data = {
    "index": "11111",
    "quantity": 1213,
    "names": [
        {"language": "DE","title": "GER"},
        {"language": "CZ","title": "CZZ"}
    ]
}

RESPOND:
names field required

I've tried to override create in view, to "look" whats wrong:
    def create(self, request):
    data = request.data
    serializer = ProductSerializer(data=data)
    if serializer.is_valid():
        serializer.save()
        return Response(serializer.data, status=201)
    return Response(request.data, status=400)

Then I get:
{'index': '11111', 'quantity': '1213', 'names': 'title'}

So it can't send all of data, so it can't validate.
Need help, pls ;)

A: Problem solved:
Just forget to add in request:
data = json.dumps(data)


text:
Q: Pinterest URL Debugger Grabbing Old Info Running a URL through the Pinterest URL Debugger, and it appears to be caching have old data. Is there a way to force a refresh similar to Facebook's debugger?

A: I would attempt to clear your browser cache (I'm assuming it's ran in browser).
Maybe it's also using an old cookie, so log out, clear your browser cache/history, then close and open it again. You could also try a different browser to access it.
You could also try changing some old data to see if there is a pinterest db process that's using old data, and an update might refresh it.
Otherwise, you may want to reach out to pinterest support.

A: OK so it turns out that it was NOT holding on to old information, but rather I was using the incorrect tags for price and currency.
should be og:price:amount and og:price:currency
full documentation for the product type of rich pins: https://developers.pinterest.com/docs/rich-pins/products/
from above, minimum requirements:
<meta property="og:title" content="Name of your product" />
<meta property="og:type" content="product" />
<meta property="og:price:amount" content="1.00" />
<meta property="og:price:currency" content="USD" />


text:
Q: Erorres con material design y android studio 3.2.1 Tengo el android studio 3.2.1, sincronize el material design con la siguiente version: implementation 'com.android.support:design:28.0.0, cuando inserto un:
me sale error no se que hacer si hay respuesta le agradeceria
asi esta el Build.gradle en mi pc:
    apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig{
        applicationId"miscelanea2018.daniel.miscelanea2018"
        minSdkVersion 24
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    } buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt '), ' proguard - rules.pro '
        }
    }
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'junit:junit:4.12'
    androidTestImplementation'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation'com.android.volley:volley:1.1.1'
    implementation'com.android.support:design:28.0.0'
}

gracias

A: Recorda instalar las herramientas del SDK 28, anda al SDK manager en Tools - SDK Manager
e instala lo siguiente


text:
Q: Visually aligning a jpeg image to Google Maps in preparation for Photoshop tile cutter I'm looking to add a custom tile overlay of my university campus on top of a Google Map.  What I have is a jpeg image of my university campus layout, and what I'm trying to figure out is how to align it to the existing Google Maps such that I know the top leftmost tile coordinate which I need in order to then run the image through the Photoshop tile cutter script found at http://brokenbytes.info/tuts/documentation/examples/tilecutter.php.
The tool at http://anymap.org/GmapImage2TileGenerator/ sounded perfect for this job, but it looks as though it's only just been moved over to a new server and is proving buggy for me (I enter the image URL of my campus, but then it never shows an overlay of it on top of the map).
Are there any other tools available which can help with visually aligning an image/prepping it for the tile cutter, when the image itself has no geo information immediately attached to it?

A: The easiest is probably to use the latest MapTiler (from http://www.maptiler.com/) and it's visual georeferencing functionality.
See the video tutorial we prepared: https://www.youtube.com/watch?v=eJxdCe9CNYg


text:
Q: Does a monotone function on an arbitrary subset of $\mathbb R$ always have at most countable number of discontinuity? I know a monotone function of a closed and bounded interval can have at most countably many point of discontinuity. And hence a monotone function on $\mathbb R$ can have at most countably many point of discontinuity since $\mathbb R=[0,1]\cup[1,2]\cup[2,3]\cup...\cup[-2,-1]\cup[-3,-2]\cup...$
Now my question is

Does a monotone function on an arbitrary subset of $\mathbb R$ always have at most countable number of discontinuity?

Does the funtion $f:(\mathbb R-\mathbb Q)\to\mathbb R:x\mapsto x$ serve our purpose?

A: First, let me give some terminology that I will use here:

Suppose that $E\subseteq\Bbb R,$ $x_0\in\Bbb R,$ and $f:E\to\Bbb R$ are given.
We will say that $x_0$ is $E$-supremal if $$x_0=\sup\{x\in E:x<x_0\},$$ and $E$-infimal if $$x_0=\inf\{x\in E:x>x_0\}.$$ Equivalently, $x_0$ is $E$-supremal if $E\cap(x_0-\delta,x_0)$ is non-empty for all $\delta>0,$ and $E$-infimal if $E\cap(x_0,x_0+\delta)$ is non-empty for all $\delta>0$. Note that $x_0$ is a limit point of $E$ iff $x_0$ is $E$-supremal and/or $E$-infimal. If $x_0\in E$, then $x_0$ is isolated in $E$ iff $x_0$ is neither $E$-supremal nor $E$-infimal.
If $x_0$ is a limit point of $E$ and $L\in\Bbb R$, we say that $L$ is the limit of $f(x)$ as $x$ approaches $x_0$--written $L=\lim_{x\to x_0}f(x)$--if for all $\epsilon>0$ there is some $\delta_\epsilon>0$ such that $|f(x)-L|<\epsilon$ whenever $x\in E$ and $0<|x-x_0|<\delta$. We say that $\lim_{x\to x_0}f(x)$ fails to exist if there is no such $L$, or if $x_0$ is not a limit point of $E$.
If $x_0$ is $E$-supremal and $L\in\Bbb R$, we say that $L$ is the limit of $f(x)$ as $x$ approaches $x_0$ from below--written $L=\lim_{x\to x_0^-}f(x)$--if for all $\epsilon>0$ there is some $\delta_\epsilon>0$ such that $|f(x)-L|<\epsilon$ whenever $x\in E\cap(x_0-\delta_\epsilon,x_0).$ We say that $\lim_{x\to x_0^-}f(x)$ fails to exist if there is no such $L$, or if $x_0$ is not $E$-supremal.
If $x_0$ is $E$-infimal and $L\in\Bbb R$, we say that $L$ is the limit of $f(x)$ as $x$ approaches $x_0$ from above--written $L=\lim_{x\to x_0^+}f(x)$--if for all $\epsilon>0$ there is some $\delta_\epsilon>0$ such that $|f(x)-L|<\epsilon$ whenever $x\in E\cap(x_0,x_0+\delta_\epsilon).$ We say that $\lim_{x\to x_0^+}f(x)$ fails to exist if there is no such $L$, or if $x_0$ is not $E$-infimal.
Now, suppose $x_0\in E$. Recall that $f$ is said to be continuous at $x_0$ iff for all $\epsilon>0$ there is some $\delta>0$ such that $|f(x)-f(x_0)|<\epsilon$ whenever $|x-x_0|<\delta.$ It can be shown that $f$ is continuous at $x_0$ iff either $x_0$ is isolated in $E,$ or $x_0$ is a limit point of $E$ and $f(x_0)=\lim_{x\to x_0}f(x).$ $f$ is said to be discontinuous at $x_0$ iff it is not continuous there--that is, iff there is some $\epsilon_0>0$ such that for all $\delta>0$ we have $|f(x)-f(x_0)|\ge\epsilon_0$ for some $x\in E$ with $0<|x-x_0|<\delta.$ Note that if $f$ is discontinuous at $x_0$, then $x_0$ is $E$-supremal and/or $E$-infimal (why?).
You should be able to prove the following:

Lemma: Suppose $E\subseteq\Bbb R,$ $x_0\in E,$ and $f:E\to\Bbb R$ are given, with $f$ discontinous at $x_0.$ Then exactly one of the following $5$ situations occurs:
(i) $x_0$ is $E$-supremal and $E$-infimal. There is some $L\in\Bbb R$ with $L\ne f(x_0)$ and $L=\lim_{x\to x_0}f(x).$
(ii) $x_0$ is $E$-supremal and not $E$-infimal. There is some $L\in\Bbb R$ with $L\ne f(x_0)$ and $L=\lim_{x\to x_0^-}f(x).$
(iii) $x_0$ is $E$-infimal and not $E$-supremal. There is some $L\in\Bbb R$ with $L\ne f(x_0)$ and $L=\lim_{x\to x_0^+}f(x).$
(iv) $x_0$ is $E$-supremal and $E$-infimal. There are some $L_1,L_2\in\Bbb R$ with $L_1\ne L_2$, $L_1=\lim_{x\to x_0^-}f(x),$ and $L_2=\lim_{x\to x_0^+}f(x).$
(v) $x_0$ is $E$-supremal but $\lim_{x\to x_0^-}f(x)$ fails to exist, and/or $x_0$ is $E$-infimal but $\lim_{x\to x_0^+}f(x)$ fails to exist.

We say that $f$ has a removable discontinuity at $x_0$ if (i) holds; that $f$ has an essential discontinuity at $x_0$ if (v) holds; that $f$ has a jump discontinuity at $x_0$ in the other three situations.

Now for the kicker: real-valued monotone functions on subsets of the reals can have only jump discontinuities, and can only have at most countably many of those.
Let me give you an idea of how to prove this. (Toward the end, I will use the fact that the rationals are countable and dense in the reals.)
Proof Idea: Suppose $E\subseteq\Bbb R,$ that $f:E\to\Bbb R$ is monotone function, and that $f$ is discontinuous at some point $x_0\in E$. (WLOG, suppose $f$ is nondecreasing. The proof when $f$ is nonincreasing will be similar.) By definition, then, there is some $\epsilon_0>0$ such that for all $\delta>0,$ there exists $x\in E$ where $0<|x-x_0|<\delta$ and $|f(x)-f(x_0)|\ge\epsilon_0.$ We must address three cases.

(Case 1): If $x_0$ is not $E$-supremal, then $x_0$ must be $E$-infimal since $f$ is discontinuous at $x_0$. Moreover, since $f$ is non-decreasing, we must have that $f(x)\ge f(x_0)+\epsilon_0$ for all $x\in E\cap(x_0,\infty),$ for otherwise, this would violate our choice of $\epsilon_0$. (Why?) Then $\{f(x):x\in E,x>x_0\}$ is a non-empty set bounded below by $f(x_0)+\epsilon_0,$ so since $f$ is nondecreasing then we can conclude (why?) that $$\lim_{x\to x_0^+}f(x)=\inf\{f(x):x\in E,x>x_0\}\ge f(x_0)+\epsilon_0>f(x_0).$$ Thus, we have a type (iii) discontinuity.
(Case 2): If $x_0$ is not $E$-infimal, then in a similar fashion to Case 1, we conclude that $x_0$ is $E$-supremal, that $\lim_{x\to x_0^-}f(x)$ exists and is at most $f(x_0)-\epsilon_0,$ meaning we have a type (ii) discontinuity.
(Case 3): If $x_0$ is both $E$-supremal and $E$-infimal, then since $f$ is nondecreasing, we can conclude that $$\lim_{x\to x_0^+}f(x)=\inf\{f(x):x\in E,x>x_0\}\ge f(x_0)$$ and likewise that $\lim_{x\to x_0^-}f(x)\le f(x_0).$ By our choice of $\epsilon_0$, we can show that these two limits cannot be equal, so we have a type (iv) discontinuity.

Thus, $f$ must have a jump discontinuity at $x_0.$
Now, let $Y$ be the union of the "gaps" in $\text{range}(f)$--more precisely: $$Y=\{y\in\Bbb R:\exists x_1,x_2\in E\text{ s.t. }f(x_1)<y<f(x_2),\text{ and }\exists a<y<b\text{ s.t. }(a,b)\cap\text{range}(f)=\emptyset\}.$$ Note that $Y$ is a union of pairwise disjoint open intervals, and is disjoint from $\text{range}(f)$. (Why?) Note further that if $f$ has a jump discontinuity at any point $x_0\in E$, then at least one (and at most two) of the component intervals of $Y$ has an endpoint at $f(x_0)$. (Why?) Thus, we readily have a one-to-one function from the set of discontinuities of $f$ into the set of component intervals of $Y$--in particular, say that for any given point of discontinuity $x_0$, we take $x_0$ to the component interval of $Y$ with $f(x_0)$ for an endpoint, and if we have a choice, take $x_0$ to the component interval of $Y$ whose lower endpoint is $f(x_0)$.
Now, let $\{q_n\}_{n\in\Bbb N}$ be any enumeration of the rationals, and note that for each component interval $J$ of $Y,$ there is some least $n$ such that $q_n\in J$--call this $n_J$ for each such $J$. Different components of $Y$ correspond to different $n_J$ (why?), so the function $J\mapsto n_J$ is a one-to-one function from the set of component intervals of $Y$ into the naturals, meaning that $Y$ has at most countably-many component intervals. Since we also have a one-to-one function from the set of discontinuities of $f$ into the set of component intervals of $Y$, then $f$ has at most countably-many discontinuities.

A: Suppose $f: D \rightarrow \mathbb{R}$ is a monotone function with cardinality $C$ discontinuities, where $D \subset \mathbb{R}$. Define the extended function $\tilde{f}$ by setting $\tilde{f}(x) = f(x)$ when $x \in D$, and for each $x \notin D$
$$\tilde{f}(x) = \inf_{y \in D, y > x} f(y).$$
Thus $\tilde{f}$ extends $f$ by interpolating horizontally across subsets of $\mathbb{R} \setminus D$. Then $\tilde{f}: \mathbb{R} \rightarrow \mathbb{R}$ is monotone and has cardinality $C'$ discontinuities, where $C' \geq C$. Since $C' \le \aleph_0$, then also $C \le \aleph_0$, so $f$ has at most countably many discontinuities.

A: Yes. The crucial remark is that, due to the monotonicity, the jumps can neither compensate each other nor be partly compensated by the non-jump variations of the function. Thus, for every positive integer $n$, between every $x$ and $y$ in the domain there is at most $n\cdot|f(x)-f(y)|$ jumps of size at least $1/n$. Considering the union  over $n$ of the jumps of size at least $1/n$, this proves that there is at most a countable number of jumps between $x$ and $y$. Again by countable union on suitable $x$ and $y$, the total number of jumps on the whole domain is at most countable.
At first sight, this uses mainly (only?) that the real field is Archimedean.


text:
Q: ASP.net c# Masterpage problem I'm trying to make my masterpage work with my content page, allowing the content page to access the master page controls.  I get the error:

Parser Error Message: The 'mastertype'
  directive must have exactly one
  attribute: TypeName or VirtualPath

This is on the lines:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="viewProduct.aspx.cs" Inherits="AlphaPackSite.viewProduct"
    MasterPageFile="MasterPages/Main.master"
    title="Hi there!"
%>
<%@ MasterType TypeName="Main" VirtualPath="MasterPages/Main.master" %>

My master page is:
namespace AlphaPackSite
{
    public partial class Main : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

I'm a bit confused with namespaces and such so may have got them wrong, but all pages are in the same namespace now I beleive.
Update
When I turn it to:
<%@ MasterType VirtualPath="MasterPages/Main.master" %>

I keep getting the error:
Compiler Error Message: CS0030: Cannot convert type 'AlphaPackSite.Main' to 'ASP.masterpages_main_master'

Source Error:

Line 147:        public new ASP.masterpages_main_master Master {
Line 148:            get {
Line 149:                return ((ASP.masterpages_main_master)(base.Master));
Line 150:            }
Line 151:        }

A: Unless you want to keep a reference of your master page in the current page (in which this code is written), I'd suggest you remove the <%@ MasterType VirtualPath="MasterPages/Main.master" %>
line.
This line provides a way to access your page's master page (such as when you've to change a label on the master page or the menu needs to add a few more items etc.). If the content of your master page does not require any changes/updates from your content page there's not need to use the MasterType tag. Because by using both MasterPageFile="MasterPages/Main.master and MasterType, you're confusing the compiler (even though the master page is same).
Update
If you have to keep the MasterType tag, then remove the MasterPageFile="MasterPages/Main.master attribute from the page directive.

A: As the error says, @MasterType expects only one parameter.  Try just:
<%@ MasterType VirtualPath="MasterPages/Main.master" %>

See http://msdn.microsoft.com/en-us/library/ms228274.aspx for more info.

A: (1) comment out MasterType directive and compile the web site
(2) uncomment the masterType directive and place it with either type name or virtual path, both will throw error
Reason for commenting and uncommenting:
Logically, when website fails to build, it will not have
AlphaPackSite.Main created and hence will throw error
but once you comment it out, and there are not other errors in the code, you will hopefully get the type in your bin!
So there are more chances to work with comment > compile > uncomment kind of things

reference for MasterType:
http://msdn.microsoft.com/en-us/library/ms228274.aspx

A: Try:
<%@ MasterType TypeName="AlphaPackSite.Main"  %>

A: I saw this question while searching for another answer and figured I would provide the answer quickly in case other people have this issue.
The problem is that you do not want to use a virtual path in the master name call.  Instead you need to use TypeName and add in underscores for your path.  Here is the correct tag based on your path:
<%@ MasterType TypeName="AlphaPackSite_Main" %>


text:
Q: Keep getting error status on Kubernetes Cron Job with connection refused? I am trying to write a cron job which hits a rest endpoint of the application it is pulling image of.
Below is the sample code:
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: {{ .Chart.Name }}-cronjob
  labels:
    app: {{ .Release.Name }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version }}
    release: {{ .Release.Name }}
spec:
  concurrencyPolicy: Forbid
  successfulJobsHistoryLimit: 2
  failedJobsHistoryLimit: 2
  startingDeadlineSeconds: 1800
  jobTemplate:
    spec:
      template:
        metadata:
          name: {{ .Chart.Name }}-cronjob
          labels:
            app: {{ .Chart.Name }}
        spec:
          restartPolicy: OnFailure
          containers:
            - name: demo
              image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
              command: ["/bin/sh", "-c", "curl http://localhost:8080/hello"]
              readinessProbe:
                httpGet:
                  path: "/healthcheck"
                  port: 8081
                initialDelaySeconds: 300
                periodSeconds: 60
                timeoutSeconds: 30
                failureThreshold: 3
              livenessProbe:
                httpGet:
                  path: "/healthcheck"
                  port: 8081
                initialDelaySeconds: 300
                periodSeconds: 60
                timeoutSeconds: 30
                failureThreshold: 3
              resources:
                requests:
                  cpu: 200m
                  memory: 2Gi
                limits:
                  cpu: 1
                  memory: 6Gi
  schedule: "*/5 * * * *"

But i keep running into *curl: (7) Failed to connect to localhost port 8080: Connection refused*.
I can see from the events that it creates the container and immediately throws: Back-off restarting failed container.
I already have pods running of demo app and it works fine, it is just when i am trying to point to this existing app and hit a rest endpoint i start running into connection refused errors.
Exact output when seeing the logs:
 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) Failed to connect to localhost port 8080: Connection refused

Event Logs:
Container image "wayfair/demo:728ac13-as_test_cron_job" already present on machine
9m49s       Normal    Created                pod/demo-cronjob-1619108100-ndrnx   Created container demo
6m17s       Warning   BackOff                pod/demo-cronjob-1619108100-ndrnx   Back-off restarting failed container
5m38s       Normal    SuccessfulDelete       job/demo-cronjob-1619108100         Deleted pod: demo-cronjob-1619108100-ndrnx
5m38s       Warning   BackoffLimitExceeded   job/demo-cronjob-1619108100         Job has reached the specified backoff limit

Being new to K8, Any pointers are helpful!

A: You are trying to connect to localhost:8080 with your curl which doesn't make sense from what I understand of your CronJob definition.
From the docs (at https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#define-a-command-and-arguments-when-you-create-a-pod )

The command and arguments that you define in the configuration file
override the default command and arguments provided by the container
image. If you define args, but do not define a command, the default
command is used with your new arguments.
Note: The command field corresponds to entrypoint in some container
runtimes. Refer to the Notes below.

If you define a command for the image, even if the image would start a rest application on port 8080 on localhost with its default entrypoint (or command, depends on the container type you are using), the command overrides the entrypoint and no application is start.
If you have the necessity of both starting the application and then performing other operations, like curls and so on, I suggest to use a .sh script or something like that, depending on what is the Job objective.


text:
Q: Compiling ICU for Android: __timezone' was not declared in this scope In attempting to compile ICU49 using Android NDKv7b, I ran into the following:
/home/tim/icu49/icu/source/common/putil.cpp: In function 'int32_t uprv_timezone_49()':
/home/tim/icu49/icu/source/common/putil.cpp:637: error: '__timezone' was not declared in this scope
/home/tim/icu49/icu/source/common/putil.cpp: At global scope:
/home/tim/icu49/icu/source/common/putil.cpp:2253: error: expected constructor, destructor, or type conversion before '*' token

using
export ANDROIDVER=8
export AR=/usr/bin/ar
export BASE=/home/tim/icu49
export HOST_ICU=$BASE/icu
export ICU_CROSS_BUILD=$BASE/icu-linux
export NDK_ROOT=$BASE/android-ndk-r7b
export CPPFLAGS="-I$NDK_ROOT/platforms/android-$ANDROIDVER/arch-arm/usr/include/ -O3 -fno-short-wchar -DU_USING_ICU_NAMESPACE=0 -DU_GNUC_UTF16_STRING=0 -fno-short-enums -DU_HAVE_NL_LANGINFO_CODESET=0 -D__STDC_INT64__"
export LDFLAGS="-lc -Wl,-rpath-link=$NDK_ROOT/platforms/android-$ANDROIDVER/arch-arm/usr/lib/ -L$NDK_ROOT/platforms/android-$ANDROIDVER/arch-arm/usr/lib/"

export OLDPATH=$PATH
export PATH=/home/tim/icu49/api$ANDROIDVER/bin:$PATH

$NDK_ROOT/build/tools/make-standalone-toolchain.sh --platform=android-$ANDROIDVER --install-dir=$BASE/api$ANDROIDVER

$HOST_ICU/source/configure --with-cross-build=$ICU_CROSS_BUILD --enable-extras=no --enable-strict=no -enable-static --enable-shared=no --enable-tests=no --enable-samples=no --enable-dyload=no --enable-tools=no --host=arm-linux-androideabi

Any advice would be much appreciated.

A: Here is a patch for that particular issue (made with ICU 4.8 but should give you the idea).
Also, see the discussion here.

A: Fixed using -DU_TIMEZONE=0 in CPPFLAGS. But not clear if this is the right approach.


text:
Q: Stuck on a limits problem I'm having some trouble with this one limit, here's what I have so far:
$$
\lim_{t\to2}\frac{t^3 + 3t^2 - 12t + 4}{t^3 - 4t}
= \lim_{t\to2} \frac{t(t^2 + 3t - 12) + 4}{t(t^2 - 4)}
= \lim_{t\to2} \frac{t(t^2 + 3t - 12) + 4}{t((t + 2)(t - 2))} = \frac{0}{0}
$$
This needs to be solved without L'Hôpital's rule.
I'm stuck with the above, and I can't seem to continue solving it.
Any help (preferably well-explained) is much appreciated.

A: HINT:
$$\frac{t^3 + 3t^2 - 12t + 4}{t^3 - 4t} =1+\frac{(3t-2)(t-2)}{t(t-2)(t+2)}$$
We can safely cancel $t-2$ as $t-2\ne0$ as $t\ne2$ as $t\to2$

A: Since
$$t^3+3t^2-12t+4=(t-2)(t^2+5t-2)$$
and
$$t^3-4t=t(t-2)(t+2),$$
you'll have
$$\lim_{t\to 2}\frac{t^3+3t^2-12+4}{t^3-4t}=\lim_{t\to 2}\frac{t^2+5t-2}{t(t+2)}=\frac{2^2+5\cdot 2-2}{2\cdot (2+2)}.$$

A: Hint $\ $ Your evaluation shows that the numerator and denominator both have root $\,\color{#c00}{t = 2}.\,$ Thus being $ $ polynomials $ $ in $\,t,\,$ the Factor Theorem implies  $ $ that they both  have a factor  $\,\color{#c00}{t-2}.\,$ Cancelling this common factor from the fraction yields a limit of determinate form.


text: Q: LLVM IR directly to a shared binary file (without any intermediate files) I'm wondering if there is a way to go directly from LLVM IR (contained in a cpp program, i.e. in memory) to a shared binary? I'm looking for a way that does not create any intermediate files on disk except the end result, i.e. the shared binary. Is this possible? If yes, where can I find documentation / references on how to do it? Thanks!


text:
Q: Create a named string in xml configuration It is possible to create a named registration for an interface or non-primitive, e.g.
...
<register type="ILogger" mapTo="PageAdminLogger" name="emergency" />
...

Is it also possible to create a named registration for a string, especially one that will be used multiple times? What I am aiming to do:
...
<container>
  <register type='System.String' name='serverAddress'>
    127.0.0.1
  </register>

  <register type='IFooConnector' mapTo='FooConnector'>
    <constructor>
      <param name='addr' dependencyName='serverAddress'/>
    </constructor>
  </register>

  <register type='IBarDoer' mapTo='BarDoerOnAServer'>
    <constructor>
      <param name='server' dependencyName='serverAddress'/>
    </constructor>
  </register>
</container>
...

So that when the FooConnector and the BarDoerOnAServer and constructed they both get "127.0.0.1" as the input to their constructors, but "127.0.0.1" is only coded in one place (reducing duplication), and also all the literal variables (e.g. ports, timeouts, usernames, ...) are configured in one place rather than being littered around the configuration file.

A: Yes you can create a named string using Unity's XML configuration.
To do this you would use the instance element.
In your example it would look like:
<container>
  <instance name='serverAddress' value='127.0.0.1' />

  <register type='IFooConnector' mapTo='FooConnector'>
    <constructor>
      <param name='addr' dependencyName='serverAddress'/>
    </constructor>
  </register>

  <register type='IBarDoer' mapTo='BarDoerOnAServer'>
    <constructor>
      <param name='server' dependencyName='serverAddress'/>
    </constructor>
  </register>
</container>


text:
Q: What is the time constant L/R of this circuit?
I've solved this circuit but i got some issues about the alternatives.
English question at this picture:
Switch \$S_1\$ had been closed for long time and after that \$S_2\$ was opened. Therefore, at \$t=0\$, the switch \$S_2\$ has closed.
The current \$i_1(t)\$ is equal for \$t\geq 0\$
My attempt:
\$L\frac{di_1(t)}{dt} + i_1(t).1 = 2\Rightarrow\$
\$i(t) = C.e^{-t} + 2\$
\$i_1(t=0^-) = i_1(t=0^+) = 2V/2\Omega = 1A\$
\$C = -1\$
\$i_1(t) = -e^{-t} + 2\Rightarrow \boxed{i_1(t) = 2\left(1-\frac{e^{-t}}{2}\right)}\$
\$\tau = 1s\$
Is this alternatives about that question all wrong respecting time constant?

A: Let us re-check your solution through laplace method.
At t>=0,
$$\frac{2}{s} = L(sI(s) - I(0)) + I(s)R_{eq} $$
$$\implies \frac{2}{s} = sI(s)-1+I(s)$$
$$\implies \frac{2}{s}+1 = I(s)(s+1)$$
$$\implies \frac{2+s}{s(s+1)} = I(s)$$
$$\implies I(s) = \frac{2}{s}+\frac{-1}{s+1}$$
Taking inverse laplace,
$$I(t) = 2 - e^{-t} = 2(1-\frac {e^{-t}}{2})$$
Your solution is therefore correct.


text:
Q: CoreData get data for base class using predicate on drived class In short >> list of all countries with their favorite websites only.

I want list of all Countries having the "isFav = YES" in Websites. Can I do that using a predicate query please help?

A: The answer from @James Richard is correct.  However you need to take it a step further than just the predicate.
The predicate will return you the country objects.  Then you need to add a convenience method (or just write the filter every time you want the answer) that filters the websites.
For example, in your Country entity subclass you could have this method:
- (NSSet*)favoriteWebsites
{
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"isFav == YES"];
    NSSet *websites = [self valueForKey:@"websites"];
    NSSet *favorites = [websites filteredSetUsingPredicate:predicate];
    return favorites;
}

BTW, you should always have bi-directional relationships in core data.  The risk of corrupting your data is great.  Likewise, Core Data naming convention is to not prepend the word is to attributes.  The attribute should be just favorite and then the getter accessor can be configured with isFavorite.

A: Yes, you can.
The predicate you would have to do is:
[NSPredicate predicateWithFormat:@"ANY websites.isFav == YES"]

This document might help with other predicate formatting:
https://developer.apple.com/library/ios/documentation/cocoa/conceptual/Predicates/Articles/pUsing.html#//apple_ref/doc/uid/TP40001794-SW3


text:
Q: How to copy SQL Server log shipping files to AWS EC2 instance I am using SQL Server 2008 R2 and would like to log ship from my local data center SQL Server instance to a log shipping target SQL Server running in AWS EC2.
What is the best way to copy the log ship files from the local SQL Server to the remote EC2 instance?
I have seen plenty of 'how to copy a file to EC2' solutions, but am wondering what is the best method for continuous unattended file copying (such as SQL Server T-Log files every 15 minutes).


text:
Q: Polymorphic behavior involving Java Interface interface MyInterface {

      public List<String> getNames();
}

class MyClass implements MyInterface {

     @Override
     public List<String> getNames() {
         ...
         return names;
     }
     public List<String> getTypes() {
          ...
           return types;
     }
}

class MyClassFactory {

    public MyInterface create() {
        ...
        MyInterface myClass = new MyClass();
        return myClass;
    }
}

public class MyClient {

   MyInterface myClass = myClassFactory.create();
   List<String> types = myClass.getTypes();
}

In this code, it complains the last line, "List types = myClass.getTypes();" which says the method is not defined for the class. Why is that? Is this not the right way to use the polymorphic behavior?

A:
Is this not the right way to use the polymorphic behavior?

This would be a perfect way of programming to interface if you called getNames(), a method defined in the interface. However, getTypes() is defined only in the class, but not in the interface. The compiler is not allowed to use this information, so it is issuing an error.
You can fix this by adding getTypes() to the interface, or changing the compile-time type of myClass variable to MyClass.

A: Put "public List getTypes();" in MyInterface.Or in your MyClient class use
MyClass myClass = (MyClass) myClassFactory.create();

this line instead of `
MyInterface myClass = myClassFactory.create();


text:
Q: SQL JOIN same table I have one table with "ID", "Sequence", "Status":
    ID | Seq | Status
    ======================
    10 | 001 | 010
    10 | 002 | test
    10 | 003 | 005
    11 | 001 | 010
    11 | 002 | 338

The result from my query should give me the complete table plus an extra column with the status for the highest sequence for the respective ID:
    ID | Seq | Status | LStatus
    ======================
    10 | 001 | 010    | 005
    10 | 002 | test   | 005
    10 | 003 | 005    | 005
    11 | 001 | 010    | 338
    11 | 002 | 338    | 338

I have no clue how to do it. I startet with something like that:
SELECT a.*, b.status as lstatus
FROM table a
left join (select top 1 b.status from table b order by b.seq DESC)
on a.id = b.id

Hope you can help me :)
Thanks in advance!!!

A: You should use a group by max for the subquery and join the base table
  SELECT a.*, b.status as t.lstatus
  FROM my_table a
  INNER  join (select id,
            max(b.status) lstatus
            from my_table b

              group by id)  t on t.id = a.id and

for numeric value only
  SELECT a.*, b.status as t.lstatus
  FROM my_table a
  INNER  join (select id,
            max(b.status) lstatus
            from my_table b
            where IsNumeric([b.status])=True
              group by id)  t on t.id = a.id and

A: You can try using ROW_NUMBER() to assign number to each row within the ids ordered by seq. Join that back to your table where the id matches and the rownumber rn = 1.
DEMO
SELECT
  a.*
, b.status
FROM table a
JOIN (SELECT *, ROW_NUMBER() OVER (PARTITION BY id ORDER BY seq DESC) AS rn
  FROM dbo.Table) b ON a.id = b.id AND b.rn = 1

A: Try the below.
with status as (
Select distinct(id),status from table order by seq desc)select a.*,s.status as LStatus from table a,status s where a.id=s.id;

A: Use can use subquery here:
select *,
       (select top 1 Status from table where id = t.id order by status desc) as Lstatus
from table t;


text:
Q: Group Umbraco nodes based on doctype of AncestorOrSelf using LINQ I'm trying to group all the nodes in my Umbraco (v7) content tree using LINQ, but with one condition: if a node has a certain doctype, then this node and it's children will be grouped together.
So, in the following example, the aliases in brackets represent the doctype alias of the node:
Page 1 ('Page')
    Child 1 ('Page')
Page 2 ('Page')
Page 3 ('Page')
Page 4 ('Article')
    Child 2 ('Text')
    Child 3 ('Text')
    Child 4 ('Text')

Page 4 has a different doctype to Page 1, so Page 4 and it's children should be grouped together, whereas Page 1's child isn't grouped because it has the ('Page') doctype. The count of all nodes should be '8' and the filtered nodes count should be '5'.
My first attempt at this query was to do the following:
var results = from x in nodes
              (x.DocumentTypeAlias == "Article" ?
                  group x by x.AncestorOrSelf().Id into z :
                  group x by x into z)
              select new{Id = z.Key};

However, this results in the error message "Invalid expression term 'group'". Is there a solution this and/or is my logic completely wrong?


text:
Q: Cannot disable the default API versioner when upgrading from .NET Core 2.2 to 3.1 I'm currently going through the process of upgrading from 2.2 to 3.1.
In doing so .NET's default api-versioner is running along side ours despite adding the code to remove this:
Is there a new way to register a custom versioner or is there a new approach to removing .NET's default one after calling 'AddApiVersioning'.
        services.AddControllers(opts =>
        {
            opts.Filters.Add<DatedApiVersionFilter>();
        });

        // add standard asp.net core versioning mechanism
        services.AddApiVersioning(o =>
        {
            o.ApiVersionReader = new HeaderApiVersionReader(PlatformVersioningOptions.VersionHeaderName);
            o.DefaultApiVersion = new ApiVersionDate(2020, 1, 31);
            o.AssumeDefaultVersionWhenUnspecified = true;
        });

        // removing the default api version policy
        services.Remove(services.Single(s => s.ImplementationType == typeof(DefaultApiVersionRoutePolicy)));
        services.TryAddEnumerable(ServiceDescriptor.Singleton<MatcherPolicy, DatedApiVersionMatcherPolicy>());
        services.AddSingleton<IDatedApiVersionResolver, DatedApiVersionResolver>();

A: I've managed to solve this by removing the call to 'services.AddApiVersioning()'.
It seems in .NET Core 3.1 adding the filter with the new 'AddControllers' extension is enough to kick off our versioning policy for any endpoint decorated with the filter.
Final implementation:
        services.AddControllers(opts =>
        {
            opts.Filters.Add<DatedApiVersionFilter>();
        });

        services.TryAddEnumerable(ServiceDescriptor.Singleton<MatcherPolicy, DatedApiVersionMatcherPolicy>());
        services.AddSingleton<IDatedApiVersionResolver, DatedApiVersionResolver>();


text:
Q: Eclipse Scala IDE - Worksheet process has terminated unexpectedly I get this error on my new installation of Scala IDE (Eclipse) for Linux anytime I try to use scala worksheets:
Worksheet process has terminated unexpectedly (exit code 143)
At the time of termination, the following text was available in the output streams:
Standard output:

Standard error

Does anybody know what's happening? I'm using java-7-openjdk
Thanks!


text:
Q: SVG Image element flickers on mouseover I have a svg image element in my site. i want to hide that image on mouseover and show on mouseout.
But, i have a strange problem that the image flickers on mouseover.
I tried hiding the image though css and jquery. In both approaches i encountered the same error.
SVG
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  <image x="20" y="20" class="imghideshow" width="300" height="80"
     xlink:href="http://cdn1.iconfinder.com/data/icons/musthave/128/Help.png" />
</svg>

CSS
.imghideshow:hover
{
    visibility:hidden;
}

http://jsfiddle.net/GMd8w/
Please help me to recover the flicker problem. All i want is to hide the image on hover and show on mouseout.
Edited Scenario based on the answers given below.
Well implementing opacity solved flickering issue. But reproduces another problem when i implemented that css property.
So let me explain my full requirement.
I have two overlapped images.(i.e.,) child image overlapped on parent. when i click on parent image, it should trigger a function in js. since child image is not completely hidden here, i cant click on the child overlapped area of parent. check this fiddle.
http://jsfiddle.net/VwmEU/
Expected output is:
When i hover on child, it should hide and i should be able to trigger parent function.
Thanks.

A: The problem is just that visibility hidden interferes with the element hover . All you need is to use another way to hide it. for instance
.imghideshow:hover
{
    opacity: 0;
}

updated fiddle
new solution
There isn't much more that can be done, I think.
Another idea, that could work depending on the scenario. The upper image has no mouse interaction. It's the lower image that handles the events, and so has to make the other one transparent.
CSS:
#img2 {
    pointer-events: none;
}
#img1 {
    cursor:pointer;
}
#img1:hover ~ #img2 {
    opacity: 0;
}

updated fiddle
And, if this one can't do the trick (it depends on the layout, that I don't know ... ) there is a last idea: do the very first option that you had (visibility hidden) but then put a delay in the hover-out of say 3 seconds. The only problem will be a small flickering every 3 seconds.

A: After your update, I moved to something totally different to make it works :
SVG
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="svg">
    <g class="first">
      <!-- Both images here -->
      <rect x="25px" y="25px" width="150" height="100" class="green" />
      <rect x="50px" y="50px" width="150" height="100"/>
    </g>
    <g class="hover">
       <!-- The hover state -->
        <rect x="25px" y="25px" width="150" height="100" class="green" id="click" />
    </g>
</svg>

jQuery
$('.first').mouseenter(function() {
    $(this).hide();
    $('.hover').show();
});

$('.hover').mouseleave(function() {
   $(this).hide();
    $('.first').show();
});

$('#click').click(function() {
   alert('clicked');
});

See the updated fiddle.


text:
Q: Get error "firestore is not a function" when upgrade an old Firebase from 5.4.0 to 5.5.x I got a "firestore is not a function" error after I had updated my code by "npm i firestore@latest"
I have tried to clear my node_modules out and re-install a project, But the issue still the same.  How can I resolve this issue? Is this a bug?
Below is my import code:
var firebase = require('firebase/app');
require("firebase/firestore");

var fbApp = firebase.initializeApp({...});
var db = fbApp.firestore();


text:
Q: Binding path for nested arrays in JSONModel I'm trying to bind a nested array to a tokenizer with SAPUI5.
The model contains the data like:
{
    "results":[
        {
            "name": "aabbbcccc",
            "values": {
                "results":[
                    {
                        "ObjVal1": 123,
                        "ObjVal2": 234
                    }
                ]
            }
        },
        {
            "name": "effec",
            "values": {
                "results":[
                    {
                        "ObjVal1": 13,
                        "ObjVal2": 634
                    }
                ]
            }
        }
    ]
}

I need to bind the data contained in values, but I have no idea on how to access them in my factory function:
tokenizer.bindAggregation("tokens", "/results", function(sId, oContext){
    //here i can access the object in current position
});

Since the factory function can only return an object at a time, I can't extract the data from the model and return more than 1 token.
Is there a special binding path format to similar to /results/*/values/results?


text:
Q: GCP Dataproc - adding multiple packages(kafka, mongodb) while submitting jobs not working I'm trying to add the kafka & mongoDB packages while submitting dataproc pyspark jobs, however that is failing.
So far, i've been using only kafka package and that is working fine,
however when i try to add mongoDB package in the command below it gives error
Command working fine, with only Kafka package
gcloud dataproc jobs submit pyspark main.py \
  --cluster versa-structured-stream  \
  --properties spark.jars.packages=org.apache.spark:spark-sql-kafka-0-10_2.12:3.1.2, spark.dynamicAllocation.enabled=true,spark.shuffle.service.enabled=true

I tried e few options to add both the packages, however that is not working :
eg.
--properties ^#^spark:spark.jars.packages=org.apache.spark:spark-sql-kafka-0-10_2.12:3.1.2,org.mongodb.spark:mongo-spark-connector_2.12:3.0.2,spark:spark.dynamicAllocation.enabled=true,spark:spark.shuffle.service.enabled=true,spark:spark.executor.memory=20g,spark:spark.driver.memory=5g,spark:spark.executor.cores=2 \
  --jars=gs://dataproc-spark-jars/spark-avro_2.12-3.1.2.jar,gs://dataproc-spark-jars/isolation-forest_2.4.3_2.12-2.0.8.jar,gs://dataproc-spark-jars/spark-bigquery-with-dependencies_2.12-0.23.2.jar \
  --region us-east1 \
  --py-files streams.zip,utils.zip

Error :
Traceback (most recent call last):
  File "/tmp/1abcccefa3144660967606f3f7f9491d/main.py", line 303, in <module>
    sys.exit(main())
  File "/tmp/1abcccefa3144660967606f3f7f9491d/main.py", line 260, in main
    df_stream = spark.readStream.format('kafka') \
  File "/usr/lib/spark/python/lib/pyspark.zip/pyspark/sql/streaming.py", line 482, in load
  File "/usr/lib/spark/python/lib/py4j-0.10.9-src.zip/py4j/java_gateway.py", line 1304, in __call__
  File "/usr/lib/spark/python/lib/pyspark.zip/pyspark/sql/utils.py", line 117, in deco
pyspark.sql.utils.AnalysisException: Failed to find data source: kafka. Please deploy the application as per the deployment section of "Structured Streaming + Kafka Integration Guide".

How do i make this work ?
tia!

A: In your --properties you have defined ^#^ as delimiter. To properly use the delimiter you need to change the , to # as separator of your properties. You will only use , when defining multiple values in a single key. Also you need to remove spark: prefix on your properties. See sample command below:
gcloud dataproc jobs submit pyspark main.py \
  --cluster=cluster-3069  \
  --region=us-central1 \
  --properties ^#^spark.jars.packages=org.apache.spark:spark-sql-kafka-0-10_2.12:3.1.2,org.mongodb.spark:mongo-spark-connector_2.12:3.0.2#spark.dynamicAllocation.enabled=true#spark.shuffle.service.enabled=true#spark.executor.memory=20g#spark.driver.memory=5g#spark.executor.cores=2

When job config is inspected this is the result:


text:
Q: Need help to replicate a document layout and substitute the values in the replicated document Azure Form recognizer does not provide capability of training less than 5 documents in a group. For this reason, I have to replicate the documents available in the group and change their values so I can create a set of 5 documents. The files are in PNG/JPG format. Any help would be great in finding the right tool to do this.
Note: The layout changes by group

A: Form Recognizer needs 5 documents to train a model, best is to use real documents to train the model so it fits the production scenario. If you need to create 5 PNG / JPG files from a single file you can use an image editor or even power point to place new text on the existing values as an additional layer or in power point as text boxes with white background and then save them as a new image. Old school way of creating sample documents but as it needs only 5 for train and then 1 or 2 for testing the model shouldn't be too complex.


text:
Q: Fixing UIToolbar height to 32 pixels in iPhone Landscape mode I am building an iPhone application that works only in Landscape mode. When I add a UIToolbar to my landscape view, it gets a fixed height of 44 pixels. I expect the height to be 32 pixels instead. How do I get the height of the UIToolbar to 32 pixels while I am not handling any orientation changes?

A: A quick reminder: you would like to talk about "point" instead of "pixel" because of retina display.
For fixing toolbar to 32 points in landscape, you have two ways. One is suggested in the comments - set toolbar frame programmatically. A simpler way is to leverage navigation controller's toolbar (suppose your view controller is embedded in a nav controller), which will resize automatically to 32 points in landscape orientation.


text:
Q: How to open a small window in non activity class in android I am trying to find a way to open a small window which along with a button in non activity class. Basically i tried to use this way:
public class Mytest{
 private Context context;
public Mytes(Context context)
{
  this.context = context.getApplicationContext();
 }

        AlertDialog alertDialog = new AlertDialog.Builder(context).create(); //Use context
    alertDialog.setTitle("Warning");
    alertDialog.setMessage("You are currently in a battle");
    alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK",
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            });
    alertDialog.show();

but getting exception that
Unable to add window -- token null is not for an application

I have seen a thread in which someone suggested to use activity instead of context. i have try with both way to set context into nonactivity class from my main activity:
mytest = new Mytest(MainActivity.this);

but it is not working. Any other solution for this.

A: Instead of getApplicationContext(), just use ActivityName.this.

A: try to edit your constructor like this:
public Mytes(Context context) {
this.context = context;
}


text:
Q: Restore of database failed I wanna restore my database and i use sql server 2012 express edition but when i restore my backup file in sql server management studio, i take this error:

System.Data.SqlClient.SqlError: There is insufficient free space on disk volume 'c:\' to create the database. The database requires 84260749312 additional free bytes, while only 47428677632 bytes are available. (Microsoft.SqlServer.SmoExtended)

My .bak file is 8.27 gb and my C disk has 44.1 gb free space. Why do i take this error ? how can i fix this error ? Thanks in advance.

A: As Max Vernon states, the database is trying to restore to a location that doesn't have space to contain it.  If the backup file is compressed or mostly empty, you will still need the full uncompressed space to restore to.  Additionally, by default SQL Server will try to restore those files to their original file location, so if that original location does not exist or does not have enough space when you restore, the restore will fail.
In order to see the space and location required for a backup, you can run the following command:
RESTORE FILELISTONLY
FROM DISK='<backup file location>'

The output from this will show all files contained within the backup.  Look at PhysicalName and Size for the restore location and size (in bytes) that SQL Server needs for the restore.  You can change the restore location by specifying the WITH MOVE syntax in your restore statement, but as Max states, there's not much you can do about the space required.

A: You need 84,260,749,312 bytes of free space to create the files necessary to restore the database.  The backup file is not necessarily representative of the required size.
You can only restore this backup to a drive with the required free space.


text:
Q: Polymorphism with a friend function in C++ I would like to combine the concepts of polymorphism and friendship. I am making a pure virtual member function of a base class a friend of another class. I would then like to override this pure virtual member function in the classes derived from that base class, and access private member data of the class who has such function as friend. See the code snippet below. The compiler complains when I refer to my_int in the derived classes member function add(). I understand friendship is a 1-to-1 relationship, but I wonder if there is any way around it so as to implement polymorphism. Do I just have to make the member functions of the different derived classes friends of the foo() class?
class foo {
private:
    int my_int{};
public:
    friend virtual int base::add();
};

class base {
public:
    virtual int add() = 0;
};

class derived_1 : public base {
public:
    int add() {
        return my_int + 1;
    }
};

class derived_2 : public base {
public:
    int add() {
        return my_int + 2;
    }
}

A: You might want to look here:

https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Virtual_Friend_Function
Intent
Simulate a virtual friend function.
Solution and Sample Code
Virtual friend function idiom makes use of an extra indirection to
  achieve the desired effect of dynamic binding for friend functions. In
  this idiom, usually there is only one function that is a friend of the
  base class of the hierarchy and the friend function simply delegates
  the work to a helper member function that is virtual. The helper
  function is overridden in every derived class, which does the real job
  and the friend function just serves as a facade.
class Base {
  public:
    friend ostream& operator << (ostream& o, const Base& b);
    // ...
  protected:
    virtual void print(ostream& o) const
    { ... }
};
/* make sure to put this function into the header file */
inline std::ostream& operator<< (std::ostream& o, const Base& b)
{
  b.print(o); // delegate the work to a polymorphic member function.
  return o;
}

class Derived : public Base {
  protected:
    virtual void print(ostream& o) const
    { ... }
};

A: First, with what you've displayed it's not going to work because my_int is a member of foo but in the base class tree there is no 'foo' to get the member from.
The easy answer would be to make the function take an int argument and do away with the use of friend entirely.
struct derived2 : base
{
  int add(int arg) { return arg + 2; }
};

The use of 'friend' should make you seriously question whether what you are doing is a good answer, sometimes the answer to that question is 'yes' but not often. And the more friends you need the less often the answer remains 'yes'.
Another way would be to add a function to base:
int get_arg(foo & f) { return f.my_int; }

and make that function the friend rather than add, get_arg() would be called from each derived's add() in order to get the value to work with but get_arg is not itself virtual.


text:
Q: Proof of one of the operations on Random Variables This is a known operation on Random Variables (r.vs.):
If $(X_n : n \in \mathbb{N})$ is a sequence of r.vs., then $\inf X_n$, $\liminf X_n$, as
well as $\sup X_n$ and $\limsup X_n$ are also r.vs.
Proof given in class :
Notice first that
$\{\inf X_n \ge c\} = \bigcap_n \{X_n \ge c\} \in \mathcal F$. Hence, $\inf X_n$ is an r.v.
Let $L_n(\omega) := \inf \{X_r(\omega) : r \ge n\}$.
By the previous argument, $L_n$ is an r.v.
However, $L(\omega) := \liminf X_n(\omega) = \sup L_n(\omega)$.
Thus, $\{L \le c\} = \{\sup L_n \le c\} = \bigcap_n \{L_n \le c\} \in \mathcal F$, and $L$ is an r.v.
Now I dont understand how $\{\inf X_n \ge c\} = \bigcap_n \{X_n \ge c\}$ and later on $\{\sup L_n \le c\} = \bigcap_n \{L_n \le c\}$. As a result I do not understand the proof at all. Could someone please explain the proof? I've attached the screenshot of the proof also just in case

A: To show $\{\inf X_n \ge c\} = \bigcap_n \{X_n \ge c\}$, note the following statements are equivalent for any $\omega$ in the sample space:

*

*$\omega \in \{\inf X_n \ge c\}$

*$\inf X_n(\omega) \ge c$

*$c$ is a lower bound for $\{X_n(\omega) : n \in \mathbb{N}\}$ (because $\inf X_n(\omega)$ is the greatest such lower bound)

*$X_n(\omega) \ge c$ for all $n$

*$\omega \in \{X_n \ge c\}$ for all $n$

*$\omega \in \bigcap_n \{X_n \ge c\}$.

The case $\{\sup L_n \le c\} = \bigcap_n \{L_n \le c\}$ is very similar.


text:
Q: Xcode 4.2 iOS 5 SDK iPhone 3G not working? I know that there are a lot of iPhone 3G / xcode4.2 questions on here but mine is strange;
I have XCode 4.2 w/iOS 5 SDK on my Snow Leopard macbook. I already tried changing the architectures and the required device capabilities, but the real problem is my iPhone will not provision.
In XCode i get the error " Xcode has encountered an unexpected error (0xC002)
No such file or directory, at '/SourceCache/DTDeviceKit/DTDeviceKit-867/DTDeviceKit/DTDeviceKit_Utilities.m:864'"
According to other questions I installed iOS 3.0/3.2.2 and iOS 4.0-4.1 debugging support but even after rebooting I still get the aforementioned error.
a screenshot of organizer/error http://img717.imageshack.us/img717/3960/screenshot20111227at913.png
Is there anything I'm missing?
If it would make a difference (i doubt) I'm doing jailbreak development. However I had the same error before I tried JB dev.
Thanks!

A: Your question is similar to this one: Jailbroken iPhone 3G with iOS 4.2.1 can't be debugged with XCode
You need a non-jailbroken device to collect debug symbols. After this you can use your device without any problems.

A: xCode doesnt support 4.2.1 , restore your device back , or test on a device other than 4.2.1 , 4.2 would be ok


text:
Q: Simulator Freezes at Animation Blocks After Swift 5 / Xcode 11 Update I updated my project to Swift 5 in Xcode 11 and now the program freezes at my animation blocks in the iPhone 11 simulator. When I set a breakpoint after the animation it never hits it.  Restarting Xcode and the Simulator did not solve the issue.  If I run the program on a device it works fine.
Any ideas about what's going on?  Maybe a memory issue?
UIView.animate(withDuration: 1, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0.5, options: [UIView.AnimationOptions.curveEaseIn], animations: {

    self.introTextView.transform = self.introTextView.transform.translatedBy(x: 200, y: 0)
})

A: Apparently it's a bug on the Simulator. Hopefully it will be solved soon, but until then, you can fix by unchecking the pasteboard option.

Simulator -> Edit -> Automatically Sync Pasteboard.

From this helpful answer here.

A: After restarting my computer everything now seems to be working fine.  If that changes I will report back in case anyone else runs into the same issue.
UPDATE: Unfortunately it's a temporary fix.  After a while, the simulator freeze issue starts again and I need to restart to get it working properly.
Additional UPDATE: After updating to the newest version of Xcode the issue went away.


text:
Q: Find $AC: CB$ in $\triangle XYZ$ Problem:
In $\triangle XYZ$, $XY = 4$, $YZ = 7$, and $XZ = 9$. Let $M$ be the midpoint of $\overline{XZ}$, and let $A$ be the point on $\overline{XZ}$ such that $\overline{YA}$ bisects angle $XYZ$. Let $B$ be the point on $\overline{YZ}$ such that $\overline{YA} \perp \overline{AB}$. Let $\overline{AB}$ meet $\overline{YM}$ at $C$. Find $AC: CB$.
Attempt:
We know that $XM$ = $MZ$ = $\dfrac{9}{2}$, and by the Angle-Bisector theorem,
$$\dfrac{4}{x} = \dfrac{7}{9-x}$$
$$\implies 36-4x = 7x$$
$$\implies x= \dfrac{36}{11}=XA$$
Therefore, $AZ$ = $\dfrac{63}{11}$, and $AM$ = $\dfrac{9}{2} - \dfrac{36}{11}= \dfrac{27}{22}.$
 Also, by the Menelaus theorem,
$$\dfrac{ZM}{MA} \times \dfrac{AC}{CB} \times \dfrac{YB}{YZ} = 1$$
$$\implies \dfrac{11}{3} \times \dfrac{AC}{CB} \times \dfrac{YB}{7} = 1$$
From here, I got stuck. I'm wondering if one could use mass points, since the problem wants to find the ratio of lengths, and not specific side lengths. Any help is appreciated!

A: You have already got
$$\dfrac{11}{3} \times \dfrac{AC}{CB} \times \dfrac{YB}{7} = 1\tag1$$
Also, we have
$$YB=\frac{AY}{\cos \frac Y2}\tag2$$
So, we want to find $\cos\frac Y2$ and $AY$.
By the law of cosines,
$$9^2=4^2+7^2-2\cdot 4\cdot 7\cos Y\implies \cos Y=-\frac 27$$
from which we have
$$\cos\frac Y2=\sqrt{\frac{1-\frac 27}{2}}=\sqrt{\frac{5}{14}}$$
Also, the length of $AY$ is given by $$AY=\sqrt{YX\cdot YZ\left(1-\frac{YZ^2}{(YX+YZ)^2}\right)}=\frac{4\sqrt{70}}{11}$$
(see here or here for this formula)
So, from $(1)$ and $(2)$, we get
$$\color{red}{AC:CB=3:8}$$

A: (Wrong!!! This is the case for $YB\perp AB.$)
Following your attempts, we get $\frac{11}{3}\times\frac{AC}{CB}\times\frac{YB}{7} = 1.$ Hence it remains to find the length of $YB.$ Let $K$ be the point on $YZ$ such that $XK\perp YZ.$ Then we can use the area of the triangle to find $XK$:
$$\sqrt{10(10-9)(10-7)(10-4)}=\frac{7\times XK}{2}.$$
Therefore $XK=\frac{12\sqrt{5}}{7}.$
Then since $\triangle XKZ\sim\triangle ABZ,$ we can get
$$AB = XK \times\frac{63/11}{9}=\frac{12\sqrt{5}}{11}$$
and obtain $BZ = \sqrt{(\frac{63}{11})^2-(\frac{12\sqrt{5}}{11})^2}=\frac{57}{11}.$
Then our $YB=7- \frac{57}{11} = \frac{20}{11},$ so the answer should be
$$\frac{AC}{CB} = \frac{3}{11}\times\frac{7}{YB} = \frac{21}{20}.$$


text:
Q: Error SignalR connect to Network Load Balancing(NLB ) net::ERR_SSL_VERSION_INTERFERENCE? I have a simple SingulaR connect to Network Load Balancing(NLB) example that I've added to a legacy ASP.Net MVC application but have error like this

WebSocket connection to 'wss://mytest.com/signalr/connect?transport=webSockets&clientProtocol=4.1&connectionToken=DFGDFSGDFSGDSFGDFSGDFGFjnmH8Oj7%2F76WUwFvgnoaQlN%2FuttLoF9hSMerB4pf%2B0x69XOu5G8R3qtz20Gpm8NdBYijl621dEkfeoRheiOjC4%2FM6OeRX343uixpdPcK%2Bt1&connectionData=%5B%7B%22name%22%3A%22cls_hub%22%7D%5D&tid=20' failed: Error in connection establishment: net::ERR_SSL_VERSION_INTERFERENCE


text:
Q: How can I input a value as a string and then input a int value without having two input boxes? I am writing code where the user has to guess a number and input it and where they can type either 'quit', 'QUIT', or 'Quit' and it'll end the program.
I have a while loop that will end the program once they have reached their limit of six tries and have the input() in it where they can guess the number. I know I need to test for the strings,'quit', 'QUIT', or 'Quit' before I convert the input() to an integer, but I don't know how to do so without having an input() that checks for the string and one that checks for the integer.
Any suggestions?

A: Whatever you input is a string, so there's no harm in just comparing it to QUIT before trying to create an int object from it.
tries = 0
while tries < 6:

    value = raw_input("Enter a number, or 'quit' to quit: ")  # input() in Python 3.x
    if value.upper() == 'QUIT':
        sys.exit()

    try:
        value = int(value)
    except ValueError:
        continue  # Return to the top of the loop for another value

    # Process the input integer...

A: May be you are looking for something like this(python 2.6/7):-
lucky_number = 5
tries = 6
while tries:
  inp = raw_input("User input: ")
  if inp.isdigit() and int(inp) == lucky_number:
    return True
  elif inp.lower() == 'quit':
    break
  tries -= 1
return False

A: Since you are converting it into an int after taking an input, I am going to assume you are using Python 3.
Try the following in your main loop:
a = input()
if(a.isdigit()):
    n = int(a)
    #main code here
else:
    #check for "quit" here as shown below
    if(a.upper == 'QUIT'):  #a.upper() will convert the string into capital letters
        #You need to break from the main loop
        break

If you are using Python 2.7 or lower, then replacing input() with raw_input() in the above example code will solve your problem.
raw_input() takes in any type of input, thus solving your problem.


text:
Q: a bit of confusion over pointers (void ones) and functions so right now i am trying to do some nift code for a little game i am making and I've run into something that has been bothering me for a while about pointers.
but first things first, i am trying to have a function take in a void* and give that void* a value, but it seems to not actually stay beyond the function like i'm used to. so...
void ItemGen(void* Holder){

    Item* NewItem
    NewItem = new Item*
    NewItem->Init();
    Holder = NewItem;

}

it's not actually making "items" but various kinds of items that inherit from a item, this is just me making it simpler.
Holder gets changed but never make it outside the function, how should i change this, so that it does.
on top of that, i am sort of confused about a certain occurrence that can happen and i just want to know what happens when you do these. or really the difference between them
void *p1;
void *p2;
&p1 = &p2;
p1 = p2;
*p1 = *p2;

oh and is there a way to do a XOR operation on pointers so i can swap them with out a holding pointer.
i feel like i asked very stupid questions, but are confusing simply because they're void *'s.

A: Pointers are variables like any other, and as such are passed by value to functions.  You've simply assigned a new value to the parameter copy of your pointer.
If you want to change a variable you pass to a function you must pass by reference or by pointer.  Preferably the former.
void ItemGen(void *& Holder);

BTW, that's a horrible naming convention.

A: I am answering this point "Holder gets changed but never make it outside the function, how should i change this, so that it does."
void ItemGen(Item** Holder){
 Item* NewItem
 NewItem = new Item*
 NewItem->Init();
 *Holder = NewItem;
}

void someotherfunc() {
 Holder * holder=0;
 ItemGen(&holder)
 if(holder!=0) {
      holder->dosomething()
  }

}

A: "void" simply means "nothing". A "void*" pointer points to nothing in particular. It's a way of saying "I don't know what kind of thing this pointer points to"; a void* pointer is a catch all that can receive any kind of pointer, but if you want to go from a void* pointer to any other kind, you have to explicitly cast it.
As to your first problem:
If you lived at "1234 Pointer Street", there is nothing magical about the number "1234", it's just a number. It only tells you anything when you treat it as a "pointer" - a house number. It "points" to a house on a particular street.
In the case of a computer, the street is memory.
int a = 0;
int* b = 0;

the variables "a" and "b" both contain the numeric value "0".
b = b + 1;

See? perfectly valid. So
void foo(int a, int* b)
{
    a = a + 1;
    b = b + 1;
}

void bar()
{
    int x = 0;
    int* y = 0;
    foo(x, y);
    // 'x' and 'y' are still zero here, they have to be, or you couldn't do
    foo(0, 0);
}

Pointers to have some distinguishing features from regular variables.
int a = 0;
int* b = 0;

a = a + 1; // now a = 1
b = b + 1; // now b = b + sizeof(int) => 4.

What pointers do best is provide values for C/C++'s "dereference" operators.
a = *(b);

Going back to the streets example, if we assigned b our "1234 Pointer Street" address, it would be:
b = 1234;

What if we wanted to deliver something there?
*b

This means: The contents of the address that b describes.
Lets go back to the definition
int* b;

This says: "b is the address of an integer". How do we get the address of a specific integer?
// imagine a set of mailboxes.
int box1, box2, box3, box4, box5;

// lets put something interesting into box 3.
box3 = 5;

// now let's address somethign to box3.
// "&" is the "address of" operator.
int* pointer = &box3;

// now lets put something more interesting in pointer.
pointer = 10;
// whoops - that was wrong, we just changed the ADDRESS to some random numeric value.
// what we mean't was:
*pointer = 10;

printf("box 3 contains %d\n", box3);
// answer? 10, not 5.

After setting "pointer = &box3" we populated "pointer" with the location of box3's storage in memory, so when we wrote to that address using "*pointer = 10" we wrote to the storage address of box3.
You asked about
    void *p1;
    void *p2;
    &p1 = &p2;
    p1 = p2;
    *p1 = *p2;
"&p1 = &p2" says "the address of p1 is the address of p2" and isn't legal, it wouldn't compile.
"p1 = p2" is legal, but it says "assign the same address as p2 to p1"
"*p1 = *p2" is illegal because you are using void pointers, which point to void, besides, you've just made p1 and p2 be equal to each other so it would be a null operation.
To fix your initial problem, you would need to provide a way for the caller to receive the new value you are creating.
Option 1: Accept a pointer-to-pointer
This is the very old-school C way to do it, but your code doesn't look very C++ so far so I'll list it first.
void ItemGen(void** Holder)
{
    Item* NewItem = new Item;
    NewItem->Init(); // why doesn't the constructor do this?
    // ** means pointer to storage that is itself also a pointer,
    // so if we dereference it once we will be refering to the inner pointer.
    *Holder = NewItem;
}

Option 2: Return a pointer
void* ItemGen() // Why isn't this "Item*"?
{
    Item* NewItem = new Item;
    NewItem->Init();
    return NewItem;
}

Option 3: Take a reference
void ItemGen(Item*& Holder)
{
    Holder = new Item;
    Holder->Init();
}

This says "Holder is a reference to a pointer to storage of type Item". It's exactly like a "Item*" pointer except instead of creating a temporary local copy of the value passed in, it's an alias for the value that was passed in.
If you absolutely have to throw away the type information of your pointer:
void ItemGen(void*& Holder)
{
    Item* NewItem = new Item;
    NewItem->Init();
    Holder = NewItem;
}

At the level you appear to be with C++ so far, I would guess that your use of void* pointers is probably misguided.


text:
Q: Entity Framework- Cannot reference entity context Context:
public class EntityContext : DbContext
{
   public EntityContext(DbContextOptions options) : base(options)
      {

      }

   protected override void OnModelCreating(ModelBuilder modelBuilder)
      {
          var cascadeTables = modelBuilder.Model.GetEntityTypes()
           .SelectMany(foreignKeysTables => foreignKeysTables.GetForeignKeys())
           .Where(foreignKeysTables => !foreignKeysTables.IsOwnership &&
                  foreignKeysTables.DeleteBehavior == DeleteBehavior.Cascade);

         foreach (var table in cascadeTables)
         {
             table.DeleteBehavior = DeleteBehavior.Restrict;
         }

         base.OnModelCreating(modelBuilder);
     }

    DbSet<Account> Accounts { get; set; }
}

Saving into the database using the context:
using (var context = new EntityContext()) //error on EntityContext()
{
     context.Account.Add(acc); //error on Account because EntityContext can't be referenced
     context.SaveChanges();
}

I can't reference the context because there's a parameter needed for it (DbContextOptions options), how can I get past it so I can save my Account instance?
Thank you.

A: You can use dependency injection (constructor injection) with an IOC container like,
public class YourClass {
    private readonly EntityContext context;
    public YourClass(EntityContext context) {
        this.context = context;
    }

    public void YourMethod(){
       context.Account.Add(acc);
       context.SaveChanges();
    }
}

Most popular IOC containers,

*

*Unity Container

*Castle Windsor

*NInject

*Structure Map

You need to specify with IOC container how to create the instance of EntityContext  like singleton, scoped or transient. Something like this;
var container = new YourContainer();
container.Register<DbContext>(Lifestyle.Scoped);

A: You need to register your context in DI container, then it can be injected to any object's constructor you need. And you won't need to construct context manually each time.
See more here

A: You need to configure DbContextOptions since DbContext requires DbContextOptions to work correctly. DbContextOptions contains information such as database provider and connection string.
It can be configured in below ways:
1) When using a Dependency Injection Container
If you are using default Dependency Injection Container in ASP.Net Core, you can add below code in Startup.cs inside the method ConfigureServices.
public void ConfigureServices(IServiceCollection services)
{
        // ...other service registration
        services.AddDbContext<EntityContext>(options =>
        options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
}

and in appsettings.json, you need to define the connection string:
{
  "ConnectionStrings": {
    "DefaultConnection": "Server=servername;Database=dbname;Trusted_Connection=True;MultipleActiveResultSets=true"
  }
}

Then, Dependency Injection Container will provide options to the Entity Context when the object is created.
public class EntityContext : DbContext
{
   public EntityContext(DbContextOptions options) : base(options)
      {

      }

      .....
}

Then, you can use in your class as follows:
public class AccountRepository
{
    private readonly EntityContext context;

    public AccountRepository(EntityContext entityContext)
    {
            this.context = entityContext;
    }

    public void Save()
    {
         context.Account.Add(acc);
         context.SaveChanges();
    }
 }

2) OnConfiguring option - Initialize the DbContextOptions within the context itself (When Dependency Injection Container is not used):
public class EntityContext : DbContext
{
    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        options.UseSqlServer(connectionString);
    }

    .....
}

Then, in your class, you can instantiate context without passing arguments:
using (var context = new EntityContext())
{
     context.Account.Add(acc);
     context.SaveChanges();
}

3) Pass DbContextOptions as constructor argument when instantiating Context (When Dependency Injection Container is not used):
var optionsBuilder = new DbContextOptionsBuilder<EntityContext>();
optionsBuilder.UseSqlServer(connectionString);

using (var context = new EntityContext(optionsBuilder.Options))
{
     context.Account.Add(acc);
     context.SaveChanges();
}


text:
Q: how to pass a variable through sendKeys in selenium webdriver? I want to pass the float variable 'f' through sendKeys in the below program.Can someone please let me know the same? As of now, it is throwing

"The method sendKeys(CharSequence...) in the type WebElement is not applicable for the arguments ".

Code:
public static String isEditable(String s1) {
    f=Float.parseFloat(s1);
    System.out.println(f);

    boolean bool=webDriver.findElement(By.xpath("expression")).isEnabled();
    if(bool) {
        if((f<0) || (f>6)) {
            error="Value must be between 0.00% and 6.00%";
            System.out.println(error);
        } else {
            webDriver.findElement(By.xpath(""expression")).sendKeys(f);
        }
    } else {
        error="Please enter a valid Number";
    }
    return error;
}

A: Can you try passing s1 instead of f. Because the method takes a string, not a float.
Your method should look like this:
String selector = "expression";
webDriver.findElement(By.xpath(selector)).sendKeys(f);

And please use better variable names like userInput instead of s1 or userInputAsFloat instead of f or investmentInputVisible instead of bool etc.

A: Convert the float to a string:
webDriver.findElement(By.xpath("...")).sendKeys(Float.toString(f));

A: I know you already accepted an answer but I wanted to clean up your code a little and give you some feedback.

*

*I changed the name of the function because a function named isEditable() should return a boolean indicating whether some field is editable. That's not what your function is doing so it should be given a more appropriate name. I made a guess at what the actual name should be... I could be way off but you should name it something more along the lines of what it's actually doing... putting text in a field.

*I removed the isEnabled() check because that should be done in the function that sets the fund number. Each function should do one thing and only one thing. This function validates that the rate passed is in a valid range and then puts it in the field.

*I removed the duplicate code that was scraping the INPUT twice. Just do it once, save it in a variable, and reuse that variable. In this case, there's no need to scrape it twice.

*and as d0x said, you shouldn't convert the s1 string to a float and then back to string when you sendKeys() ... just send the s1 string. Translating it back doesn't help readability, it just means you wrote more code that someone after you will need to understand. Favor clean code... it's always more readable.
public static String enterRate(String s1)
{
    f = Float.parseFloat(s1);
    WebElement input = webDriver.findElement(By.xpath(".//*[@id='p_InvestmentSelection_4113']/div/div/div[5]/div/ul/li/div[3]/div[2]/label/div[1]/input"));
    if ((f < 0) || (f > 6))
    {
        error = "Value must be between 0.00% and 6.00%";
    }
    else
    {
        input.sendKeys(s1);
    }
    return error;
}


text:
Q: Finding elements on a matrix with indexes from another array - python Sorry if this question was already answered somewhere, but i couldn't find what i was looking for!
So, say that i have a matrix/array like this
a = [[1,2,3], [4,5,6], [7,8,9]]

with an array like the one below, which is supposed to indicate element indexes that i want to retrieve for the matrix above...
b = [2,0,1] # get the 2nd element from a[0], the 0th from a[1] and 1st from a[2]

What i want is something like
c = magic (a,b)
c = [3,4,8] # elements correspondent with the indexes from b

The catch is, i wanna do that WITHOUT LOOPS (no for/while or similars)
I've tried doing something like this...
c = a[:,b[:]]

but no avail.... Is there something else i could try?

A: A list comprehension like:
   c = [ a[indx][b[indx]] for indx in range(len(b)) ]
   print c #[3, 4, 8]

A: Use list-comprehension and zip to achieve that:
a = [[1,2,3], [4,5,6], [7,8,9]]
b = [2,0,1]
c = [a[i][j] for i,j in zip(range(len(b)), b)]
print(c)
# Output [3, 4, 8]