text:
Q: Magento 2.x: add column to sales order history page (FO) What are methods for add a column to sales_order_history page? without edite  view/frontend/templates/order/history.phtml
can help me please ?

A: You don't need to touch view/frontend/templates/order/history.phtml template file to add aditional column into customer sales order history page.
copy layout view/frontend/layout/sales_order_history.xml to your theme and add addtional column header to sales.order.history.extra.column.header block and render column data using sales.order.history.extra.container block.
The solution:
<?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

        <referenceBlock name="sales.order.history.extra.column.header">
            <block class="Magento\Framework\View\Element\Template" name="your.additional.column.header" template="Namespace_Module::columnheader.phtml"/>
        </referenceBlock>

        <referenceBlock name="sales.order.history.extra.container">
            <block class="Magento\Framework\View\Element\Template" name="your.additional.column.data" template="Namespace_Module::columndata.phtml"/>
        </referenceBlock>

</page>

A: In Magento 2.3.3
app/code/Vendor/Module/view/frontend/layout/sales_order_history.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

    <referenceBlock name="sales.order.history.extra.column.header">
        <block name="vendor.additional.column.header" template="Vendor_Module::history-header.phtml"/>
    </referenceBlock>

    <referenceBlock name="sales.order.history.extra.container">
        <block name="vendor.additional.column.data" template="Vendor_Module::history.phtml"/>
    </referenceBlock>

app/code/Vendor/Module/view/frontend/templates/history.phtml
<?php
    /* @var $block \Magento\Sales\Block\Order\History\Container */
?>

 <td data-th="<?= $block->escapeHtml(__('Created At')) ?>" class="col created-
 date">
  <?= $block->escapeHtml($block->getOrder()->getCreatedAt()) ?>

app/code/Vendor/Module/view/frontend/templates/history-header.phtml
<?php
  /* @var $block \Magento\Sales\Block\Order\History\Container */
 ?>
    <th data-th="<?= $block->escapeHtml(__('Created At')) ?>" class="col created-date">
    <?= $block->escapeHtml("Created At") ?>

A:
create the 'sales_order_history.xml' into your theme (view\frontend\layout\sales_order_history.xml) or your module (Magento_Sales\layout\sales_order_history.xml)

add the following content in sales_order_history.xml file
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

    <referenceBlock name="sales.order.history.extra.container" template="Vendor_Module::OrderHistoryColumn.phtml"/>

create the OrderHistoryColumn.phtml file and add content. I have
  added the created column into the History

<?php
/* @var $block \Magento\Sales\Block\Order\History\Container */
?>

<td data-th="<?= $block->escapeHtml(__('Created At')) ?>" class="col date">
    <?= $block->escapeHtml($block->getOrder()->getCreatedAt()) ?>

run the following commands

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
php bin/magento indexer:reindex
php bin/magento cache:clean

Check the output.

Thanks

A: Please note that you need to edit sales order history template, without edit its not possible. The sales order history grid container being managed via

vendor/magento/module-sales/view/frontend/templates/order/history.phtml

You can override this template in your custom theme at:

app/design/frontend/Your/theme/Magento_Sales/templates/order/history.phtml

add the required column and get value for the same.
Update
Yes, we can use $block->getChildHtml('extra.column.header'); to add new column to sales order history. If you look into that template, there is code
<?php echo $block->getChildHtml('extra.column.header');?>

to add additional columns and value being populated by
<?php if ($extra): ?>
       <?php $extra->setOrder($_order); ?>
       <?php /* @noEscape */ echo $extra->getChildHtml() ?>
<?php endif; ?>

Also it is referenced in sales_order_history.xml
<referenceContainer name="content">
            <block class="Magento\Sales\Block\Order\History" name="sales.order.history" cacheable="false">
                <container name="sales.order.history.info" as="info" label="Order History Info"/>
                <container name="sales.order.history.extra.column.header" as="extra.column.header" label="Order History Extra Column Header"/>
                <block class="Magento\Sales\Block\Order\History\Container"
                       name="sales.order.history.extra.container" as="extra.container">
                    <block class="Magento\Framework\View\Element\Template"
                        name="sales.order.history.extra.container.data" as="extra.container.data"/>
                </block>
            </block>
            <block class="Magento\Customer\Block\Account\Dashboard" name="customer.account.link.back" template="account/link/back.phtml" cacheable="false"/>
        </referenceContainer>

However, I am not sure where we need to add extra columns. I checked store configuration but can't see the option to add new columns to order history. I am also curious to know more about it, will update you if get more idea on it. Please update me too in case you get anything on it :)

A: You don't need to touch view/frontend/templates/order/history.phtml template file to add aditional column into customer sales order history page.
copy layout view/frontend/layout/sales_order_history.xml to your theme and add addtional column header to sales.order.history.extra.column.header block and render column data using sales.order.history.extra.container block.
You have all set now.


text:
Q: Не понимаю как создать двумерный массив в Python, у меня получается одномерный Принялся делать задачу по транспонированию. На бумаге все выглядит очень хорошо. Мы заменяем элементы матрицы с индексами a[i][j] на a[j][i] и задача решена. Но при реализации возникла проблема. Не понимаю как создать двумерный массив (матрицу), у меня получается одномерный. Вот код.
array1=[[1,2,3],[4,5,6],[7,8,9],[10,11,12]]
array2=[]

for i in range(len(array1)):
    for j in range(len(array1[i])):
        array2.append(array1[j][i])
        #print(array2)

print(array2)

A: С использованием модуля Numpy:
import numpy as np    # pip install numpy

In [121]: np.array(array1).T
Out[121]:
array([[ 1,  4,  7, 10],
       [ 2,  5,  8, 11],
       [ 3,  6,  9, 12]])

в виде списка списков:
In [122]: np.array(array1).T.tolist()
Out[122]: [[1, 4, 7, 10], [2, 5, 8, 11], [3, 6, 9, 12]]

A: a = [[1, 2, 3], [4, 5, 6]]
b = [[x[i] for x in a] for i in range(len(a[0]))]
print (b)

A: Ошибка в коде. Вот правильный вариант:
array1=[[1,2,3],[4,5,6],[7,8,9],[10,11,12]]
array2=[]
for i in range(0, len(array1[0])):
    array2.append([])
    for j in range(0, len(array1)):
        array2[i].append(array1[j][i])
print(array2)

Так как размерности всех векторов в матрице равны, то не имеет разницы, размерность какого вектора(длину списка) брать за образец
Смысл кода объяснять надо?

A: Вопрос, вероятно, вовсе не по транспонированию, а по языку.
Классических массивов в Python нет. Однако в стандартную библиотеку входит модуль array. А для более-менее серьезных вычислений есть numpy

redpajama_set_name: RedPajamaStackExchange


text:
Q: Horizontally align CSS arrow and text I've got some text and a CSS arrow inside a button, but I can't horizontally align them - the arrow is below the text:

I've tried adding vertical-align: middle; to .down-arrow but it doesn't horizontally align them. I've also tried adding display: flex; align-items: center; to the button but to no avail.

.down-arrow {
    transform: rotate(45deg);
    border: solid black;
    border-width: 0 1px 1px 0;
    display: inline-block;
    padding: 3px;
    margin-left: 7px;
}
<button>Text</button>

JsFiddle: https://jsfiddle.net/1L3odx6s/

A: There are multiple ways you can achieve this easily.
One way to do this use vertical-align
Using vertical-align

.down-arrow {
  transform: rotate(45deg);
  border: solid black;
  border-width: 0 1px 1px 0;
  display: inline-block;
  padding: 3px;
  margin-left: 7px;
  vertical-align: 2px;
}
<button>Text</button>

Flex technique
The other way is use flex on your button and use margin-top: 3px
Using flex and margin-top
You can read more about using flex boxes and easy recemended techniques here

.down-arrow {
  transform: rotate(45deg);
  border: solid black;
  border-width: 0 1px 1px 0;
  display: inline-block;
  padding: 3px;
  margin-left: 7px;
  margin-top: 2px;
}

button {
 display: flex;
}
<button>Text</button>

Using align-items

.down-arrow {
  transform: rotate(45deg);
  border: solid black;
  border-width: 0 1px 1px 0;
  display: inline-block;
  padding: 3px;
  margin-left: 7px;
}

button {
  display: flex;
  align-items: center;
}
<button>Text</button>

A: Do the transformation differently and you can use vertical-align:middle

.down-arrow {
  transform: translateY(25%) rotate(-45deg);
  transform-origin: top left;
  border: solid black;
  border-width: 0 0 1px 1px;
  display: inline-block;
  vertical-align: middle;
  padding: 3px;
  margin-left: 5px;
  margin-right:2px;
}
<button>Text</button>

<button style="font-size:30px">Text</button>
<button style="font-size:50px">Text</button>
<button style="font-size:50px">Text</button>
<button style="font-size:50px">Text</button>

Or a custom value for vertical-align

.down-arrow {
  transform: rotate(45deg);
  border: solid black;
  border-width: 0 1px 1px 0;
  display: inline-block;
  padding: 3px;
  margin-left: 7px;
  vertical-align: 0.2em;
}
<button>Text</button>

<button style="font-size:30px">Text</button>
<button style="font-size:50px">Text</button>
<button style="font-size:50px">Text</button>
<button style="font-size:50px">Text</button>


text:
Q: Looks like app doesn't have permission to access location in react native I am making an app which access user location using gps.That is why i added following lines to the AndroidManifest.xml
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

And below is my function which fetches location of user
componentWillMount(){
    navigator.geolocation.getCurrentPosition(
      position => {

        this.setState({
          latitude: position.coords.latitude,
          longitude: position.coords.longitude,

        });
      },
      error => Alert.alert(error.message),
      { enableHighAccuracy: true, timeout: 20000, maximumAge: 1000 }
    );

  }

But this produces error that app doesn't have permission to access location and i need to declare
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

in manifest file.I tried many ways and found a solution i.e to ask for run time permission. So I also added following lines in my code
try {
      const granted =  PermissionsAndroid.request(
        PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
        {
          'title': 'Location Permission',
          'message': 'This app needs access to your location',
        }
      )
      if (granted === PermissionsAndroid.RESULTS.GRANTED) {
        console.log("You can use the location")
      } else {
        console.log("Location permission denied")
      }
    } catch (err) {
      console.warn(err)
}

But problem doesn't go away.What should i do ?

A: if you are not using Promise ,you should use async-await.  in your code its missing. and after getting permission you can get location

async  requestLocationPermission(){
  try {
    const granted = await PermissionsAndroid.request(
      PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
      {
        'title': 'Example App',
        'message': 'Example App access to your location '
      }
    )
    if (granted === PermissionsAndroid.RESULTS.GRANTED) {
      console.log("You can use the location")
      alert("You can use the location");
    } else {
      console.log("location permission denied")
      alert("Location permission denied");
    }
  } catch (err) {
    console.warn(err)
  }
}

 async componentDidMount() {
   await requestLocationPermission()
  }

A: The accepted answer worked for me, but since I was using hooks I had to define the requestLocationPermission method differently.
Create a state for locationPermissionGranted which will change after access is granted
const [locationPermissionGranted, setLocationPermissionGranted] = useState(false);

Set the useEffect method like this:
useEffect(() => {
  async function requestLocationPermission() {
    try {
      const granted = await PermissionsAndroid.request(
        PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
        {
          'title': 'Example App',
          'message': 'Example App access to your location '
        }
      )
      if (granted === PermissionsAndroid.RESULTS.GRANTED) {
        console.log("You can use the location")
        alert("You can use the location");

        // Change the value of the locationPermissionGranted to true after
        // the user grants location access
        setLocationPermissionGranted(true);
      } else {
        console.log("location permission denied");
        alert("Location permission denied");
      }
    } catch (err) {
      console.warn(err);
    }
  }

  // Don't forget to call the method here
  requestLocationPermission();
})

Then later in your code, Show the map/location based on the state value, something like this:
{ locationPermissionGranted ? <TestMapComponent /> : <AccessNotGrantedComponent /> }

A: When the screen loads asks for the user for location permission (for API > 23 as per the documentation). For more refer this link https://facebook.github.io/react-native/docs/permissionsandroid . If the user allows the location permission it shows the position otherwise show default screen.
import React,{useEffect,useState} from 'react';
import {Text,View,StyleSheet,Alert} from 'react-native';
import MapView from 'react-native-maps';
import {PermissionsAndroid} from 'react-native';

const SearchScreen = () => {
    const [latitude,setLatitude] = useState('');
    const [longitude,setLongitude] = useState('');
    const [granted,setGranted] = useState('');

    useEffect(async() =>{
        const granted = await PermissionsAndroid.request(
            PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION,
            {
                title: 'Location Permission',
                message:'Get your location to post request',
                buttonNeutral: 'Ask Me Later',
                buttonNegative: 'Cancel',
                buttonPositive: 'OK',
            },
        );
        if (granted === PermissionsAndroid.RESULTS.GRANTED) {
            navigator.geolocation.getCurrentPosition(position => {
                setLatitude(position.coords.latitude);
                setLongitude(position.coords.longitude);
            });
            setGranted(true);
        }
    },[]);

    const onUserPinDragEnd = (e) => {
        Alert.alert(JSON.stringify(e))
    };

    if(granted) {
        return (
            <View style={styles.container}>
                <MapView
                    style={styles.map}
                    region={{
                        latitude: Number(latitude),
                        longitude: Number(longitude),
                        latitudeDelta: 0.015,
                        longitudeDelta: 0.0121
                    }}
                >
                    <MapView.Marker
                        key={'i29'}
                        draggable
                        onDragEnd={() => onUserPinDragEnd()}
                        title={'You are here'}
                        coordinate={{
                            latitude: Number(latitude),
                            longitude: Number(longitude),
                        }}
                    />
                </MapView>
            </View>
        )
    }else{
        return(
            <View>
                <Text>Permission not granted for maps</Text>
            </View>
        )
    }
};

const styles = StyleSheet.create({
    container: {
        ...StyleSheet.absoluteFillObject,
        height: 400,
        width: 400,
        justifyContent: 'flex-end',
        alignItems: 'center',
    },
    map: {
        ...StyleSheet.absoluteFillObject,
    },
});

export default SearchScreen;


text:
Q: Select Max and Min datetime for distinct user I have a record as below
ID(int)      DATA_ORA(timestamp)     BADGE  LETTORE
   1         2017-04-01 09:30:00       1       1
   2         2017-04-01 12:30:00       1       2
   3         2017-04-01 13:30:00       1       1
   4         2017-04-01 18:30:00       1       2
   5         2017-04-01 09:30:00       2       1
   6         2017-04-01 18:30:00       2       2
   7         2017-04-02 09:30:00       1       1
   8         2017-04-02 18:30:00       1       2
   9         2017-04-03 09:30:00       3       1
   10        2017-04-03 12:30:00       3       2
   11        2017-04-03 13:30:00       3       1
   12        2017-04-03 18:30:00       3       2

I want to get the first access time and the last daily logout time (for each day) for each individual user (badge).
How I can do this?
The record I wish to as below
ID(int)      DATA_ORA(timestamp)     BADGE  LETTORE
   1         2017-04-01 09:30:00       1       1
   4         2017-04-01 18:30:00       1       2
   5         2017-04-01 09:30:00       2       1
   6         2017-04-01 18:30:00       2       2
   7         2017-04-02 09:30:00       1       1
   8         2017-04-02 18:30:00       1       2
   9         2017-04-03 09:30:00       3       1
   12        2017-04-03 18:30:00       3       2

Is it possible to do that? Thanks.
NOTE: ID are auto-incremented and LETTORE 1 is entry and LETTORE 2 is exit.

A: You could use a join  with subquery for badge 1 and badge 2
select t1.badge, min_dat, nax_date
from  (
  select  badge, min_(data_ora) min_data
  from my_table
  where lettore  = 1
  group by badge
) t1
INNER JOIN  (
 select  badge, max_(data_ora) max_data
  from my_table
  where lettore  = 2
  group by badge
) t2  ON t1.badge = t2.badge

A: try below using correlated subquery and union all
select * from tablename a
where DATA_ORA in (select min(DATA_ORA) from tablename b where a.badge=b.badge)
union
select * from tablename a
where DATA_ORA in (select max(DATA_ORA) from tablename b where a.badge=b.badge)

A: You can do it grouping by date, badge and lettore like:
SELECT date(DATA_ORA),badge,lettore, case when lettore=1 then min(time(data_ora))
                                          when lettore=2 then max(time(data_ora))
                                          else 0
                                     end
FROM table1
group by date(DATA_ORA),badge,lettore

A: I like @fa06 answer, but he misses, that you want the data daily.
so try this:
select * from t1 a
where DATA_ORA in (select min(DATA_ORA) from t1 b where a.badge=b.badge GROUP BY DATE_FORMAT(DATA_ORA, '%Y%m%d'))
union
select * from t1 a
where DATA_ORA in (select max(DATA_ORA) from t1 b where a.badge=b.badge GROUP BY DATE_FORMAT(DATA_ORA, '%Y%m%d'));

A: Here is the executed version of your table and query that gives output in the order you needed, on DB-fiddle.
Try this query:
select * from EntryExitLogs where id in
    (select id from EntryExitLogs where (badge,data_ora)= any
    (select badge,min(data_ora)from EntryExitLogs group by date(data_ora),badge))
    union
    (select * from EntryExitLogs where id in
    (select id from EntryExitLogs where (badge,data_ora)= any
    (select badge,max(data_ora)from EntryExitLogs group by date(data_ora),badge)))
    order by id;

I think its better to make use of the ID column for selecting the rows, because the timestamp column contains duplicates.


text:
Q: how come it's ok for customView extends constraintLayout but inflates linear layout say i have a custom android view:
public class myView extends ConstraintLayout {

and in its ctor I call:
LayoutInflater.from(context).inflate(R.layout.header, this, true);

I see inflate returns a View, but the calling code doesn't use it at all. so how does it takes an affect?
In addition what would happen if the customView inherits from constraintLayout but the inflated xml is linear layout
why would it work?


text:
Q: Google OAuth 2.0 for WinForms C# How would one send an email from google to other users when they register.
Website to get all this info: https://console.cloud.google.com/apis/
What I currently have:

*

*Client ID

*Client Secret + json file

*API Key

*using Google.Apis.Auth.OAuth2;
Is this all I need to create the OAuth 2.0? And how would I?
Every tutorial states some use for p12 key which I do not have nor can find.


text:
Q: On the definition of neighborhood and Hausdorff spaces Until now, I've seen two definitions for a neighborhood on a topological space X:

*

*Given an open set U and a point x in X,  U is a neighborhood of x if $x\in U $.

*Given an open set U and a point x in X, $A\subseteq X$ is a neighborhood of x if $x\in U\subseteq A$.

This ambiguity led me to some doubts envolving the separation axioms. We say that a space follows the $T_2$ axiom- being called a Hausdorff space- if, for any two points in this space, there is a neighborhood of one of them that doens't contain the other.
My question is: which definition is used here to describe a Hausdorff space? Is it the second one? If yes, does it imply that all Kolmogorov spaces are Hausdorff?

A: Just take $A=U$ in the second definition and that gives the equivalence between the two statements.
Note that we also have the following inclusions:
$T_4 -\text{spaces} \subset T_3 -\text{spaces}\subset T_2 -\text{spaces} = \text{Hausdorff} \subset T_1 -\text{spaces}\subset T_0 -\text{spaces} = \text{Kolmogorov spaces}$.
However The excluded point topology on any set with at least two elements is $T_0$ but not $T_1$ and hence cannot be $T_2$. The only closed point is the excluded point.

A: N is a nhood of x when x in $N^o$, the interior of N.
There is little need for not open neighborhoods in topology today. In the developement of topology it seems nhoods were used to get a sense of the limit concepts they were generalizing.


text:
Q: Roman numerals in sans serif fonts Inspired by a question, that unfortunately has been deleted by the OP after getting some hints from me in a comment.
Lacking serifs the Roman numerals in sans serif fonts look sometimes a bit strange. Do you have some ideas for a workaround?

A: I would suggest the package romanbar. This produces Roman numerals with an over- and an underline, and without serifs.
The basic command for this is \Romanbar{⟨arabic number⟩}, this works also with counters inside! You can instead include a Roman numeral, as well. For more abilities see example file of package documentation.
An example (note, in KOMA-Script all titles are by default printed in sans serif fonts):
\documentclass[numbers=endperiod]{scrartcl}
\usepackage[T1]{fontenc}

\usepackage{romanbar}

\begin{document}

\section{section I vs. \Romanbar{\thesection}}
MDCLXVI vs. \Romanbar{1666}.

\stepcounter{section}
\section{section III vs. \Romanbar{\thesection}}
MDCLXVI vs. \Romanbar{MDCLXVI}.

\setcounter{section}{1665}
\section{section MDCLXVI vs. \Romanbar{\thesection}}
2014 vs. \Romanbar{2014} vs. \Romanbar{\relax 2014}.

\end{document}

This package is BTW based on egreg's answer to a question here on TeX.SE: Roman numerals with over- and underline (the OP Stephen is also the package author).


text:
Q: Detect if cPanel / WHM is currently running, in PHP? I have full automatic backups running fine in WHM, and I'm now implementing a script to automatically download content to a database, however they're not playing nicely together.
There's several dozen feeds I'm trying to aggregate, many of them containing several thousand items, so ideally I'd like this a process running round the clock refreshing them all, which alone isn't a problem.
But, due to the feeds and backups needing a lot of disk usage, the load and I/O wait time is getting ridiculous, so I'm hoping there's a way I can detect (preferably in PHP) if a backup is currently running pause the feed processing while that's happening.
I could just play around with backup/feed times so they don't coincide, but the backups seem to take anything from 2 - 10 hours, so that's really not ideal.
Can I detect if a backup is currently being run by WHM? Thanks.

A: If you already know the name of the backup process shown when you type top using SSH, then I think you can use ps aux | grep your_process_name with BASH using SSH.
You may also call this commands using PHP , more info about this : Run Bash Command from PHP


text:
Q: Should I "Pull Up" Refactor I have some very small classes that I feel should be "pulled up" but the methods are so small I'm not sure. For example, the only thing that's meaningfully different is the body of the buildFromJSON: selector.
I acknowledge that this is similar to:
Pull-up refactoring, Objective-C
but I feel my question is specific to refactoring very small classes/methods.
Also, not sure it relates to my particular code example, but I'm wondering if a child class says it conforms to a protocol, whether it's enough that it's parent actually supply the implementation of required selector(s)?
@implementation AsyncFoo

-(void)dealloc {
    [clientDelegate release];
    [super dealloc];
}

- (id)initWithDelegate: (id <ServiceClientProtocol>) delegate {
    if((self = [super init])) {
        clientDelegate = [delegate retain];
    }
    return self;
}

- (void)buildFromJSON:(NSString*)jsonResponseString {
    [clientDelegate serviceComplete:[RestAdapter buildFooArray: jsonResponseString]];
}

@end

@implementation AsyncBar

-(void)dealloc {
    [clientDelegate release];
    [super dealloc];
}

- (id)initWithDelegate: (id <ServiceClientProtocol>) delegate {
    if((self = [super init])) {
        clientDelegate = [delegate retain];
    }
    return self;
}

- (void)buildFromJSON:(NSString*)jsonResponseString {
    [clientDelegate serviceComplete:[RestAdapter buildBarArray:jsonResponseString]];
}

@end

Answers including code example would be great.
EDIT: Post accepted answer I'd like to add that since I was able to subclass, the derived classes did not need to declare that they conformed to protocol:
@interface Async : NSObject <ModelBuilderProtocol> {
    id <ServiceClientProtocol> clientDelegate;
}
- (void)buildFromJSON:(NSString*)jsonResponseString;
@end

@interface AsyncArtistById : Async
@end

A: You don't normally retain your delegates as this can cause a retain cycle.
Knowing what I know from looking at your example I would probably implement like this:
The super class
// Async.h
@interface Async : NSObject

@property (nonatomic, assign) id<ServiceClientProtocol> delegate;

- (void)buildFromJSON:(NSString *)jsonResponseString;

@end

// Async.m
@implementation Async

@synthesize delegate = _delegate;

- (id)initWithDelegate:(id<ServiceClientProtocol>)delegate
{
    self = [super init];
    if(self) {
        _delegate = delegate;
    }
    return self;
}

- (void)buildFromJSON:(NSString *)jsonResponseString
{
    // This will ensure that we over ride this method in a sub class
    [NSException raise:NSInternalInconsistencyException
        format:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)];
}

@end

Concrete subclass AsyncFoo
// AsyncFoo.h
@interface AsyncFoo : Async
@end

// AsyncFoo.m
@implementation AsyncFoo

- (void)buildFromJSON:(NSString *)jsonResponseString
{
    [self.delegate serviceComplete:[RestAdapter buildFooArray: jsonResponseString]];
}

@end

Concrete subclass AsyncBar
// AsyncBar.h
@interface AsyncBar : Async
@end

// AsyncBar.m
@implementation AsyncBar

- (void)buildFromJSON:(NSString *)jsonResponseString {
    [self.delegate serviceComplete:[RestAdapter buildBarArray:jsonResponseString]];
}

@end


text:
Q: Show text over a image when hovering over it So I'm working on a project where I want a title to show up upon having the mouse over an image. I have searched stackoverflow for similar cases, tried what was suggested but have not gotten it to work yet.
For example on a pic, I want a text saying "Nutrition" showing up when I put the cursor over it. What would be the easiest way to do this?
I'm new to web developing, not much knowledge when it comes to Javascript/JQuery

A: No JavaScript needed; just use the title attribute:

Here is a fiddle.
The title attribute also works on any HTML element, so if you want to use it on an image's container to expand the hoverable area, you can.

A: http://jsfiddle.net/DerekL/eXTYX/

TEXT

span{
    display: none;
}
img{
    width: 500px;
}
img:hover ~ span{
    display: inline;
}

This is one way of doing it. No JavaScript is needed ;)
You can even add animation and transitions to it: http://jsfiddle.net/DerekL/eXTYX/1/

As others have also mentioned, you can also use title to show a system tooltip. This is very easy to implement, however, you will have no control over how it appears:

A: When setting your image in html, you can set a title attribute. like the following

this is also beneficial for SEO!

A: No need for java script just use the title see more here

Hope this helps


text:
Q: Exporting data from SQL Developer only pulls half of the query output - is there a preference for increasing this? I'm on version 19.2.1.247 of SQL Developer and ran a script that returned 80,000 records. I exported to Excel (Right click data grid, select 'Export', select Excel 2003+ for the format) and the Excel sheet contained only 40,000 records. I've used SQL Developer for many years but this is the first I've noticed this issue.
I repeated a couple of times with the same query, trying different export formats, and no luck. I tried a different query and the same thing happened - the query itself returned 60,000 records but after exporting to Excel, the file contained only 30,000 records.
I will add that I looked for something under the Tools -> Preferences menu but didn't see anything. The closest was under Tools-> Preferences -> Export -> Worksheet. There are two options there - 'Max rows to print in a script' and 'Max lines in script output.' Both of those had values and I deleted those values so there are no limits. Still, when I exported my data, the Excel sheet contained only half of the records that were retrieved in the output in SQL Developer.
Has anybody run into this and/or is there a preference that can be set to increase the number of records exported to Excel?
Thanks in advance,
Joe

A: Remove the limit of rows fetched or refresh data before you export


text:
Q: Why can't I access a namespace added through NuGet? Because I want to use matrices in my program, I added the Math.NET library through NuGet in Visual Studio 2015. However, although I can see the library files in the Project References folder, VS doesn't seem to recognize any of the references to it. Autocomplete won't suggest MathNet when writing the using-command, and it won't recognize any of the classes from that namespace either, of course. Are there any more steps I'm missing?

A: While I still can't say why autocomplete didn't suggest the namespace (even though after attempting to build it it did end up showing in the suggestions), I can confirm that the source of my problem was that matrices and vectors need to be imported with MathNet.Numerics.LinearAlgebra, not MathNet.Numerics.

A:
Why can't I access a namespace added through NuGet?

Whether there is a error when you add the using command:using MathNet.Numerics;?
Not sure why autocomplete won't suggest MathNet when you write the using-command, it works fine on my machine, I will write detail steps here so that you can check the difference, then find some help.
Detail Steps:

*

*Create a new blank c# class library project.

*Add the package MathNet.Numerics to the project by NuGet.

*Open a .cs file, add using MathNet.Numerics and instantiate a class "Permutation" (Most classes are static class).


text:
Q: BS4 is not defined I'm trying to create the following variable in my Python shell app:
soup = bs4.BeautifulSoup(offSpring.text, 'lxml')

However, it keeps returning an error saying:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'bs4' is not defined

I have already installed bs using the "pip install bs" command.
Any ideas as to why this isn't working correctly?

A: Try this:
from bs4 import BeautifulSoup
soup = BeautifulSoup(offSpring.text, 'lxml')


text:
Q: blog subsite giving 404 on accessing in public facing I need help and it would be great if anyone suggest/help.
The Problem is:
We added a blog sub-site in a SharePoint 2010 publishing site. now the site is browseable in the authoring version. But it is showing 404 on the public facing, the URL is
http://www.nextdocs.com/en-us/blogs/default.aspx
I am not seeing the publishing tab in authoring.
Do you have any idea how to make the blog site available in the public facing. Well appreciated for help.
Regards,
Zohaib

A: Ensure that you have an Alternate Access Mapping set up for www.nextdocs.com and IIS has a binding for the host header.
I've seen similar behaviour when a web has been created without the host header and IIS has been used to bind the address to the site but SharePoint has no knowledge of the host header.


text:
Q: Arm Cortex-M Programming Personally, I have experience on 8-bit and 16-bit architectures (such as Atmel or Microchip) and now I would like to continue with 32-bit ARM Cortex-M family. I wanted to learn the internals of Cortex-M architecture and how to flash/program it.
According to my fast and superficial searches, it seems there are CMSIS libraries provided by ARM's itself to remove manufacture dependency. However, I also saw some extra hardware abstraction libraries in some manufacturer's website.
Trying to figure out from where should I start to work but it I'm a bit confused.
I actually do not want to be a manufacturer dependent when I'm developing software for Cortex-M family since the internals of the chip would be fairly similar for each manufacturer (so is it?). I believe I can read and find the differences of an MCU which is using Cortex-M3 core by looking the datasheet provided by manufacturer and can write code with CMSIS libraries (so can I?)
So, my questions are;

*

*Is it possible to develop a firmware for Cortex-M family by just using CMSIS libraries (and using manufacturer's datasheet to figure out chip's internals)? If I want to change manufacturer (without changing the Cortex-M core), will it be a headache to adapt the code for a the chip by using CMSIS libraries?

*For changing the manufacturer and deciding for a new chip, will it be another headache? Imagine you're all adopted your both hardware and software work environment for Microchip family and you're migrating your applications to Atmel family (learning new libraries, code syntaxes, IDEs, programmers, debuggers etc..). Sometimes you have to change even the OS that you're using just to use some suitable debugger or programmer interfaces. Will it be same?

*If it is a headache to change the manufacturer, what are the tradeoffs of selecting manufacturer at the beginning? (Actually, how could it differ in 2 different chips from 2 different manufacturers while the core is still Cortex-M3?)

*Do you have any suggestion for where to start? (Readings, evaluation kits, debuggers, programmers etc. Everything that is needed to bring up a Cortex-M family.)

Thanks in advance.

A: "I wanted to learn the internals of Cortex-M architecture"
a mcu has two parts in it, the core (ARM) and the peripherals (vendor specific). To use a chip, you don't need to know the architectures of the core, but you need to have intimate knowledge of the peripherals.
if you want to know the architectures, Yiu's books on the whole CMx family are a great starting point. Be warned: it provide next to nothing to a practitioner.
otherwise, start with the datasheets, tool chain manuals and lots of coding.
As to vendor libraries, I use them often but only through a middle layer of mine so if I want to, I can easily swap out the vendor library in whole or in pieces with no change to my own user code. essentially, my user code has no knowledge about how a certain function is implemented.

A: About your questions 1-3, some sort of headache is unavoidable... but it is much easier to change between two manufacturers of chips which are based on ARM core.
Please consider some open source libraries that address exactly your concerns, like libopencm3 --
https://github.com/libopencm3/libopencm3
it already has full support for STM32 and work in progress for many other chips (NXP, Freescale, ...).
For question 4, you can order starter kits that are quite inexpensive. Many of them are programmed through USB, and you can use some nice open source software packages, like GCC, GDB (cross compiling for ARM) and OpenOCD.


text:
Q: GitLab: Docker in Docker container can't connect to Service container My GitLab CI/CD has a service image named clair-db, but my main job's image (docker:19.03.6 can't seem to communicate with it.  I have reviewed the GitLab Service's documentation, which claims you can connect your build's main image to a service by simply using the service's name as the hostname and its exposed port (for example, a service named mysql:latest with an exposed port 1234 would allow you to connect to it as mysql:1234 -- meaning ping mysql:1234 would work successfully).
Interestingly, I can ping the service i'm trying to communicate with (which is arminc-clair-db:5432) within the GitLab CI/CD build with the following command:
$ export LOCAL_MACHINE_IP_ADDRESS=arminc-clair-db
$ ping -c 4 $LOCAL_MACHINE_IP_ADDRESS:5432
PING arminc-clair-db:5432 (172.17.0.3): 56 data bytes
64 bytes from 172.17.0.3: seq=0 ttl=64 time=0.106 ms
64 bytes from 172.17.0.3: seq=1 ttl=64 time=0.075 ms
64 bytes from 172.17.0.3: seq=2 ttl=64 time=0.094 ms
64 bytes from 172.17.0.3: seq=3 ttl=64 time=0.074 ms
--- arminc-clair-db:5432 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.074/0.087/0.106 ms

But trying to communicate with arminc-clair-db:5432 fails in the following command:
$ docker run --interactive --rm --volume "$PWD":/tmp/app -e CI_PROJECT_DIR=/tmp/app -e CLAIR_DB_CONNECTION_STRING="postgresql://postgres:password@${LOCAL_MACHINE_IP_ADDRESS}:5432/postgres?sslmode=disable&statement_timeout=60000" -e CI_APPLICATION_REPOSITORY=[MASKED]/codigo-initiative -e CI_APPLICATION_TAG=latest registry.gitlab.com/gitlab-org/security-products/analyzers/klar

Status: Downloaded newer image for registry.gitlab.com/gitlab-org/security-products/analyzers/klar:latest
[INFO] [klar] [2020-07-12T17:50:54Z] ▶ GitLab klar analyzer v2.4.8
[WARN] [klar] [2020-07-12T17:50:54Z] ▶ Allowlist file with path '/tmp/app/clair-whitelist.yml' does not exist, skipping
[WARN] [klar] [2020-07-12T17:50:54Z] ▶ Allowlist file with path '/tmp/app/vulnerability-allowlist.yml' does not exist, skipping
[INFO] [klar] [2020-07-12T17:50:54Z] ▶ DOCKER_USER and DOCKER_PASSWORD environment variables have not been configured. Defaulting to DOCKER_USER=$CI_REGISTRY_USER and DOCKER_PASSWORD=$CI_REGISTRY_PASSWORD
[WARN] [klar] [2020-07-12T17:50:54Z] ▶ Vulnerabilities database not ready, waiting 2s before retrying. Retry 1 of 10
[WARN] [klar] [2020-07-12T17:50:56Z] ▶ Vulnerabilities database not ready, waiting 2s before retrying. Retry 2 of 10
[WARN] [klar] [2020-07-12T17:50:58Z] ▶ Vulnerabilities database not ready, waiting 2s before retrying. Retry 3 of 10
[WARN] [klar] [2020-07-12T17:51:00Z] ▶ Vulnerabilities database not ready, waiting 2s before retrying. Retry 4 of 10
[WARN] [klar] [2020-07-12T17:51:02Z] ▶ Vulnerabilities database not ready, waiting 2s before retrying. Retry 5 of 10
[WARN] [klar] [2020-07-12T17:51:04Z] ▶ Vulnerabilities database not ready, waiting 2s before retrying. Retry 6 of 10
[WARN] [klar] [2020-07-12T17:51:06Z] ▶ Vulnerabilities database not ready, waiting 2s before retrying. Retry 7 of 10
[WARN] [klar] [2020-07-12T17:51:08Z] ▶ Vulnerabilities database not ready, waiting 2s before retrying. Retry 8 of 10
[WARN] [klar] [2020-07-12T17:51:10Z] ▶ Vulnerabilities database not ready, waiting 2s before retrying. Retry 9 of 10
[WARN] [klar] [2020-07-12T17:51:13Z] ▶ Vulnerabilities database not ready, waiting 2s before retrying. Retry 10 of 10
[FATA] [klar] [2020-07-12T17:51:15Z] ▶ error while waiting for vulnerabilities database to start. Giving up after 10 retries.: dial tcp: lookup arminc-clair-db on 169.254.169.254:53: no such host
ERROR: Job failed: exit code 1

Below is my full .gitlab-ci.yml file:
stages:
  - scan

scanning:
  stage: scan
  image: docker:19.03.6
  services:
    - name: arminc/clair-db:latest
    - name: docker:19.03.6-dind
  before_script:
    - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
  script:
    - export LOCAL_MACHINE_IP_ADDRESS=arminc-clair-db
    - ping -c 4 $LOCAL_MACHINE_IP_ADDRESS:5432 #Pinging 'arminc-clair-db:5432' to prove that it IS accessible
    - docker run --interactive --rm --volume "$PWD":/tmp/app -e CI_PROJECT_DIR=/tmp/app -e CLAIR_DB_CONNECTION_STRING="postgresql://postgres:password@${LOCAL_MACHINE_IP_ADDRESS}:5432/postgres?sslmode=disable&statement_timeout=60000" -e CI_APPLICATION_REPOSITORY=vismarkjuarez1994/codigo-initiative -e CI_APPLICATION_TAG=latest registry.gitlab.com/gitlab-org/security-products/analyzers/klar

I've also referred to this similar question to no avail.


text:
Q: Maintaining Eclipse project include/lib paths in CVS Background:
Here at the office my group uses a common linux environment where we do our code development. Our code is kept in CVS. The latest releases of our various libraries are kept in a specific directory (ie /data/group_projects/lib). Our Makefiles/Ant builds all specify what libraries are needed. We use autoconf to create the makefile after checkout for most C/C++ projects. We've just got Eclipse (3.4) installed and are planning to incorporate it into our workflow.
Problem:
So, when I check out a project from CVS through the Eclipse interface and then I have to set up all of the library paths (and include paths for C/C++). For some of our projects, this could be a lot of work. Is there a good way to save these paths along with the code when I check it back into CVS?
Ideally, when the next person checks out the code in Eclipse, the paths (and anything else they might need) will automatically be set up and they will be able to compile straight away.
Efforts:
I know that the include/lib path info is kept in a .cproject or a .classpath file (C/C++ or Java respectively). I thought I could export this info through Export -> Preferences. The resulting epf file doesn't have any path data in it unfortunately. I tried directly adding the .cproject file to one of my projects (so I could then put it into CVS) but Eclipse really doesn't seem to want me to do that.
I am quite new to Eclipse (esp using CDT), but maybe the necessary path info can be pulled out of build.xml/Makefile automatically by Eclipse? There seems to be a bit of a disconnect in Eclipse between the buildfile/makefile and the jar/include files that the IDE uses for checking your code as you type it. Maybe I am missing something?? I'm planning to put some serious time into researching Eclipse over the next few days so hopefully the inner workings will become much more clear to me.
I've asked the guys here at the office but no one is much of an Eclipse guru. My searches haven't turned up much . . I did see a suggestion to add all external jars to Java -> Build Path -> User Libraries under Eclipse Preferences. For us, each user would have to set this up once but afterward all of our java libraries would be available to whatever project we decided to check out. Unfortunately, it doesn't seem as though I can do the same thing for CDT.
What would you suggest? Am I missing a setting or function of Eclipse? Or am I going about this the wrong way? Please let me know what you think. I'd really appreciate it. Thanks!

A: You simply need to share the .project, .cproject and .classpath files through CVS. You can do this from the cvs command line, or select then 'Team/add file to version control'.
You don't need to add these files to the project explicitly: they are inherently part of it.
Obviously, if you do this, you need to make sure they are location-independent.
See:
eclipse wiki
Safari books

A: I've done this in Eclipse, and it's not too hard. You have to check in the .project and .classpath files. There are one or two places where Eclipse doesn't correctly automatically check out the files when you want to edit them, so when you get a read-only error you have to go manually do it, but for the most part it works.
The paths need to be all relative.
If relative paths is a problem, you can also take advantage of workspace variables in Eclipse. The developer sets their workspace variables appropriately on their machine (e.g., OPENGL_INCLUDE_PATH ), and then in the builder you can set the environment to pass that path along.


text:
Q: Is this a bug? (recursive constructors in Java) I've been playing with recursive constructors in Java. The following class is accepted by the compiler two examples of recursive constructors in Java. It crashes with a StackOverflowError at runtime using java 1.7.0_25 and Eclipse Juno (Version: Juno Service Release 2 Build id: 20130225-0426).
  class MyList<X> {
    public X hd;
    public MyList<X> tl;

    public MyList(){
      this.hd = null;
      this.tl = new MyList<X>();
    }
  }

The error message makes sense, but I'm wondering if the compiler should catch it. A counterexample might be a list of integers with a constructor that takes an int as an argument and sets this.tl to null if the argument is less than zero. This seems reasonable to allow in the same way that recursive methods are allowed, but on the other hand I think constructors ought to terminate. Should a constructor be allowed to call itself?
So I'm asking a higher authority before submitting a Java bug report.
EDIT: I'm advocating for a simple check, like prohibiting a constructor from calling itself or whatever the Java developers did to address https://bugs.openjdk.java.net/browse/JDK-1229458. A wilder solution would be to check that the arguments to recursive constructor calls are decreasing with respect to some well-founded relation, but the point of the question is not "should Java determine whether all constructors terminate?" but rather "should Java use a stronger heuristic when compiling constructors?".

A: I wouldn't see any reason why a constructor should more need to terminate than any other kind of function. But, as with any other kind of function, the compiler cannot infer in the general case whether such function ever terminates (halting problem).
Now whether there's generally much need for a recursive constructor is debatable, but it certainly is not a bug, unless the Java specification would explicitly state that recursive constructor calls must result in an error.
And finally, it's important to differentiate between recursive calls to constructor(s) of the same object, which is a common pattern for instance to overcome the lack of default parameters, and calling the constructor of the same class to create another object, as done in your example.

A: You could even have several constructors with different parameters, calling each other wiht this(...). In general, by computer science, a termination of code can not always be guaranteed. Some intelligence, like in this simple case, would be nice to have, but one may not require a compiler error. A bit like unreachable code. There is no difference between a constructor or normal method in my eyes however.

A: Although this specific situation seems quite obvious, determining whether or not code terminates is an impossible question to answer.
If you try to configure compiler warnings for infinite recursion, you run into the Halting Problem:

"Given a description of an arbitrary computer program, decide whether
the program finishes running or continues to run forever."
Alan Turing proved in 1936 that a general algorithm to solve the
halting problem for all possible program-input pairs cannot exist.


text:
Q: Trouble with interpreting a question about polynomial rings? I trying to do problem $9.3.1$ in Dummut & Foote; I think they use some "abuse of notation" that I don't understand.

Let $R$ be an integral domain with quotient field $F$ and let $p(x)$ be a monic polynomial in $R[x]$. Assume $p(x) = a(x)b(x)$ where $a(x)$ and $b(x)$ are monic polynomials in $F[x]$ of smaller degree than $p(x)$. $\color{red}{\text{Prove that if a(x)} \not \in \text{R[x] then R is not a U.F.D.}}$ Deduce that $\mathbb{Z}[2\sqrt2]$ is not a U.F.D.

The part in red is what's confusing me. The reason why I think it's "abuse of notation" is because there is nothing to distinguish $a(x)$ from $b(x)$. So I could see an argument for each of the following interpretations, and I don't know which one is correct:

*

*Exactly one of $a(x), b(x)$ is not in $R[x]$

*At least one one of $a(x), b(x)$ is not in $R[x]$

*Precisely both of $a(x), b(x)$ are not in $R[x]$

Any help is appreciated.
Edit for Lord Shark the Unknown:
Proof that if $(x+a)(x+b) \in \mathbb{Z}[x]$ and $a, b \in \mathbb{Q}$ then $a, b \in \mathbb{Z}$.
Since $(x+a)(x+b) = x^2 + (a+b)x + ab$ we know $ab \in \mathbb{Z}$ and $a+b \in \mathbb{Z}$. Thus:
$$a^2+2ab+b^2 \in \mathbb{Z}$$
$$\implies a^2-2ab +b^2\in \mathbb{Z}$$
$$\implies (a-b)^2 \in \mathbb{Z}$$
$$\implies a-b \in \mathbb{Z}$$
$$\implies (a+b)(a-b) \in \mathbb{Z}$$
$$\implies a^2-b^2 \in \mathbb{Z}$$
Now we can also get that $a^2+b^2 \in \mathbb{Z}$ using the same trick we used in the first steps. So $(a^2+b^2)-(a^2-b^2) \in \mathbb{Z}$,
$$\implies 2a^2 \in \mathbb{Z}$$
$$\implies a^2 \in \mathbb{Z}$$
$$\implies a \in \mathbb{Z}$$
And by a similar argument, $b \in \mathbb{Z}$.


text:
Q: Fluid Dynamics: How to solve this system of differential equations? Consider the system
\begin{align}
\ \frac{dx}{dt} & = k \bigl(\frac{gA}{\omega} \cosh (ky) + \frac{A \omega}{k} \sinh (ky) \bigr) \cos(kx- \omega t) \\
\ \frac{dy}{dt} & = k \bigl(\frac{gA}{\omega} \sinh (ky) + \frac{A \omega}{k} \cosh (ky) \bigr) \sin(kx- \omega t) \\
\end{align}
Where $g$, $k$, $A$, $\omega$ are (positive) constants. How do you find expressions for $x(t)$ and $y(t)$?
If it helps, the context for this question comes from Fluid Dynamics where I am trying to find the particle paths of travelling harmonic waves. I have already found that the potential is
$$\phi(x,y,t) = \bigl(\frac{gA}{\omega} \cosh (ky) + \frac{A \omega}{k} \sinh (ky) \bigr)\sin(kx-\omega t)$$
and I got the above system of differential equations by computing $\nabla \phi$ and equating with $\bigl( \frac{dx}{dt},\frac{dy}{dt} \bigr)$ to find the prticle paths.
Within the context of this question, $\omega$ satisfies
$$\omega ^2 = gk \tanh (kh)$$
where $h$ is the depth of the water, with the bottom being at $y=-h$.
I tried considering $\frac{dy}{dx}=\frac{dy/dt}{dx/dt}$ and I got $$\frac{dy}{dx} = \coth(k(h+y)) \cot(kx-\omega t)$$
which doesn't seem to help since there is still a $t$ in the expression. What should I do?


text:
Q: View not respecting constraint, why is that? I have this view that has these constraints

When this view appears and I get its size on viewWillAppear I get the size as 320,568.
For a view that is locked to the left and right borders, nas an aspect ratio of 80:107 and is running on iPhone 5, I should be getting 320 x 428, right?
So why the view is full screen not respecting the constraint?
thanks

A: The views have not yet been laid out in viewWillAppear:. The frame will be correct in viewDidLayoutSubviews.


text:
Q: How to convert a percentage to a decimal? So here is an example of my code:
var = int(input("What is your restaurant bill: "))
var2 = int(input("How much percent did you tip(Don't add the % symbol)? "))

I want this to print the percentage increase plus the total. Here is an example:
#input
var = 50
var2 = 5
#output
50*1.05 = 52.5

So in this example, how would I convert the 5% to 1.05?

A: Since var2 shows us the percentage of the tip in probability 1 represents 100% hence var2/100 would show the % out of 1. Now add 1 ( or 100% in our case) to var2/100


text:
Q: Опции изменения текста при выделении

Мне нужно знать как сделать эту панель и выделить определенный текст, а потом отменить выделение. Как сделать меню опций редактирования стиля текста над клавиатурой: выделение поддчеркивание и т. д. . При выделении менял стиль выделенного и мог отменять выделения ,да  про Spaneble знаю. И еще чтобы выделение применялось к TextView


text:
Q: Map linux commands Cygwin I have installed on cygwin a mercury compiler but the comand to invoke it is *mmc module_name* but mmc calls Microsoft Management Console.
Is there anything I can do about it?

A: You can alias mmc in your .bashrc:
alias mmc "/path/to/mercurycompiler"

A: Also, you could edit your ~.bashrc to contain something like
export PATH="/usr/bin:$PATH"

This will also prevent problems with find.exe being used from Windows (ick) etc.


text:
Q: Why PHP can't use Sqlsrv_connect with cmd I make sure that I can run website with WampServer,and also can connect the Sql Server.However,I run the bat file by the operating system scheduler,that return error:
OK,Can Run PHP
Fatal error: Uncaught Error:Call to undefined function sqlsrv_connect() in C:\wamp64\www\shell.php
Stack trace:
#0{main}
 thrown in C:\wamp64\www\shell.php

My configuration : WampServer 3.0.6 64bits (PHP 7.0.10, Apache 2.4.23)
There are my steps:
First: I wrote a bat file in \wamp64\bin\php\php7.0.10
C:\wamp64\bin\php\php7.0.10\php.exe -q C:\test.php
PAUSE

Second: The function sql_connect is basic on php
echo "OK,Can Run PHP";
$serverName = "------";
$uid = "------";
$pwd = "------";
$connectionInfo = array("UID"=>$uid, "PWD"=>$pwd, "Database"=>"------","characterset"=>"utf-8");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn == false){
echo "Error
";
die( print_r( sqlsrv_errors(), true));

}
else{
echo "OK
";
}

Third: Put the bat in the operating system scheduler(Win7 64bit)
The cmd also can work by php -v and php -f.I think that cmd can work PHP with bat on the operating system scheduler because it answer "OK,Can Run PHP".
And then,the problem maybe is in "sqlsrv_connect()".
However,I really don't know that why the function "sqlsrv_connect()" can work in localhost website but can't work cmd without website. Please help me!!


text:
Q: How to Curl Kibana Dashboard with GET Response to Find All Dashboard IDs and/or Dashboard Content So I am trying to automate the scrape of our internal Kibana Dashboards from within our environments for information gathering purposes. I have looked through the following link, but Elasticsearch doesn't seem to really provide good examples of what I am trying to do or accomplish here. Several constraints I have: 1. the commands must be in BASH, 2. I cannot use any compiler such as Python and the Requests and/or Beautifulsoup modules to grab the information and parse it.
Here is my Dilemma:
I log in to the Kibana Dashboard:
Some http://<IP_ADDRESS>:5601/app/kibana#/dashboards?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-1h,mode:quick,to:now))
It will look like this if I am properly tunneled into the environment.

There are three dashboards that I want to collect:

*

*API RESPONSES

*Logs

*Notifications

The example curl command I am using is as follows to scrape the dashboards:
curl -s http://<IP_ADDRESS>:5601/app/kibana#/dashboard/API\ RESPONSES
curl -s http://<IP_ADDRESS>:5601/app/kibana#/dashboard/logs
curl -s http://<IP_ADDRESS>:5601/app/kibana#/dashboard/notifications

Now the Elasticsearch Documentation mentions something of a Dashboard ID, to which I cannot see it unless I open a webpage and use the inspect tool on a particular element I am sending the GET request to. I am trying to accomplish that by curling the main dashboard page:
curl -s http://<IP_ADDRESS>:5601/app/kibana#/dashboard/_search?pretty

My output will return an HTML output, but it doesn't seem to change and I cannot properly acquire the Dashboards without knowing the Dashboard ID. Furthermore, I am trying to see what dashboards are available and scrape all of them depending on what a person has set up within the environment so it's important that this process is dynamic. My eventual and ultimate goals are to get:

*

*Dashboard IDs Available

*Scrape the Dashboards by IDs

Basically I want to curl this output to get the return JSON.

Any thoughts would be greatly appreciated.

A: So apparently, I was curling the wrong location.
I needed to curl the VIP and port 9200 for the Kibana Index to pull in the available dashboards.
rbarrett@cfg01:~$ curl -s http://<IP_ADDRESS>:9200/.kibana/dashboard/_search?pretty
{
  "took" : 15,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 2,
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : ".kibana",
        "_type" : "dashboard",
        "_id" : "logs",
        "_score" : 1.0,
        "_source" : {
          "description" : "",
          "hits" : 0,
          "kibanaSavedObjectMeta" : {
            "searchSourceJSON" : "{\"filter\":[{\"query\":{\"query_string\":{\"analyze_wildcard\":true,\"query\":\"*\"}}}]}"
          },
          "optionsJSON" : "{\"darkTheme\":true}",
          "panelsJSON" : "[{\"col\":1,\"columns\":[\"Hostname\",\"Logger\",\"programname\",\"severity_label\",\"Payload\",\"environment_label\"],\"id\":\"search-logs\",\"panelIndex\":5,\"row\":13,\"size_x\":12,\"size_y\":12,\"sort\":[\"Timestamp\",\"desc\"],\"type\":\"search\"},{\"col\":1,\"id\":\"NUMBER-OF-LOG-MESSAGES-PER-SEVERITY\",\"panelIndex\":7,\"row\":9,\"size_x\":6,\"size_y\":4,\"type\":\"visualization\"},{\"col\":7,\"id\":\"TOP-10-PROGRAMS\",\"panelIndex\":9,\"row\":5,\"size_x\":6,\"size_y\":4,\"type\":\"visualization\"},{\"col\":1,\"id\":\"LOG-MESSAGES-OVER-TIME-PER-SOURCE\",\"panelIndex\":10,\"row\":1,\"size_x\":6,\"size_y\":4,\"type\":\"visualization\"},{\"col\":7,\"id\":\"TOP-10-HOSTS\",\"panelIndex\":11,\"row\":9,\"size_x\":6,\"size_y\":4,\"type\":\"visualization\"},{\"col\":1,\"id\":\"TOP-10-SOURCES\",\"panelIndex\":14,\"row\":5,\"size_x\":6,\"size_y\":4,\"type\":\"visualization\"},{\"col\":7,\"id\":\"LOG-MESSAGES-OVER-TIME-PER-SEVERITY\",\"panelIndex\":16,\"row\":1,\"size_x\":6,\"size_y\":4,\"type\":\"visualization\"}]",
          "timeFrom" : "now-1h",
          "timeRestore" : true,
          "timeTo" : "now",
          "title" : "Logs",
          "uiStateJSON" : "{\"P-10\":{\"vis\":{\"legendOpen\":true}},\"P-11\":{\"vis\":{\"colors\":{\"Count\":\"#629E51\"},\"legendOpen\":true}},\"P-12\":{\"spy\":{\"mode\":{\"fill\":false,\"name\":null}},\"vis\":{\"colors\":{\"Count\":\"#2F575E\"},\"legendOpen\":false}},\"P-14\":{\"vis\":{\"legendOpen\":true}},\"P-7\":{\"vis\":{\"legendOpen\":false}},\"P-9\":{\"vis\":{\"colors\":{\"Count\":\"#99440A\"},\"legendOpen\":true}}}",
          "version" : 1
        }
      },
      {
        "_index" : ".kibana",
        "_type" : "dashboard",
        "_id" : "notifications",
        "_score" : 1.0,
        "_source" : {
          "description" : "",
          "hits" : 0,
          "kibanaSavedObjectMeta" : {
            "searchSourceJSON" : "{\"filter\":[{\"query\":{\"query_string\":{\"analyze_wildcard\":true,\"query\":\"*\"}}}]}"
          },
          "optionsJSON" : "{\"darkTheme\":true}",
          "panelsJSON" : "[{\"col\":1,\"columns\":[\"Logger\",\"publisher\",\"severity_label\",\"event_type\",\"old_state\",\"old_task_state\",\"state\",\"new_task_state\",\"environment_label\",\"display_name\"],\"id\":\"search-notifications\",\"panelIndex\":1,\"row\":14,\"size_x\":12,\"size_y\":11,\"sort\":[\"Timestamp\",\"desc\"],\"type\":\"search\"},{\"col\":1,\"id\":\"NOTIFICATIONS-OVER-TIME-PER-SOURCE\",\"panelIndex\":2,\"row\":1,\"size_x\":6,\"size_y\":4,\"type\":\"visualization\"},{\"col\":7,\"id\":\"NOTIFICATIONS-OVER-TIME-PER-SEVERITY\",\"panelIndex\":3,\"row\":1,\"size_x\":6,\"size_y\":4,\"type\":\"visualization\"},{\"col\":7,\"id\":\"EVENT-TYPE-BREAKDOWN\",\"panelIndex\":4,\"row\":5,\"size_x\":6,\"size_y\":5,\"type\":\"visualization\"},{\"col\":1,\"id\":\"SOURCE-BREAKDOWN\",\"panelIndex\":5,\"row\":5,\"size_x\":6,\"size_y\":5,\"type\":\"visualization\"},{\"col\":1,\"id\":\"HOST-BREAKDOWN\",\"panelIndex\":6,\"row\":10,\"size_x\":6,\"size_y\":4,\"type\":\"visualization\"},{\"col\":7,\"id\":\"NOTIFICATIONS-PER-SEVERITY\",\"panelIndex\":7,\"row\":10,\"size_x\":6,\"size_y\":4,\"type\":\"visualization\"}]",
          "timeFrom" : "now-1h",
          "timeRestore" : true,
          "timeTo" : "now",
          "title" : "Notifications",
          "uiStateJSON" : "{\"P-4\":{\"vis\":{\"legendOpen\":true}},\"P-7\":{\"vis\":{\"legendOpen\":false}}}",
          "version" : 1
        }
      }
    ]
  }
}

Afterwhich I was able to pull out the existing IDs with JQ:


text:
Q: SQL query to insert the same record for all the ids of another table in a new table I'm having two tables: notificattins and users
I want to insert one record into the notifications table for every record of the users table.
in fact i want to add one notification for every user to receive.
can anyone help me?

A: You did not specify your table structure but generally you can do this
insert into notifications (some_column, other_column)
select username, other_column
from users


text:
Q: Tastypie 'NoneType' object has no attribute '_clone' error I am using tastypie (v0.11) and django(v1.6.1) on windows operating system using pycharm IDE. I am using virtual environment within pycharm. The django model and related ORM cruds work fine and I am using postgresql with psycopg2 driver. Now, I am trying to create a simple REST based request-response framework utilizing json payloads. While trying to test the REST request-response, I keep getting a strange error in the response. The error is as follows:
**AttributeError 'NoneType' object has no attribute '_clone' error.**

The url used for testing is
http://localhost:8000/api/comment?format=json

And YES ... the Comment table in the database does have records.
I have already spent a day trying to figure what's wrong. I tried using two other versions of tastypie (v0.10 and v0.9), but the error remains. Any help and guidance will very much be appreciated. Many thanks !!
My code is as follows:
The django model class
from django.db import models

class Comment(models.Model):
    ID=models.BigIntegerField(primary_key=True)
    text=models.CharField(max_length=200)

The tastypie resource class
from tastypie.resources import ModelResource
from pie.models import Comment

class CommentResource(ModelResource):
    class Meta:
        queryset=Comment.objects.all()
        resource_name="comment"

The urls.py file
from django.conf.urls import patterns, include, url
from pie.api import CommentResource
from django.contrib import admin
admin.autodiscover()

res=CommentResource()

urlpatterns = patterns('',
    url(r'^admin/', include(admin.site.urls)),
    url(r'^api/', include(res.urls)),
)


text:
Q: OpenID for android apps that require SignIn I am a fresh developer on Googles Android Platform - my HTC Desire arrived last week.
Now i need a way to sign in to my existing application (Java, currently running on jetty).
The server Application is developed using spring security 3.0.2
In my case, i want to support the following:
If a user has set up his Android phone with a googlemail/google-Account (and most users do) i want to use this account credentials to automagically log in to my server app.
Is there any Android framework supporting that use-case?
Or are there any alternatives?
I read: http  code.google.com intl/de-DE/apis/accounts/docs/OpenID.html
How we do sign in with an app on google AppEngine is described here: http://blog.notdot.net/2010/05/Authenticating-against-App-Engine-from-an-Android-app

A: Here is an OPENID java API : Here is the link:http://code.google.com/p/openid4java/

A: I'm not sure I understand where you want the user to be logged on.
Note that you can't assume which web browser will be used (default browser, opera mobile, manufacturer browser, etc.) If you only offer an web site, it is the web browser responsibility to know the user. Most people I have already logged in their google account. Android is sort of unrelelated here.
If you want your Android application to connect to a web service without prompting for a login/password, you can't achieve this with openID. I suggest oauth for this use case.

A: I think what you want is to use AccountManager
To find out what type the google account is, use something like:
AuthenticatorDescription[] types = mAccountManager.getAuthenticatorTypes(); //
for (AuthenticatorDescription type : types) {
  Log.d("account types", type.type);
}

Then do something like
AccountManager mAccountManager = AccountManager.get(context);
Account[] mAccounts = AccountManager.get(context).getAccountsByType("com.google");
// Choose which account to use if there are multiple google accounts registered, save to Account mAccount
AccountManagerFuture<options> response = mAccountManager.getAuthToken(mAccount, type, options, activity, mCallback, mHandler); // define callback and handler yourself for where to return

When the user reaches mCallback in your mHandler, the login process is done. The usual google login dialogue will be used if the user is not already logged in to his/her Google account.
Try it out for yourself and let me know if it helped you!


text:
Q: Couldn't deploy GAE (Google App Engine) application (Java SDK) I was trying this quick start but I couldn't deploy the app. I made Google Cloud Platform account, cloud platform project and app engine application.
I used mvn appengine:update command.
Result was
[INFO] Running -A masas-first-project -V masas-first-project1 --oauth2 update /home/masa/Code/googleAppEngine/java-docs-samples/appengine/helloworld/target/appengine-helloworld-1.0-SNAPSHOT
The following URL can be used to authenticate:
  https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&client_id=550516889912.apps.googleusercontent.com&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=https://www.googleapis.com/auth/appengine.admin%20https://www.googleapis.com/auth/cloud-platform
Attempting to open it in your browser now.

And it was like
I don't know where to paste code

A: At last could deploy...
By using command "gcloud app create".
Maybe I made gcp project, but not gcloud app yet.
First I went along with Japanese quick start but I tried English one next.
cloud.google.com/appengine/docs/standard/java/quickstart
And I got same similar error but I read error message of maven
mvn appengine:deplpy
ERROR: (gcloud.app.deploy) The current Google Cloud project [testproject-218805] does not contain an App Engine application. Use gcloud app create to initialize an App Engine application within the project.

Here is another good resource... github.com/GoogleCloudPlatform/getting-started-java/issues/371 Thanks LOL.
By the way I wrote about this at my weblog. But in Japanese..
I have also English contents. Visit https://lavilleeternelle.wordpress.com/2018/10/08/gae-google-app-engine%e3%81%a7%e9%81%8a%e3%81%b6/

A: You have to paste that code into your terminal in order to authenticate.


text:
Q: User Supplied Initial States in Statespace Model I am trying to replicate the result in Trends and Cycles in Macroeconomic Time Series (1985). I was able to get the same result if using only Local Linear models, but failed to do so when adding a stationary cyclical component. Although I am not entirely sure, I suspect it has to do with me using full diffuse priors for all states instead of on the local linear components only. To maintain some level of flexibility, I would like to feed initials to statsmodels using known keyword, and update them in the update method. For now I am not worry too much about using approximate diffuse. What is the best way to achieve this?

A: Since v0.10, you can get quite a bit of flexibility in setting the initialization by creating your own Initialization instance. Using this approach, each state or block of states can be independently set to use one of the available methods: known, stationary, approximate_diffuse or diffuse.
Here is an example of a local level model, but where the irregular component is modeled as an AR(1). The first state is the AR(1), and I specify stationary initialization. The second state is the level, and I estimate the initial level via maximum likelihood, using the known initialization. The third state is the slope, and I set its initialization to diffuse.
import numpy as np
import pandas as pd
import statsmodels.api as sm

from statsmodels.tsa.statespace.initialization import Initialization
from statsmodels.tsa.statespace.tools import (
    constrain_stationary_univariate,
    unconstrain_stationary_univariate)

class LocalLevelAR1(sm.tsa.statespace.MLEModel):
    def __init__(self, endog):
        super().__init__(endog, k_states=3, k_posdef=3)

        self['design', 0, :2] = 1
        self['transition', 1:, 1:] = np.array([[1., 1.],
                                               [0., 1.]])
        self['selection'] = np.eye(3)

        init = Initialization(3)
        init.set(0, 'stationary')
        init.set(1, 'known', stationary_cov=[[0]])
        init.set(2, 'diffuse')
        self.ssm.initialization = init

    @property
    def state_names(self):
        return ['ar1', 'level', 'slope']

    @property
    def param_names(self):
        return ['level0', 'phi', 'sigma2.ar1', 'sigma2.level', 'sigma2.slope']

    @property
    def start_params(self):
        return np.r_[0, 0, 1e-5, 1e-5, 1e-5]

    def transform_params(self, unconstrained):
        constrained = unconstrained.copy()
        constrained[1] = constrain_stationary_univariate(unconstrained[1:2])
        constrained[2:5] = constrained[2:5]**2
        return constrained

    def untransform_params(self, constrained):
        unconstrained = constrained.copy()
        unconstrained[1] = unconstrain_stationary_univariate(constrained[1:2])
        unconstrained[2:5] = constrained[2:5]**0.5
        return constrained

    def update(self, params, **kwargs):
        params = super().update(params, **kwargs)

        self['transition', 0, 0] = params[1]
        self['state_cov'] = np.diag(params[2:5])
        self.ssm.initialization.set(1, 'known', constant=params[:1], stationary_cov=[[0.]])

dta = sm.datasets.macrodata.load_pandas().data
dta.index = pd.period_range(start='1959Q1', end='2009Q3', freq='Q')

mod = LocalLevelAR1(dta['infl'])
res = mod.fit()

print(res.summary())


text:
Q: Ошибка в коде silero.py, синтез речи? Решил потестить библиотеку silero, запускаю код, ошибка происходит в файле silero.py, то есть в файле самой библиотеки
Вот текст ошибки:
Возникло исключение: RuntimeError
open file failed because of errno 2 on fopen: No such file or directory,
file path: C:\Users\Стас/.cache\torch\hub\snakers4_silero-
models_master\src\silero\model\ru_v3.pt
File "C:\Users\Стас\.cache\torch\hub\snakers4_silero-
models_master\src\silero\silero.py", line 87, in silero_tts
imp = package.PackageImporter(model_path)
File "C:\Users\Стас\Documents\Assistent\test.py", line 14, in <module>
model, _ = torch.hub.load(repo_or_dir='snakers4/silero-models',

Сам файл при этом присутствует в это директории
Вот код:
import torch
import sounddevice as sd
import time

language = 'ru'
model_id = 'ru_v3'
sample_rate = 48000
speaker = 'aidar'
put_accent = True
put_yo = True
device = torch.device('cpu')
text = 'Привет хабр'

model, _ = torch.hub.load(repo_or_dir='snakers4/silero-models',
                          model='silero_tts',
                          language=language,
                      speaker=model_id)
model.to(device)

audio = model.apply_tts(text=text,
                        speaker=speaker,
                        sample_rate=sample_rate,
                        put_accent=put_accent,
                        put_yo=put_yo)
print(text)

sd.play(audio, sample_rate)
time.sleep(len(audio) / sample_rate)
sd.stop()


text:
Q: Android PreferenceScreen overlay Toolbar Android PreferenceScreen overlay Toolbar.
I have tried to use padding and margin to set Preference Screen under the
Toolbar but no any success.
NOTE: after changing Toolbar with ActionBar it works as expected.
Any help please.
Thanks,
Hrach

A: I just now resolve the issue:
Here is the code:
<RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <include layout="@layout/app_toolbar"
             android:id="@+id/app_toolbar" />

        <FrameLayout
            android:id="@+id/pref_content"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/app_toolbar" />

        <!-- The main content view -->
        <FrameLayout
            android:id="@+id/content_frame"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:paddingTop="?attr/actionBarSize"/>

    </RelativeLayout>

After adding the fist FrameLayout the issue is resolved.
Thanks


text:
Q: ASP.NET MVC Authorization based on Route Params My site allows people to edit posts. I want people to only edit their posts. I'd want an authorization attribute like:
[CanEditPost(PostId = Id)]
ActionResult Edit(int Id) { }

But it seems like parameters to attributes have to be static, which makes this impossible. Is there any way to get around this?

A: Yes.
If you create an attribute that inherits from AuthorizeAttribute,
you should be able to access the route parameters by:
protected override bool AuthorizeCore(HttpContextBase httpContext)
{
    var postId = httpContext.Request.RequestContext.RouteData.Values["Id"];
    .
    .
    .
}


text:
Q: Two lines of code mashing together but I need them separately import java.util.Scanner;

import static java.lang.System.out;

public class main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int Safeties;
        out.print("Safeties:");
        Safeties = input.nextInt();
        out.print("Home Team:");
        String HomeTeam = input.nextLine();
        out.print("Touchdowns:");
        double Touchdown2 = input.nextDouble();
        }
}

The output is:
Safties:
Home Team:Touchdowns:
But it's supposed to be
Safties:
Home Team:
Touchdowns:
I'm assuming it's because I have an int above a string but I don't know how to fix this problem. I need them in that order. I'm completely lost. Can anyone help?

A: Add input.nextLine(); below out.print("Home Team:");


text:
Q: How can I add symbols in slider labels? I'm trying to add symbols and math expressions to slider labels, e.g. instead of "Choose lambda:" I want the label to read "Choose λ:".  I've tried multiple variations of HTML and expression(), such as:
sliderInput ("lambda1", label=HTML("Choose &-lambda;:"), min=0, max=10, value=1.1, step=0.1)

with the hyphen removed (I put it there to defeat formatting in this editor).
and:
sliderInput("lambda1", label=expression(lambda), min=0, max=10, value=1.1, step=0.1).

In all cases the label displays as "Choose &-lambda;:" (without hyphen) rather than "Choose λ:".
I also need subscripts and superscripts, but haven't tried any code yet.  I presume that if I can get HTML symbols, I'll be able to format subscripts and such with the appropriate tags.
Edit
Sorry, I can't answer myself because I'm a new user.  I found an answer to the Greek symbols part of the question.  It's ironic, because I've been beating my head against this problem for a week, then an hour after posting the question on SO I figured it out.  D'oh!
Enclose the HTML() function with div(HTML()).  Thusly:
sliderInput ("lambda1", label=div(HTML("Choose &-lambda;:")), min=0, max=10, value=1.1, step=0.1),

again without the hyphen in &-lambda;.
That worked!

A: This is a bug reported here, and has been fixed in the development version of shiny. HTML() should work with the sliderInput() labels in shiny >= 0.9.0.


text:
Q: How to Use A Different GetEnumerator() in For Each Statement My custom collection Example implements IEnumerable(Of Long) and IDictionary(Of String, Long).
When I enumerate through my collection with For Each, I get values of type KeyValuePair(Of String, Long), but I want values of type Long.
The three GetEnumerator's only differ in their return type.  This is not overloading.
Module Main
    Sub Main()
        Dim Examples As New Example

        For Each E In Examples
            ' E is of type KeyValuePair(Of String, Long)
            ' I want E to be of type Long
        Next
    End Sub
End Module

Public Class Example
    Implements IEnumerable(Of Long), IDictionary(Of String, Long)

    Private Property TheKeyedCollection As KeyedCollection(Of String, Long)

    Public Function GetEnumerator() As IEnumerator(Of KeyValuePair(Of String, Long)) Implements IEnumerable(Of KeyValuePair(Of String, Long)).GetEnumerator
        Return TheKeyedCollection.GetEnumerator()
    End Function

    Public Function GetEnumerator1() As IEnumerator(Of Long) Implements IEnumerable(Of Long).GetEnumerator
        Return TheKeyedCollection.GetEnumerator()
    End Function

    Public Function GetEnumerator2() As IEnumerator Implements IEnumerable.GetEnumerator
        Return TheKeyedCollection.GetEnumerator()
    End Function

    '>>>>>>>>>>>>>>>>>>>>>>>>>>>> IGNORE THESE OTHER UNNECESSARY FUNCTIONS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    Private Sub Add(item As KeyValuePair(Of String, Long)) Implements ICollection(Of KeyValuePair(Of String, Long)).Add
    End Sub
    Private Sub Clear() Implements ICollection(Of KeyValuePair(Of String, Long)).Clear
    End Sub
    Private Function Contains(item As KeyValuePair(Of String, Long)) As Boolean Implements ICollection(Of KeyValuePair(Of String, Long)).Contains
        Throw New Exception
    End Function
    Private Sub CopyTo(array() As KeyValuePair(Of String, Long), arrayIndex As Integer) Implements ICollection(Of KeyValuePair(Of String, Long)).CopyTo
    End Sub
    Private ReadOnly Property Count As Integer Implements ICollection(Of KeyValuePair(Of String, Long)).Count
        Get
            Throw New Exception
        End Get
    End Property
    Private ReadOnly Property IsReadOnly As Boolean Implements ICollection(Of KeyValuePair(Of String, Long)).IsReadOnly
        Get
            Throw New Exception
        End Get
    End Property
    Private Function Remove(item As KeyValuePair(Of String, Long)) As Boolean Implements ICollection(Of KeyValuePair(Of String, Long)).Remove
        Throw New Exception
    End Function
    Private Sub Add1(key As String, value As Long) Implements IDictionary(Of String, Long).Add
    End Sub
    Private Function ContainsKey(key As String) As Boolean Implements IDictionary(Of String, Long).ContainsKey
    End Function
    '>>>>>>>>>>>>>>>>>>>>>>>>>>>> IGNORE THESE OTHER UNNECESSARY FUNCTIONS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    Private Property Item(key As String) As Long Implements IDictionary(Of String, Long).Item
        Get
            Throw New Exception
        End Get
        Set(value As Long)
        End Set
    End Property
    Private ReadOnly Property Keys As ICollection(Of String) Implements IDictionary(Of String, Long).Keys
        Get
            Throw New Exception
        End Get
    End Property
    Private Function Remove1(key As String) As Boolean Implements IDictionary(Of String, Long).Remove
        Throw New Exception
    End Function
    Private Function TryGetValue(key As String, ByRef value As Long) As Boolean Implements IDictionary(Of String, Long).TryGetValue
        Throw New Exception
    End Function
    Private ReadOnly Property Values As ICollection(Of Long) Implements IDictionary(Of String, Long).Values
        Get
            Throw New Exception
        End Get
    End Property
    '>>>>>>>>>>>>>>>>>>>>>>>>>>>> IGNORE THESE OTHER UNNECESSARY FUNCTIONS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
End Class

I tried setting GetEnumerator() and GetEnumerator2() to private, but that produced the error: 'For Each' on type 'Example.Example' is ambiguous because the type implements multiple instantiations of 'System.Collections.Generic.IEnumerable(Of Long)'.
How do I pick which GetEnumerator() For Each uses?

A: Change the name of the function you want as the default enumerator to GetEnumerator().  Not GetEnumerator1().
If you don't plan to use the other two versions of GetEnumerator, you can set them to Private, but they still have to be there to satisfy the given interface.
If you want to use one of the GetEnumerator()s that is not the default, i.e. GetEnumerator1(), you need to force For Each to infer it like this:
For Each E In DirectCast(Example, IEnumerable(Of String))
    ' E is of type String
Next


text:
Q: Golang + Avconv error (exit status 254) I'm getting "panic: exit status 254" on the second line.
Can you spot the mistake I made here:
command := exec.Command("avprobe", "inputfile.mp4 -loglevel quiet -show_streams -frame_size -print_format -show_format -of json")

output, err := command.StdoutPipe();
if err != nil {
    log.Panic(err)
}

if err := command.Run(); err != nil {
    log.Panic(err)
}

json.NewDecoder(output).Decode(&struct1)

A: You are running the equivalent of
avprobe "inputfile.mp4 -loglevel quiet -show_streams -frame_size -print_format -show_format -of json"

I am guessing avprobe doesn't like that, try
command := exec.Command("avprobe", "inputfile.mp4", "-loglevel", ...)

You can also use exec.CombinedOutput() to get the output from avprobe and see what it says.

A:
Package exec
func Command
func Command(name string, arg ...string) *Cmd

For example,
arg := []string{
    "inputfile.mp4",
    "-loglevel", "quiet",
    "-show_streams",
    "-frame_size",
    "-print_format",
    "-show_format",
    "-of", "json",
}
command := exec.Command("avprobe", arg...)


text:
Q: Any great *Introductory* books for Finite (Element/Difference) Methods I sort of have two questions on the same subject so I just thought to ask both in one thread.
I am looking to do some research on Finite Element Methods (FEM) and I am recently started looking into the related different methods such as Finite Difference Methods (FDM) and Finite Volume Methods (FVM). Assuming I will do the research on (FEM), I wanted to ask what were some good books that will be suitable for a beginner in this subject field topic with more so a electrical engineering and math background? I am not sure if there are any applications for these methods to use in the field of electrical engineering or similar topics, but this is what type of books I am most concerned to look for. I am also interested in the traditional subject field topics these methods are used for such as (viscosity, collisions, structure analysis,$\;\ldots$ etc.), from more of a Applied Math stand point/background.
My second question is, I am still unsure which method would be most suitable for a beginning learner on this topic and most beneficial for the electrical applications (preferably). I hear that the (FEM) is the most difficult method of the three for one who is just starting to pursue interest in this field of study. I hear that the (FDM) and (FVM) are the two that are more accessible and easy to pick up on for the first time then (FEM). Any our your suggestions would be greatly appreciated whether they are from just reading or from actual personal experience or someone you may know experience when it came to dealing with this in real life practice. So again, to summarize, my question is what method do you feel would be best to start off with learning with the preferred topics of interest  stating above which are electrical phenomena or the latter (viscosity,$~\ldots$). In the long run I would like to have experience with each method (as a side note).
Thank You.

A: I would start by learning the FEM for elliptic problems as this is the easiest. The book Numerical Solution of Partial Differential Equations by the Finite Element Method by Claes Johnson is a fairly good introductory book if you are mainly interested in implementing and using the finite element method. It skips most of the Hilbert space theory needed to make the arguments rigorous. It also skips most of the technical difficulties. On the other hand, if you want a rigorous treatment I recommend just reading a book on the Hilbert space approach to PDE as a complementary text. I thought Introduction to PDE by Renardy and Rogers (especially chapters 6-8) to be a gentle introduction to this topic. There is also a great deal of work done on constructing approximation spaces and finding error approximations in p-norms rather than the Sobolev estimates the FEM gives you via Cea's Lemma. I found this to be the hardest part and would leave it for last. As for you second question, no, I don't think learning the FEM before the FDM will cause major problems.


text:
Q: Speed up index in large matrix I have a large matrix (as class Matrix) in R. It is sparse (only containing 01).
What I do is (if M is the Matrix)
j<-list()
for(i in 1:dim(M)[1]){
    which(M[i,]==1)->j[[i]]
}

this is normally fast but on such a large matrix(dim 1.7 Mil to 5000) it is very slow. I just cant believe that there is no faster way to obtain the indices of those cols that are 1 in every row....

A: Using the example by @zx8754
M <- matrix(c(1,1,0,0,1,0,1,1,1,1,1,1), 4)

we can define an auxiliary matrix that contains the row and column indices of the entries equal to 1:
oneMat <- which(M==1, arr.ind=TRUE)

From this auxiliary matrix we can create a list that contains the column numbers that are equal to one in each row with
oneList <- lapply(1:nrow(M), function(x) oneMat[oneMat[,1] == x, 2])
#[[1]]
#[1] 1 2 3
#
#[[2]]
#[1] 1 3
#
#[[3]]
#[1] 2 3
#
#[[4]]
#[1] 2 3

If the matrix M is large and sparse, the matrix oneMat should be much smaller than M. In that case I think that the lapply() loop used in the second step could lead to a speedup with respect to the for loop described in the OP.

After some tests, I regretfully have to admit that this answer is particularly slow. The solution by @ColonelBeauvel is the winner:
j <- list()
set.seed(123)
M <- matrix(rbinom(1e5,1,0.01),ncol=100)
library(microbenchmark)
f_which_and_lappy <- function(x) {oneMat <- which(x==1, arr.ind=TRUE);
           lapply(1:nrow(x), function(i) oneMat[oneMat[,1] == i, 2])}
f_only_apply <- function(x) {apply(x, 1, function(i) which(i == 1))}
f_with_data.frame <- function(x) {with(data.frame(which(!!x, arr.ind=T)), split(col, row))}
f_OP <- function(x) {for(i in 1:dim(x)[1]){which(x[i,]==1)->j[[i]]}}
res <- microbenchmark(
  f_which_and_lappy(M),
  f_only_apply(M),
  f_with_data.frame(M),
  f_OP(M),times=1000L)
#> res
#Unit: microseconds
#                 expr       min        lq       mean     median        uq       max neval  cld
# f_which_and_lappy(M) 11063.170 11254.032 12090.9506 11351.1830 11570.662  31313.48  1000    d
#      f_only_apply(M)  3204.572  3359.410  4117.4971  3456.3960  3610.945  25352.35  1000  b
# f_with_data.frame(M)   739.556   811.906   912.4726   918.0315   946.700  18623.77  1000 a
#              f_OP(M)  5642.639  5854.751  6955.9980  5969.3685  6151.209 148847.22  1000   c

A: I would rather opt for a vectorized approach,and use split instead of these apply/lapply family functions:
M  = matrix(c(1,1,0,0,1,0,1,1,1,1,1,1), 4)

with(data.frame(which(!!M, arr.ind=T)), split(col, row))
#$`1`
#[1] 1 2 3

#$`2`
#[1] 1 3

#$`3`
#[1] 2 3

#$`4`
#[1] 2 3

A: Edit after comments:
apply(M, 1, function(i) which(i == 1))

# [[1]]
# [1] 1 2 3
#
# [[2]]
# [1] 1 3
#
# [[3]]
# [1] 2 3
#
# [[4]]
# [1] 2 3

Try this example:
#data
M <- matrix(c(1,1,0,0,1,0,1,1,1,1,1,1), 4)
#      [,1] [,2] [,3]
# [1,]    1    1    1
# [2,]    1    0    1
# [3,]    0    1    1
# [4,]    0    1    1

# index of rows with all ones
which(rowSums(M == 1) == ncol(M))
# [1] 1

# index of cols with all ones
which(colSums(M == 1) == nrow(M))
# [1] 3


text:
Q: Good enterprise-capacity, platform-nuetral file and program distribution systems? In an organization with hundreds of Windows and UNIX boxes what options exist to manage and distribute files and programs to the enterprise?  I have looked at Microsoft's SMS with some UNIX integration as well as BigFix.  If you have had experience with these would you call them good experiences?

A: Another one you might want to take a look at is Novell's Zen Configuration Management -- Advanced Edition. The Advanced edition includes the linux management pieces. I haven't used these personally, don't have nearly enough Linux in our environment to warrant it, but it deserves a look. Unfortunately, there are separate pieces for Windows and Linux distribution but at least they ship under the same SKU.

A: IBM Tivoli is multi-platform and will distribute files and applications. It is quite complex and pricey, but it is amazingly customizable.

A: I've used the KACE KBox pretty successfully at a prior job. It allows you to perform all sorts of Windows installations (similar to SMS), and allows for Linux/Unix and OS X installs as well. You can also do file replication, instead of running an installer. The KBOX also lets you do all sorts of interesting things like patch deployment and asset tracking. It can be expensive, but not as expensive as some solutions (so I hear), like Altiris. I should note that, no, I don't work for KACE, but I really did enjoy using their product. It made some tasks quite a breeze.


text:
Q: Proof variance from mean and overall are not covaried? Let $X_1, X_2,..., X_n$ be independent and identically distributed random variables
having variance $\sigma^2$
Show that $Cov [X_i − \bar{X},X] = 0$
So I get that $E[X_i - \bar{X}] = 0$, so all I'm left with proving is that $E[X_i − \bar{X},X] = 0$.
Here we assume that $X$ is $\sum_{i=1}^n{X_i}$

A: Use the fact that covariance is bilinear. Indeed,
\begin{align*}
\text{Cov}(X_i − \bar{X},X)
&=\text{Cov}(X_i,X)-\text{Cov}(\bar{X},X)\\
&=\sum_j\text{Cov}(X_i,X_j)-\frac{1}{n}\sum_i\sum_j\text{Cov}(X_j,X_i)\\
&=\sigma^2-\frac{1}{n}(n\sigma^2)=0\tag{1}.
\end{align*}
where we used the fact that the $X_i$ are independent and hence uncorrelated in (1).

A: So you want $C=E((X_j-X/n)X)$, where $X=\sum_{i=1}^nX_i$, where the $X_i$ are iid $N(0,1)$.   Well, $C= E(X_jX)-E(X^2)/n = \sigma^2 - n\sigma^2/n = 0$.  Because $EX_j X = E X_j^2$ and because $X\sim N(0,n\sigma^2)$.