text:
Q: Is there a way to abort the 'Payback' story mission? I started the story mission 'Payback' in Far Cry 4, however I would like to abort it because:

 I believe it will remove Yuma and weaken her fortress, and I would like to liberate the fortress at full strength

I have canceled missions before from the Escape menu, but this time my only options are: "Resume" and "Restart Mission":

I have tried:

*

*fast traveling

*starting a side quest (eg Kyrati racing)

*dying

*leaving the area

*exiting to menu

*exiting the game

*starting the game in online mode with the hope of inviting someone (anyone!) to the game, thereby disabling the campaign temporarily

Another user had this issue, but someone else reported that "Leave mission" works for them.
Is there something I have to do before I can leave the mission? I'm open to just about anything up to and including editing the save file*, if needed.

* Unfortunately I don't have a backup of the save, because it seems that Uplay keeps saves in its directory instead of %USERPROFILE% (harrumph).


text:
Q: Flutter firebase not able to display snapshot data due to object operator issues I am having trouble displaying data from a firebase cloud firestore linked to a flutter project.
I keep getting this error, and I see that it's a common occurrence in other projects. However, I am not sure how to fix it in my case. I see that some other projects involve specifying Map<String,dynamic> but I'm not sure how it applies for my code.
I keep getting this error of:

'The operator '[]' isn't defined for the type 'Object'.
Try defining the operator '[]'.'.

Here is my streambuilder.
The main issue lies in doc.data()!['itemname']. I have tried adding "as String" but it still doesn't work.
I know that once I fix one of the doc.data()!['itemname'] issue, the rest can be fixed by implementing the same solution.
StreamBuilder<QuerySnapshot>(
              stream: FirebaseFirestore.instance
                  .collection('transactions')
                  .doc(Provider.of<Login>(context, listen: false).email)
                  .collection('transactions')
                  .snapshots(),
              builder: (context, AsyncSnapshot<QuerySnapshot> snapshot) {
                if (!snapshot.hasData) {
                  return Center(
                    child: CircularProgressIndicator(),
                  );
                }
                return DataTable(
                  columns: [
                    DataColumn(
                      label: Text('Date'),
                    ),
                    DataColumn(
                      label: Text('Time'),
                    ),
                    DataColumn(
                      label: Text('Currency'),
                    ),
                    DataColumn(
                      label: Text('Item'),
                    ),
                    DataColumn(
                      label: Text('Amount'),
                    ),
                    DataColumn(
                      label: Text('Entry'),
                    ),
                    DataColumn(
                      label: Text('Comment'),
                    ),
                    DataColumn(
                      label: Text('Edit'),
                    ),
                    DataColumn(
                      label: Text('Delete'),
                    ),
                  ],
                  rows: snapshot.data!.docs.map((doc) {
                    return DataRow(
                      cells: [
                        DataCell(
                          Text(
                            DateFormat('MM-dd-yyyy')
                                .format(DateTime.parse(doc.data()!['date'])),
                          ),
                        ),
                        DataCell(
                          Text(
                            DateFormat('h:mm a')
                                .format(DateTime.parse(doc.data()['time'])),
                          ),
                        ),
                        DataCell(
                          Text(doc.data()!['currency'] as String),
                        ),
                        DataCell(
                          Text(doc.data()['item']),
                        ),
                        DataCell(
                          Text(doc.data()['amount']),
                        ),
                        DataCell(
                          Text(doc.data()['entry']),
                        ),
                        DataCell(
                          Text(doc.data()['comment']),
                        ),
                        DataCell(
                          IconButton(
                            icon: Icon(Icons.edit),
                            onPressed: () {
                              userSelectDate = DateFormat('yyyy-MM-dd')
                                  .format(DateTime.parse(doc.data()['date']));
                              userSelectTime = DateFormat('h:mm a')
                                  .format(DateTime.parse(doc.data()['time']));
                              userEntry = doc.data()['entry'];
                              userAmount = doc.data()['amount'];
                              commentTransaction = doc.data()['comment'];
                              Navigator.pushNamed(context, 'edit_transaction');
                            },
                          ),
                        ),
                        DataCell(
                          IconButton(
                            icon: Icon(Icons.delete),
                            onPressed: () {
                              FirebaseFirestore.instance
                                  .collection('transactions')
                                  .doc(
                                      Provider.of<Login>(context, listen: false)
                                          .email)
                                  .collection('transactions')
                                  .doc(doc.data()['id'])
                                  .delete();
                            },
                          ),
                        ),
                      ],
                    );
                  }).toList(),
                );
              },
            ),

Example of my data in firebase:

I appreciate any guidance and tips!
References:
After updating cloud firestore: The operator '[]' isn't defined for the type 'Object'. Try defining the operator '[]'
The operator '[]' isn't defined for the type 'Object? Function()'. Try defining the operator '[]'
The operator '[]' isn't defined for the type 'Object'. Try defining the operator '[]'. | Flutter | Firebase
FLUTTER The operator '[]' isn't defined for the type 'Object'

A: Try replacing Text(doc.data()['item'])
With:
Text(doc.get('item'))

redpajama_set_name: RedPajamaStackExchange


text:
Q: What is the newest linux kernel on EC2? What is the newest linux kernel on ec2? I want to make some tests on the newest kernel which I can find on EC2.
Do you know what is the newest linux kernel on EC2, and where can I find it?

A: Currently it is 3.2.30 in the 2012.09 version of Amazons Linux ami
Check out this page
http://aws.amazon.com/en/amazon-linux-ami/
If you launch a new instance this is the default ami used for the specific instance type.
After the machine has booted run a
sudo yum upgrade --assumeyes && sudo init 6

To ensure you got the latest patches
Edit:
Current update brings the 3.2 kernel at version 3.2.34 rev 55
===================================================================================
 Package              Arch        Version                 Repository          Size
===================================================================================
Installing:
 kernel               x86_64      3.2.34-55.46.amzn1      amzn-updates       9.1 M


text:
Q: Passing textbox value to Action After page loaded, user will give a value to textbox. I want to give that value as parameter to my Action. I am new to MVC and don't know how to do. I know that Html.Textbox name should be same as parameter but i'm conflicted about when i call that action, parameter will be empty so i will take parameter missing error.
This is my html:
@Html.TextBoxFor(x => x.EventID, new { id = "eventID" })

This is my action:
public ActionResult DownloadAttendeeExcel(int eventID)
        {
           return View();
        }

A: for helpers tie the value of the field to your model.  so if on your view you have
@model ViewModel

at the top and EventID is part of that model then change your controller to
public ActionResult DownloadAttendeeExcel(ViewModel model)...

and that will have that value of that text box.  Being an id you probably don't want the user to change it so in that case I would put that value in a hidden for
@Html.HiddenFor(x => x.EventID)

so the value passed to the view will be passed back to the controller


text:
Q: Dynamically creating a component from another component I am trying to create a cart that loads the items dynamically.
Sidebar Component .TS
@ViewChild('cartContainer', { read: ViewContainerRef }) public container;
public componentRef: ComponentRef<any>;

public createComponent(type: any) {
  this.container.clear();
  const factory: ComponentFactory<any> = this.resolver.resolveComponentFactory(CartComponent);
  this.componentRef = this.container.createComponent(factory);
  this.componentRef.instance.type = type;
  this.componentRef.instance.output.subscribe(event => console.log(event));
}

Sidebar Component .HTML
<ng-template #cartContainer></ng-template>

Cart Component .TS
export class CartComponent {
  @Input() public type = 'success';
  @Output() output = new EventEmitter();
}

Cart Component .HTML

Cart {{ type | json}}

  1x CRISTOMORADO MAIZMORADO KG

S/.7.00

  Remove

StoreItems Component .TS
constructor(private _sidebarComponent: SidebarComponent){}

private addItem(key: string, value: object) {
  this._sidebarComponent.createComponent(value);
}

StoreItems Component .HTML

<md-card class="item-card">

{{ Item.Item_Description }}

{{ MONEY_CHAR }}{{ Item.ITEM_Sale_Price | number : '1.2-2'}}

</md-card>

LayoutComponent .HTML
<app-sidebar></app-sidebar>

However, when I call addItem() and it calls createComponent(), it doesn't recognize my ViewChild()
Cannot read property 'clear' of undefined

What am I missing?

A: I have tried something like this and it's working fine for me
import { Directive, ViewContainerRef } from '@angular/core';

@Directive({
  selector: '[my-host]',
})
export class MyHostDirective {
  constructor(public viewContainerRef: ViewContainerRef) {
  }
}

import { Component, ViewChild, ComponentFactoryResolver } from '@angular/core';
export class YourComponent{
 @ViewChild(MyHostDirective) myHost: MyHostDirective;
ngAfterViewInit() {
    this.renderDynamicComponents();
  }

  renderDynamicComponents() {
    let component = this.widgetsStoreFactory.getWidgetComponent("ComponentName");
    let componentFactory = this._componentFactoryResolver.resolveComponentFactory(component);
    let viewContainerRef = this.myHost.viewContainerRef;
    viewContainerRef.clear();
    let componentRef = viewContainerRef.createComponent(componentFactory);
    (<IModel>componentRef.instance).YourProperty = "DataToPass";

  }
}

<ng-template my-host>

</ng-template>

Finally please add the dynamic components to the entryComponents of your module
https://angular.io/guide/dynamic-component-loader
https://fromjami.com/2017/06/26/load-components-dynamically-at-runtime-in-angular-4/


text:
Q: keys(window) does not return all members I need to generate a list of all events (MouseEvent, InputEvent, etc.). I was thinking I would do this by iterating over all members of window and testing for each of them, if they are events.
But I am having problems getting a list of these members. I thought I could use keys(window) but it does not return any of the events (fx MouseEvent), even though window.MouseEvent is defined.
I don't want a list of member names, I need a list of the members themselves. In a format like:
arr = [MouseEvent, InputEvent];

How do I get such a list?

A: This will show you all the on events (onmouseout etc). Is this what you were looking for?
function onThing() {
  return Object.keys(window).filter(function (el) {
    return el.substring(0, 2) === 'on';
  });
}

onThing();

DEMO


text:
Q: ValueError: Index contains duplicate entries, cannot reshape I'm trying to reshape my pd dataframe with the following function:
 ar = ar.pivot(index='Received', columns='Merch Ref', values='acceptance_rate')

The dataset looks like:
     Merch Ref            Received  acceptance_rate
0           SF 2014-08-28 15:38:00                0
1           SF 2014-08-28 15:44:00                0
2           SF 2014-08-28 16:04:00                0
3           WF 2014-08-28 16:05:00                0
4           WF 2014-08-28 16:07:00                0
5           SF 2014-08-28 16:34:00                0
6           SF 2014-08-28 16:55:00                0
7           BF 2014-08-28 17:59:00                0
8           BF 2014-08-29 15:05:00                0
9           SF 2014-08-29 21:25:00                0
10          SF 2014-08-30 10:29:00                0
...

What I'd like to obtain is:
                      SF WF BF
2014-08-28 15:38:00    0  1  0
2014-08-28 15:44:00    0  1  0
2014-08-28 16:04:00    0  0  1
2014-08-28 16:05:00    1  1  0
2014-08-28 16:07:00    0  0  1
2014-08-28 16:34:00    1  1  0
2014-08-28 16:55:00    1  1  0
2014-08-28 17:59:00    0  1  0
2014-08-29 15:05:00    0  0  1
2014-08-29 21:25:00    0  0  1
2014-08-30 10:29:00    0  1  0

However, I get the error:
 ValueError: Index contains duplicate entries, cannot reshape

This is because i have some orders placed at the same time. Is there a way to sum/aggregate these orders ?

A: Try to remove duplicate:
ar = ar.drop_duplicates(['Received','Merch Ref'])

it should work

A: As you identified, the error occurs from duplicates in pairs (x, y) for x in Received and y in Merch Ref.
If you would like to aggregate by sum then
ar.pivot_table(index='Received', columns='Merch Ref',
               values='acceptance_rate', aggfunc=np.sum)

. The default aggregation function is mean. That is,
ar.pivot_table(index='Received', columns='Merch Ref',
               values='acceptance_rate')

, will pivot the table and all entries with the same (x, y) pair will be aggregated with the np.mean function.
Remark: I initially received the same error, but after iterating through the (x, y) pairs I didn't find any duplicates. It turns out some of the pairs were of the form (nan, nan) and were omitted from the iteration process. Thus for other users trying to debug what they believe are unique pairs, consider checking for nans with pd.isnull or pd.notnull.

A: You should use crosstab.
Example:
pd.crosstab(index=ar.Recieved, columns=ar['Merch Ref'], aggfunc='count')


text:
Q: A noun for a country you live in and that's not your home country Suppose you are from country X, and had to travel to and live in a foreign country Y for a better life, leaving behind your family. I'm looking for a word with the meaning a foreign country you voluntarily [to exclude exile] live in

I've been living in [expatriation] for five years.

My understanding is that in this sentence, expatriation referes to a state rather than a physical place.

I hope my husband will return from [expatriation] soon.

I'm not sure this last sentence is correct with expatriation refering to a foreign country (place). What I'm particulary interested in is the phrase return from Y.
So, does expatriation work? any other word? Other words that I have a confused understanding of are exile, alienation and diaspora.

A: In formal contexts (e.g. immigration forms and other official documents), you can use the noun phrase country of residence.

A: You can refer to your new country as "adopted home" as the headline in this article suggests:

Refugee youth explore adopted home through photography

A: Abroad is the word you are looking for.

In or to a foreign country; away from your home.

It is widely used in expressions like:

I decided to study abroad for 2 years because it costs less money.
I enjoy living and working abroad because I meet new kinds of people every day!
I can't wait for my husband to return from his military operation abroad.

It also obviously works in both your example sentences, as per my previous examples (if you remove "in").

I've been living abroad for five years.
I hope my husband returns from abroad soon.

Update: Note that "abroad" is mostly used as an adverb, but can also be used as a noun, in expressions like "from abroad" as per my third example sentence and the OP's second example sentence.

A: As there is always more than one way to express a thought in English (with subtly different connotations), consider also the word sojournment:
•temporary residence, as of a stranger or traveller
Ex:

*

*"I've been living in sojournment for five years."

*"I hope my husband will return from sojournment soon."
Use of sojournment is more formal than, for instance, abroad, but carries the connotation of being a more business related than tourist related experience.

A: There is a single verb which can be used instead of return from Y in your example, repatriate:

to return to one's own country

So this would work:

I hope my husband will repatriate soon.


text:
Q: NetworkX Graph removing edges whose removal will not add bridges to the graph What is the most effective way to determine all edges in a graph that can be removed so that there will not arise new bridges in a given graph.
Currently I always copy the graph, remove an edge and check whether the bridges and number of bridges change. I repeat this for every edge and then return the list of edges. Choose one in the list and remove it.
When I want to remove several edges I repeat the whole process several times.
What would be a better/more efficient approach. (I always need the whole candidate list.)

A: I think you are looking for the edges that when removed give rise to all k-edge components with k=2.

*

*Search for all k-edge components in G using nx.algorithms.connectivity.edge_kcomponents.k_edge_components (with k=2). This will yield all vertex sets resulting from cuts with a cut size of 2.

*Induce a subgraph for each vertex set, and combine subgraphs using nx.compose into a graph H.

*Determine the difference between G and H with nx.difference(G, H).


text:
Q: Android: Auto Increment version code only on Release BuildType in Gradle I have read this topic: Autoincrement VersionCode with gradle extra properties
But it seems to increase the versionCode on every build (builds up a lot if you run debug version often).
Is there a way to tweak the answer so that VersionCode only increases when I build a release signed version in Android Studio?

A: For this solution is necessary a file version.properties.
in build.gradle:
def getVersionCode() {
    def propertiesFile = file('version.properties')

    if (!propertiesFile.canRead()) {
        throw new GradleException("Could not read " + propertiesFile.name)
    }

    Properties properties = new Properties()
    properties.load(new FileInputStream(propertiesFile))

    def code = properties['VERSION_CODE_PROD'].toInteger()

    gradle.taskGraph.whenReady { tasksGraph ->
        List<Task> tasks = tasksGraph.getAllTasks()

        for (Task task : tasks) {
            if (task.name.contains("Production")) {
                code = code + 1
                properties['VERSION_CODE_PROD'] = code.toString()
                properties.store(propertiesFile.newWriter(), null)
                break
            }
        }
    }

    return code
}

android {

    def code = getVersionCode()

    defaultConfig {
        ...
        versionCode code
        ...
    }
}


text:
Q: PhpStorm Git not connecting through the general proxy After set proxy at the general proxy setting of PhpStorm, ssh git not connecting and errors:

Ssh_exchange_identification: Connection closed by remote host Could not read from remote repository. Please make sure you have the correct access rights and the repository exists

But with the same settings, PyCharm works.
Git server is BitBucket.


text:
Q: Identify unknown ASN.1 Objects We searched for DER-encoded SEQUENCE's in an executable. After cherrpicking those, which looked like valid DER-encoded data, we wanted to analyse how they are used.
X.509 Certificates and CMS Objects were easy to recognize (since we are aware of them), but we also found valid encodings, from which we cant tell what they are used for.
E.g. Have a look at the following output of openssl asn1parse (...):

    0:d=0  hl=4 l=1804 cons: SEQUENCE
    4:d=1  hl=2 l=   1 prim:  INTEGER           :03
    7:d=1  hl=4 l=1797 cons:  SEQUENCE
   11:d=2  hl=2 l=  20 cons:   SEQUENCE
   13:d=3  hl=2 l=   8 prim:    OBJECT            :des-ede3-cbc
   23:d=3  hl=2 l=   8 prim:    OCTET STRING      [HEX DUMP]:0000000000000000
   33:d=2  hl=2 l=   3 prim:   PRINTABLESTRING   :<OMITTED>
   38:d=2  hl=2 l=  13 prim:   UTCTIME           :<OMITTED>
   53:d=2  hl=2 l=   1 prim:   INTEGER           :01
   56:d=2  hl=4 l=1748 cons:   SET
   60:d=3  hl=4 l= 830 cons:    SEQUENCE
   64:d=4  hl=2 l=   6 prim:     PRINTABLESTRING   :PKRoot
   72:d=4  hl=2 l=  13 prim:     UTCTIME           :<OMITTED>
   87:d=4  hl=2 l=   5 prim:     OBJECT            :1.3.36.2.5.1
   94:d=4  hl=4 l= 796 cons:     SEQUENCE
   98:d=5  hl=2 l=  69 cons:      SEQUENCE
  100:d=6  hl=2 l=  11 cons:       SET
  102:d=7  hl=2 l=   9 cons:        SEQUENCE
  104:d=8  hl=2 l=   3 prim:         OBJECT            :countryName
  109:d=8  hl=2 l=   2 prim:         PRINTABLESTRING   :<OMITTED>
  113:d=6  hl=2 l=  31 cons:       SET
  115:d=7  hl=2 l=  29 cons:        SEQUENCE
  117:d=8  hl=2 l=   3 prim:         OBJECT            :organizationName
  122:d=8  hl=2 l=  22 prim:         PRINTABLESTRING   :<OMITTED>
  146:d=6  hl=2 l=  21 cons:       SET
  148:d=7  hl=2 l=  19 cons:        SEQUENCE
  150:d=8  hl=2 l=   3 prim:         OBJECT            :commonName
  155:d=8  hl=2 l=  12 prim:         PRINTABLESTRING   :<OMITTED>
  169:d=5  hl=4 l= 614 cons:      SEQUENCE
  173:d=6  hl=2 l=   3 cons:       cont [ 0 ]
  175:d=7  hl=2 l=   1 prim:        INTEGER           :02
  178:d=6  hl=2 l=   1 prim:       INTEGER           :00
  181:d=6  hl=4 l= 290 cons:       SEQUENCE
  185:d=7  hl=2 l=  13 cons:        SEQUENCE
  187:d=8  hl=2 l=   9 prim:         OBJECT            :rsaEncryption
  198:d=8  hl=2 l=   0 prim:         NULL
  200:d=7  hl=4 l= 271 prim:        BIT STRING
  475:d=6  hl=2 l=  32 cons:       cont [ 1 ]
  477:d=7  hl=2 l=  30 cons:        SEQUENCE
  479:d=8  hl=2 l=  13 prim:         UTCTIME           :<OMITTED>
  494:d=8  hl=2 l=  13 prim:         UTCTIME           :<OMITTED>
  509:d=6  hl=2 l=  15 cons:       cont [ 2 ]
  511:d=7  hl=2 l=  13 cons:        SEQUENCE
  513:d=8  hl=2 l=   9 prim:         OBJECT            :sha256WithRSAEncryption
  524:d=8  hl=2 l=   0 prim:         NULL
  526:d=6  hl=4 l= 257 prim:       BIT STRING
  787:d=5  hl=2 l= 105 cons:      cont [ 0 ]
  789:d=6  hl=2 l= 103 cons:       SEQUENCE
  791:d=7  hl=2 l=  15 cons:        SEQUENCE
  793:d=8  hl=2 l=   3 prim:         OBJECT            :X509v3 Basic Constraints
  798:d=8  hl=2 l=   1 prim:         BOOLEAN           :255
  801:d=8  hl=2 l=   5 prim:         OCTET STRING      [HEX DUMP]:<OMITTED>
  808:d=7  hl=2 l=  37 cons:        SEQUENCE
  810:d=8  hl=2 l=   3 prim:         OBJECT            :X509v3 Subject Alternative Name
  815:d=8  hl=2 l=  30 prim:         OCTET STRING      [HEX DUMP]:<OMITTED>
  847:d=7  hl=2 l=  14 cons:        SEQUENCE
  849:d=8  hl=2 l=   3 prim:         OBJECT            :X509v3 Key Usage
  854:d=8  hl=2 l=   1 prim:         BOOLEAN           :255
  857:d=8  hl=2 l=   4 prim:         OCTET STRING      [HEX DUMP]:<OMITTED>
  863:d=7  hl=2 l=  29 cons:        SEQUENCE
  865:d=8  hl=2 l=   3 prim:         OBJECT            :X509v3 Subject Key Identifier
  870:d=8  hl=2 l=  22 prim:         OCTET STRING      [HEX DUMP]:<OMITTED>
  894:d=3  hl=4 l= 910 cons:    SEQUENCE
  898:d=4  hl=2 l=   4 prim:     PRINTABLESTRING   :Cert
  904:d=4  hl=2 l=  13 prim:     UTCTIME           :<OMITTED>
  919:d=4  hl=2 l=   5 prim:     OBJECT            :1.3.36.2.1.3
  926:d=4  hl=4 l= 878 cons:     SEQUENCE
  930:d=5  hl=4 l= 598 cons:      SEQUENCE
  934:d=6  hl=2 l=   3 cons:       cont [ 0 ]
  936:d=7  hl=2 l=   1 prim:        INTEGER           :02
  939:d=6  hl=2 l=   1 prim:       INTEGER           :00
  942:d=6  hl=2 l=  13 cons:       SEQUENCE
  944:d=7  hl=2 l=   9 prim:        OBJECT            :sha256WithRSAEncryption
  955:d=7  hl=2 l=   0 prim:        NULL
  957:d=6  hl=2 l=  69 cons:       SEQUENCE
  959:d=7  hl=2 l=  11 cons:        SET
  961:d=8  hl=2 l=   9 cons:         SEQUENCE
  963:d=9  hl=2 l=   3 prim:          OBJECT            :countryName
  968:d=9  hl=2 l=   2 prim:          PRINTABLESTRING   :<OMITTED>
  972:d=7  hl=2 l=  31 cons:        SET
  974:d=8  hl=2 l=  29 cons:         SEQUENCE
  976:d=9  hl=2 l=   3 prim:          OBJECT            :organizationName
  981:d=9  hl=2 l=  22 prim:          PRINTABLESTRING   :<OMITTED>
 1005:d=7  hl=2 l=  21 cons:        SET
 1007:d=8  hl=2 l=  19 cons:         SEQUENCE
 1009:d=9  hl=2 l=   3 prim:          OBJECT            :commonName
 1014:d=9  hl=2 l=  12 prim:          PRINTABLESTRING   :<OMITTED>
 1028:d=6  hl=2 l=  30 cons:       SEQUENCE
 1030:d=7  hl=2 l=  13 prim:        UTCTIME           :<OMITTED>
 1045:d=7  hl=2 l=  13 prim:        UTCTIME           :<OMITTED>
 1060:d=6  hl=2 l=  69 cons:       SEQUENCE
 1062:d=7  hl=2 l=  11 cons:        SET
 1064:d=8  hl=2 l=   9 cons:         SEQUENCE
 1066:d=9  hl=2 l=   3 prim:          OBJECT            :countryName
 1071:d=9  hl=2 l=   2 prim:          PRINTABLESTRING   :<OMITTED>
 1075:d=7  hl=2 l=  31 cons:        SET
 1077:d=8  hl=2 l=  29 cons:         SEQUENCE
 1079:d=9  hl=2 l=   3 prim:          OBJECT            :organizationName
 1084:d=9  hl=2 l=  22 prim:          PRINTABLESTRING   :<OMITTED>
 1108:d=7  hl=2 l=  21 cons:        SET
 1110:d=8  hl=2 l=  19 cons:         SEQUENCE
 1112:d=9  hl=2 l=   3 prim:          OBJECT            :commonName
 1117:d=9  hl=2 l=  12 prim:          PRINTABLESTRING   :<OMITTED>
 1131:d=6  hl=4 l= 290 cons:       SEQUENCE
 1135:d=7  hl=2 l=  13 cons:        SEQUENCE
 1137:d=8  hl=2 l=   9 prim:         OBJECT            :rsaEncryption
 1148:d=8  hl=2 l=   0 prim:         NULL
 1150:d=7  hl=4 l= 271 prim:        BIT STRING
 1425:d=6  hl=2 l= 105 cons:       cont [ 3 ]
 1427:d=7  hl=2 l= 103 cons:        SEQUENCE
 1429:d=8  hl=2 l=  15 cons:         SEQUENCE
 1431:d=9  hl=2 l=   3 prim:          OBJECT            :X509v3 Basic Constraints
 1436:d=9  hl=2 l=   1 prim:          BOOLEAN           :255
 1439:d=9  hl=2 l=   5 prim:          OCTET STRING      [HEX DUMP]:<OMITTED>
 1446:d=8  hl=2 l=  37 cons:         SEQUENCE
 1448:d=9  hl=2 l=   3 prim:          OBJECT            :X509v3 Subject Alternative Name
 1453:d=9  hl=2 l=  30 prim:          OCTET STRING      [HEX DUMP]:<OMITTED>
 1485:d=8  hl=2 l=  14 cons:         SEQUENCE
 1487:d=9  hl=2 l=   3 prim:          OBJECT            :X509v3 Key Usage
 1492:d=9  hl=2 l=   1 prim:          BOOLEAN           :255
 1495:d=9  hl=2 l=   4 prim:          OCTET STRING      [HEX DUMP]:<OMITTED>
 1501:d=8  hl=2 l=  29 cons:         SEQUENCE
 1503:d=9  hl=2 l=   3 prim:          OBJECT            :X509v3 Subject Key Identifier
 1508:d=9  hl=2 l=  22 prim:          OCTET STRING      [HEX DUMP]:<OMITTED>
 1532:d=5  hl=2 l=  13 cons:      SEQUENCE
 1534:d=6  hl=2 l=   9 prim:       OBJECT            :sha256WithRSAEncryption
 1545:d=6  hl=2 l=   0 prim:       NULL
 1547:d=5  hl=4 l= 257 prim:      BIT STRING

Does anybody recognize, which ASN.1 type maps to this?
Of course, there are some patterns (e.g. at offset 98 or 930) which are easy to recognize, but is there any "clever" way of identifying unknown ASN.1 structures?
Special Google search-patterns, websites, software, etc.?
We tried Google searches like * ::= SEQUENCE { * INTEGER } etc., with no success.

A: Look at this: http://www.oid-info.com/get/1.3.36.2.1
oid-info.com currently has over 950.000 OID's, but it has your OID in question up to the level 1.3.36.
Therefore, by querying this service starting from 1.3.36 will give you the that this OID is registered by
TeleTrusT - IT Security Association Germany

and querying with 1.3.36.2 will tell you that it is a
Security information object

and with 1.3.36.2.1 will tell you that this is a
Certificate

However, there is no information on 1.3.36.2.5.1 or 1.3.36.2.1.3, this is because it doesn't have to, because once 1.3.36 is registered by TeleTrust, they have overall ownership on the sub nodes.
I don't know if the registration office has a service to let you query among all registered OID's, but for now, odi-info has some 1 million OID's queryable.

A: To me, this dump looks like a sort of PKCS#7 message (but it is not PKCS#7). There is no universal way to bind raw data to arbitrary ASN object without ASN module. You may need to create your own tables, map raw data to them and see which table succeed. It is not that easy without knowing each message semantic (which is defined in the ASN module). If you are on Windows, you can try the following command:
certutil -dump path\fileWithUnknownAsn.ext
Certutil has several built-in tables to represent common X509 objects and, maybe, it shows you what is that.


text:
Q: Why does my trait definition compile with the 2015 edition but not with the 2018 edition? I wrote this simple program:
trait Command<T> {
    fn execute(&self, &mut T);
}

fn main() {
    let x = 0;
}

I compiled this with rustc --edition=2018 main.rs and get the error message:
error: expected one of `:` or `@`, found `)`
 --> main.rs:2:29
  |
2 |     fn execute(&self, &mut T);
  |                             ^ expected one of `:` or `@` here

Compiling via rustc --edition=2015 main.rs or rustc main.rs doesn't cause this error, although there are some warnings.
What's the problem with this code?

A: Anonymous trait parameters have been removed in 2018 edition: No more anonymous trait parameters.
Add _: before &mut T if you want to ignore the parameter:
trait Command<T> {
    fn execute(&self, _: &mut T);
}

Compiling with rustc main.rs works, because it defaults to --edition=2015.

Indeed, if you put your main.rs in a new Cargo project, then remove edition = "2018" from Cargo.toml, and run
cargo fix --edition

then Cargo will add the missing _: automatically. See Transitioning an existing project to a new edition.


text:
Q: Distribution of a sample generated from an AR(2) model Consider the autoregressive model of order 2 $$X_{t}=\varphi_1X_{t-1}+\varphi_2X_{t-2}+\varepsilon_t,$$
where $\varepsilon_t$ are zero-mean normally distributed random variables with $\sigma^2$ variance such that these random variables are uncorrelated. Suppose that we have a sample for the above model with sample size, let say, somewhere between 100 and 1000.
As a part of a simulation I would like to know something about the probability distribution of the data. Some examples I made using MATLAB suggests that some normal distribution produces an excellent fitting, which - at least in my opinion - makes sense because the white noise process in the model is normally distributed.
However I am not skilled in the topic. Is there any result in the literature which can give me a theoretical base for this suggestion (that a sample of the above AR(2) model is normally distributed if considered as values of some random variable rather than as a time-series)? If there is not any, then how can I support the good fitting of some normal distribution?

A: At stationarity, the AR(2) model above is centered normal and its covariance structure $c_n=E(X_tX_{t-n})$ is given by
$$
c_0=\frac{1-\varphi_2}{\Delta}\sigma^2,\qquad c_1=\frac{\varphi_1}{\Delta}\sigma^2,
$$
where
$$
\Delta=(1-\varphi_2)(1-\varphi_1^2-\varphi_2^2)-2\varphi_1^2\varphi_2,
$$
and, for every $n\geqslant2$,
$$
c_n=\varphi_1c_{n-1}+\varphi_2c_{n-2}.
$$


text:
Q: Directory Configuration in C# I would like to read from a htm file, that is located to the following directory:
C:\Users\**NAME**\AppData\Roaming\Microsoft\Signatures

How can I change the path, so that I can use it from another computer, where the user name is not equal to the one above?
DirectoryInfo directoryInfo = new DirectoryInfo(Environment.SpecialFolder.ApplicationData + @"Roaming\Microsoft\Signatures");

A: Environment.SpecialFolder is an enumeration, you need to call GetFolderPath to get the actual path.  Also ApplicationData includes the "Roaming" part, so you don't need that
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Microsoft\Signatures"

A: Try this:
  Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData,Environment.SpecialFolderOption.None) + @"\Microsoft\Signatures"

Check also the possibility of parameter Environment.SpecialFolderOption


text:
Q: Scrollviewer with stackpanel not working I'm quite new to WPF and I'm sure I'm missing something trivial.
The scrollviewer does not work when the content of the stackpanel grows.
<ItemsControl>
                <TextBlock Margin="30,4,0,4" Text="Associated Data: None" Visibility="{Binding SelectedPBL.PBLData.Count, Converter={StaticResource VisibleIfZero}}"/>
                <ScrollViewer>
                    <StackPanel Margin="30,4,0,4" Orientation="Horizontal" Visibility="{Binding SelectedPBL, Converter={StaticResource CollapsedIfNull}}" ScrollViewer.VerticalScrollBarVisibility="Auto">
                        <TextBlock FontSize="12" Text="Associated Data:" Visibility="{Binding SelectedPBL.PBLData.Count, Converter={StaticResource CollapsedIfZero}}"/>
                        <ItemsControl FontSize="12" ItemsSource="{Binding SelectedPBL.PBLData}" >
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <WrapPanel Margin="20,0,20,0" Orientation="Horizontal">
                                        <TextBlock Margin="0,0,10,0" Text="{Binding Path=Key, StringFormat=({0})}"/>
                                        <TextBlock Text="{Binding Path=Value}"/>
                                    </WrapPanel>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                </StackPanel>
                </ScrollViewer>
            </ItemsControl>

A: Try restricting the Height of your ItemsControl or ScrollViewer (e.g. add Height="200").  If the height is not restricted, the ScrollViewer will take as much room as it needs and will never see a reason to scroll.


text:
Q: UIView for video list I am a beginner of objective c, please forgive me if the question is too silly :P
In this stage, I just want to query videos from iphone library and pick the video to get their urls. I have added an UITextField and an UIActivityIndicatorView to the UIView. Now I want to create an area to add the videos. What UI should I use?
Here is my interface for now:
@interface videoProcessorViewController : UIViewController
{
    MPMediaQuery *mediaQuery;
    IBOutlet UITextField *feedBackText;
    IBOutlet UIActivityIndicatorView *activityIndicator;
    IBOutlet _____________? videoLibrary;
}
@end

A: You should use UITableView, which is the standard iOS control for showing a list of information.  It would probably be easiest to change your controller to a UITableViewController and move the feedBackText field into a tableHeaderView.
Here is a good tutorial to get you started: http://blog.teamtreehouse.com/introduction-to-the-ios-uitableviewcontroller


text:
Q: Is there anyway that I can remove encoded characters from xpath selector in scrapy? I require to scrape price from flipkart website but the price comes along special characters is there any possible solutions to avoid this
class StackSpider(Spider):
    name = "stack"
    allowed_domains = ["flipkart.com"]
    start_urls = [
     "https://www.flipkart.com/clothing-and-accessories/topwear/pr sid=clo%2Cash&otracker=categorytree&p%5B%5D=facets.ideal_for%255B%255D%3DMen",
    ]

def parse(self, response):
    original_price = response.xpath('//*[contains(concat( " ", @class, " " ), concat( " ", "_30jeq3",
                        " " ))]/text()').extract()
    item['original_price'] = original_price
    yield item

Example output: \u20b9399
Expected output : 399


text:
Q: trouble with email with one click I just launched my rails app with heroku (http://fast-reaches-9399.herokuapp.com/).  I want people to be able to type stuff in the textarea on the top, and then click the submit button, and then have it email me what is in the textarea.  I'm really having trouble with it though.  It redirects in the development environment, but doesn't seem to send an email.  And I get a 500 error in production.  Here's some relevant code...
application_controller.rb
class ApplicationController < ActionController::Base
  protect_from_forgery

  def email
    UserMailer.idea_bar(params[:message]).deliver
    redirect_to "/"  # how can I redirect to the page the user was just on?
  end
end

/mailers/user_mailer.rb
class UserMailer < ActionMailer::Base
  default from: "anonymous@collegeanswers.com", to: "info@collegeanswerz.com", subject: "collegeanswers"

  def idea_bar(message)
    mail(:body => message)
  end
end

application.html.erb (layout file)

Ideas, comments, questions, suggestions?  Help us help you!

        <%= form_tag("/application_controller/email", :method => "post", :id => "idea_bar_form") do %>
          <%= text_area_tag('message', nil, :size => "60x4", :id => "message", :name => "message") %>

          <%= label_tag(:email, "• include your email if you want a response:") %>
          <%= text_field_tag(:email, nil, :id => "email", :size => "36") %>

          <button id="submit" type="submit" form="idea_bar_form">Send

&#8226 one click
&#8226 anonymous</button>
        <% end %>

/user_mailer/idea_bar.html.erb (test file.  I want the email to be what's in the textarea, not this)

hello

/user_mailer/idea_bar.text.erb
hello

logs
~/collegeanswerz >>  heroku logs -n 100
2013-06-24T02:10:39.511211+00:00 app[web.1]: [2013-06-24 02:10:39] INFO  WEBrick::HTTPServer#start: pid=2 port=37425
2013-06-24T02:10:39.628181+00:00 heroku[web.1]: State changed from starting to up
2013-06-24T02:10:39.971477+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2013-06-24T02:10:41.046475+00:00 app[web.1]: [2013-06-24 02:10:41] ERROR SignalException: SIGTERM
2013-06-24T02:10:41.046475+00:00 app[web.1]:    /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/server.rb:98:in `select'
2013-06-24T02:10:46.399057+00:00 app[web.1]: Started GET "/" for 150.212.18.15 at 2013-06-24 02:10:46 +0000
2013-06-24T02:10:46.588166+00:00 heroku[router]: at=info method=GET path=/ host=fast-reaches-9399.herokuapp.com fwd="150.212.18.15" dyno=web.1 connect=1ms service=198ms status=200 bytes=14988
2013-06-24T02:10:46.547918+00:00 app[web.1]: Processing by StaticPagesController#home as HTML
2013-06-24T02:10:46.581761+00:00 app[web.1]:   Rendered static_pages/home.html.erb within layouts/application (3.8ms)
2013-06-24T02:10:46.584211+00:00 app[web.1]: Completed 200 OK in 36ms (Views: 35.8ms | ActiveRecord: 0.0ms)
2013-06-24T02:10:46.827096+00:00 heroku[router]: at=info method=GET path=/assets/home-73d942132cfdcc305dabf385494f8201.css host=fast-reaches-9399.herokuapp.com fwd="150.212.18.15" dyno=web.1 connect=1ms service=6ms status=200 bytes=1884
2013-06-24T02:10:46.814074+00:00 heroku[router]: at=info method=GET path=/assets/layout-eae006a3ffc93619e067580f95bb8a9a.css host=fast-reaches-9399.herokuapp.com fwd="150.212.18.15" dyno=web.1 connect=3ms service=10ms status=200 bytes=1643
2013-06-24T02:10:46.834802+00:00 heroku[router]: at=info method=GET path=/assets/application-e432bc54db845c729a762e0d298d3579.js host=fast-reaches-9399.herokuapp.com fwd="150.212.18.15" dyno=web.1 connect=2ms service=15ms status=200 bytes=156605
2013-06-24T02:10:47.262693+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=fast-reaches-9399.herokuapp.com fwd="150.212.18.15" dyno=web.1 connect=4ms service=6ms status=200 bytes=0
2013-06-24T02:10:49.760439+00:00 heroku[web.1]: Stopping remaining processes with SIGKILL
2013-06-24T02:10:49.760205+00:00 heroku[web.1]: Error R12 (Exit timeout) -> At least one process failed to exit within 10 seconds of SIGTERM
2013-06-24T02:10:52.386481+00:00 heroku[web.1]: Process exited with status 137
2013-06-24T02:15:55.505285+00:00 app[web.1]: Started GET "/" for 67.171.66.44 at 2013-06-24 02:15:55 +0000
2013-06-24T02:15:55.510268+00:00 app[web.1]: Processing by StaticPagesController#home as HTML
2013-06-24T02:15:55.512568+00:00 app[web.1]:   Rendered static_pages/home.html.erb within layouts/application (1.6ms)
2013-06-24T02:15:55.514297+00:00 app[web.1]: Completed 200 OK in 4ms (Views: 3.7ms | ActiveRecord: 0.0ms)
2013-06-24T02:15:55.518380+00:00 heroku[router]: at=info method=GET path=/ host=fast-reaches-9399.herokuapp.com fwd="67.171.66.44" dyno=web.1 connect=7ms service=23ms status=200 bytes=14988
2013-06-24T02:15:55.739788+00:00 heroku[router]: at=info method=GET path=/assets/layout-eae006a3ffc93619e067580f95bb8a9a.css host=fast-reaches-9399.herokuapp.com fwd="67.171.66.44" dyno=web.1 connect=3ms service=6ms status=200 bytes=1643
2013-06-24T02:15:55.786186+00:00 heroku[router]: at=info method=GET path=/assets/home-73d942132cfdcc305dabf385494f8201.css host=fast-reaches-9399.herokuapp.com fwd="67.171.66.44" dyno=web.1 connect=2ms service=5ms status=200 bytes=1884
2013-06-24T02:15:55.854372+00:00 heroku[router]: at=info method=GET path=/assets/application-e432bc54db845c729a762e0d298d3579.js host=fast-reaches-9399.herokuapp.com fwd="67.171.66.44" dyno=web.1 connect=3ms service=26ms status=200 bytes=156605
2013-06-24T02:19:33.509774+00:00 app[web.1]: Started GET "/colleges" for 150.212.18.15 at 2013-06-24 02:19:33 +0000
2013-06-24T02:19:33.513257+00:00 app[web.1]: Processing by StaticPagesController#colleges as HTML
2013-06-24T02:19:33.523421+00:00 heroku[router]: at=info method=GET path=/colleges host=fast-reaches-9399.herokuapp.com fwd="150.212.18.15" dyno=web.1 connect=2ms service=21ms status=304 bytes=0
2013-06-24T02:19:33.524174+00:00 app[web.1]: Completed 200 OK in 11ms (Views: 10.4ms | ActiveRecord: 0.0ms)
2013-06-24T02:19:33.522339+00:00 app[web.1]:   Rendered static_pages/colleges.html.erb within layouts/application (7.7ms)
2013-06-24T02:19:33.753391+00:00 heroku[router]: at=info method=GET path=/assets/application-e432bc54db845c729a762e0d298d3579.js host=fast-reaches-9399.herokuapp.com fwd="150.212.18.15" dyno=web.1 connect=2ms service=5ms status=304 bytes=0
2013-06-24T02:19:33.735957+00:00 heroku[router]: at=info method=GET path=/assets/layout-eae006a3ffc93619e067580f95bb8a9a.css host=fast-reaches-9399.herokuapp.com fwd="150.212.18.15" dyno=web.1 connect=2ms service=6ms status=304 bytes=0
2013-06-24T02:19:33.811360+00:00 heroku[router]: at=info method=GET path=/assets/colleges-7adcb0138796cf2dd39ad973ccd58699.css host=fast-reaches-9399.herokuapp.com fwd="150.212.18.15" dyno=web.1 connect=5ms service=6ms status=200 bytes=232
2013-06-24T02:19:33.972423+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=fast-reaches-9399.herokuapp.com fwd="150.212.18.15" dyno=web.1 connect=1ms service=6ms status=304 bytes=0
2013-06-24T02:19:35.619992+00:00 app[web.1]: Started GET "/university-of-pittsburgh" for 150.212.18.15 at 2013-06-24 02:19:35 +0000
2013-06-24T02:19:35.624209+00:00 app[web.1]:   Parameters: {"college"=>"university-of-pittsburgh"}
2013-06-24T02:19:35.624209+00:00 app[web.1]: Processing by CollegePagesController#college_page as HTML
2013-06-24T02:19:35.876371+00:00 app[web.1]:   Rendered college_pages/college_page.html.erb within layouts/application (20.9ms)
2013-06-24T02:19:35.878070+00:00 app[web.1]: Completed 200 OK in 254ms (Views: 50.0ms | ActiveRecord: 22.2ms)
2013-06-24T02:19:35.902402+00:00 heroku[router]: at=info method=GET path=/university-of-pittsburgh host=fast-reaches-9399.herokuapp.com fwd="150.212.18.15" dyno=web.1 connect=7ms service=289ms status=200 bytes=29578
2013-06-24T02:19:35.993171+00:00 heroku[router]: at=info method=GET path=/assets/college_pages-72b79bbce46f6e1c4a7b947a635cb3ef.css host=fast-reaches-9399.herokuapp.com fwd="150.212.18.15" dyno=web.1 connect=2ms service=8ms status=200 bytes=4711
2013-06-24T03:23:03.750562+00:00 heroku[web.1]: Idling
2013-06-24T03:23:06.124578+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2013-06-24T03:23:06.590444+00:00 app[web.1]:    /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/server.rb:98:in `select'
2013-06-24T03:23:06.590444+00:00 app[web.1]: [2013-06-24 03:23:06] ERROR SignalException: SIGTERM
2013-06-24T03:23:15.819421+00:00 heroku[web.1]: Stopping remaining processes with SIGKILL
2013-06-24T03:23:15.819273+00:00 heroku[web.1]: Error R12 (Exit timeout) -> At least one process failed to exit within 10 seconds of SIGTERM
2013-06-24T03:23:17.542955+00:00 heroku[web.1]: Process exited with status 137
2013-06-24T03:23:17.555718+00:00 heroku[web.1]: State changed from up to down
2013-06-24T04:43:11.725754+00:00 heroku[web.1]: State changed from down to starting
2013-06-24T04:43:11.725389+00:00 heroku[web.1]: Unidling
2013-06-24T04:43:15.022448+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 20121`
2013-06-24T04:43:19.525120+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-06-24T04:43:19.525120+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-06-24T04:43:28.871809+00:00 app[web.1]: => Call with -d to detach
2013-06-24T04:43:28.871809+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2013-06-24T04:43:28.871809+00:00 app[web.1]: => Rails 3.2.13 application starting in production on http://0.0.0.0:20121
2013-06-24T04:43:28.871809+00:00 app[web.1]: => Booting WEBrick
2013-06-24T04:43:28.871809+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-06-24T04:43:29.530107+00:00 app[web.1]: [2013-06-24 04:43:29] INFO  WEBrick 1.3.1
2013-06-24T04:43:29.530107+00:00 app[web.1]: [2013-06-24 04:43:29] INFO  ruby 1.9.3 (2013-05-15) [x86_64-linux]
2013-06-24T04:43:29.530878+00:00 app[web.1]: [2013-06-24 04:43:29] INFO  WEBrick::HTTPServer#start: pid=2 port=20121
2013-06-24T04:43:30.022925+00:00 heroku[web.1]: State changed from starting to up
2013-06-24T04:43:31.838145+00:00 app[web.1]: Started GET "/" for 150.212.13.47 at 2013-06-24 04:43:31 +0000
2013-06-24T04:43:32.678465+00:00 app[web.1]: Processing by StaticPagesController#home as HTML
2013-06-24T04:43:32.889354+00:00 app[web.1]:   Rendered static_pages/home.html.erb within layouts/application (31.0ms)
2013-06-24T04:43:32.932875+00:00 app[web.1]: Completed 200 OK in 254ms (Views: 246.6ms | ActiveRecord: 0.0ms)
2013-06-24T04:43:32.949968+00:00 heroku[router]: at=info method=GET path=/ host=fast-reaches-9399.herokuapp.com fwd="150.212.13.47" dyno=web.1 connect=2ms service=1132ms status=304 bytes=0
2013-06-24T04:43:53.901496+00:00 app[web.1]: Started GET "/" for 24.131.255.163 at 2013-06-24 04:43:53 +0000
2013-06-24T04:43:53.905840+00:00 app[web.1]: Processing by StaticPagesController#home as HTML
2013-06-24T04:43:53.918816+00:00 app[web.1]:   Rendered static_pages/home.html.erb within layouts/application (1.1ms)
2013-06-24T04:43:53.924969+00:00 app[web.1]: Completed 200 OK in 19ms (Views: 7.6ms | ActiveRecord: 0.0ms)
2013-06-24T04:43:53.927908+00:00 heroku[router]: at=info method=GET path=/ host=fast-reaches-9399.herokuapp.com fwd="24.131.255.163" dyno=web.1 connect=1ms service=44ms status=200 bytes=14988
2013-06-24T04:43:54.371502+00:00 heroku[router]: at=info method=GET path=/assets/layout-eae006a3ffc93619e067580f95bb8a9a.css host=fast-reaches-9399.herokuapp.com fwd="24.131.255.163" dyno=web.1 connect=4ms service=12ms status=304 bytes=0
2013-06-24T04:43:54.400418+00:00 heroku[router]: at=info method=GET path=/assets/home-73d942132cfdcc305dabf385494f8201.css host=fast-reaches-9399.herokuapp.com fwd="24.131.255.163" dyno=web.1 connect=3ms service=27ms status=304 bytes=0
2013-06-24T04:43:54.404305+00:00 heroku[router]: at=info method=GET path=/assets/application-e432bc54db845c729a762e0d298d3579.js host=fast-reaches-9399.herokuapp.com fwd="24.131.255.163" dyno=web.1 connect=1ms service=18ms status=304 bytes=0
2013-06-24T04:43:54.987065+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=fast-reaches-9399.herokuapp.com fwd="24.131.255.163" dyno=web.1 connect=2ms service=6ms status=304 bytes=0
2013-06-24T04:44:00.837309+00:00 app[web.1]: Started POST "/application_controller/email" for 24.131.255.163 at 2013-06-24 04:44:00 +0000
2013-06-24T04:44:00.845288+00:00 app[web.1]:   Parameters: {"utf8"=>"✓", "authenticity_token"=>"MubEQddsKvR/QBLZtZKCt8TF9EiUSHjSTpxtSB5mAhE=", "message"=>"testing", "email"=>""}
2013-06-24T04:44:00.845096+00:00 app[web.1]: Processing by ApplicationController#email as HTML
2013-06-24T04:44:00.946113+00:00 app[web.1]:
2013-06-24T04:44:00.946113+00:00 app[web.1]: Sent mail to info@collegeanswerz.com (16ms)
2013-06-24T04:44:00.946346+00:00 app[web.1]: Completed 500 Internal Server Error in 101ms
2013-06-24T04:44:00.948747+00:00 app[web.1]:
2013-06-24T04:44:00.948747+00:00 app[web.1]: Errno::ECONNREFUSED (Connection refused - connect(2)):
2013-06-24T04:44:00.948747+00:00 app[web.1]:   app/controllers/application_controller.rb:5:in `email'
2013-06-24T04:44:00.948747+00:00 app[web.1]:
2013-06-24T04:44:00.948747+00:00 app[web.1]:
2013-06-24T04:44:00.952511+00:00 heroku[router]: at=info method=POST path=/application_controller/email host=fast-reaches-9399.herokuapp.com fwd="24.131.255.163" dyno=web.1 connect=1ms service=126ms status=500 bytes=643
2013-06-24T04:44:13.657925+00:00 app[web.1]: Started POST "/application_controller/email" for 24.131.255.163 at 2013-06-24 04:44:13 +0000
2013-06-24T04:44:13.662188+00:00 app[web.1]: Processing by ApplicationController#email as HTML
2013-06-24T04:44:13.662374+00:00 app[web.1]:   Parameters: {"utf8"=>"✓", "authenticity_token"=>"MubEQddsKvR/QBLZtZKCt8TF9EiUSHjSTpxtSB5mAhE=", "message"=>"testing with test email", "email"=>"test email"}
2013-06-24T04:44:13.690119+00:00 heroku[router]: at=info method=POST path=/application_controller/email host=fast-reaches-9399.herokuapp.com fwd="24.131.255.163" dyno=web.1 connect=3ms service=42ms status=500 bytes=643
2013-06-24T04:44:13.690067+00:00 app[web.1]:   app/controllers/application_controller.rb:5:in `email'
2013-06-24T04:44:13.690067+00:00 app[web.1]:
2013-06-24T04:44:13.686636+00:00 app[web.1]:
2013-06-24T04:44:13.686636+00:00 app[web.1]: Sent mail to info@collegeanswerz.com (15ms)
2013-06-24T04:44:13.690067+00:00 app[web.1]: Errno::ECONNREFUSED (Connection refused - connect(2)):
2013-06-24T04:44:13.690067+00:00 app[web.1]:
2013-06-24T04:44:13.690067+00:00 app[web.1]:
2013-06-24T04:44:13.687154+00:00 app[web.1]: Completed 500 Internal Server Error in 25ms
~/collegeanswerz

A: You're likely seeing the connection refused error because you're not being allowed to connect to the local SMTP server on Heroku, which is not allowed.
You'll need to use an external SMTP service.  Heroku has plug-ins for several providers which offer external SMTP service listed on their addons page: (https://addons.heroku.com/#email-sms).  Each add-on provides instructions on how to configure your application
You could also use a standard mail service for which you have an account and configure it through ActionMailer.  You can try something like this in your config/environments/production.rb if you have a GMail account.
http://guides.rubyonrails.org/action_mailer_basics.html#example-action-mailer-configuration

A: From log supplied it's clear that you get an error because Rails ActionMailer is unable to connect to SMTP server. To debug this problem in production you can change config in development.rb to this:
config.action_mailer.raise_delivery_errors = true

so you will see mailer exceptions in development.
When you have exact error msg you can update log in question for further help.


text:
Q: angular2-date-picker - only current date-time is displayed I am using angular2-date-picker plugin in my angular project, I want to display current time - 5 minutes, so I've written modifyDate() in my component.ts file
component.ts:
      modifyDate() {
      let modifiedDate=new Date();
      modifiedDate.setMinutes(modifiedDate.getMinutes()-5);
      console.log("modified: "+modifiedDate);
      return modifiedDate;
     }

     //datetime picker
     startDate: Date =this.modifyDate();
     settings = {
     bigBanner: true,
     timePicker: true,
     format: 'dd-MM-yyyy hh:mm a',
     defaultOpen: false,
     closeOnSelect:false
};

there is component.html file :
    <angular2-date-picker class="form-control" id="datetimepicker" (onDateSelect)="onDateSelect($event)"  name="datetime" [(ngModel)]="startDate" [settings]="settings"></angular2-date-picker>

After building above code, in my DOM I get the next lines:

As you can see, in  tag,  ng-reflect-model has correct data assigned, but below, in  element, I get a current datetime anyway and therefore, in my application is displayed current time. can you suggest any solutions?

A: Unable to replicate the issue that you're facing. Maybe there is something missing to make it work...
relevant HTML:
<angular2-date-picker [(ngModel)]="date" [settings]="settings" name="angular-calendar" (onDateSelect)="onDateSelect($event)"
 ngDefaultControl></angular2-date-picker>

        Time from selection:  {{date | date:'EE, MMM d, y, H:mm:ss zzzz' }}

        minus 5 minutes: {{newVar}}

relevant TS:
import { Component } from '@angular/core';

@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  name = 'Angular 6';
  date = new Date();
  newVar: string = '';
  datePulled:boolean=false;
  settings = {
    bigBanner: true,
    timePicker: true,
    format: 'dd-MM-yyyy',
    defaultOpen: true
  }
  constructor() {
    /* Update #2 */
    if(!this.datePulled){
      let someVar = new Date(this.date);
      someVar.setMinutes(someVar.getMinutes() - 5);
      this.date = someVar;
      this.datePulled = true;
    }
  }
  onDateSelect(evt) {
    if(!this.datePulled){
      let someVar = new Date(this.date);
      someVar.setMinutes(someVar.getMinutes() - 5);
      /* Update #1 */
      this.date = someVar;
      this.newVar = someVar.toString();
      console.log(evt, ' & date:', this.newVar);
    this.datePulled = true;
    }
  }
}

complete working stackblitz here
update #1: as per requestor's comment, the original selected date is pulled back 5 minutes
update #2: as per requestor's comment, the date which is loaded on page load is also pulled back 5 minutes
update #3: as per requestor's comment, the timepicker is now set to true;


text:
Q: Is there a faster alternative to creating files then deleting them? I have ~100 XML files that  which I run through a python script. The script makes a subprocess call for each XML file.
I need to edit the XML file based on user input. Because I do not want to edit the original XML file (would show as changes when I push to my repo), I create a new XML file, copy the contents from the original XML file over, and add in the new param and then I make the subprocess call.
My program now takes much longer since I am creating/deleting files. Is there any way I can change my script to speed it up without editing the original XML file?
EDIT: I'm on Windows
Thanks!

A: One alternative is to use ramdisk.  You can copy file to ramdisk, edit it, run script against it and then delete.  In this case, the only I/O operations would be reading a file.
If you're running Linux, you can do:
mkdir /mnt/ramdisk
mount -t tmpfs -o size=512m tmpfs /mnt/ramdisk

Then use /mnt/ramdisk for your file operations.
If you're running Windows, you can use software such as ImDisk to create ramdisk.
Note: Using ramdisk can reduce I/O cost.  But first of all you need to make sure I/O is the bottleneck of your script performance.  Otherwise it won't help a lot.


text:
Q: What could potentially cause a line-height variance despite the same OS/browser/hardware configuration? I have a user who is experiencing an issue with a site that I am completely unable to replicate. They have reported that they are using a Macbook Pro Retina 15", and running the latest version of Safari and Yosemite.
I've tried to replicate this on every device I can get my hands on with no luck (including using the exact OS/browser/hardware combo they have). Cache has been cleared on their end, zoom level has been reset.
Here's the screenshot comparison: http://imgur.com/a/9URXs
Has anyone ever seen anything like this before? Is there some Safari default line-height setting I'm missing?
Thanks to anyone who can shed light on this freaky issue.


text:
Q: Why should we 'get a stable reference' in Kotlin/Android? I was reading Android CameraX codelab: https://codelabs.developers.google.com/codelabs/camerax-getting-started#4
The simplified code snippet is like this:
class MainActivity : AppCompatActivity() {
    private var imageCapture: ImageCapture? = null

    //(some other codes here...)

    private fun takePhoto() {
        // Get a stable reference of the modifiable image capture use case
        val imageCapture = imageCapture ?: return

        //(some other codes here...)

    }
}

In the codelab, it says:

First, get a reference to the ImageCapture use case.

Why do we need a new reference imageCapture in takePhoto()?
Can't we just use the imageCapture in MainActivity?
Is this for some kind of 'best practice' stuff or am I missing something?
Any advice would be greatly appreciated!

A: Its equivalent to a null check .
stable reference -> Not null reference

its similar to
if(imageCapture==null) return;

Also in the code lab they have mentioned the same thing.

First, get a reference to the ImageCapture use case. If the use case is null, exit out of the function. This will be null If you tap the photo button before image capture is set up. Without the return statement, the app would crash if it was null.

So basically you are removing the possibility of an NPE which can done in multiple ways and they happen to use a Another local variable for it . it can also be done with let.
imageCapture?.let{
 // code goes here
   }

A: private var imageCapture: ImageCapture? = null

With this line you are assigning null on imageCapture variable. Now, when you start using takePhoto() how will the compiler know that imageCapture is not null anymore?
As @ADM describes, you can use
imageCapture?.let{
  //your code goes here
}

if you want. This is basically making sure you don't call anything on a nullable object.


text:
Q: Having troubles targeting an h1 inside a div I have this part on my index.html page

EXAMPLE

I am trying to target the word 'EXAMPLE' in my main.css, but I am having troubles with it. Whatever I try, it seems to target the parent divs or not target it at all.
I have tried targeting:
.headertext .h1
.headertext h1
p h1
I basically tried every combination, but I can't achieve the effect I desire.
My goal is to have an image, then a black overlay with opacity on top of the image and then some text in the center of the page.
Thanks everyone!
edit: removed p tags around h1
edit2: I actually figured it out. There was margin-top added automatically to the h1. I am guessing it's a default in bootstrap? I set margin-top to 0 and it's working fine now. Thanks!

A: You can't use
 inside of
 as this is an invalid HTML. Although you can use an anchor or a span with a bigger font size.
Please try something like below.

.headertext h1 {
  color: green;
}

EXAMPLE

A: I actually figured it out. There was margin-top added automatically to the h1. I am guessing it's a default in bootstrap? I set margin-top to 0 and it's working fine now. Thanks!


text:
Q: How to remove overlapping between labels in ITK snap? I have 3 labels in for a 3D image. But one of the labels is also present (slightly) between the other two labels. Please refer the rough image below where I don't want the blue label to be present in between red and green labels ..rather I want to replace it with green label. I have been trying it solve this problem with ITK Snap and Convert3D software.
click here to view the image

A: If you don't mind using an other software, you could load the image in 3D Slicer (https://download.slicer.org/) and use the Segment editor to "identify the island" and then update the value of the segment associated with the thin blue one. See https://slicer.readthedocs.io/en/latest/user_guide/module_segmenteditor.html


text:
Q: DOMDocument not working I want to find all images in the html string like in the code below.
Why all results are null in this example (except node name which gives 'img')? I want to display the image html string for each image.
 $html = '<img src=\'dasdasdasd.jpg\' >';

$dom = new DOMDocument();
$dom->loadHTML($html);
$els = $dom->getElementsByTagName('img');

foreach ( $els as $el ) {
    $nodeName = strtolower($el->nodeName);
    $nodetext =  strtolower($el->textContent);
    $nodeval = strtolower($el->nodeValue);
        var_dump($nodeName);
        var_dump($nodetext);
        var_dump($nodeval);
}

A: Well, that node doesn't have any value or text...
What you want is the attribute:
$src = $el->getAttribute("src");
var_dump($src); //dasdasdasd.jpg

As commented, if you need the whole XML, you can use
$xml = $dom->savexml($el);
echo $xml;


text:
Q: How to do Query String in Firebase Hosting? I want to send userID from client to firebase on Query String.
I confirmed that I can set Query String on firebase Hosting URL.
But I don't know how to read Query String from React source.
How to do Query String in Firebase Hosting?
edit:2018/08/27 Add Detail
I use firebase Hostings, Storage, Database.
Now, I want to know client's userID from Hosting.
The reason why I don't want to use Database is that users who are now acsessing that userID can not be obtained directly from Hosting are not associated with user IDs.
So, I thought that I send client's userID to Hostingon Query String.


text:
Q: Using ICSharpCode.TextEditor on VB.NET I've integrated ICSharpCode.TextEditor into VB.NET and it run smoothly without error. But, I cannot find in properties window the property to enable or select the syntax highlighting features as well as intellisense. I don't have any experience with ICSTE, so please help me. Thanks you.

A: Here is code from my project
//Initialize HM
HighlightingManager.Manager.AddSyntaxModeFileProvider(new FileSyntaxModeProvider(AppDomain.CurrentDomain.BaseDirectory));

//Setup current Highlighter

IHighlightingStrategy highlighter = HighlightingManager.Manager.FindHighlighter("SQL");
txtQuery.Document.HighlightingStrategy = highlighter;

Ensure that file SQL.xshd exists in AppDomain.CurrentDomain.BaseDirectory
As for entellisense you should implement it mostly yourself using this code
private void ShowCompletionWindow(ICompletionDataProvider completionDataProvider, char ch)
        {

            try
            {
                codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow(
                    this,
                    codeEditorControl,
                    "<code>",
                    completionDataProvider,
                    ch);
                if (codeCompletionWindow != null)
                {
                    codeCompletionWindow.Closed += delegate
                                                    {
                                                        _blockKeys = false;
                                                    };

                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }

A: See this project on github : ICSharpCode.TextEditorEx and nuget : ICSharpCode.TextEditorEx
This version exposes a property SyntaxHighlighting which you can use on designer mode to set the syntax highlighting.


text:
Q: Select from DynamicNamed Table which is Based on Static Table's Data Once more I need help from all of u..
I have Unknown numbers of Dynamic Tables in SQL DataBase
Just like Below,
=>User_Master
UserCode UserName
aaa       AAA
bbb       BBB

=>aaa_EmailInfo
UserCode    EmailId
aaa       aaa@gmail.com
aaa       aaa1@gmail.com

=>bbb_EmailInfo
UserCode    EmailId
bbb       bbb@gmail.com
bbb       bbb1@gmail.com
bbb       bbb2@gmail.com

Declare @CheckEmail VARCHAR(500) = 'aaa@gmail.com'

SELECT

    User_Master.UserCode,

    (SELECT User_Master.UserCode+'_EmailInfo'.EmailId FROM User_Master.UserCode+'_EmailInfo') EmailId

FROM User_Master

Here,
User_Master is Static Table,
But aaa_EmailInfo and bbb_EmailInfo are Dynamically generated with Named on UsedCode..
Now i want to Check that @CheckEmail is Exist in Dynamic Tables on Not??
How is it Possible??
Can anyone Suggest me SELECT Query ???

A: You can use sp_executesql. The details are given HERE You can use COUNT(*) to determine if @CheckEmail exists in a table or not.
DECLARE @CheckEmail VARCHAR(500);
DECLARE @SQLString nvarchar(500);
DECLARE @ParmDefinition nvarchar(500);
DECLARE @Cnt int;

SET @CheckEmail = 'aaa@gmail.com';
SET @SQLString = N'SELECT @cntOUT = count(*)
   FROM User_Master.UserCode'+'_EmailInfo'+' WHERE EmailID = @CheckEmail';
SET @ParmDefinition = N'@CheckEmail VARCHAR(500), @cntOUT int OUTPUT';

EXECUTE sp_executesql @SQLString, @ParmDefinition, @cntOUT=@cnt OUTPUT;
SELECT @cnt;


text:
Q: Spinner Listener LiveData Issue In my Fragment, I have two Spinners.
Both are populated by LiveData which is observed in the ViewModel as below:

      // Observe Filtered ProductGroups and populate Spinner
        businessViewModel.filteredAppDataProductGroups.observe(viewLifecycleOwner, { productGroupArrayList ->
            if (!productGroupArrayList.isNullOrEmpty()){
                val adapter = ArrayAdapter(requireContext(), android.R.layout.simple_spinner_dropdown_item, productGroupArrayList)
                binding.inventoryAddEditProductGroupSpinner.adapter = adapter
            }
        })

// Observe Filtered ProductTypes and populate Spinner
        businessViewModel.filteredAppDataProductTypes.observe(viewLifecycleOwner, { productTypeArrayList ->
            if (productTypeArrayList != null){
                val adapter = ArrayAdapter(requireContext(), android.R.layout.simple_spinner_dropdown_item, productTypeArrayList)
                binding.inventoryAddEditProductTypeSpinner.adapter = adapter
            }
        })

This works fine, but I am trying to filter the data in the second Spinner based on the current selection of the first, by setting a listener and updating ViewModel data as below:

        binding.inventoryAddEditProductGroupSpinner.onItemSelectedListener = object: AdapterView.OnItemSelectedListener{

            override fun onItemSelected(parent:AdapterView<*>, view: View, position: Int, id: Long){

                val productGroupObject = parent.selectedItem as ProductGroupObject
                if (productGroupObject.productGroupID.isNotEmpty()){
                    businessViewModel.updateCurrentProductGroupVMLiveData(productGroupObject.productGroupID)
                }
            }

            override fun onNothingSelected(parent: AdapterView<*>){
            }
        }

Which updates the filtered list in the ViewModel as below:

    fun updateCurrentProductGroupVMLiveData (currentProductGroupId: String) {
        val newProductGroup = allAppDataProductGroups.value?.find { productGroup -> productGroup.productGroupID == currentProductGroupId }
        _currentProductGroup.value = newProductGroup
        if(newProductGroup?.productGroup != null) {
            val filteredProductsList = allAppDataProductTypes.value?.filter { productTypeObject -> productTypeObject.productGroup == newProductGroup.productGroup} as ArrayList<ProductTypeObject>
            _filteredAppDataProductTypes.value = filteredProductsList
        }
        Log.d(TAG, "updateCurrentProductGroupVMLiveData(): '_currentProductGroupId.value' updated ($currentProductGroupId)")
    }

However, if I add the code shown into onItemSelected, the app crashes and I see the following error:

    --------- beginning of crash
2021-10-06 23:06:34.740 17510-17510/com.xxxxx.acorn E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.locators.acorn, PID: 17510
    java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter view
        at com.xxxxx.acorn.business.inventory.InventoryAddEditFragment$setSpinnerListeners$2.onItemSelected(InventoryAddEditFragment.kt)
        at android.widget.AdapterView.fireOnSelected(AdapterView.java:931)
        at android.widget.AdapterView.dispatchOnItemSelected(AdapterView.java:920)
        at android.widget.AdapterView.-wrap1(AdapterView.java)
        at android.widget.AdapterView$SelectionNotifier.run(AdapterView.java:890)
        at android.os.Handler.handleCallback(Handler.java:751)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6077)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)

I'm seeing that the ViewModel list is changing, so I'm at a loss to why this is causing a NullPointerException.

A: Seems the error log pointing to view (at 3rd line)
java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter view

I think those parent: AdapterView<*> and view: View are nullable type.
Therefore need to add null safe call operator for that type
binding.inventoryAddEditProductGroupSpinner.onItemSelectedListener = object: AdapterView.OnItemSelectedListener{

         override fun onItemSelected(parent:AdapterView<*>?, view: View?, position: Int, id: Long){
            ...
         }

         override fun onNothingSelected(parent: AdapterView<*>?){
         }
     }

A: You can simplify and clean your code.
Just pass the selected position to your viewmodel
 override fun onItemSelected(parent:AdapterView<*>, view: View, position: Int, id: Long){
     businessViewModel.updateCurrentProductGroup(position)
}

And inside your viewmodel class write the main business logic. like the following
fun updateCurrentProductGroup(position: Int){
    // here you can do what you want
    // example
    val productGroupObject = filteredAppDataProductGroups.value[position]
    if (productGroupObject.productGroupID.isNotEmpty()){
            businessViewModel.updateCurrentProductGroupVMLiveData(productGroupObject.productGroupID)
    }
}


text:
Q: sysarticles system view - what does a status of 57 mean? I'm trying to work out why one article within a publication isn't replicating. I've scripted it out and confirmed the replication procs it's supposed to call are the correct ones, and have run a trace on the destination instance looking for those procs being called - no results.
Querying the sysarticles view in the published database, I noticed the article in question has a status of 57, whereas the rest of the articles have a status of 17.
Looking at msdb, http://msdn.microsoft.com/en-us/library/ms174970(v=sql.90).aspx, there are 5 bitwise values available: 1, 8, 16, 24, 64.
So it makes sense that the articles with status 17 are made up of 1 and 16 above.
But even if I add all bitwise values above excluding 64, I can't get a status value of 57. The max is 49.
Can anyone please explain to me what a status of 57 is, and whether it could be the cause of my article not replicating.
Thankfully this isn't on production, so I'm going to try and update the status manually, and if that doesn't work, take the table out of replication and add it again as its own publication.
But it would be good to understand what a status of 57 means.

A: I'm not sure what that status value means, but most of my articles are listed with status 57 and they are working just fine.
I'm guessing that there's a bitwise value of 32 which is missing (why else go from 16 to 64) and I'm guessing that 24 should actually be 32 as 24 isn't a valid bitwise value.
57 = 1+8+16+32

I'll see if I can get it confirmed that the 24 should actually be 32.


text:
Q: Independence is conversed under $\sigma$-spanning Let $(\Omega,F, \mathbb{P})$ be a probability space. Let $A$ and $(B_i)_{i\in I}$ be elements of $F$ such that $A$ and $B_i$ is independent for all $i\in I$.
Is it true that $A$ and $\sigma((B_i)_{i\in I})$ is independent (when $I$ is countable, uncountable)?
How can I prove this for a general case?

A: Independence is not conserved even when $I$ has two elements. Toss a fair coin twice. Let $A$ be the event that exactly one toss lands heads, let $B_1$ be the event that the first toss lands heads, and $B_2$ be the event that the second toss lands heads. You can check that
$$P(A\cap B_i) = \frac14=P(A)P(B_i)$$
for $i=1,2$. But the event $A$ is not independent of the event $B_1\cap B_2$, since
$$P(A)P(B_1\cap B_2) = \frac 12 \cdot\frac12\cdot\frac12$$
(since $B_1$ and $B_2$ are independent) while the event $A\cap B_1\cap B_2$ is empty. (This is an example of three events that are pairwise independent, but not mutually independent.)


text:
Q: Problems using Java Windowbuilder I've been working toward making a Java program with a simple GUI. After a bit of research I decided on using the plugin Windowbuilder. I followed instructions online step-by-step to set up the program, but after I finished I've been getting numerous errors about the import statements (and by extent the code).
To be clear, I made sure to install the plugin for eclipse before creating the program. Everything that has been listed was auto-generated.
/* These are the import statemements that
 * I believe are causing the issues.
 * Eclipse says the import "org" cannot be resolved. */

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

I'm not sure what the issue is here.
Is there another plugin that Windowbuilder requires?
I just want to experiment with visual programming.
P.S. please let me know if there is something else I should share to help diagnose and solve the issue.
Also, if there is a better/easier method to implement a primitive UI, a reference to that would be greatly appreciated!


text:
Q: Modify system date using Win32SetSystemTime in C# (only date, no hour, minute, second) Is possible to set the system time (using Win32SetSystemTime) without changing hour, minute and second (only year, month and day)?
Here is my code. As you can see, I commented falseData.Hour, falseData.Minute and falseData.Second because I don't want to change them. With this code, however, system time is automatically setted on 01:00:00.
Manually, I can change the system date without changing hour, minute and second (by clicking the clock of the taskbar), but programmatically?
Any help will be appreciated.
Thanks. Marco
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Runtime.InteropServices;

namespace SysData1_0
{
    public partial class Form1 : Form
    {
        public struct SystemTime
        {
            public ushort Year;
            public ushort Month;
            public ushort DayOfWeek;
            public ushort Day;
            public ushort Hour;
            public ushort Minute;
            public ushort Second;
            public ushort Milliseconds;
        };

        [DllImport("kernel32.dll", EntryPoint = "GetSystemTime", SetLastError = true)]
        public extern static void Win32GetSystemTime(ref SystemTime sysTime);

        [DllImport("kernel32.dll", EntryPoint ="SetSystemTime",SetLastError=true)]
        public extern static bool Win32SetSystemTime(ref SystemTime sysTime);

        public Form1()
        {
            InitializeComponent();
        }

        private void buttonImpostaDataFittizia_Click(object sender, EventArgs e)
        {
            SystemTime falseData = new SystemTime ();
            if (comboBox.SelectedIndex == 0)
            {
                falseData.Year = (ushort)2015;
                falseData.Month = (ushort)3;
            }

            if (comboBox.SelectedIndex == 1)
            {
                falseData.Year = (ushort)2014;
                falseData.Month = (ushort)9;
            }

            //Please, read here
            falseData.Day = (ushort)1;
            //falseData.Hour = (ushort)10 - 1;
            //falseData.Minute = (ushort)30;
            //falseData.Second = (ushort)30;
            Win32SetSystemTime(ref falseData);

            string Y,M,D;
            Y = Convert.ToString(falseData.Year);
            M = Convert.ToString(falseData.Month);
            D = Convert.ToString(falseData.Day);
            textBoxDataImpostata.Text = D + "/" + M + "/" + Y;
        }
    }
}

A: Actually, that's pretty easy to do, and you already have all the methods you need. Just get the current time before modifying it and injecting it back to the system:
var nowSystemTime = new SystemTime(); //dummy value so that the code compiles.

Win32GetSystemTime(ref nowSystemTime);

nowSystemTime.Year = (ushort)2015;
nowSystemTime.Month = (ushort)3;

Win32SetSystemTime(ref nowSystemTime);

Of course, if you go this way, make sure you don't spend to much time before injecting the system time back, or find a way to compensate!

A: All SystemTime fields are initialized to their type's default value at creation : 0 for ushort.
You actually set the date related values, but not the time related ones, which stay at 0.
I guess the 1 in hours is related to your time zone.
You should do something like :
falseData.Hour = DateTime.Now.Hour
falseData.Minute = DateTime.Now.Minute
falseData.Second = DateTime.Now.Seconds


text:
Q: Area of Plot in shiny using ggplot 2 Hi I am using the below code, I am using the plot at the bottom to filter the plot at the top
Sample Data :
headings :- ComplaintID;    Date Complaint Received;    Is Regulatory Complaint?;   Days Complaint is Open; Text Days Complaint is Open.
Values for each heading:-
973;    16-Nov; No; 0;  Complaints Open for 0 Days,
972;    16-Nov; No; 0;  Complaints Open for 0 Days,
971;    16-Nov; No; 0;  Complaints Open for 0 Days.
ui <- pageWithSidebar(

   # Application title
   headerPanel("Filter by month"),

   sidebarPanel(
         selectizeInput("YrMon",
                     "Filter by Month-Year:" ,
                     choices = unique(CCMS3$ccmsdate), "11-16", multiple = TRUE
                     ),

    radioButtons("Regcmp", "Regulatory Complaint :", choices = unique(CCMS3$Is.Regulatory.Complaint.),selected = 'No'),

         sliderInput(inputId="dayscmp", label="Days Complaint Open :", step=10,min = min(CCMS3$Days.Complaint.is.Open),max=max(CCMS3$Days.Complaint.is.Open),value = c(0,150))

   ),
      mainPanel(
         plotOutput("histPlt"),
         plotOutput("histplt2", click = clickOpts(id="flt",clip = FALSE), dblclick = "sm"),
         textOutput("asd")
         )
   )

server <- function(input, output) {

  library(dplyr)

  output$histPlt <- renderPlot({

  if(!is.even(length(input$flt)) & !is.null(input$flt))  {

  nwflt2 <- factor(CCMS$Text.Days.Complaint.is.Open)

  nwflt1 <- unique(nwflt2)

  nwflt <- nwflt1[round(input$flt$x)]

  ddd <- ({filter(CCMS3, Text.Days.Complaint.is.Open %in% nwflt & ccmsdate %in% input$YrMon & Is.Regulatory.Complaint. %in% input$Regcmp & Days.Complaint.is.Open %in% (input$dayscmp[1] : input$dayscmp[2]))})

  require(ggplot2)
  library(ggplot2)

  g <- ggplot(ddd, aes_string(x='ccmsdate'))

  plr <- g+geom_bar()+ylab("")+ggtitle("Number Of Complaints By Date")+xlab('Date(Year-Month)')+scale_x_discrete(labels= addline_format(c(unique(ddd$ccmsdate))),limits=c(unique(ddd$ccmsdate)))

  gg <- plr+theme(axis.text.x = element_text(size=10,colour="Blue",hjust=0.5,vjust=1),axis.ticks.y=element_blank(),panel.background=element_rect(fill="White",colour="Black"),panel.grid=element_blank())

  gg

   } else

     { ddd <- ({filter(CCMS3, ccmsdate %in% input$YrMon & Is.Regulatory.Complaint. %in% input$Regcmp & Days.Complaint.is.Open %in% (input$dayscmp[1] : input$dayscmp[2]))})

   require(ggplot2)
   library(ggplot2)

   g <- ggplot(ddd, aes_string(x='ccmsdate'))

   plr <- g+geom_bar()+ylab("")+ggtitle("Number Of Complaints By Date")+xlab('Date(Year-Month)')+scale_x_discrete(labels= addline_format(c(unique(ddd$ccmsdate))),limits=c(unique(ddd$ccmsdate)))

   gg <- plr+theme(axis.text.x = element_text(size=10,colour="Blue",hjust=0.5,vjust=1),axis.ticks.y=element_blank(),panel.background=element_rect(fill="White",colour="Black"),panel.grid=element_blank())

   gg     }})

output$histplt2 <- renderPlot({

  ddd <- ({filter(CCMS3, ccmsdate %in% input$YrMon & Is.Regulatory.Complaint.%in% input$Regcmp & Days.Complaint.is.Open %in% (input$dayscmp[1] : input$dayscmp[2]))})

  g2 <- ggplot(ddd, aes_string(x='Text.Days.Complaint.is.Open'))

  plr2 <- g2+geom_bar()+ylab("")+ggtitle("Number Of Complaints By Complaints Open")+xlab('Date(Year-Month)')+scale_x_discrete(labels= addline_format(c(unique(ddd$Text.Days.Complaint.is.Open))),limits=c(unique(ddd$Text.Days.Complaint.is.Open)))

  gg2 <- plr2+theme(axis.text.x = element_text(size=10,colour="Blue",hjust=0.5,vjust=1),axis.ticks.y=element_blank(),panel.background=element_rect(fill="White",colour="Black"),panel.grid=element_blank())

  gg2

  })
}

Now I am not able to reset the graph at the top again until I change the values in the filter. I want to create something where if the user clicks on the graph within the plotted area then it should be filtered else if it is outside the plotted area it should not be filtered and the graph at the top should also be unfiltered.
Any help is appreciated.


text:
Q: How to rotate a point cloud in xy plane?
I want to rotate a given point cloud into the xy plane. Therefore I fitted a plane through the pointcloud. This way I want to calculate the angles that need to be rotated to get the plane and also the pointcloud in xy-plane. The center of the plane is located in the orign. So i need to rotate around x- and y-axis. But I am not sure how to continue. Any Ideas?

Here is my code so far:
def fitPlaneLTSQ(df):
    (rows, cols) = df.shape
    G = np.ones((rows, 3))
    G[:, 0] = df['X']
    G[:, 1] = df['Z']
    Z = df['Y']
    (a, b, c),resid,rank,s = np.linalg.lstsq(G, Z)
    normal = (a, b, -1)
    nn = np.linalg.norm(normal)
    normal = normal / nn
    return (c, normal)

#load data
data = pd.read_csv('data.csv', sep=';')

# calc middle of cloud
meanx = np.mean(data['X'])
meany = np.mean(data['Y'])
meanz = np.mean(data['Z'])

#translate cloud to orign
data['X'] = data['X'] - meanx
data['Y'] = data['Y'] - meany
data['Z'] = data['Z'] - meanz

#calc plane
maxx = np.max(data['X'])
maxz = np.max(data['Z'])
minx = np.min(data['X'])
minz = np.min(data['Z'])

c, normal = fitPlaneLTSQ(data)
point = np.array([0.0, 0.0, c])
d = -point.dot(normal)

# compute needed points for plane plotting
xx, yy = np.meshgrid([minx, maxx], [minz, maxz])
z = (-normal[0]*xx - normal[1]*yy - d)*1. / normal[2]

A: I would say it is the rotation that aligns the normal of the pointcloud plane with normal of XY plane (which is Z or -Z).
Checkout here for the math on how to do that and here for some python code.


text:
Q: ERROR: Cannot install pytest-cov==2.12.1 and pytest<4.6 because these package versions have conflicting dependencies I want to install a project, before that i must install the requirement.txt, but there's a problem here
ERROR: Cannot install -r requirements.txt (line 15) and idna==3.1 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested idna==3.1
    requests 2.25.1 depends on idna<3 and >=2.5

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

requirement.txt:
certifi==2020.12.5
chardet==4.0.0
defusedxml==0.7.1
Django==3.2
django-mathfilters==1.0.0
idna==3.1
oauthlib==3.1.0
Pillow==8.2.0
psycopg2==2.8.6
psycopg2-binary==2.8.6
PyJWT==2.0.1
python3-openid==3.2.0
pytz==2021.1
reportlab==3.5.67
requests==2.25.1
requests-oauthlib==1.3.0
six==1.15.0
social-auth-app-django==4.0.0
social-auth-core==4.1.0
urllib3==1.26.4

i dont know how to solve this problem :/


text:
Q: Writing ArrayList of objects to textfile using filter (Disclaimer: I am not done writing the coding, so I have been using lousy names to
identify things.)
I have an ArrayList of PersonObjects called PersonIndex.
The parameters of the PersonObjects are as follows: Name, Age, Gender, Height.
What I am trying to do is process the list and depending on what the last name starts with, it gets written to a different text file.
Because it is in bad taste to try combining three write methods to one writer, I have three different ones which are then called into a single method.
That method is as follows:
public void fullWriteNames(){
    writeNamesA2K();
    writeNamesL2R();
    writeNamesS2Z();
}

I know the general layout of the writer method which is as follows:
String stopper = "stop";
    try{
        personWriter = new FileWriter(fileName2, true);
        personWriter.write(*stuff to write*);
        personWriter.close();
    }
    catch(IOException ioException){
        System.out.println("Error.");
    }

The issue I am having is how to use an if statement by the .write line to filter the objects. I know I need to use .startsWith, but otherwise I am clueless.
Any help would be appreciated. If there is any coding I left out here which would be relevant, please let me know.

A: Since characters are really just numbers, you could do something like this:
public void fullWriteNames() {
    char first = lastname.charAt(0);

    if (first >= 'A' && first <= 'K')
        writeNamesA2K();
    else if (first >= 'L' && first <= 'R')
        writeNamesL2R();
    else if (first >= 'S' && first <= 'Z')
        writeNamesS2Z();
}

I'm assuming here that the lastname variable is your PersonObject's last name.

A: You could use a regular expression to match a group
    List<String> names = new ArrayList<>(25);
    names.add("Apple");
    names.add("apple");
    names.add("bannas");
    names.add("Kings");
    names.add("Nov");
    names.add("Nov");
    names.add("Yak");

    for (String name : names) {
        if (name.matches("[A-Ka-k].*")) {
            System.out.println("[A-K] " + name);
        } else if (name.matches("^[L-Rl-r].*")) {
            System.out.println("[L-R] " + name);
        } else if (name.matches("^[S-Zs-z].*")) {
            System.out.println("[S-Z] " + name);
        }
    }

This might allow you to set up a write method which could take a "filter" parameter and make the decisions what to do based on the filter
public void writeToFile(List<Person> listOfNames, File fileToWrite, String filter) {
    ...
}

Which you could call using something like...
 writeToFile(listOfPeople, fileForGroupAToK, "[A-Ka-k].*");

Personally, though, I might be tempered to generate groups of lists based on the filter which might be a little faster then iterating over the entire list 3 times...but that's me ;)


text:
Q: Javascript hash table vs associative arrays I'm new to javascript and I cannot find answer about some issues, one is the following:
Why in js would be useful an hash table data structure when we can use objects as associative arrays that is simple to use and have a very good performance?

A:
why in js would be useful an hash table data structure when we can use
  objects as associative arrays that is simple to use and have a very
  good performance?

The only reason I can imaging to implement an hash table data structure is if you want to preserve the ordering of the elements. The for…in loop for objects doesn't guarantee to you in which order the properties ("keys") are returned, even if commonly you can obtain them in chronological order (last added, last returned). But it's not guarantee. For instance, old version of Opera returned the properties in an apparently random order. So, if you need an "ordered" hash table, you need to implement it by yourself.

A: A javascript hashtable and javascript associative array (and javascript objects) are all the same thing in the underline implementation. These are just different syntax.
So :
var a = {};
a.id = "aa";

is same as:
var a = new Object();
a.id = "aa";

Which is is same as:
var a = {};
a["id"] = "aa";

A: Associative arrays and hashtables are the same.
These expressions usually means the same too: dictionary, associative array, hashmap, map, hashtable and... the list goes on.
There is a difference between simple ARRAY and HASHTABLE though.
If you want to search an item in an array, the more items you have inside it, the longer will the search takes.
For example searching an item in an array with 10000 elements could takes 100 times longer than in an array with 100 elements.
With hashtables, no matter how many elements you have, the performance remains the same. (Be it 100 elements or even 99999999 elements...)


text:
Q: drupal form_state при ajax post запросе Есть стандартный запрос, типа
$.post('my_url',{'var1':'value1','var2':'value2'},function(data){
//обработка даты
}

И стандартная функция, которая ловит это дело:
function myfunc(){
  if(!empty($_POST['var1'])){
    //обработка поста
  }

}

Объявленная через коллбэк:
$items['my_url'] = array(
    'page callback' => 'myfunc',
    'access callback' => true,
    'type' => MENU_CALLBACK
);

Вопрос: как неправославный $_POST переписать через православный $form_state?
Пост приходит, форм стэйт, очевидно, пустой: формы-то соответствующей нет.
A: filter_xss(trim($_POST['var1']))

мне в помощь. И пост сразу станет православным.


text:
Q: Is there a notation for "open subset" I very often have to write something like:
$\exists U,V\subseteq M$ where $U,V$ are open, but there's no short hand for it. On my written notes, I do tend to write something like:
$\exists U,V\mathop{\subseteq}_\text{open}M$ is there a common short hand though?

Example of a short hand that exists
$\newcommand{\bigudot}{\mathop{\bigcup\mkern-14mu\cdot\mkern5mu}}$
$\newcommand{\udot}{\cup\mkern-11.5mu\cdot\mkern5mu}$
It is established already that $\bigudot$ means "union of sets that are pairwise disjoint", so if I write:
$\forall A\exists\mathcal{A}:A\subseteq\bigudot\mathcal{A}$ - or something - it is clear from the context that $\mathcal{A}$ is a family of pairwise disjoint sets
So my question is this:
Is there a notation for this already, like perhaps a $\subset$ with a dot in to mean "open subset"

A: Remember that a topological space $X$ is really a pair $(X,\mathcal{T})$ where $\mathcal{T}$ is a collection of "open" subsets of $X$. We often drop this cumbersome notation. But if you write, $U\in \mathcal{T}$, then it is clear you are talking about open sets.
For example, you can define continuity $f:X\to Y$ by saying,
$$ \forall U\in \mathcal{T}_Y, ~ f^{-1}(U) \in \mathcal{T}_X $$

A: I use $U \subseteq_{op}X$, but I writing "${op}$" underneath the subset symbol. Looks nice, quick to write, gets the message across. Three traits of good notation.


text:
Q: Get file name list in fileinfo list How can i get file name list from
List<FileInfo> FileInfoList;

by using LINQ? I want all file names in
List<string> FileNames;

list. I don't want to construct a foreach loop and don't want to add file names iteratively.

A: You can use the Select extension method:
List<string> FileNames = FileInfoList.Select(x => x.Name).ToList();

However, if you don't really need it to be a List<T>, you can probably take advantage of Linq's lazy-execution ability by simply omitting the ToList method:
IEnumerable<string> FileNames = FileInfoList.Select(x => x.Name);

Or if you prefer query syntax:
IEnumerable<string> FileNames = from x in FileInfoList select x.Name;

A: If you only want the FileNames in FileNames list, try:
FileInfoList.ForEach(x =>
            FileNames.Add(Path.GetFileName(x.FullName)));

If you want complete file paths in FileNames try
FileInfoList.ForEach(x =>
            FileNames.Add(x.FullName));


text:
Q: flask return pil generate image error, I can see the resize pictures but the response image is error I have flask api response picture:
FORMAT = {'image/jpeg':'JPEG', 'image/bmp':'BMP', 'image/png':'PNG', 'image/gif': 'GIF'}

@app.route('/api/image/<id>/<str_size>', methods=['get'])
def show_thumbnail(id, str_size):
    size = int(str_size)
    with get_db().cursor() as cur:
        cur.callproc('getimage', (id,))
        result = cur.fetchone()
        buf = BytesIO(result[1])
        if(size>0):
            im = Image.open(buf)
            im.thumbnail((size, size))
            buf = BytesIO(b'')
            im.save(buf, format=FORMAT[result[0].lower()])
        fw = open('w03.jpg', 'wb')
        fw.write(buf.getbuffer())
        fw.close()
        resp = Response(buf)
        resp.headers.set('Content-Type', result[0].lower())
    return resp

ps:
result[0] = 'image/jpeg'
result[1] is the bytes array of jpeg picture.
If I set the size(str_size) = 0, I mean I do not run PIL Image thumbnail code part. I can get the correct picture in response.
If I set the size(str_size) = 256 for instance, I find the 'w03.jpg' is correct and I can get the correct resize image, but the response is black for the reason is the image contains error.

A: im.save(buf) puts the buffer to the end.  You need to rewind this before building resp  Do this with buf.seek(0).  I suspect buf.getbuffer doesn't change the stream position in the same way, which would explain why w03.jpg is correct in the second test:
You can also use a with block to minimize some of the code (this auto closes the file):
        # ...
        with open('w03.jpg', 'wb') as fw:
            fw.write(buf.getbuffer())

        buf.seek(0)
        resp = Response(buf)
        # ...


text:
Q: How to differentiate legitmate URL redirects from ISP redirects or other hijacks I'm trying to use VBA to test URLs for bad links and redirects.
I'm able to obtain redirect URLs using HTTP request GET method for URLs that return a 3xx series .Status response using either MSXML2 or WinHttp libraries through VBA.
When I attempt this method for some URLs that have legitimate (intended by the URL site) redirects, I receive an error when trying to obtain the Request object.
For example, when this URL is entered into a browser:
http://www.teconnectivity.com
...the browser will ultimately arrive at this address:
http://www.te.com/en/home.html
However this VBA code will return  Error -2147012744: "The server returned an invalid or unrecognized response". The error is thrown on the .Send statement.
Sub Test()
   Debug.Print sGetRedirectURL("http://www.teconnectivity.com/")
End Sub

Private Function sGetRedirectURL(ByVal sURL As String) As String
 Dim oRequest As WinHttp.WinHttpRequest
 Dim sReturn As String

 Set oRequest = New WinHttp.WinHttpRequest

 On Error GoTo ErrProc
 With oRequest
   .Option(WinHttpRequestOption_EnableRedirects) = False
   .Open "GET", sURL, False
   .Send
   If Left$(.Status, 1) = "3" Then
      sReturn = .GetResponseHeader("Location")
   End If
 End With
 On Error GoTo 0

ExitProc:
 sGetRedirectURL = sReturn
 Exit Function

ErrProc:
 Debug.Print Err.Number & ": " & Err.Description
 Resume ExitProc
End Function

How is my browser able to get to the destination: http://www.te.com/en/home.html, if an HTTP request with that URL returns an error?
I can use the browser's application to get the final destination URL like this:
Function sGetFinalURL(sURL As String) As String
 Dim oAppIE As Object
 Dim sReturn As String

 Set oAppIE = CreateObject("InternetExplorer.Application")

 With oAppIE
   .Navigate sURL

   Do While .Busy
   Loop
   sReturn = .document.url
   .Quit
 End With
 Set oAppIE = Nothing

 sGetFinalURL = sReturn
End Function

However, that approach will also return URLs for ISP redirects or other hijacks.

A: The approach I ended up taking for this was to use the browser application to try to navigate to a non-existent domain URL. If the browser arrives at a URL, then that means it has been redirected by the ISP or something other than the non-existent domain.
Private Function sGetNXDomainRedirect() As String
'--attempts to return the domain used to redirect non-existant
'    domain urls. Used to distinguish legitimate redirects
'    from ISP redirects or other hijacks
'--returns "NoRedirect" if the bogus url is not redirected.

 Dim sReturn As String
 Dim oIEapp As Object
 Dim uTest As udtHttpInfo

 Const sBOGUS_URL As String = _
   "http://wwXYXw.NXDomainToTest"

 Set oIEapp = CreateObject("InternetExplorer.Application")

 With oIEapp
   .Navigate sBOGUS_URL

   Do While .Busy
   Loop

   On Error Resume Next
   sReturn = .document.Domain
   On Error GoTo 0
   .Quit
 End With

 Set oIEapp = Nothing

 If Len(sReturn) = 0 Then sReturn = "NoRedirect"
 sGetNXDomainRedirect = sReturn
End Function

Link to complete code on MrExcel.com forum
Once that "ISP Redirect" site is known, then the IE Application can be used to test for bad links or legitimate redirects. If the Navigation through the IE Application returns a domain other than the ISP Redirect domain, then I interpret that as a legitimate redirect.