text:
Q: Running two Django Apps on Apache with mod_auth_sspi and mod_wsgi I've been running one Django app with Single Sign-On enabled by mod_auth_sspi using mod_wsgi.
Apache/2.2.21 (Win32) mod_wsgi/3.3 Python/2.7.2 mod_auth_sspi/1.0.4
Problem is, that I can't add second Django app, which uses the same modules, because I want to use Single Sign-On too. If I add second app, Apache authenticates only the first requested app. The second one throws Error 500 - Internal server error. If I restart Apache and try to request second app at first, it works. But then when I request the first app, it throws error 500 (same error as the first).
error.log:
mod_wsgi (pid=4724): Exception occurred processing WSGI script 'C:/www/app2/app2.wsgi'.
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] Traceback (most recent call last):
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\core\\handlers\\wsgi.py", line 272, in __call__
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     response = self.get_response(request)
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\core\\handlers\\base.py", line 169, in get_response
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\core\\handlers\\base.py", line 203, in handle_uncaught_exception
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     return debug.technical_500_response(request, *exc_info)
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\views\\debug.py", line 59, in technical_500_response
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     html = reporter.get_traceback_html()
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\views\\debug.py", line 151, in get_traceback_html
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     return t.render(c)
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\template\\base.py", line 123, in render
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     return self._render(context)
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\template\\base.py", line 117, in _render
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     return self.nodelist.render(context)
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\template\\base.py", line 744, in render
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     bits.append(self.render_node(node, context))
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\template\\debug.py", line 73, in render_node
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     result = node.render(context)
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\template\\debug.py", line 90, in render
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     output = self.filter_expression.resolve(context)
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\template\\base.py", line 536, in resolve
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     new_obj = func(obj, *arg_vals)
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\template\\defaultfilters.py", line 695, in date
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     return format(value, arg)
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\dateformat.py", line 285, in format
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     return df.format(format_string)
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\dateformat.py", line 30, in format
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     pieces.append(force_unicode(getattr(self, piece)()))
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\dateformat.py", line 191, in r
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     return self.format('D, j M Y H:i:s O')
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\dateformat.py", line 30, in format
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     pieces.append(force_unicode(getattr(self, piece)()))
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\encoding.py", line 71, in force_unicode
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     s = unicode(s)
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\functional.py", line 206, in __unicode_cast
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     return self.__func(*self.__args, **self.__kw)
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\translation\\__init__.py", line 81, in ugettext
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     return _trans.ugettext(message)
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\translation\\trans_real.py", line 286, in ugettext
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     return do_translate(message, 'ugettext')
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\translation\\trans_real.py", line 276, in do_translate
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     _default = translation(settings.LANGUAGE_CODE)
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\translation\\trans_real.py", line 185, in translation
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     default_translation = _fetch(settings.LANGUAGE_CODE)
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\translation\\trans_real.py", line 162, in _fetch
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     app = import_module(appname)
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\utils\\importlib.py", line 35, in import_module
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     __import__(name)
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\contrib\\admin\\__init__.py", line 3, in <module>
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\contrib\\admin\\helpers.py", line 3, in <module>
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     from django.contrib.admin.util import (flatten_fieldsets, lookup_field,
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\contrib\\admin\\util.py", line 1, in <module>
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     from django.db import models
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\db\\models\\__init__.py", line 12, in <module>
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     from django.db.models.fields.files import FileField, ImageField
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\db\\models\\fields\\files.py", line 9, in <module>
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     from django.core.files.storage import default_storage
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\core\\files\\storage.py", line 9, in <module>
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     from django.core.files import locks, File
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\django-1.3.1-py2.7.egg\\django\\core\\files\\locks.py", line 25, in <module>
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     import pywintypes
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\win32\\lib\\pywintypes.py", line 124, in <module>
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     __import_pywin32_system_module__("pywintypes", globals())
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]   File "C:\\Python\\lib\\site-packages\\win32\\lib\\pywintypes.py", line 114, in __import_pywin32_system_module__
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121]     assert sys.modules[modname] is old_mod
[Tue Feb 28 09:57:48 2012] [error] [client 192.168.1.121] TemplateSyntaxError: Caught AssertionError while rendering:

conf/wsgi.conf:
WSGIScriptAlias /app1 "C:/www/app1/app1.wsgi"

<Directory "C:/www/app1">
  Allow from all
#  AllowOverride AuthConfig
</Directory>

<Location /app1>
  AuthName "server"
  AuthType SSPI
  SSPIAuth On
  SSPIAuthoritative On
  SSPIUsernameCase lower
#  SSPIDomain DOMAIN
  require valid-user
</Location>

WSGIScriptAlias /app2 "C:/www/app2/app2.wsgi"

<Directory "C:/www/app2">
  Allow from all
#  AllowOverride AuthConfig
</Directory>

<Location /app2>
  AuthName "server"
  AuthType SSPI
  SSPIAuth On
  SSPIAuthoritative On
  SSPIUsernameCase lower
#  SSPIDomain DOMAIN
  require valid-user
</Location>

Alias /static/ "c:/static-root/"
<Directory "c:/static-root/">
  Order Allow,Deny
  Allow from all
</Directory>

c:/www/app2/app2.wsgi (app1.wsgi is similar):
import os
import sys

path = 'c:/www/'
apps_path = 'c:/www/app2/'
if path not in sys.path:
  sys.path.append(path)
if apps_path not in sys.path:
  sys.path.append(apps_path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'app2.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Do you know what to do to get both apps work with Single Sign-On? I don't know, if it is Django's fault, mod_wsgi fault or mod_auth_sspi fault. Can you help me, please?
EDIT:
It looks, that it doesn't depend on mod_auth_sspi module.

A: It seem to be a pywin32 error, answered here:
Multiple django sites on Apache / Windows / mod_wsgi - problem with win32
There is some python version check, which does something with modules and raises:
AssertionError: assert sys.modules[modname] is old_mod

Bug is reported, but not resolved:
https://sourceforge.net/tracker/?func=detail&aid=2905909&group_id=78018&atid=551954
https://sourceforge.net/tracker/?func=detail&aid=3496224&group_id=78018&atid=551954
Temporary solution is comment out two lines in win32/lib/pywintypes.py:
if sys.version_info < (3,0):
    #next two lines are problematic!!!!!
    #assert sys.modules[modname] is old_mod
    #assert mod is old_mod
    pass
else:
    assert sys.modules[modname] is not old_mod
    assert sys.modules[modname] is mod
    # as above - re-reset to the *old* module object then update globs.
    sys.modules[modname] = old_mod
    globs.update(mod.__dict__)


text:
Q: Scatter Plot - Python - Why does legend, tight_layout only affect one of the graphs in the same plot I have two graphs in one plot but for some reason the
legend, x-label rotation and tight layout only applies to the 2nd graph and not the first?
figure, axis = plt.subplots(1,2,figsize=(9,7))
x2 = ['A','B','C']
Y1 = [90,80,100]
Y2 = [70,100,200]
axis[0].scatter(x2,Y1, c = 'pink',label='salary')
axis[1].scatter(x2,Y2, c = 'orange',label='overtime')
plt.xticks(rotation = 45)
plt.tight_layout()
plt.legend()

I can duplicate the code and put it underneath the first graph but is there a better way.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Get a picture - Python-pptx I am trying to read a .pptx file using python-pptx. I managed to get all the content except the image from the presentation. Below is the code i used to identify images other than textframes in the presentation. After identifying i am getting the auto_shape_type as RECTANGLE (1) but nothing about the image.
from pptx import Presentation
from pptx.shapes.picture import Picture

def read_ppt(file):
    prs = Presentation(file)
    for slide_no, slide in enumerate(prs.slides):
        for shape in slide.shapes:
            if not shape.has_text_frame:
                print(shape.auto_shape_type)

Any help on understanding this problem appreciated. Alternative options are also welcome.

A: try querying the shape.shape_type. by default, the auto_shape_type returns rectangle as you've observed, though pictures can be inserted into and masked by other shapes as well.

Note the default value for a newly-inserted picture is MSO_AUTO_SHAPE_TYPE.RECTANGLE, which performs no cropping because the extents of the rectangle exactly correspond to the extents of the picture.

the shape_type should return:

Unique integer identifying the type of this shape, unconditionally MSO_SHAPE_TYPE.PICTURE in this case.

You can extract the image content to a file by using its blob property and writing out the binary:
from pptx import Presentation
pres = Presentation('ppt_image.pptx')
slide = pres.slides[0]
shape = slide.shapes[0]
image = shape.image
blob = image.blob
ext = image.ext
with open(f'image.{ext}', 'wb') as file:
    file.write(blob)


text:
Q: React map gl with typescript Hello so I'm fairly new to React, but I have made the choice of going through typescript (which I'm also new too) as opposed to raw JS. Having said that Im having trouble adding layers to a react-map-gl element.
Here is the error code that I'm getting
Type '{ id: string; type: string; paint: { 'sky-type': string; 'sky-atmosphere-sun': number[]; 'sky-atmosphere-sun-intensity': number; }; }' is not assignable to type 'LayerProps'.
  Types of property 'type' are incompatible.
    Type 'string' is not assignable to type '"symbol" | "sky" | "circle" | "line" | "fill" | "fill-extrusion" | "raster" | "background" | "heatmap" | "hillshade"'.ts(2322)

Which looks lke it says that it wants an enum?
Here are the offeding pieces of code:
const skyLayer = {
    id: 'sky',
    type: 'sky',
    paint: {
      'sky-type': 'atmosphere',
      'sky-atmosphere-sun': [0.0, 0.0],
      'sky-atmosphere-sun-intensity': 15
    }
  };

and this one which is the one that gives me red squigglies (under Layer):
<Layer {...skyLayer} />

And the sample code that I'm trying to follow:
https://github.com/visgl/react-map-gl/blob/6.1-release/examples/terrain/src/app.js
EDIT1: I changed things as suggested in the code but I cant seem to fix the issue. Here is the error that I am getting:
Type '{ id: string; type: "sky"; paint: { "sky-type": string; "sky-atmosphere-sun": number[]; "sky-atmosphere-sun-intensity": number; }; }' is not assignable to type 'LayerProps'.
  Types of property 'paint' are incompatible.
    Type '{ "sky-type": string; "sky-atmosphere-sun": number[]; "sky-atmosphere-sun-intensity": number; }' is not assignable to type 'BackgroundPaint | FillPaint | FillExtrusionPaint | LinePaint | SymbolPaint | RasterPaint | CirclePaint | HeatmapPaint | HillshadePaint'.
      Type '{ "sky-type": string; "sky-atmosphere-sun": number[]; "sky-atmosphere-sun-intensity": number; }' has no properties in common with type 'HillshadePaint'.ts(2322)

A: You should decalre data type for type when you declare skyLayer. Because the default type will be string and can' be pass into Layer. You can use as to do it:
  const skyLayer = {
    id: 'sky',
    type: 'sky' as 'sky',
    paint: {
      'sky-type': 'atmosphere',
      'sky-atmosphere-sun': [0.0, 0.0],
      'sky-atmosphere-sun-intensity': 15
    }
  };


text:
Q: jQuery selector using multiple data-* attribute selectors I want to use an attribute-selector, created dynamically from a variable, but it only react to the beginning of string in the variable (the non-dynamic portion):
var dataKeys = 'td[data-key="name"],td[data-key="code"],td[data-key="date"]';
dataKeys = dataKeys + ',td[data-key="' + fieldsArray[i] + '"]';

And when I use it as follows:
$(dataKeys, this).each(function ()

It only reacts to attribute-values of "name", "code" and "date" keys, when dataKeys:
td[data-key="serial_no"], td[data-key="name"], td[data-key="code"], td[data-key="date"], td[data-key="serial_no"]"

A: I got your code parts to work inside 1 snippet. I only had 1 problem at first: my browser stripped the TD elements because they where not inside a proper html table table, and so the selector did not find the tds
So i put it inside a table and it worked. (see snippet below).
Most probably the error is somewhere else in your code. maybe its good to add some logging or debug and see which values your variables have. I only  give you 1 possible solution.

var fieldsArray = ['dynamic', 'serial_no'];
var dataKeys = 'td[data-key="name"],td[data-key="code"],td[data-key="date"]';
dataKeys = dataKeys + ',td[data-key="' + fieldsArray[1] + '"]';

console.log('selector', dataKeys);
$(dataKeys).each(function() {
  console.log('i am', this);
});

    hey
    hi
    hoho
    hoho


text:
Q: ExtJs 3: How to dynamically update grid cell tool tip based on user grid store value? I have tool tip function as bellow
function renderTip(val, meta, rec, rowIndex, colIndex, store) {
    // meta.tdCls = 'cell-icon'; // icon
    metadata.attr = 'ext:qtip="rec.get('ERROR')"; ext:qclass="maint-usg-data-tip-error"';
    return val;
};

i add to tooltip in to grid column as bellow
     initComponent: function() {
        colDesc = this.grid.getColumnModel().getColumnById('grid_col_id');
        colDesc.renderer  = this.addToolTip;
     }

Ext.onReady(function() {
 Ext.QuickTips.init();
});

when update my one row form editable grid that grid store ERROR value update(change). but that not update my tooltip value(rec.get('ERROR')). when i reload grid store after grid update(after edit some row cell) that tooltip update for new value.
How can i render update store value to to grid tooltip without reload grid store?

A: Try using grid.getView().refresh();


text:
Q: Pandas script doesnt work properly inside function but works fine if used step by step on jupyter notebooks I have this script which i have tested on about 20 separate dataframes now and it works fine when i execute the commands one by one but throws the Error: KeyError: "['to_drop'] not found in axis"  when run inside a single function in a for loop. Is it some execution order issue with pandas? or perhaps how it uses memory.? I have tested on the first few iters of a for loop and it works fine inside jupyter notebooks.
def calc_df(co):
try:
    dfbs = pd.read_csv(f"NSE/BS/NonFinancial/{co}_stnd_BS.csv")
    dfpl = pd.read_csv(f"NSE/PL/NonFinancial/{co}_stnd_PL.csv")
    if len(dfbs.columns) == 8 and len(dfpl.columns) == 8:
        dfbs.drop(['Unnamed: 0', '6'],axis=1, inplace=True)
        dfpl.drop(['Unnamed: 0', '6'],axis=1, inplace=True)

        dfbs.set_index('0')
        dfpl.set_index('0')

        dfbs.columns = dfbs.iloc[0]
        dfpl.columns = dfpl.iloc[0]

        dfbs = dfbs.transpose()
        dfpl = dfpl.transpose()

        dfbs.columns = dfbs.columns.fillna('to_drop')
        dfbs.drop('to_drop', axis=1, inplace=True)

        dfpl.columns = dfpl.columns.fillna('to_drop')
        dfpl.drop('to_drop', axis=1, inplace=True)

        cd = dfbs.filter(regex=("Balance Sheet"),axis=1)
        dfbs.drop(cd, axis=1, inplace=True)

        cd2 = dfpl.filter(regex=("Profit & Loss"), axis=1)
        dfpl.drop(cd2,axis=1, inplace=True)

        dfbs.replace(to_replace='--', value=0, inplace=True)
        dfpl.replace(to_replace='--', value=0, inplace=True)

        dfbs.fillna(0, inplace=True)
        dfpl.fillna(0, inplace=True)

        indx = dfpl.index.name
        df = dfbs.join(dfpl, rsuffix="_pl")

        for d in df.columns:
            df[d] = df[d].astype(float)

        df.to_csv(f'Cleaned/NSE/PL_BS/{co}_plbs.csv')
        dfbs.to_csv(f'Cleaned/NSE/BS/{co}_BS.csv')
        dfpl.to_csv(f'Cleaned/NSE/PL/{co}_PL.csv')
        print(f'data saved for {co}')
    else:
        print(f'inconsistent data for {co}')
except FileNotFoundError:
    print(f'file not found for {co}')


text:
Q: Why doesn't my to_string() work? I am doing a BigInt implementation and for one of my constructors, I'm required to take in an int value and basically convert it to a string, and then take each character and save it into a node of a linked list.
My struct Digit Node is a doubly linked list with value 'char digit'. My class BigInt has two private member variables head and tail. (which are pointers to DigitNode).
I am getting this error:  error: call of overloaded 'to_string(int&)' is ambiguous
My file headers:
#include <iosfwd>
#include <iostream>
#include "bigint.h"

using namespace std;

My constructor:
BigInt::BigInt(int i) // new value equals value of int (also a default ctor)
{
  string num = to_string(i);
  DigitNode *ptr = new DigitNode;
  DigitNode *temp;
  ptr->prev = NULL;
  this->head = ptr;
  if (num[0] == '-' || num[0] == '+') ptr->digit = num[0];
  else ptr->digit = num[0] - '0';
  for (int i = 1; num[i] != '\0'; i++)
    {
      ptr->next = new DigitNode;
      temp = ptr;
      ptr = ptr->next;
      ptr->digit = num[i] - '0';
      ptr->prev = temp;
    }
  ptr->next = NULL;
  this->tail = ptr;

}

Thanks for your help!

A: I would have to guess you are using VC 2010, the problem is VC2010 only provides overloads for long, long long, long double, unsigned long. int is not included. You need to use a type compliant instead:
static_cast<long long>(i)
that line would become
string num = to_string(static_cast<long long>(i));


text:
Q: macOS "./configure: No such file or directory" problem When I try to install Sphinx with this guide
./configure --with-pgsql --with-mysql #from guide
make #from guide
sudo make install #from guide

./configure
 -bash: ./configure: No such file or directory

$ autoreconf --install
autoreconf: 'configure.ac' or 'configure.in' is required

A: Are you running the ./configure command within the Sphinx source code folder? These instructions are for compiling Sphinx.
It's worth noting that the latest (v3.x) Sphinx releases aren't available as source code, only as pre-compiled binaries. So if that's what you've downloaded, you'll want to copy the files in ./bin - which would include indexer and searchd - into a location within your PATH (I would suggest /usr/local/bin).

A: Not excellent solution (because without mysql), but working (as all in programming world).
1) brew remove mysql
2) brew install mysql@5.7 (I don't know why, but it is working only with this version)
3) download sphinxsearch.com/files/sphinx-2.2.11-release.tar.gz and extract and cd to it
4) ./configure --with-pgsql --without-mysql and make and sudo make install
It is working for me, because I need postgresql first of all


text:
Q: Crash when trying to run WebGoat with a Java Agent I am currently learning how to boot a web application with a java agent for monitoring.
The Web Application I chose was WebGoat, and running WebGoat with java -jar webgoat-server-8.0.0.M17.jar as stated in WebGoat's README works perfectly fine.
However, when I try to add my agent, I get the following mess of an error log:
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v1.5.12.RELEASE)

2018-06-06 22:36:08.528  INFO 3741 --- [           main] org.owasp.webgoat.StartWebGoat           : Starting StartWebGoat v8.0.0.M17 on MacBook-Pro.local with PID 3741 (/Users/andrewfan/Desktop/Lang Agent Dev Proj help info/webgoat-server-8.0.0.M17.jar started by andrewfan in /Users/andrewfan/Desktop/Lang Agent Dev Proj help info)
2018-06-06 22:36:08.531  INFO 3741 --- [           main] org.owasp.webgoat.StartWebGoat           : No active profile set, falling back to default profiles: default
2018-06-06 22:36:08.844  INFO 3741 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1376c05c: startup date [Wed Jun 06 22:36:08 EDT 2018]; root of context hierarchy
2018-06-06 22:36:11.354  INFO 3741 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$8e12590a] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-06-06 22:36:11.442  WARN 3741 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'webgoat.user.directory' in value "${webgoat.user.directory}"
2018-06-06 22:36:11.455  INFO 3741 --- [           main] utoConfigurationReportLoggingInitializer :

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-06-06 22:36:11.464 ERROR 3741 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'webgoat.user.directory' in value "${webgoat.user.directory}"
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:372) ~[spring-beans-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1268) ~[spring-beans-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.16.RELEASE.jar!/:4.3.16.RELEASE]
    at

...
I cut the error messages short since the trace is a few pages long, but the main error seems to be org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'webgoat.user.directory' in value "${webgoat.user.directory}"

I am running my agent as follows:
java -javaagent:/Users/path/to/jar/Spn-LangAgent-0.0.jar -jar webgoat-server-8.0.0.M17.jar --server.port=8080 --server.address=localhost
My agent is as follows:
package com.spnlangagent.langagent;

import java.io.File;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLClassLoader;
import java.lang.reflect.Field;
import java.lang.instrument.Instrumentation;
import java.lang.instrument.UnmodifiableClassException;

import com.google.monitoring.runtime.instrumentation.AllocationRecorder;

public class LangAgent {

    public static void premain(String agentArgs, Instrumentation inst) throws Exception {
        System.out.println("LangAgent: premain now running");
        setupInstrumentation(agentArgs, inst);
        startRuntime(agentArgs);
    }

    private static void setupInstrumentation(String agentArgs, Instrumentation inst) throws Exception {
        System.out.println("setupInstrumentation: now running with agentArgs: " + agentArgs);
    }

    private static void startRuntime(String agentArgs) throws Exception {
        System.out.println("startRuntime: now running with agentArgs: " + agentArgs);
    }
}

The original contents of the agent were commented out except for a few print statements, and yet even with this, WebGoat is crashing on startup.
I tried another agent with WebGoat and it worked fine, so the only thing I can think of is that something is wrong with either my agent, or the way it is being packaged.
I am using Maven, and my MANIFEST.MF is as follows:
Manifest-Version: 1.0
Premain-Class: com.spnlangagent.langagent.LangAgent
Can-Redefine-Classes: true
Can-Retransform-Classes: true

After running mvn package, the MANIFEST packaged in the .jar is as follows:
Manifest-Version: 1.0
Premain-Class: com.spnlangagent.langagent.LangAgent
Built-By: andrewfan
Can-Redefine-Classes: true
Can-Retransform-Classes: true
Created-By: Apache Maven 3.5.3
Build-Jdk: 1.8.0_172

In my pom.xml, I am doing the following to reach the manifest:
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>3.1.0</version>
            <configuration>
                <archive>
                    <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
                </archive>
            </configuration>
        </plugin>

If someone could point me in the right direction in regards to figuring out why WebGoat is crashing, or if someone could provide more insight into why what I am currently doing is wrong, that would be greatly appreciated.
Thank you.
Note: If the rest of my pom.xml is necessary for debugging, I will gladly provide it; it's just that the question is already very long as-is.

A: The solution was mvn clean
Earlier I had an application.properties that was automatically added as part of the Spring Boot Initializr. The very presence of this file in my agent .jar, even with nothing inside, seems to have been the reason why WebGoat freaked out. Now that it is no longer present, WebGoat is running normally via java -javaagent:/Users/path/to/jar/Spn-LangAgent-0.0.jar -jar webgoat-server-8.0.0.M17.jar --server.port=8080 --server.address=localhost
I'd like to thank Adrian Shum for mentioning application.properties, since I had removed it a while back. mvn package didn't actually rebuild the .jar when I ran it, so the jar I had been testing on was the one that still contained application.properties.

A: Webgoat (and also in most Spring-based application) relies on properties file (in properties or yaml format usually) to perform placeholder lookup.
The symptom in your failure indicate that Spring failed to lookup properties for placeholder processing.
Given that placeholder lookup works well without presence of your agent JAR, and with information you mentioned in comment, the problem is caused by

*

*Your agent JAR provided application.properties (which has name collision with the properties file used by Webgoat for placeholder)

*Agent JAR will be part of classpath, and probably even appear earlier than the main JAR

*your empty application.properties "shadowed" the one in Webgoat main JAR.  Which means, when Webgoat starts, Spring picked up your empty application.properties for its placeholder processing, hence failed.


text:
Q: "statsd" prefix on data when using Telegraf with StatsD I am using Telegraf as a server to collect StatsD data from Python and send it to InfluxDB. However, the name values I receive in InfluxDB have the prefix "statsd_". How can I remove it?
In python I do:
ctr_name  = 'foo'
client = statsd.StatsClient('MY_DOMAIN.com', 8125)
client.incr(ctr_name, 1)

And then in InfluxDB I see:
> show measurements
name: measurements
------------------
name
statsd_foo

A: By default, the statsd python package does not put a prefix in front of your measurements.
Below is the default
client = statsd.StatsClient('MY_DOMAIN.com', 8125, prefix=None)

I am pretty sure you set prefix="statsd" in your actual code
The problem does not seem to come from the statsd plugin configuration in  Telegraf since it doesnt offer to prefix all measurements with a string constant. See here


text:
Q: listing EC2 instances by wildcard with Ruby I want to list all instances that have a name containing loadtest.
I've tried various forms of filter and filters unsuccessfully
What I have so far is:
ec2 = Aws::EC2::Client.new
ec2.describe_instances.each do |page|
  page.reservations.each do |reservation|
    reservation.instances.each do |instance|
      puts instance.tags
      puts instance.state
      puts instance.state.name
    end
  end
end

I wish to get a hash similar to :
{Name: loadtest-1west, id: <someid>, state: running}
{Name: loadtest-10west, id: <someid>, state: stopped}

A: Assuming you're using the Name tag on your instances, the describe_instances call would look like this:
ec2.describe_instances({
  filters: [{ name: 'tag:Name', values: ['loadtest*'] }]
})

For tags, the filter name is tag:<name-of-tag>.
You can just iterate through the response and output the fields you want (example without pagination):
def name_tag(tags)
  name = tags.select {|t| t.key == 'Name'}
  name[0].value if name.length > 0
end

ec2.describe_instances({
  filters: [{ name: 'tag:Name', values: ['loadtest*'] }]
}).reservations.each do |reservation|
  reservation['instances'].each do |instance|
    name = name_tag(instance.tags)
    puts "{Name: #{name}, id: #{instance.instance_id}, state: #{instance.state.name}}"
  end
end


text:
Q: Dynamic event to handle download file async completed, and download async progress changed im trying to create a tumblr image downloader,
my problem is when i need to download 100 image in one time.
i'm searching in google that i cant download 100 image in one time with one object webclient
so i will create new webclient every downloading.
the problem is eventhandler for downloadasyncCompleted and download progresschanged is always same.
how can i resolve this?
maybe my question is wrong
but what i need is :
1. download multiple file in one time
2. control the progresschanged event with dynamically created progressbar (progressbar total is same with how much the picture will download)

A: It sounds like you're calling the "DownloadFileAsync" function 100 times in a loop, then getting back your results slowly in a messy order. I'd recommend maintaining a list of URIs to download and storing an index of what you're up to. In your event handler for download finished, start the download of the next object. Download them one at a time.
It wont be "downloading all the files at the same time' but that's functionally impossible anyway, you shouldn't lose significant download performance by doing them one at a time.
To recap:

*

*Establish your list of URI's to download (the addresses)

*Keep a track of the index in that list of the URI that's currently downloading

*In the download completed event, increment that index and start the download for the next one if there's still more.

This way, whenever download completed gets fired, you know that the file that just finished downloading was the file behind the URI at [index] in your list of files to download.
This should also mean that you wont need to destroy and create a new WebClient for every request.

A: Use the DownloadFileAsync overload that lets you pass a user token. That token will be presented in the UserState property of the DownloadProgressChangedEventArgs and AsyncCompletedEventArgs. So, if you have:
WebClient client = new WebClient();
client.DownloadProgressChanged += DownloadProgressChangedHandler;
client.DownloadFileCompleted += DownloadCompletedHandler;
client.DownloadFileAsync(new Uri(urlToDownload), filename, urlToDownload);
// ...

void DownloadProgressChangedHandler(object sender, DownloadProgressChangedEventArgs e)
{
    string urlToDownload = (string)e.UserState;  // get the URL we're downloading from
    // do whatever
}

void DownloadCompletedHandler(object sender, AsyncCompletedEventArgs e)
{
    string urlToDownload = (string)e.UserState; // get the URL we're downloading from
    // whatever
}

Note that you can pass any data you like in that third parameter to DownloadFileAsync. If you want to pass multiple fields, then you'll need to create a class that has properties, or create a Tuple for the multiple fields. In either case, you'll still cast the e.UserState field to whatever type it actually is, and then access it.

A: I would make 30 threads each with their own web client and then use a ConcurrentQueue of string. Then push all the uri's only the queue then start all the threads they can have a while(trydequque()) and then each thread can dl. 30 threads works pretty good and a quad core pc. You can use download no need to use async this way.
ConcurrentQueue<string> queue = new ConcurrentQueue<string>();

        queue.Enqueue("http://link.jpg");

        for (var x = 0; x < 30; x++)
        {
            new Thread(new ThreadStart(() =>
                {
                    //create webclient here
                    string uri;
                    while(queue.TryDequeue(out uri))
                    {
                        //download here
                    }
                })).Start();
        }


text:
Q: Naively mixing two (or perhaps more) audio signals this is my first question and I am very much a beginner in electronics so I apologize if this is a too stupid question.
I have Atari punk console and another small homemade audiomaking circuit. These two have mono audio signals as outputs and I would like to combine these as one in the simplest possible way. I know next to nothing about audio processing but I believe that the strength of the two signals is roughly the same.
What would a neat solution be? It would be really nice if I could extend the solution later on to more than just two signals but thats not really important.
Any hints, references, guides, links or ideas would be highly appreciated.

A: In your situation you would probably want to use an op amp in a summing amplifier configuration, shown below:

This circuit provides an output signal voltage according to the following equation:
 $$V_{out} =  -R_4(\frac{V_1}{R_1} + \frac{V_2}{R_2} + \frac{V_3}{R_3}+ ...) = -(V_1 + V_2 + V_3)$$
The equation simplifies nicely in this case since all of the resistor values are equal, but you can easily change the values to set fixed gains for the channels. Additionally you can add quite a few more resistors for extra channels as needed (although its best to disconnect unused resistors/channels as they contribute noise to the circuit).
You can also take this configuration one step further and add individual gain control for each of your channels, simply by adding a potentiometer before the resistor on the given channel, as shown below. Since you are only dealing with mono channels, you would only need one potentiometer per channel (and only one op amp).

As far as actual components go, the TL071 is a single op amp available in an 8-pin DIP package and can be run off of +/- 3.5V. DIP packages are usually much easier to work with than SMD parts if you're just starting out in electronics. Since your devices are pretty low fidelity, you won't have to worry about using a high-performance chip at all and could get away with a less expensive chip.
For extra information on audio mixing, you can check out this link, and more information on specific audio op amps can be found here

A: The simplest way to combine two signals is with two resistors as shown in the circuit diagram below.

simulate this circuit – Schematic created using CircuitLab
The ground connecton is shared between both inputs and output. The quality can be improved by adding an output buffer (opamp), but that complicates things in requiring an IC, power supply, (de)coupling caps, ...

simulate this circuit
The advantage of the lower circuit is that the inputs see a constant input impedance, one that doesn't change with the other signal's level. This improves output quality. Practically speaking the inverting output (-) of the amplifier is virtual ground, which means it is set at a static voltage (4.5V in this case). The series capacitors are required to decouple the DC bias of both in- and outputs, they allow the signal to pass, but block the DC voltage.


text:
Q: Is it correct to say "running in the rain"? I somewhere found this sentence,
"She is running in the rain".
According to Oxford dicionary and all the other dictionaries I came across,
"In"always refers to someone or something (still or moving) that is sorrounded or enclosed by an area.And sometimes "in" refers to be present on spot but only at office or house...
So what's the logical explanation behind using "in"in this sentence??

A:
According to Oxford dictionary and all the other dictionaries I came across, "In"always refers to someone or something (still or moving) that is surrounded or enclosed by an area.

I think you have misunderstood the dictionaries. The rain is the thing that surrounds the person who is running.
In = inside or within. (Occasionally, it is used as a short form of "into")


text:
Q: Decrypt encfs with SJCL I'm trying for few days to do the thing below:
I have on my hard drive/server files which were encrypted with ENCFS (aes256). What i want to do is to decrypt them on my browser (client side) with a JavaScript library.
For now, I've found two js library :

*

*CryptoJS: I've give up this one because the decryption is really really long;

*SJCL: this one is really nice and after some bench of encryption/decryption, it appears this one is 100x faster than CryptoJS.
So, okay. I'm trying to work with SJCL since few days... I've good results for encrypt and decrypt file with the library but I've some troubles with decryption of files encrypted with encfs.
I'm doing steps in this order:

*

*Read xml meta information file and get information for SJCL. Here is SJCL need and the corresponding element I'd choose in the xml file:

iv : chainedNameIV
v : 1 (default value)
iter : kdfIterations
ks : keySize
ts : blockSize
mode : 'ccm'
adata : '' (empty value...)
cipher : aes
salt : saltData
ct : ct is the content of the file i want to decrypt.

I think I have a problem in the « selection » of elements I'm setting for my chain... Here is what I proceed with js code.
Functions file which can get information from xml file and decrypt the file.
var decrypt = {

    getMetaInfos: function(file) {
        var ks   = file.getElementsByTagName('keySize');
        var iv   = file.getElementsByTagName('chainedNameIV');
        var salt = file.getElementsByTagName('saltData');
        var iter = file.getElementsByTagName('kdfIterations');
        var ts   = file.getElementsByTagName('blockSize');

        var infos = {};

        infos.iv     = iv[0].childNodes[0].nodeValue;
        infos.v      = 1;
        infos.iter   = iter[0].childNodes[0].nodeValue;
        infos.ks     = ks[0].childNodes[0].nodeValue;
        infos.ts     = ts[0].childNodes[0].nodeValue;
        infos.mode   = 'ccm';
        infos.adata  = '';
        infos.cipher = 'aes';
        infos.salt   = salt[0].childNodes[0].nodeValue;
        infos.ct     = '';

        return infos;
    },

    getFileContent: function(file) {
        request = new XMLHttpRequest();

        request.open('POST', 'ajax.php', false);
        request.setRequestHeader("Content-type","application/x-www-form-urlencoded");
        request.send('t=getFile&file='+file);

        if (request.status >= 200 && request.status < 400){
            return request.responseText;
        }
    },

    decryptFile: function(fileContent, metaInfos, passphrase) {
        metaInfos.ct = fileContent;
        console.log(metaInfos);
        console.log(sjcl.decrypt(passphrase, metaInfos));
    },

    createFile: function(file) {
        return;
    }

}

If you look at the decryptFile function, there are two console.log. The first one is showing my object with all meta information and the content of the file i want to decrypt and the second is the one which displays the js error:
Uncaught TypeError: undefined is not a function

And here is my controller file:
window.onload = function() {
    // Declare some vars
    var xmlFile = 'files/coffre/ecfs6.xml';
    var passPhrase = 'passphrase';
    var request = new XMLHttpRequest();

    // Ajax request
    request.onload = function() {
        xmlData = new DOMParser().parseFromString(request.responseText, 'text/xml');

        // Get meta informations which'll help to decrypt files in folder (encfs config)
        xmlData = decrypt.getMetaInfos(xmlData);

        // Add eventlistener on link click to do all the stuff we need
        var links = document.getElementsByTagName('a');
        for (var _i = 0; _i < links.length; _i++) {
            links[_i].onclick = function linkClicked() {

                var fileUrl = this.href;
                var fileContent = decrypt.getFileContent(fileUrl);

                var decryptedFile = decrypt.decryptFile(fileContent, xmlData, passPhrase);

                return false;
            };
        }
    }

    // Sending request
    request.open('GET', xmlFile, false);
    request.send();
}

I'm working with AJAX and a PHP script to get the content of the file (file_get_contents) and I encode my data with utf8_encode before returning them to my js script. All the data I store seems to be ok.
To finish, this is my xml file generated when I encrypt my folder with encfs (working on an Ubuntu 14.04 VM).
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="10">
<cfg class_id="0" tracking_level="0" version="20">
    <version>20100713</version>
    <creator>EncFS 1.7.4</creator>
    <cipherAlg class_id="1" tracking_level="0" version="0">
        <name>ssl/aes</name>
        <major>3</major>
        <minor>0</minor>
    </cipherAlg>
    <nameAlg>
        <name>nameio/null</name>
        <major>1</major>
        <minor>0</minor>
    </nameAlg>
    <keySize>256</keySize>
    <blockSize>1024</blockSize>
    <uniqueIV>0</uniqueIV>
    <chainedNameIV>1</chainedNameIV>
    <externalIVChaining>0</externalIVChaining>
    <blockMACBytes>0</blockMACBytes>
    <blockMACRandBytes>0</blockMACRandBytes>
    <allowHoles>1</allowHoles>
    <encodedKeySize>52</encodedKeySize>
    <encodedKeyData>
9cyR/qRvdP4mq9pPOOhwPJSrQ4qzmABRRX3JtzLdhSfMkryDxzH+w+OKM7Oa9PFvIUWNiQ==
    </encodedKeyData>
    <saltLen>20</saltLen>
    <saltData>
rPeAGiV5hXourhX4WAu6tENiBeE=
    </saltData>
    <kdfIterations>180192</kdfIterations>
    <desiredKDFDuration>500</desiredKDFDuration>
</cfg>
</boost_serialization>

My questions are next: Am I getting the goods xml fields? Did I missed something ? I hope someone can help me. Don't be afraid to ask me more questions, I'll enjoy to answer them.


text:
Q: Choosing elements of the list based on vector R I have a very large list mylidt where each element corresponds to a sequence of years represented by myYears - short example below. The elements of the list were not named. I have then vectors goodyear badyear and neutralyear and I would like to use them to create three new lists each taking correct elements from the list. For goodyear it would be element [[2]] and [[5]] etc. what is an elegant way to do it?
A <- seq(900,1000,1)
B <- rnorm(101,10,2)
C <- rnorm(101,10,2)
D <- rnorm(101,10,2)
E <- rnorm(101,10,2)
G <- rnorm(101,10,2)
H <- rnorm(101,10,2)
I <- rnorm(101,10,2)
J <- rnorm(101,10,2)
K <- rnorm(101,10,2)

mylist <- list(A,B,C,D,E,G,H,I,J,K)

myYears <- seq(1981,1990,1)

goodyear <- c(1981,1985)
badyear <- c(1984,1986,1990)
neutralyear <- myYears[!myYears %in% c(goodyear,badyear)]]


text:
Q: how to insert in different table using merge query Here i am trying to add bulk data using Store Procedure
but the problem is i dont want to Update Data i want to Insert Data into temp table when condition Matched
 Alter PROCEDURE [dbo].[Update_Customers]
     @typeMembership aspnet_Membership_type READONLY
    AS
    BEGIN
          SET NOCOUNT ON;

          MERGE INTO aspnet_Membership c1
          USING @typeMembership c2
          ON c1.EmployeeCode=c2.EmployeeCode
          WHEN MATCHED THEN
          UPDATE SET
          c1.[EmployeeCode] =  c2.[EmployeeCode] ,
          c1.[EmployeeTypeId] = c2.[EmployeeTypeId] ,
          c1.[FirstName] = c2.[FirstName] ,
          c1.[LastName] =  c2.[LastName] ,
          c1.[Gender] =  c2.[Gender] ,
          c1.[Email] =  c2.[Email]  ,
          c1.[MobilePIN] = c2.[MobilePIN] ,
          c1.[Current_Address] =  c2.[Current_Address] ,
          c1.[Permanent_Address] =  c2.[Permanent_Address] ,
          c1.[IsApproved] = c2.[IsApproved]
          WHEN NOT MATCHED THEN
          INSERT VALUES (c2.EmployeeCode, c2.EmployeeTypeId,c2.FirstName,c2.LastName,c2.Gender,c2.Email,c2.MobilePIN,c2.Current_Address, c2.Permanent_Address,c2.IsApproved);
    END

A: AFAIK You can't do it with merge. You'll have to write different insert statements:
BEGIN TRY
BEGIN TRANSACTION

INSERT INTO thirdTable (<ColumnsList>)
SELECT <ValuesList>
FROM @typeMembership c2
WHERE EXISTS
(
    SELECT 1
    FROM aspnet_Membership c1
    WHERE c1.EmployeeCode = c2.EmployeeCode
);

INSERT INTO aspnet_Membership (<ColumnsList>)
SELECT <ValuesList>
FROM @typeMembership c2
WHERE NOT EXISTS
(
    SELECT 1
    FROM aspnet_Membership c1
    WHERE c1.EmployeeCode = c2.EmployeeCode
);

COMMIT TRANSACTION
END TRY
BEGIN CATCH
    IF @@Trancount > 0
        ROLLBACK TRANSACTION
END CATCH


text:
Q: Computing the derivatives of $e^{-rT} \int_{K}^{+\infty} (s - k)\Phi(T, s) \, \mathrm{d}s$
$$ c(T,K) = e^{-rT} \int_{K}^{+\infty} (s - K)\Phi(T, s) \, \mathrm{d}s $$
Then
$$ \frac{\partial c(T,K)}{\partial K} = -e^{-rT} \int_{K}^{+\infty} \Phi(T, s) \, \mathrm{d}s \qquad \text{and} \qquad \frac{\partial^2 c(T,K)}{\partial K^2} = e^{-rT} \Phi(T, K). $$

I am having problem with the derivation from the top integral to the bottom 2 derivatives. Can someone please show me step by step of the derivation, Especially for the derivation of the 2nd derivative?
Your help would be very much appreciated!
This is an extract from the Dupire Formula.
$$ c(T,K) = e^{-rT} \int_{K}^{+\infty} (s - K)\Phi(T, s) \, \mathrm{d}s $$
Can someone please share with me the steps to get to this:
$$ \frac{\partial c(T,K)}{\partial K} = -e^{-rT} \int_{K}^{+\infty} \Phi(T, s) \, \mathrm{d}s \qquad \text{and} \qquad \frac{\partial^2 c(T,K)}{\partial K^2} = e^{-rT} \Phi(T, K). $$

Reference: Original Image

A: Let $f(x), g(x), h(t,x)$ be nice functions. Then the following formula is well-known under the name Leibniz integral rule:
\begin{align*}
&\frac{\partial}{\partial x} \int_{f(x)}^{g(x)} h(t, x) \, \mathrm{d}t \\
&\qquad = g'(x)h(g(x),x) - f'(x)h(f(x),x) + \int_{f(x)}^{g(x)} \frac{\partial h}{\partial x}(t, x) \, \mathrm{d}t.
\end{align*}
Using this, it follows that
\begin{align*}
\frac{\partial c(K)}{\partial K}
&= - \left[ e^{-rT}(s-K)\Phi(T, s) \right]_{s=K} + \int_{K}^{+\infty} \frac{\partial}{\partial K} e^{-rT}(s-K)\Phi(T, s) \, \mathrm{d}s\\
&= -\int_{K}^{+\infty} e^{-rT}\Phi(T, s) \, \mathrm{d}s.
\end{align*}
Differentiating this again with respect to $K$ is much easier in view of FToC, and we get
$$ \frac{\partial^2 c(K)}{\partial K^2} = -\frac{\partial}{\partial K}\int_{K}^{+\infty} e^{-rT}\Phi(T, s) \, \mathrm{d}s = e^{-rT} \Phi(T, K). $$

A: $$
c(T,K) = e^{-rT} \int_{\color{red}{K}}^{+\infty} (s - \color{blue}{K})\Phi(T, s) \, ds
$$
We see $K$ here twice.  So the partial derivative $\partial/\partial K$ is done with two terms.
Think of
$$
b(T,\color{red}{A},\color{blue}{B}) = e^{-rT} \int_{\color{red}{A}}^{+\infty} (s - \color{blue}{B})\Phi(T, s) \, ds
$$
and then
$$
\frac{\partial c}{\partial K} = \frac{\partial b}{\partial A}\;\frac{\partial A}{\partial K} + \frac{\partial b}{\partial B}\;\frac{\partial B}{\partial K}
$$
where $A=K, B=K$. Now
$$
\frac{\partial b}{\partial A} = -e^{-rT}(A-B)\Phi(T,A)
\\
\frac{\partial b}{\partial B} = -e^{-rT} \int_{A}^{+\infty} \Phi(T, s) \, ds
$$
and $\partial A/\partial K = 1$, $\partial B/\partial K = 1$. Thus
$$
\frac{\partial c}{\partial K} =
-e^{-rT}(K-K)\Phi(T,A)
-e^{-rT} \int_{K}^{+\infty} \Phi(T, s) \, ds
=-e^{-rT} \int_{K}^{+\infty} \Phi(T, s) \, ds
$$
as claimed.

A: There's probably some way to solve this by a clever substitution, but I haven't seen it yet. I only see how to directly apply the definition of a derivative.
You have $c(T,K)$ defined by
$$ c(T,K) = e^{−rT} \int_K^\infty (s − K)\Phi(T,s)\,ds.$$
Therefore
\begin{align}
 c(T,K+h) &= e^{−rT} \int_{K+h}^\infty (s − (K+h))\Phi(T,s)\,ds \\
&= e^{−rT} \int_{K+h}^\infty (s − K)\Phi(T,s)\,ds
 - h e^{−rT} \int_{K+h}^\infty \Phi(T,s)\,ds \\
&= e^{−rT} \int_K^\infty (s − K)\Phi(T,s)\,ds \\
 &\qquad - e^{−rT} \int_K^{K+h} (s − K)\Phi(T,s)\,ds \\
 &\qquad - h e^{−rT} \int_{K+h}^\infty \Phi(T,s)\,ds,
\end{align}
so
\begin{align}
\frac{c(T,K+h) - c(T,K)}h &= \frac1h\left(
 - e^{−rT} \int_K^{K+h} (s − K)\Phi(T,s)\,ds
 - h e^{−rT} \int_{K+h}^\infty \Phi(T,s)\,ds\right) \\
 &= -\frac1h e^{−rT} \int_K^{K+h} (s − K)\Phi(T,s)\,ds
 - e^{−rT} \int_{K+h}^\infty \Phi(T,s)\,ds.
\end{align}
Now observe that for $h > 0,$
\begin{align}
\left\lvert \int_K^{K+h} (s − K)\Phi(T,s)\,ds \right\rvert
&= \int_K^{K+h} \lvert(s − K)\Phi(T,s)\rvert\,ds \\
&\leq \int_K^{K+h} h \max_{K\leq s\leq K+h}\lvert\Phi(T,s)\rvert\,ds \\
& = h^2 \max_{K\leq s\leq K+h}\lvert\Phi(T,s)\rvert.
\end{align}
We get the same result for $h < 0$ by reversing the limits of integration.
Therefore
$$ \lim_{h\to 0} \frac1h\left\lvert \int_K^{K+h} (s − K)\Phi(T,s)\,ds \right\rvert
= \lim_{h\to 0} \left( h \max_{K\leq s\leq K+h}\lvert\Phi(T,s)\rvert\right) = 0, $$
so
$$ \lim_{h\to 0} \frac{c(T,K+h) - c(T,K)}h
 = \lim_{h\to 0}\left(- e^{−rT} \int_{K+h}^\infty \Phi(T,s)\,ds\right)
 = - e^{−rT} \int_K^\infty \Phi(T,s)\,ds. $$


text:
Q: How to copy resources from other module to specific location ? (maven) I have a maven-managed project with some modules.
One module contains some native codes inside "src/main/resources/native" directory.
Second module packages all related modules to a WAR file.
Here comes the question : How to copy the "native/" directory (and its sub-directories) in first module to WEB-INF/native directory in the second module ?
I found a copy resources plugin , but it seems not what I want. (It copies directory inside the same module , but I want cross-module copy)

A: This is doable with dependency:unpack (that I would bind on the prepare-package phase) and the appropriate excludes/includes . See the Unpacking specific artifacts example.

A: The goal of modules in maven is to spearate them from each other. I am afraid there will be no satisfactory solution inside maven as this goes against the grain.
A solution could be to create a war archive with your resources and depend on that to build your final war.
I use for a project for example the camel-web resources by adding a dependency :
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-web</artifactId>
        <version>${camel.version}</version>
        <type>war</type>
        <scope>runtime</scope>
    </dependency>

The war resources are merged with my web resources.


text:
Q: Can Bintray sign packages/files using a signing subkey? TL;DR: Can Bintray sign files or packages using a signing key which is a subkey, or is a master signing key (also?) required?
In my private keyring I (originally) have a master key ([SC]) with its standard encryption subkey ([E]).  To this I added a signing subkey ([S]) that I hope to use to sign software packages (uploaded to Bintray).  Later I remove the master key from my keyring for safe-keeping, retaining only the subkeys I need for signing and encryption.
I have two ASCII-armored exports of private keys:

*

*One was produced using --export-secret-keys and contains the master key and two subkeys;

*the other was produced using --export-secret-subkeys and contains only the subkeys, including the added signing subkey.

Attempting to sign packages uploaded to Bintray:

*

*If I supply Bintray with the full private-key export containing the master key and subkeys, Bintray signing operations (via the API) work correctly.  When I download the file and .asc signature, I can see that Bintray used the master key to sign.

*If I instead supply the smaller private key export containing only the subkeys, all signing operations fail with 405 Not Allowed.

By supply of the private key here I mean either via the private_key parameter of the api.bintray.com/gpg API call, or pre-set in my account on Bintray as the private key.
Should I expect to be able to sign in Bintray using the signing subkey?  Of course I can create an armored/detached asc signature in my local shell using gpg, without the master key being in my keyring, using the signing subkey.  But can I do this in Bintray?


text:
Q: Как получить deadlock определённого типа? Мне нужно получить (сымитировать) deadlock определённого типа:

*

*У транзакции №1 изначально есть одна блокировка типа X (exclusive).

*Транзакция №2 пытается получить блокировку типа S (shared) и начинает ждать, когда Транзакция №1 освободит свою блокировку;

*Транзакция №1 пытается получить блокировку типа X (на другой набор записей) и начинает ждать, когда Транзакция №2 получит S-блокировку и освободит её.

У меня получается получить dealock, когда одновременно в двух потоках выполняются следующие транзакции:
-- Транзакция №1
BEGIN;
SELECT * FROM `testlock` WHERE id=1 LOCK IN SHARE MODE; /* GET S LOCK */
SELECT SLEEP(5);
SELECT * FROM `testlock` WHERE id=1 FOR UPDATE; /* TRY TO GET X LOCK */
COMMIT;

-- Транзакция №2
BEGIN;
SELECT * FROM `testlock` WHERE id=1 FOR UPDATE; /* TRY TO GET X LOCK - DEADLOCK AND ROLLBACK HERE */
COMMIT;

Но тогда получается, что это дэдлок другого типа - изначально у первой транзакции блокировка S и т.д.
Я пыталась изменить транзакции, например, переписать их следующим образом:
-- Транзакция №1
BEGIN;
SELECT * FROM `testlock` WHERE id=1 FOR UPDATE; /* GET X LOCK */
SELECT SLEEP(5);
SELECT * FROM `testlock` WHERE id=3 FOR UPDATE; /* TRY TO GET X LOCK */
COMMIT;

-- Транзакция №2
BEGIN;
SELECT * FROM `testlock` WHERE id > 2 LOCK IN SHARE MODE; /* TRY TO GET S LOCK*/
COMMIT;

Также я меняла поле id на поле без индекса, и во всех запросах изменяла условие на WHERE id = 1, но всё равно, в этих случаях я deadlock'а не получаю, обе транзакции выполняются.
Каким образом можно получить именно описанный выше deadlock?

A: LOCK IN SHARE MODE не запрещает читать. Потому второй SELECT * FROM testlock WHERE id=3 FOR UPDATE; выполняется нормально.
Проделайте следующее - откройте три консоли, чтобы видеть их одновременно. Выполните:
подготовка
create table testlock (id int, val int);

insert into testlock (id,val)
select 1,1 union all
select 2,2 union all
select 3,3 union all
select 4,4 ;

консоль 1
start transaction;
SELECT * FROM `testlock` WHERE id=1 FOR UPDATE;

консоль 2
start transaction;
SELECT * FROM `testlock` WHERE id > 2 LOCK IN SHARE MODE;

консоль 1
SELECT * FROM `testlock` WHERE id=3 FOR UPDATE;

консоль 3
update testlock set val=val+1 where id=3;

консоль 1
commit;

консоль 2
commit;

A: У меня получилось повторить deadlock именно такого же типа.
Для этого создаётся таблица:
CREATE TABLE ad_data(
   DAY DATE NOT NULL,
   ad_id INT NOT NULL,
   CLIENT INT NOT NULL,
   clicks INT NOT NULL,
   cost INT NOT NULL,
   PRIMARY KEY(DAY, ad_id)
) ENGINE=INNODB;

INSERT INTO ad_data(DAY, ad_id, CLIENT, clicks, cost)
   VALUES
   ('2006-08-01', 1, 1, 10, 100),
   ('2006-08-01', 2, 1, 20, 200),
   ('2006-08-01', 3, 1, 30, 300),
   ('2006-08-01', 4, 1, 40, 400),
   ('2006-08-01', 6, 1, 60, 600);

И в 1-ом соединении выполняются запросы:
START TRANSACTION;
INSERT INTO ad_data(DAY, ad_id, CLIENT, clicks, cost)
   VALUES
   ('2006-08-01', 7, 1, 70, 700);

Далее во 2-ом соединении выполняются запросы:
START TRANSACTION;
DROP TABLE IF EXISTS cost;
create temporary table cost as
select * from ad_data
where day = '2006-08-01';

После этого 2-ое соединении блокируется (в ожидании своей S-блокировки). И в завершении в 1-ом соединении выполняем запрос:
INSERT INTO ad_data(DAY, ad_id, CLIENT, clicks, cost)
   VALUES
   ('2006-08-01', 5, 1, 50, 500);

Получаем дэдлок:

Error Code: 1213
Deadlock found when trying to get lock; try restarting transaction

После вызова команды SHOW ENGINE INNODB STATUS; можно увидеть, что тип deadlock'a именно тот, который был нужен:
------------------------
LATEST DETECTED DEADLOCK
------------------------
170329 18:05:28
*** (1) TRANSACTION:
TRANSACTION 0 187654012, ACTIVE 2 sec, OS thread id 2304 fetching ROWS
mysql TABLES IN USE 2, locked 2
LOCK WAIT 4 LOCK struct(s), HEAP size 320, 7 ROW LOCK(s), UNDO LOG entries 5
MySQL thread id 1180, QUERY id 1984999 127.0.0.1 USER Sending DATA
CREATE TEMPORARY TABLE cost AS
SELECT * FROM ad_data
WHERE DAY = '2006-08-01'
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS SPACE id 0 page NO 196086 n bits 80 INDEX `PRIMARY` of TABLE `db`.`ad_data`
trx id 0 187654012 LOCK MODE S waiting
Record LOCK, HEAP NO 7 PHYSICAL RECORD: n_fields 7; ...

*** (2) TRANSACTION:
TRANSACTION 0 187654007, ACTIVE 6 sec, OS thread id 488 inserting, thread declared inside INNODB 500
mysql TABLES IN USE 1, locked 1
4 LOCK struct(s), HEAP size 320, 4 ROW LOCK(s), UNDO LOG entries 1
MySQL thread id 1179, QUERY id 1985000 ip USER UPDATE
INSERT INTO ad_data(DAY, ad_id, CLIENT, clicks, cost)
   VALUES
   ('2006-08-01', 5, 1, 50, 500)
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS SPACE id 0 page NO 196086 n bits 80 INDEX `PRIMARY` of TABLE `db`.`ad_data`
trx id 0 187654007 lock_mode X LOCKS rec but NOT gap
Record LOCK, HEAP NO 7 PHYSICAL RECORD: n_fields 7; ...

*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS SPACE id 0 page NO 196086 n bits 80 INDEX `PRIMARY` of TABLE `db`.`ad_data`
trx id 0 187654007 lock_mode X LOCKS rec but NOT gap waiting
Record LOCK, HEAP NO 8 PHYSICAL RECORD: n_fields 7; ...

*** WE ROLL BACK TRANSACTION (2)
------------

То есть:
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
... LOCK MODE S waiting

*** (2) HOLDS THE LOCK(S):
... lock_mode X LOCKS rec but NOT gap

*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
...lock_mode X LOCKS rec but NOT gap waiting


text:
Q: Mask NumPy array and extract values where condition is met How can I mask two NumPy arrays properly? I want find pe values that are not equal to 255, for example. I also want my desired output array be the same size aspd and pe, i.e., (7, 7) and filled with 0's.

What is the most efficient way to achieve this?
import numpy as np

pd = np.random.randint(254,256, size=(7,7))
pe = np.random.randint(0,7, size=(7,7))

Desired output
[[6 6 0 0 6 6 1]
 [2 6 1 1 5 6 3]
 [3 4 6 6 3 5 6]
 [3 5 0 3 2 0 0]
 [0 3 6 1 3 6 1]
 [6 3 4 1 0 3 1]
 [6 0 4 2 2 6 4]]

Many thanks

A: Logical indexing seems the simplest of all options.
import numpy as np

pd = np.random.randint(254,256, size=(7,7))
pe = np.random.randint(0,7, size=(7,7))

pe[pd == 255] = 0

[[3 6 0 2 0 0 0]
 [0 3 4 5 2 0 5]
 [0 0 6 0 1 0 5]
 [0 3 0 4 0 6 0]
 [2 0 0 0 0 0 0]
 [2 0 4 0 0 0 5]
 [0 0 3 0 2 4 0]]

Based on your data size, you may try other options:
pe = np.where(pd == 255, 0, pe)
# OR
pe = pe * (pd == 255)

but I guess indexing is still simple and fast.


text:
Q: Are there any function in C# that returns p-value associated with a chi-square goodness of fit test? i'm new here and my English isn't very good, so i'll try to explain as well as possible.
I'm doing a web application in ASP.NET and C# about steganalysis.
I was looking for internet a function that calculates the observed significance level, or p-value in a chi-square test
for my algorithm and I found it in Java:
This is the result of mi search:
chi[block]= chiSquareTest(expectedValues, pod);
chiSquareTest(double[] expected, long[] observed)

*

*Returns the observed significance level, or p-value,

*associated with a Chi-square goodness of fit test comparing

*the observed frequency counts to those in the expected array.

My question is, Are there any equivalent function in C# that returns the same parameter?
Thank you in advance,
Ana.

A: The MathNet nugetpackage contains the ChiSquared distribution - you can get the cumulative or inverse cumulative.
ChiSquared c = new ChiSquared(degreesOfFreedom);
return c.CumulativeDistribution(testValue);

A: I doubt there is an inbuilt function.
You should try looking for a library that contains the function or implement it yourself.
A quick search returned me this
http://www.alglib.net/specialfunctions/distributions/chisquare.php
and
http://www.codeproject.com/Articles/432194/How-to-Calculate-the-Chi-Squared-P-Value

A: I know this is an old question but I figured I'd post anyway.
The Accord.NET framework has a library and NuGet package Accord.Statistics which has a ChiSquareTest class that can be used in a similar manor as mentioned in your question:
ChiSquareTest chiSquareTest = new ChiSquareTest(observedArray, expectedArray, DOF);
chiSquareTest.PValue; // gets p-value
chiSquareTest.Significant; // true if statistically significant

The only thing is that  you'll have to calculate your DOF - degrees of freedom.


text:
Q: Complex nonlinear system of four variables I am stuck on the following problem.
Given the system:
$$\displaystyle S_1=w_1e^{i(\alpha\omega_x+\beta\omega_y)}+w_2e^{i(\gamma\omega_x+\delta\omega_y)}$$
$$\displaystyle S_2=w_3e^{i(\eta\omega_x+\mu\omega_y)}+w_4e^{i(\psi\omega_x+\zeta\omega_y)}$$
I would like to solve it for the two variables:
$\omega_x,\omega_y$
assuming:
$\alpha,\beta,\gamma,\delta,\eta,\zeta$ real and $S_1,S_2,w_1,w_2,w_3,w_4$ complex.
Is there some method to solve it analytically? If not, what is the best method to solve it numerically?

A: Let $u=\alpha\omega_x+\beta\omega_y+\angle w_1-\angle S_1,v=\gamma\omega_x+\delta\omega_y+\angle w_2-\angle S_1$.
Then the first equation expresses
$$|w_1|\cos u+|w_2|\cos v=|S_1|,\\|w_1|\sin u+|w_2|\sin v=|S_1|.$$
We eliminate $v$ by
$$(|S_1|-|w_1|\cos u)^2+(|S_1|-|w_1|\sin u)^2=|w_2|^2.$$
After transformation, this is a classical
$$2|w_1|(\cos u+\sin u)=2|S_1|^2+|w_1|^2-|w_2|^2,$$
which you can solve for $u$, and then
$$\tan v=\frac{|S_1|-|w_1|\sin u}{|S_1|-|w_1|\cos u}.$$
From $u$ a,d $v$ you deduce the $\omega$'s by solving a linear system. Plugging in the second equation will tell you about the compatibility.

Geometrically, you are asking how to rotate two vectors in such a way that they sum to a third one. This is equivalent to the resolution of a triangle of three known sides.


text:
Q: RSS Viewer Customization to remove some of the text rendered - SharePoint 2010 I am trying to customize the way the items from an RSS feed is displayed in my RSS viewer web part. I would like to prevent the web part from showing everything after the ellipses (...). For example the text below is the description from my test RSS Viewer Page using the Google News RSS feed:
New Hampshire Visit Offers Glimpse Into Possible Walker, Bush Rivalry
NPR
The two likely Republican presidential front-runners, Wisconsin Gov. Scott Walker and former Florida Gov. Jeb Bush, visited New Hampshire this weekend. Though neither has officially declared their candidacy, The Boston Globe's James Pindell says they're ...
Here's what Jeb is saying when people ask him about the Bush dynastyBusinessinsider India
No longer under the radar, Jeb Bush to tour the state Capitol on ThursdayAtlanta Journal Constitution (blog)
Scott Walker PAC: Jeb Bush is not the only one who can raise moneyCNN International
New Hampshire Public Radio -Petoskey News-Review
all 82 news articles »
I would like to remove everything after the "..." and hence the page would then display :
New Hampshire Visit Offers Glimpse Into Possible Walker, Bush Rivalry NPR The two likely Republican presidential front-runners, Wisconsin Gov. Scott Walker and former Florida Gov. Jeb Bush, visited New Hampshire this weekend. Though neither has officially declared their candidacy, The Boston Globe's James Pindell says they're ...
I haven't really worked with XSLT or XML in the past and hence this is proving quite difficult for me. I have asked a similar question on SharePoint StackExchange but no response yet so I thought I would post on here as well.Thanks for any help.
Edit
Below is the code:
    <%@ Register TagPrefix="WpNs0" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>
<%-- _lcid="1033" _version="14.0.7006" _dal="1" --%>
<%-- _LocalBinding --%>
<%@ Page language="C#" MasterPageFile="~masterurl/default.master"    Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" meta:webpartpageexpansion="full" meta:progid="SharePoint.WebPartPage.Document"  %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
    <SharePoint:ListItemProperty Property="BaseName" maxlength="40" runat="server"/>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
    <WebPartPages:WebPartZone runat="server" title="loc:TitleBar" id="TitleBar" AllowLayoutChange="false" AllowPersonalization="false"><ZoneTemplate>
    <WebPartPages:TitleBarWebPart runat="server" AllowEdit="True" AllowConnect="True" ConnectionID="00000000-0000-0000-0000-000000000000" Title="Web Part Page Title Bar" IsIncluded="True" Dir="Default" IsVisible="True" AllowMinimize="False" ExportControlledProperties="True" ZoneID="TitleBar" ID="g_ebad7959_96e5_4485_b67a_ff43ff07343b" HeaderTitle="BlogTestPage" AllowClose="False" FrameState="Normal" ExportMode="All" AllowRemove="False" AllowHide="True" SuppressWebPartChrome="False" DetailLink="" ChromeType="None" HelpLink="" MissingAssembly="Cannot import this Web Part." PartImageSmall="" HelpMode="Modeless" FrameType="None" AllowZoneChange="True" PartOrder="2" Description="" PartImageLarge="" IsIncludedFilter="" __MarkupType="vsattributemarkup" __WebPartId="{EBAD7959-96E5-4485-B67A-FF43FF07343B}" WebPart="true" Height="" Width=""></WebPartPages:TitleBarWebPart>

</ZoneTemplate></WebPartPages:WebPartZone>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderTitleAreaClass" runat="server">

</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
    <meta name="GENERATOR" content="Microsoft SharePoint" />
    <meta name="ProgId" content="SharePoint.WebPartPage.Document" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="CollaborationServer" content="SharePoint Team Web Site" />

    <SharePoint:UIVersionedContent ID="WebPartPageHideQLStyles" UIVersion="4" runat="server">
        <ContentTemplate>

        </ContentTemplate>
    </SharePoint:UIVersionedContent>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderSearchArea" runat="server">
    <SharePoint:DelegateControl runat="server"
        ControlId="SmallSearchInputBox"/>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderLeftActions" runat="server">
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageDescription" runat="server">
    <SharePoint:ProjectProperty Property="Description" runat="server"/>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderBodyRightMargin" runat="server">

</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageImage" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderNavSpacer" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">

                    <WebPartPages:WebPartZone runat="server" Title="loc:FullPage" ID="FullPage" FrameType="TitleBarOnly"><ZoneTemplate>
                    <WpNs0:RSSAggregatorWebPart runat="server" Description="Displays an RSS feed." ListDisplayName="" ImportErrorMessage="Cannot import this web part." PartOrder="2" HelpLink="" AllowRemove="True" IsVisible="True" AllowHide="True" UseSQLDataSourcePaging="True" ExportControlledProperties="True" IsIncludedFilter="" DataSourceID="" Title="RSS Viewer" ViewFlag="0" NoDefaultStyle="" AllowConnect="True" CacheXslTimeOut="600" FrameState="Normal" PageSize="-1" PartImageLarge="" AsyncRefresh="False" ExportMode="All" Dir="Default" DetailLink="" ShowWithSampleData="False" ListId="00000000-0000-0000-0000-000000000000" FrameType="Default" PartImageSmall="" IsIncluded="True" SuppressWebPartChrome="False" AllowEdit="True" EnableOriginalValue="False" AutoRefresh="False" AutoRefreshInterval="60" AllowMinimize="True" ViewContentTypeId="" InitialAsyncDataFetch="False" ExpandFeed="True" MissingAssembly="Cannot import this web part." HelpMode="Modeless" FeedUrl="http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&output=rss" ListUrl="" ID="g_fd7ba5cc_29e7_4892_9305_3857422aa65a" ConnectionID="00000000-0000-0000-0000-000000000000" AllowZoneChange="True" ManualRefresh="False" __MarkupType="vsattributemarkup" __WebPartId="{FD7BA5CC-29E7-4892-9305-3857422AA65A}" __AllowXSLTEditing="true" WebPart="true" Height="" Width=""><ParameterBindings>
                        <ParameterBinding Name="RequestUrl" Location="WPProperty[FeedUrl]"/>
                    </ParameterBindings>
<DataFields>
</DataFields>
<Xsl>
<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema"
               version="1.0" exclude-result-prefixes="xsl ddwrt msxsl rssaggwrt"
               xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
               xmlns:rssaggwrt="http://schemas.microsoft.com/WebParts/v3/rssagg/runtime"
               xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
               xmlns:rssFeed="urn:schemas-microsoft-com:sharepoint:RSSAggregatorWebPart"
               xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"
               xmlns:rss1="http://purl.org/rss/1.0/" xmlns:atom="http://www.w3.org/2005/Atom"
               xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
               xmlns:atom2="http://purl.org/atom/ns#" xmlns:ddwrt2="urn:frontpage:internal">

    <xsl:param name="rss_FeedLimit">5</xsl:param>
    <xsl:param name="rss_ExpandFeed">false</xsl:param>
    <xsl:param name="rss_LCID">1033</xsl:param>
    <xsl:param name="rss_WebPartID">RSS_Viewer_WebPart</xsl:param>
    <xsl:param name="rss_alignValue">left</xsl:param>
    <xsl:param name="rss_IsDesignMode">True</xsl:param>

        <xsl:template match="rss" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:rssFeed="urn:schemas-microsoft-com:sharepoint:RSSAggregatorWebPart" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rss1="http://purl.org/rss/1.0/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:atom2="http://purl.org/atom/ns#">
            <xsl:call-template name="RSSMainTemplate"/>
        </xsl:template>

        <xsl:template match="rdf:RDF">
            <xsl:call-template name="RDFMainTemplate"/>
        </xsl:template>

        <xsl:template match="atom:feed">
            <xsl:call-template name="ATOMMainTemplate"/>
        </xsl:template>

        <xsl:template match="atom2:feed">
            <xsl:call-template name="ATOM2MainTemplate"/>
        </xsl:template>

        <xsl:template name="RSSMainTemplate">
            <xsl:variable name="Rows" select="channel/item"/>
            <xsl:variable name="RowCount" select="count($Rows)"/>

                            <xsl:value-of select="channel/title"/>

            <xsl:call-template name="RSSMainTemplate.body">
                <xsl:with-param name="Rows" select="$Rows"/>
                <xsl:with-param name="RowCount" select="count($Rows)"/>
            </xsl:call-template>

        </xsl:template>

        <xsl:template name="RSSMainTemplate.body">
            <xsl:param name="Rows"/>
            <xsl:param name="RowCount"/>
            <xsl:for-each select="$Rows">
                <xsl:variable name="CurPosition" select="position()" />
                <xsl:variable name="RssFeedLink" select="$rss_WebPartID" />
                <xsl:variable name="CurrentElement" select="concat($RssFeedLink,$CurPosition)" />
                <xsl:if test="($CurPosition <= $rss_FeedLimit)">

                                <xsl:value-of select="title"/>

                            <xsl:if test="$rss_ExpandFeed = true()">
                                <xsl:call-template name="RSSMainTemplate.description">
                                    <xsl:with-param name="DescriptionStyle" select="string('display:block;')"/>
                                    <xsl:with-param name="CurrentElement" select="$CurrentElement"/>
                                </xsl:call-template>
                            </xsl:if>
                            <xsl:if test="$rss_ExpandFeed = false()">
                                <xsl:call-template name="RSSMainTemplate.description">
                                    <xsl:with-param name="DescriptionStyle" select="string('display:none;')"/>
                                    <xsl:with-param name="CurrentElement" select="$CurrentElement"/>
                                </xsl:call-template>
                            </xsl:if>

                </xsl:if>
            </xsl:for-each>
        </xsl:template>

    <xsl:template name="RSSMainTemplate.description">
            <xsl:param name="DescriptionStyle"/>
            <xsl:param name="CurrentElement"/>

                <xsl:choose>

                    <xsl:when test="string-length(pubDate) > 0">
                        <xsl:variable name="pubDateLength" select="string-length(pubDate) - 3" />
                <xsl:value-of select="ddwrt:FormatDate(substring(pubDate,0,$pubDateLength),number($rss_LCID),3)"/>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="ddwrt:FormatDate(string(dc:date),number($rss_LCID),3)"/>
                    </xsl:otherwise>
                </xsl:choose>

                <xsl:if test="string-length(description) > 0">
                    <xsl:variable name="SafeHtml">
                        <xsl:call-template name="GetSafeHtml">
                            <xsl:with-param name="Html" select="description"/>
                        </xsl:call-template>
                    </xsl:variable>
                     - <xsl:value-of select="$SafeHtml" disable-output-escaping="yes"/>
                </xsl:if>

                More...

        </xsl:template>

        <xsl:template name="RDFMainTemplate" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
            <xsl:variable name="Rows" select="rss1:item"/>
            <xsl:variable name="RowCount" select="count($Rows)"/>

                    <xsl:value-of select="rss1:channel/rss1:title"/>

            <xsl:call-template name="RDFMainTemplate.body">
                <xsl:with-param name="Rows" select="$Rows"/>
                <xsl:with-param name="RowCount" select="count($Rows)"/>
            </xsl:call-template>

        </xsl:template>

        <xsl:template name="RDFMainTemplate.body" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
            <xsl:param name="Rows"/>
            <xsl:param name="RowCount"/>
            <xsl:for-each select="$Rows">
                <xsl:variable name="CurPosition" select="position()" />
                <xsl:variable name="RssFeedLink" select="$rss_WebPartID" />
                <xsl:variable name="CurrentElement" select="concat($RssFeedLink,$CurPosition)" />
                <xsl:if test="($CurPosition <= $rss_FeedLimit)">

                            <xsl:value-of select="rss1:title"/>

                        <xsl:if test="$rss_ExpandFeed = true()">
                                <xsl:call-template name="RDFMainTemplate.description">
                                    <xsl:with-param name="DescriptionStyle" select="string('display:block;')"/>
                                    <xsl:with-param name="CurrentElement" select="$CurrentElement"/>
                                </xsl:call-template>
                        </xsl:if>
                        <xsl:if test="$rss_ExpandFeed = false()">
                                <xsl:call-template name="RDFMainTemplate.description">
                                    <xsl:with-param name="DescriptionStyle" select="string('display:none;')"/>
                                    <xsl:with-param name="CurrentElement" select="$CurrentElement"/>
                                </xsl:call-template>
                        </xsl:if>

        </xsl:if>
            </xsl:for-each>
        </xsl:template>

    <xsl:template name="RDFMainTemplate.description" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
            <xsl:param name="DescriptionStyle"/>
            <xsl:param name="CurrentElement"/>

            <xsl:value-of select="ddwrt:FormatDate(string(dc:date),number($rss_LCID),3)"/>
                <xsl:if test="string-length(rss1:description) > 0">
                    <xsl:variable name="SafeHtml">
                        <xsl:call-template name="GetSafeHtml">
                            <xsl:with-param name="Html" select="rss1:description"/>
                        </xsl:call-template>
                    </xsl:variable>
                     - <xsl:value-of select="$SafeHtml" disable-output-escaping="yes"/>
                </xsl:if>

                More...

        </xsl:template>

        <xsl:template name="ATOMMainTemplate" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
            <xsl:variable name="Rows" select="atom:entry"/>
            <xsl:variable name="RowCount" select="count($Rows)"/>

                    <xsl:value-of select="atom:title"/>

            <xsl:call-template name="ATOMMainTemplate.body">
                <xsl:with-param name="Rows" select="$Rows"/>
                <xsl:with-param name="RowCount" select="count($Rows)"/>
            </xsl:call-template>

        </xsl:template>

        <xsl:template name="ATOMMainTemplate.body" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
            <xsl:param name="Rows"/>
            <xsl:param name="RowCount"/>
            <xsl:for-each select="$Rows">
                <xsl:variable name="CurPosition" select="position()" />
                <xsl:variable name="RssFeedLink" select="$rss_WebPartID" />
                <xsl:variable name="CurrentElement" select="concat($RssFeedLink,$CurPosition)" />
                <xsl:if test="($CurPosition <= $rss_FeedLimit)">

                                    <xsl:value-of select="atom:title"/>

                                <xsl:if test="$rss_ExpandFeed = true()">
                                    <xsl:call-template name="ATOMMainTemplate.description">
                                        <xsl:with-param name="DescriptionStyle" select="string('display:block;')"/>
                                        <xsl:with-param name="CurrentElement" select="$CurrentElement"/>
                                    </xsl:call-template>
                            </xsl:if>
                                <xsl:if test="$rss_ExpandFeed = false()">
                                    <xsl:call-template name="ATOMMainTemplate.description">
                                        <xsl:with-param name="DescriptionStyle" select="string('display:none;')"/>
                                        <xsl:with-param name="CurrentElement" select="$CurrentElement"/>
                                    </xsl:call-template>
                            </xsl:if>

        </xsl:if>
            </xsl:for-each>
        </xsl:template>

    <xsl:template name="ATOMMainTemplate.description" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
            <xsl:param name="DescriptionStyle"/>
            <xsl:param name="CurrentElement"/>

        <xsl:value-of select="ddwrt:FormatDate(string(atom:updated),number($rss_LCID),3)"/>
                <xsl:choose>
                    <xsl:when test="string-length(atom:summary) > 0">
                        <xsl:variable name="SafeHtml">
                            <xsl:call-template name="GetSafeHtml">
                                <xsl:with-param name="Html" select="atom:summary"/>
                            </xsl:call-template>
                        </xsl:variable>
                         - <xsl:value-of select="$SafeHtml" disable-output-escaping="yes"/>
                    </xsl:when>
                    <xsl:when test="string-length(atom:content) > 0">
                        <xsl:variable name="SafeHtml">
                            <xsl:call-template name="GetSafeHtml">
                                <xsl:with-param name="Html" select="atom:content"/>
                            </xsl:call-template>
                        </xsl:variable>
                         - <xsl:value-of select="$SafeHtml" disable-output-escaping="yes"/>
                    </xsl:when>
                </xsl:choose>

                More...

        </xsl:template>

        <xsl:template name="ATOM2MainTemplate" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
            <xsl:variable name="Rows" select="atom2:entry"/>
            <xsl:variable name="RowCount" select="count($Rows)"/>

                    <xsl:value-of select="atom2:title"/>

            <xsl:call-template name="ATOM2MainTemplate.body">
                <xsl:with-param name="Rows" select="$Rows"/>
                <xsl:with-param name="RowCount" select="count($Rows)"/>
            </xsl:call-template>

        </xsl:template>

        <xsl:template name="ATOM2MainTemplate.body" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
            <xsl:param name="Rows"/>
            <xsl:param name="RowCount"/>
            <xsl:for-each select="$Rows">
                <xsl:variable name="CurPosition" select="position()" />
                <xsl:variable name="RssFeedLink" select="$rss_WebPartID" />
                <xsl:variable name="CurrentElement" select="concat($RssFeedLink,$CurPosition)" />
                <xsl:if test="($CurPosition <= $rss_FeedLimit)">

                                    <xsl:value-of select="atom2:title"/>

                            <xsl:if test="$rss_ExpandFeed = true()">
                                <xsl:call-template name="ATOM2MainTemplate.description">
                                    <xsl:with-param name="DescriptionStyle" select="string('display:block;')"/>
                                    <xsl:with-param name="CurrentElement" select="$CurrentElement"/>
                                </xsl:call-template>
                            </xsl:if>
                            <xsl:if test="$rss_ExpandFeed = false()">
                                <xsl:call-template name="ATOM2MainTemplate.description">
                                    <xsl:with-param name="DescriptionStyle" select="string('display:none;')"/>
                                    <xsl:with-param name="CurrentElement" select="$CurrentElement"/>
                                </xsl:call-template>
                            </xsl:if>

        </xsl:if>
            </xsl:for-each>
        </xsl:template>

    <xsl:template name="ATOM2MainTemplate.description" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
            <xsl:param name="DescriptionStyle"/>
            <xsl:param name="CurrentElement"/>

            <xsl:value-of select="ddwrt:FormatDate(string(atom2:updated),number($rss_LCID),3)"/>
                <xsl:choose>
                    <xsl:when test="string-length(atom2:summary) > 0">
                        <xsl:variable name="SafeHtml">
                            <xsl:call-template name="GetSafeHtml">
                                <xsl:with-param name="Html" select="atom2:summary"/>
                            </xsl:call-template>
                        </xsl:variable>
                         - <xsl:value-of select="$SafeHtml" disable-output-escaping="yes"/>
                    </xsl:when>
                    <xsl:when test="string-length(atom2:content) > 0">
                        <xsl:variable name="SafeHtml">
                            <xsl:call-template name="GetSafeHtml">
                                <xsl:with-param name="Html" select="atom2:content"/>
                            </xsl:call-template>
                        </xsl:variable>
                         - <xsl:value-of select="$SafeHtml" disable-output-escaping="yes"/>
                    </xsl:when>
                </xsl:choose>

                More...

        </xsl:template>

        <xsl:template name="GetSafeHtml">
            <xsl:param name="Html"/>
            <xsl:choose>
                <xsl:when test="$rss_IsDesignMode = 'True'">
                     <xsl:value-of select="$Html"/>
                </xsl:when>
                <xsl:otherwise>
                     <xsl:value-of select="rssaggwrt:MakeSafe($Html)"/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:template>

</xsl:stylesheet>
</Xsl>
<DataSources>
<SharePoint:XmlUrlDataSource runat="server" HttpMethod="GET" SelectCommand="" AuthType="None" XPath=""><DataFileParameters><WebPartPages:DataFormParameter ParameterKey="RequestUrl" PropertyName="ParameterValues" Name="RequestUrl"></WebPartPages:DataFormParameter>
</DataFileParameters>
</SharePoint:XmlUrlDataSource>
</DataSources>
</WpNs0:RSSAggregatorWebPart>

</ZoneTemplate></WebPartPages:WebPartZone>

</asp:Content>


text:
Q: Jordan Canonical Form of simple $2\times 2$ matrix complex Let
$$A =\begin{pmatrix}
1 & 1 \\
-1 & 1 \\
\end{pmatrix}$$
Original question: determine the Jordan form of this matrix and its corresponding P matrix.
I understand all the steps I need to take to find the Jordan form, but how many times I try I can't seem to do this one the right way..
Using its characteristic polynomial I found that the eigenvalues of $A$ are $λ = 1 \pm i$.
I found the first eigenvector: $$\begin{pmatrix}
i \\
1 \\
\end{pmatrix}$$
Finding a generalized eigenvector is where I go wrong, I think.
I found: $$\begin{pmatrix}
-1 \\
0 \\
\end{pmatrix}$$
Now we can make $P = [v_1\, v_2]$ to find $J$, where $J = (P^{-1})AP$
After computing this the matrix I get for $J$ is not a Jordan form.
The matrix I got is:
$$\begin{pmatrix}
1-i & 1 \\
0 & 1+i \\
\end{pmatrix}$$
Anyone who knows what I did wrong?
Edit: Changed the original question to: "Determine the Jordan form and P matrix" instead of "Determine the Jordan form".

A: Since we have 2 distinct eigenvalues the matrix can be diagonalized and therefore the Jordan form is the diagonal matrix
$$\begin{pmatrix}
1-i & 0 \\
0 & 1+i \\
\end{pmatrix}$$


text:
Q: Connect to Debian VPS box via VPN Issue I am kinda stuck with an usual issue (or is it usual?). Let me explain.
I have two Debian VPS boxes. The first one is a pure VPN (OpenVpn) and the second one is my regular server with emails, websites and all. I also have a machine "at home" that can easily connect to these two boxes.
Now I need to connect like this:
my machine at home to -> my VPS that runs VPN only and then to -> my regular VPS server.
I thought it would be easy, but I was mistaken. I allowed my VPN's static IP address through my firewall (iptables) on my regular VPS server but I didn't work. I flushed all the iptables just to see if it helps but.. it still doesn't work (it always times out, I use ssh keys to connect). I can only connect to either my VPS that runs my VPN only or to my regular VPS, but my route of home->VPN->regular VPS just doesn't work. How can I possibly do it? These two VPS boxes are working fine: My VPS with VPN is working perfectly well and my regular VPS is also working perfectly well. I would be really grateful for any pointers / suggestions / advices at all. Many thanks in advance!

A: Let me answer my own question. Not sure why it works this way but it works. I simply allowed "password logins" and it all started working perfectly well. It connects using ssh keys anyway without any password prompts but.. nonetheless allowing password logins in ssh solved the issue (I had it turned off earlier). Hope it will help someone too.


text:
Q: Problem downloading files from shared folder I created a shared folder to download a server dependency file. I setup the shared file, tested it with ls /media to see that it was appearing on the vm, but when I went to download the file I had placed in the folder, nothing happened.

How do I access and download these files on the vm? I am using ubuntu 20.04 with putty.


text:
Q: Kitchen sink app for iOS?
Possible Duplicate:
Is there an iOS "kitchen sink" app with source code available anywhere?

I am looking for an iOS equivalent to the Titanium app named Kitchen Sink. Does anyone know if it exists? I saw Kitchen Sink and believe it is a terrific learning tool. An equivalent app on iOS would be invaluable......
I have searched this site and found suggestions, but they are all merely HTML pages. I am looking for a real, interactive app which allows the user the interact with each type of control.

A: Try ios Boilerplate
According to their site, it is:

*

*a base template for iOS apps

*it is intended to provide a base of code to start

*It is not intended to be a framework

*It is intended to be modified and extended by the developer to fit their needs

*It includes solid third-party libraries if needed to not reinvent the wheel."

Also: "iOS Boilerplate includes helper classes and examples about the following topics:"

*

*HTTP requests and an image cache (both in-memory and disk-based)

*UITableViews and UITableViewCells: fast scrolling, async images, pull-down-to-refresh, swipeable cells

*A built-in browser so your users don't leave your application when they browse to a certain URL

*Maps and locations: directions between two points, autocomplete a location, etc."

Is that what you are looking for?


text:
Q: Installing pip on windows? I tried to install pip on windows i.e
C:\Python34>python get-pip.py

also i set the path for python but it gives an message i.e.
python: can't open file 'get-pip.py': [Errno 2] No such file or directory

so what can i do for installing pip?please anyone help me?

A: You can install pip installer from windows command prompt
first download the get-pip.py from the internet from this site https://bootstrap.pypa.io/get-pip.py then run the file from command prompt
python get-pip.py

This will download and install the pip installer into your machine
to use it use the following command
pip install <package_name>

or if that doesn't work use;
python -m pip install <package_name>

or you can use this;
py -3 -m pip install <package_name>

To update pip use the following command;
python -m pip install -U pip

A: Python comes with pip if you you select the option. If you did, just upgrade it.
If you are unsure of the instruction go to this link which is the official pip website. Make sure that your environment variables has the scripts folder and python folder in PATH.