text:
Q: Why does this set a compact? Consider the following set in $\mathbb{R}^n$:
$$S = \{ x \ :\ \|x\| = 1 \}$$
Why is this set a compact? I don't know about closed, but it doesn't look bounded to me.

A: HINT: $S$ is the boundary of a certain ball.

A: Of course it is bounded: a set $S$ is bounded if and only if there exist some $R>0$ such that $\| x \| \leq R$ for all $x \in S$. In your case, take $R=1$.
It is also closed because the norm is continuous, so your set is $\| \cdot \| ^{-1} (\{1\})$, the preimage of the set $\{1\}$, which is closed, and preimages of closed sets under continuous functions are themselves closed.

A: I think maybe OP is asking whether the $S^{n-1}$ corresponding to arbitrary norm $||•||$ is closed in the standard topology on $\mathbb{R}^n$.
This is true for an arbitrary norm $||•||$ on $\mathbb{R}^n$.
In general, in a finite-dimensional Banach space, every norm is equivalent.

A: Use Heine-Borel-Theorem to verify that $\mathbb{S} = \{x \in \mathbb{R}^{n} \colon \| x \| = 1\} \subset \mathbb{R}^n$ a $n-1$-dimensional sphere is compact.
The sphere is the inverse image of a one-point set under the continuous function $\| x \|$. Therefore, the sphere is closed. $\mathbb{S}$ is also bounded; therefore it is compact.

A: Do you know the Heine-Borel Theorem?

Heine-Borel Theorem. Let $K \subset \Bbb R^n$. Then $K$ is compact, if and only if $K$ is bounded and closed.

Now let'ts consider $$ S = \{ x \in \Bbb R^n \, : \, \Vert x \Vert = 1 \} \; \; .$$
Note, that $S = \partial \mathbb B(0, 1)$, i.e. $S$ is the boundary of the ball around the point $0 \in \Bbb R^n$ with radius $1$. Since $\partial \Bbb B(0, 1)$ is bounded and closed, $S$ is compact by Heine-Borel.

A: $S$ is representing a boundary and it is an inverse image continuous function $||x||$
Compact Set is a subset of a topological space if for every open cover of there exists a finite subcover of.


text:
Q: Bash to expect and back again I am creating a script to setup a series of computers. One of the apps to install is a mysql database. The bash script will call
sudo mysql_secure_installation

The expect script will have to respond to the questions that are output in sequence from this command, answers will be hardcoded and will be the same for all.
Questions and responses are
Enter current password for root (enter for none): Just press the Enter
Set root password? [Y/n]: Y
New password: Enter password
Re-enter new password: Repeat password
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]:  Y
Reload privilege tables now? [Y/n]:  Y

A: I recommend to try it first without expect:
echo -e '\nY\nfoobar\nfoobar\nY\nY\nY\nY' | sudo mysql_secure_installation

redpajama_set_name: RedPajamaStackExchange


text:
Q: Having issue to apply second div based CSS to clicked item in first Div I am very new to angular.Need some assistance with examples as well.
I have two div's . One is created with ng-repeat and have used ng-click to get the clicked item. I have another div below that which has CSS like
style="width:100px;
float:left;
margin-top:-30px;
margin-left:-100px;">
<img src="../../../path to image" in it.

Now I want to apply the below Css div to the ng-clicked item. What is the best way to that? If necessary please provide examples.  My code :

    {{p}}Spaces

Thanks in advance

A: From my understanding, you want modify the style of a sibling element when you click on the first div.
If that's the case, I suggest you "pack" your css rules in a class, let's say .selected-package.
The next steps would be to store the selected state in a variable (when you ng-click) and use the ng-class directive to toggle the selected-package css class upon the second div.
To wrap it up, here's a simple demo:

angular
  .module('fancyApp', [])
  .controller('fancyController', function($scope) {
    $scope.packages = [
      {name:'package 1'},
      {name:'package 2'},
      {name: 'package 3'}
    ];
  });
.selected-package {
  color: red;
}
[ng-click] {
  cursor: pointer;
}

My pacakges:

first div: {{p.name}}

second div (is red when you click on the first one)


text:
Q: On opening a Google Sheet, how can I activate the 1st empty cell in column1? Volunteers sign in for work by scanning a QR code on their ID cards. The scanned data is entered into a Google Sheet. When the sheet is opened each morning, the first volunteer has to remember to click on the first empty cell in column 1, before scanning his ID card.
How can I automate this, so when the sheet is opened the first empty cell in column 1 is activated/selected and ready for the first scan of the day?
I am very inexperienced with script for google apps. I tried modifying code I found online, but it won't run.
var sheet
var data

function onOpen(){
  var sheet = SpreadsheetApp.getActiveSheet();
  var data = sheet.DataRange().getValues();
  for (var i = 0;i < data.length;i++) {
    if (data[i][1] === "") {
       break;
    }
  }
  sheet.getrange(i+1, 2).activate();
}

The script doesn't run, but returns this error message.

TypeError: Cannot find function DataRange in object Sheet. (line 9,
  file "1st Open Cell, Column1"

A: Try:
function onOpen() {
  var sheet=SpreadsheetApp.getActiveSheet();
  sheet.getRange(1,sheet.getLastRow()+1,1,sheet.getLastColumn()).activate();
}

A: Here is the code I tested and worked as you want. I used getNextDataCell function [1] to find the last cell with data for column A, and then I used offset function [2] to get the next cell in the column A (empty cell).
function onOpen(){
  var sheet = SpreadsheetApp.getActiveSheet();
  //Find the last cell with data in that specific column (A in this case)
  var lastCell = sheet.getRange("A1").getNextDataCell(SpreadsheetApp.Direction.DOWN);
  //Activate the next cell
  lastCell.offset(1, 0).activate();
}

[1] https://developers.google.com/apps-script/reference/spreadsheet/range#getnextdatacelldirection
[2] https://developers.google.com/apps-script/reference/spreadsheet/range#offsetrowoffset-columnoffset


text:
Q: Oracle 11g Creating a custom event trigger how to Create a Database event trigger called as AuditErr that will fire every time a server error occurs. The
error refers to any Oracle error. This trigger can serve as a notification mechanism to an
administrator, by populating an error log table, called server_error_log (use the given SQL script).
You should create the error lag table before-hand and when an error happens, the error code and
details must be written back to this table.
CREATE TABLE server_error_log
(
    error_code decimal(6),
    description varchar2(256)
);

A: You'll have to create a database event trigger:

CREATE TRIGGER log_errors AFTER SERVERERROR ON DATABASE
   BEGIN
      // log error
   END;

In this trigger, you can use the attribute functions ora_server_error and ora_server_error_msg to retrieve the error stack.


text:
Q: check particular node is exist or not in XML using vbscript This is my XML file :
<ECSC>
   <ATTRIBUTES>
      <some part of attribute section>
   </ATTRIBUTES>
   <SCRIPT>
      <ETXML_LINE_TABTYPE>
         <some part of script section>
      </ETXML_LINE_TABTYPE>
   </SCRIPT>
   <PARAMETERS>
      <ETPAR_GUIX>
         <item>
            <PNAME>I_LANG</PNAME>
            <PTYP>I</PTYP>
            <PINDEX>0003</PINDEX>
            <PDATLEN>0128</PDATLEN>
            <PINTTYP>C</PINTTYP>
            <PINTLEN>000128</PINTLEN>
            <PDECIMALS>000000</PDECIMALS>
            <SORT_LNR>0001</SORT_LNR>
            <TAB_INDEX>0</TAB_INDEX>
         </item>
         <item>
            <PNAME>WE20_100_STEP_1</PNAME>
            <PTYP>X</PTYP>
            <PDESC>WE20 - SAPMSEDIPARTNER - 100</PDESC>
            <PINDEX>0009</PINDEX>
            <PGROUP>SAPGUI</PGROUP>
            <XMLREF_TYP>G</XMLREF_TYP>
            <PSTRUC_TYP>T</PSTRUC_TYP>
            <PREF_NAME>SAPGUI</PREF_NAME>
            <PDATLEN>0000</PDATLEN>
            <PINTLEN>000000</PINTLEN>
            <PDECIMALS>000000</PDECIMALS>
            <SORT_LNR>0001</SORT_LNR>
            <PREF_NAME2>SAPGUI</PREF_NAME2>
            <VALUE><VALUE></VALUE>
            <VAL_TYPE>T</VAL_TYPE>
            <TAB_INDEX>0</TAB_INDEX>
         </item>
         <item>
            <PNAME>V_LANG</PNAME>
            <PTYP>V</PTYP>
            <PINDEX>0007</PINDEX>
            <PGROUP>V.01</PGROUP>
            <PDATLEN>0128</PDATLEN>
            <PINTTYP>C</PINTTYP>
            <PINTLEN>000128</PINTLEN>
            <PDECIMALS>000000</PDECIMALS>
            <SORT_LNR>0002</SORT_LNR>
            <TAB_INDEX>0</TAB_INDEX>
         </item>
         <item>
            <PNAME>WE20_100_STEP_2</PNAME>
            <PTYP>X</PTYP>
            <PDESC>WE20 - SAPMSEDIPARTNER - 100</PDESC>
            <PINDEX>0010</PINDEX>
            <PGROUP>SAPGUI</PGROUP>
            <XMLREF_TYP>G</XMLREF_TYP>
            <PSTRUC_TYP>T</PSTRUC_TYP>
            <PREF_NAME>SAPGUI</PREF_NAME>
            <PDATLEN>0000</PDATLEN>
            <PINTLEN>000000</PINTLEN>
            <PDECIMALS>000000</PDECIMALS>
            <SORT_LNR>0002</SORT_LNR>
            <PREF_NAME2>SAPGUI</PREF_NAME2>
            <VALUE><VALUE></VALUE>
            <VAL_TYPE>T</VAL_TYPE>
            <TAB_INDEX>0</TAB_INDEX>
         </item>
         <item>
            <PNAME>I_AGENT</PNAME>
            <PTYP>I</PTYP>
            <PINDEX>0002</PINDEX>
            <PGROUP>I.03</PGROUP>
            <PDATLEN>0128</PDATLEN>
            <PINTTYP>C</PINTTYP>
            <PINTLEN>000128</PINTLEN>
            <PDECIMALS>000000</PDECIMALS>
            <SORT_LNR>0003</SORT_LNR>
            <TAB_INDEX>0</TAB_INDEX>
         </item>
         <item>
            <PNAME>WE20_100_STEP_3</PNAME>
            <PTYP>X</PTYP>
            <PDESC>WE20 - SAPMSEDIPARTNER - 100</PDESC>
            <PINDEX>0011</PINDEX>
            <PGROUP>GETGUI</PGROUP>
            <XMLREF_TYP>I</XMLREF_TYP>
            <PSTRUC_TYP>T</PSTRUC_TYP>
            <PREF_NAME>GETGUI</PREF_NAME>
            <PDATLEN>0000</PDATLEN>
            <PINTLEN>000000</PINTLEN>
            <PDECIMALS>000000</PDECIMALS>
            <SORT_LNR>0003</SORT_LNR>
            <PREF_NAME2>GETGUI</PREF_NAME2>
            <VALUE><VALUE></VALUE>
            <VAL_TYPE>T</VAL_TYPE>
            <TAB_INDEX>0</TAB_INDEX>
         </item>
         <item>
            <PNAME>I_TYPE</PNAME>
            <PTYP>I</PTYP>
            <PINDEX>0004</PINDEX>
            <PGROUP>V.04</PGROUP>
            <PDATLEN>0128</PDATLEN>
            <PINTTYP>C</PINTTYP>
            <PINTLEN>000128</PINTLEN>
            <PDECIMALS>000000</PDECIMALS>
            <SORT_LNR>0004</SORT_LNR>
            <TAB_INDEX>0</TAB_INDEX>
         </item>
         <item>
            <PNAME>WE20_100_STEP_4</PNAME>
            <PTYP>X</PTYP>
            <PDESC>WE20 - SAPMSEDIPARTNER - 100</PDESC>
            <PINDEX>0012</PINDEX>
            <PGROUP>GETGUI</PGROUP>
            <XMLREF_TYP>I</XMLREF_TYP>
            <PSTRUC_TYP>T</PSTRUC_TYP>
            <PREF_NAME>GETGUI</PREF_NAME>
            <PDATLEN>0000</PDATLEN>
            <PINTLEN>000000</PINTLEN>
            <PDECIMALS>000000</PDECIMALS>
            <SORT_LNR>0004</SORT_LNR>
            <PREF_NAME2>GETGUI</PREF_NAME2>
            <VALUE><VALUE></VALUE>
            <VAL_TYPE>T</VAL_TYPE>
            <TAB_INDEX>0</TAB_INDEX>
         </item>
         <item>
            <PNAME>V_AGENT</PNAME>
            <PTYP>V</PTYP>
            <PINDEX>0006</PINDEX>
            <PGROUP>I.02</PGROUP>
            <PDATLEN>0128</PDATLEN>
            <PINTTYP>C</PINTTYP>
            <PINTLEN>000128</PINTLEN>
            <PDECIMALS>000000</PDECIMALS>
            <SORT_LNR>0005</SORT_LNR>
            <TAB_INDEX>0</TAB_INDEX>
         </item>
         <item>
            <PNAME>WE20_100_STEP_5</PNAME>
            <PTYP>X</PTYP>
            <PDESC>WE20 - SAPMSEDIPARTNER - 100</PDESC>
            <PINDEX>0013</PINDEX>
            <PGROUP>GETGUI</PGROUP>
            <XMLREF_TYP>I</XMLREF_TYP>
            <PSTRUC_TYP>T</PSTRUC_TYP>
            <PREF_NAME>GETGUI</PREF_NAME>
            <PDATLEN>0000</PDATLEN>
            <PINTLEN>000000</PINTLEN>
            <PDECIMALS>000000</PDECIMALS>
            <SORT_LNR>0005</SORT_LNR>
            <PREF_NAME2>GETGUI</PREF_NAME2>
            <VALUE><VALUE></VALUE>
            <VAL_TYPE>T</VAL_TYPE>
            <TAB_INDEX>0</TAB_INDEX>
         </item>
         <item>
            <PNAME>V_TYPE</PNAME>
            <PTYP>V</PTYP>
            <PINDEX>0008</PINDEX>
            <PGROUP>V.03</PGROUP>
            <PDATLEN>0128</PDATLEN>
            <PINTTYP>C</PINTTYP>
            <PINTLEN>000128</PINTLEN>
            <PDECIMALS>000000</PDECIMALS>
            <SORT_LNR>0006</SORT_LNR>
            <TAB_INDEX>0</TAB_INDEX>
         </item>
         <item>
            <PNAME>WE20_100_STEP_6</PNAME>
            <PTYP>X</PTYP>
            <PDESC>WE20 - SAPMSEDIPARTNER - 100</PDESC>
            <PINDEX>0014</PINDEX>
            <PGROUP>SAPGUI</PGROUP>
            <XMLREF_TYP>G</XMLREF_TYP>
            <PSTRUC_TYP>T</PSTRUC_TYP>
            <PREF_NAME>SAPGUI</PREF_NAME>
            <PDATLEN>0000</PDATLEN>
            <PINTLEN>000000</PINTLEN>
            <PDECIMALS>000000</PDECIMALS>
            <SORT_LNR>0006</SORT_LNR>
            <PREF_NAME2>SAPGUI</PREF_NAME2>
            <VALUE><VALUE></VALUE>
            <VAL_TYPE>T</VAL_TYPE>
            <TAB_INDEX>0</TAB_INDEX>
         </item>
         <item>
            <PNAME>MSG_1</PNAME>
            <PTYP>X</PTYP>
            <PDESC>Rules for Message Check eCATT Command MESSAGE</PDESC>
            <PINDEX>0005</PINDEX>
            <PGROUP>MESSAGE</PGROUP>
            <XMLREF_TYP>M</XMLREF_TYP>
            <PSTRUC_TYP>T</PSTRUC_TYP>
            <PREF_NAME>ETMSG_DEF_TABTYPE</PREF_NAME>
            <PDATLEN>0000</PDATLEN>
            <PINTLEN>000000</PINTLEN>
            <PDECIMALS>000000</PDECIMALS>
            <SORT_LNR>0007</SORT_LNR>
            <PREF_NAME2>ETMSG_DEF_TABTYPE</PREF_NAME2>
            <VAL_TYPE>T</VAL_TYPE>
            <TAB_INDEX>0</TAB_INDEX>
         </item>
         <item>
            <PNAME>E_MSG_1</PNAME>
            <PTYP>X</PTYP>
            <PDESC>Collected Messages Before ENDMESSAGE</PDESC>
            <PINDEX>0001</PINDEX>
            <PGROUP>ENDMESSAGE</PGROUP>
            <XMLREF_TYP>N</XMLREF_TYP>
            <PSTRUC_TYP>T</PSTRUC_TYP>
            <PREF_NAME>ETMSG_RES_TABTYPE</PREF_NAME>
            <PDATLEN>0000</PDATLEN>
            <PINTLEN>000000</PINTLEN>
            <PDECIMALS>000000</PDECIMALS>
            <SORT_LNR>0008</SORT_LNR>
            <PREF_NAME2>ETMSG_RES_TABTYPE</PREF_NAME2>
            <VAL_TYPE>T</VAL_TYPE>
            <TAB_INDEX>0</TAB_INDEX>
         </item>
         <item>
            <PNAME>ZX_FI_FP_0569_MS07_COAS_FB_1</PNAME>
            <PTYP>X</PTYP>
            <PDESC>TF_FI_FP_FI_0569_MS07_CO_Search_Help_Internal_Orders_vTD0_1_</PDESC>
            <PINDEX>0015</PINDEX>
            <PGROUP>REF</PGROUP>
            <XMLREF_TYP>R</XMLREF_TYP>
            <PSTRUC_TYP>T</PSTRUC_TYP>
            <PREF_NAME>ZX_FI_FP_0569_MS07_COAS_FB01</PREF_NAME>
            <PDATLEN>0000</PDATLEN>
            <PINTLEN>000000</PINTLEN>
            <PDECIMALS>000000</PDECIMALS>
            <SORT_LNR>0009</SORT_LNR>
            <PREF_NAME2>ZX_FI_FP_0569_MS07_COAS_FB01</PREF_NAME2>
            <VAL_TYPE>T</VAL_TYPE>
            <TAB_INDEX>0</TAB_INDEX>
         </item>
      </ETPAR_GUIX>
   </PARAMETERS>
</ECSC>

I want to check in above XML file in <PARAMETER> tag nodeName <PGROUP> is exist or NOT..?
For example In <PARAMETER> tag for <PNAME>I_LANG</PNAME> item does not have tag or nodeName like <PGROUP> so in this situation VB script should display error.
For <PNAME>WE20_100_STEP_1</PNAME> the nodeName <PGROUP> tag is exist so this is correct  In this way I want to check for which <PNAME> the <PGROUP> tag is not exist.
I have tried following vbscript :
Dim oFS      : Set oFS      = CreateObject("Scripting.FileSystemObject")
Dim sFSpec   : sFSpec       =        oFS.GetAbsolutePathName("C:\sample.xml")
Dim objMSXML : Set objMSXML = CreateObject("Msxml2.DOMDocument")
objMSXML.setProperty "SelectionLanguage", "XPath"
objMSXML.async = False
objMSXML.load sFSpec
objMSXML.validateOnParse = True
counter=0
Set  NodeList =      objMSXML.documentElement.selectNodes("/ECSC/PARAMETERS/ETPAR_GUIX/item/PGROUP")
for each item in NodeList
myPNAME = objMSXML.getElementsByTagName("PNAME").item(counter).text
If (Left(myPNAME,1)="I") Then
    If objMSXML.getElementsByTagName("PNAME").item(counter).nodeName = "PGROUP" Then
        msgbox("PGROUP is exist for" &myPNAME)
    Else
        msgbox("PGROUP is NOT exist for" &myPNAME)
    End If
End If
counter=counter+1
  Next

Please help. Thank you in advance.

A: Using this XPath you'll get all <PNAME> which doesn't have corresponding <PGROUGP> :
/ECSC/PARAMETERS/ETPAR_GUIX/item[not(PGROUP)]/PNAME

This way you're sure that each item in NodeList must be without <PGROUP> :
Set NodeList = objMSXML.documentElement.selectNodes("/ECSC/PARAMETERS/ETPAR_GUIX/item[not(PGROUP)]/PNAME")


text:
Q: Duplicate ASIHTTPRequest.h using TWAnalyzerClient framework Hi I am using TWAnalyzerClient framework from TouchWizards to get heatmap data for my application. But when I import this framework to my project and do the recommended setup here I get a compiler message that ASIHTTPRequest.h is duplicated. Any idea why?

A: You have probably already been using ASIHTTPRequest in your app before installing TWAnalyzerClient. Thus you don't need to drag and drop ASIHTTPRequest again from the TWFramework Bundle. You only need to do it if you don't have it already. That's the most common error.


text:
Q: How to serialize a google::protobuf::Message directly into preallocated memory? If I call ByteSizeLong on a google::protobuf::Message object and I have a char* to a suitably sized block of preallocated memory (larger than msg.ByteSizeLong()), is there a way I can serialize the message directly into the memory without extra copying?

A: You can do:
msg.SerializeToArray(buffer, bufferSize);

Or, provided that you really did call ByteSizeLong() on the message, then this is a little bit faster:
msg.SerializeWithCachedSizesToArray((unsigned char*)buffer);

The second form requires that you really did call ByteSizeLong() (and did not change anything afterwards) as doing so will have stored cached sizes for all sub-objects.


text:
Q: Angular 2 Group array of objects by first letter I'm relatively new to Angular 2 and I need to sort/group an array of objects based on the first letter of their name. eg.:
{
   "type": "fruit",
   "name": "apple",
},
{
   "type": "fruit",
   "name": "banana",
},
{
   "type": "vegetable",
   "name": "broccoli",
},
{
   "type": "fruit",
   "name": "orange",
},

I would like it to show it like:

A

apple

B

banana

broccoli

O

orange

I found this post: How to group data in Angular 2 ?.
I tried it like:

{{name.charAt(0) | uppercase}}

...

I know i probably need a pipe, but i cant get it to work.
Hope someone can help

A: Hi have you tried maybe somthing like:
import { Pipe, PipeTransform } from '@angular/core';
/*
 * Raise the value exponentially
 * Takes an exponent argument that defaults to 1.
 * Usage:
 *   value | firstLetter:'a'
 * Example:
 *   {{ 'banana' |  firstLetter:'b'}}
 *
*/
@Pipe({ name: 'firstLetter' })
export class ExponentialStrengthPipe implements PipeTransform {
    transform(value: string, letter: string): string {
        if (!value || !letter) return value;
        return value.charAt(0).indexOf(letter) > -1 ? value : "";
    }
}

Maybe you can put more check on string value if as more than 1 char etc ..i just put an idea of custom pipe .. hope it help you

A: if you don't want to use pipe then you can use lodash for changing order of your array of objects.
_.sortBy(collection, [iteratees=[_.identity]])

Creates an array of elements, sorted in ascending order by the results of running each element in a collection thru each iteratee. This method performs a stable sort, that is, it preserves the original sort order of equal elements. The iteratees are invoked with one argument: (value).
Arguments
collection (Array|Object): The collection to iterate over.
[iteratees=[_.identity]] (...(Function|Function[])): The iteratees to sort by.
Returns
(Array): Returns the new sorted array.
Example
var users = [
  { 'user': 'fred',   'age': 48 },
  { 'user': 'barney', 'age': 36 },
  { 'user': 'fred',   'age': 40 },
  { 'user': 'barney', 'age': 34 }
];

_.sortBy(users, [function(o) { return o.user; }]);
// => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]

_.sortBy(users, ['user', 'age']);
// => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]

A: You can use this Pipe that groups the input array by the first letter:
@Pipe({
  name: 'firstLetterGroupBy'
})
export class FirstLetterGroupBy implements PipeTransform {

  transform(input: any, prop: string): Array<any> {

    if (!isArray(input)) {
      return input;
    }

    const arr: { [key: string]: Array<any> } = {};

    for (const value of input) {
      const field: any = getProperty(value, prop);

      const firstLetter = field.charAt(0).toUpperCase();

      if (isUndefined(arr[firstLetter])) {
        arr[firstLetter] = [];
      }

      arr[firstLetter].push(value);
    }

    return Object.keys(arr).map(key => ({ key, 'value': arr[key] }));
  }
}

and then:

   {{item.key}}

       {{v.name}}


text:
Q: Odoo 8, Pull and Push rules managment I have main warehouse with bar-code scanners
i have these statues
1-when receiving raw materials this steps should be done with bar-code scanner
A-Receiving B-Inspection C-Put Away(in stock)
2-when our branches request raw materials (raw materials always available in warehouse)
A-Picking(from stock) B-Packing C-Dispatching
there is also a POS per branch that should sell pizza
and the pizza has of course raw materials
so, can you guys help me with an example for the above situation how to manage routes,push and pull rules and defining warehouse with location
keeping in mind we have 41 branch and 1 warehouse
Second how to reduce raw materials upon selling pizza from current branch stock
and not sell pizza if stock does not have enough required raw materials
Thank You in Advance :)

A: In odoo v8 you can Have to first Activate configuration the advance Route. and then you can define the push-pull rule accordingly.
So,

step 1  Activate configuration the advance Route.

To Make such the setting you can go to the

Setting -> Warehouse-> Logistic & Warehouse and checkmark Manage advance Routes for your warehouse.

Step 2 Define the Push and pull rule.

To define the Push and pull rule you can go to
Warehouse ->  configuration ->  routs

For the more Example, you can check the below link
For v9
https://www.odoo.com/documentation/user/9.0/inventory/routes/concepts/use_routes.html
For v7
https://www.odoo.com/forum/help-1/question/pull-flow-and-push-flow-of-a-product-6888


text:
Q: Type 'string' is not assignable to type 'number' when creating color scale using d3.scaleQuantile I am trying to replicate this d3 heatmap in a React application (with TypeScript). However, the following code gives me the headache:
 const colorScale = d3.scaleQuantile()
     .domain([0, buckets - 1, d3.max(data, (d: any) => parseInt(d.value))])
     .range(colors);

colors is underlined with red, indicating the following error:

Type 'string' is not assignable to type 'number'

I wonder how I can mitigate this issue.

A: There are minor differences to the answer depending on the version of the scale module in use. The main solution, whatsoever, is not affected by that and applicable to all versions.
D3 v4 bundled
The example you linked to uses D3 v4 which depends on the d3-scale module v1.
If you look at the type definitions for d3.scaleQuantile() you will notice there are two definitions for its creation:
/**
 * Constructs a new quantile scale with an empty domain and an empty range.
 * The quantile scale is invalid until both a domain and range are specified.
 */
export function scaleQuantile(): ScaleQuantile<number>;

/**
 * Constructs a new quantile scale with an empty domain and an empty range.
 * The quantile scale is invalid until both a domain and range are specified.
 *
 * The generic corresponds to the data type of range elements.
 */
export function scaleQuantile<Range>(): ScaleQuantile<Range>;

Because you did not specify the generic Range type parameter the compiler defaults to the first definition inferring the type of your range to be a number and, hence, the error for your range containing strings.
This can easily be solved, though, by explicitly specifying the type of the scale's range, namely, string:
 const colorScale = d3.scaleQuantile<string>()  // Specify the type of the scale's range: <string>.
     .domain([0, buckets - 1, d3.max(data, (d: any) => parseInt(d.value))])
     .range(colors);

D3 v5 bundled
D3 v5 uses version 2 of the d3-scale module with only minor changes to the scale's type definitions.
d3-scale standalone
Be careful when using the type definition for d3-scale for the standalone module as they where created for the module's version 2.1.2. At the time of writing the latest standalone version is 3.1.0 which contains significant changes to the API! Alas, there are no type definitions available for that version.


text:
Q: How to compare two List in C# Automation - selenium using C#
We are reading a table which returns value in List<string[]>. We need to compare the values before and after an action performed, which should not affect the table content.
Is there a way to compare both
List<string[]> ExpRequestItemsWithSection

with
List<string[]> ActRequestItemsWithSection

Till now i was using below code and it works fine. But is there any other way to compare both the collections? Any idea of making this quicker and less resource intensive as i need to process a lot of lists?
bool isRequestsMatch = true;

for (int i = 0; i < ActRequestItemsWithSection.Count; i++)
{
  if (!((ActRequestItemsWithSection[i][0] == ExpRequestItemsWithSection[i][0]) &&
     (ActRequestItemsWithSection[i][1] == ExpRequestItemsWithSection[i][1])))
    isRequestsMatch = false;
}

PFB screenshot from Immediate window

A: Well, if order matters, i.e.
 {["A", "B"]} != {["B, A"]}   // A and B swapped within the array

and
 {                   {
  ["A", "B"],         ["C"],     // [A, B] and [C] arrays are swapped
  ["C"]        !=     ["A, "B"]
 }                   }

Then you can check equality with a help of Linq:
bool equals = (ExpRequestItemsWithSection.Count == ActRequestItemsWithSection.Count) &&
  ExpRequestItemsWithSection
    .Zip(ActRequestItemsWithSection, (left, right) => left.SequenceEqual(right))
    .All(item => item);

A: There is a System.Collections.StructuralComparisons.StructuralEqualityComparer, but for some obscure reason it is written in an ugly nongeneric way that makes it hard to use as a generic IEqualityComparer<>.
If you wrap it like this:
class GenericStructuralEqualityComparer<T> : EqualityComparer<T>
  where T : System.Collections.IStructuralEquatable
{
  public override bool Equals(T x, T y)
    => System.Collections.StructuralComparisons.StructuralEqualityComparer.Equals(x, y);

  public override int GetHashCode(T obj)
    => System.Collections.StructuralComparisons.StructuralEqualityComparer.GetHashCode(obj);
}

then you can do SequenceEqauls on the outer (List<>) level:
if (!
  ExpRequestItemsWithSection.SequenceEqual(ActRequestItemsWithSection,
    new GenericStructuralEqualityComparer<string[]>())
  )

Maybe prettier than the .Zip solution?

Addition: If you like .Zip, you can use StructuralEqualityComparer without a wrapping class:
if (
  ExpRequestItemsWithSection.Count != ActRequestItemsWithSection.Count
  ||
  ExpRequestItemsWithSection.Zip(ActRequestItemsWithSection,
    System.Collections.StructuralComparisons.StructuralEqualityComparer.Equals)
  .Contains(false)
  )

This uses the method group System.Collections.StructuralComparisons.StructuralEqualityComparer.Equals whose signature and return type is good enough for a Func<string[], string[], bool> which .Zip takes (tried with C# 7.3 compiler).

A: Maybe you are looking for this answer
if (a1.SequenceEqual(a2))


text:
Q: finite subgroup which group is infinite but all of its subgroups are finite?

A: Yes but the Tarski monsters were the first known finitely generated examples. It is
open whether there exist finitely presented groups with this property.


text:
Q: Block pop-ups from embedded iframe | Javascript I embeded an iframe on a page but when you click on the frame a pop up appears, I want to block this popups, I know I can do this job with sandbox, but I want to do it with code javascript or php
<iframe src="https://example.com"></iframe>

And I wanna some code that block all popups redirects in my page
Thanks in advance


text:
Q: Olingo Odata v4 - Generate types,sets and metadata from models I am working with JAVA + Olingo Odata v4 library and I was wondering if there is an easier way to "generate" entity types / entities / entitysets using annotations as it used to be the case as in v2 of the same library.
In my opinion manually "binding" entities several times (for the metadata as definition, for the set and for the separate entity as values ) is kinda strange and "not modernistic".
Maybe I am missing the point of it all, so I would be glad to read some opinions that will open my eyes.

A: Replicacia development platform does the same thing.
disclaimer: I am the founder. Replying this question as more than one person was checking for a solution to this problem.
I have implemented this feature of generating Odata v4 services with odata schema (edmx) OR Star UML file as input. It also generates SAPUI5/OpenUI5 layout code and integrates with Odata service. Other forms of input like Java POJOs/UML support is under development.
Although it is a paid service, I can offer at significantly low price as I am just getting started.
Check the website for more details.


text:
Q: Get a list of installed applications in android I'm trying to develop an application launcher application for android. I'm in the very beginning but I have a problem here: How do I get a list of all installed applications in android?

A: Use these methods in your activty to get a list of installed applications.
  private ArrayList<PackageInfoStruct> getPackages() {
        ArrayList<PackageInfoStruct> apps = getInstalledApps(false);
        final int max = apps.size();
        for (int i=0; i < max; i++) {
            apps.get(i);
        }
        return apps;
    }

    private ArrayList<PackageInfoStruct> getInstalledApps(boolean getSysPackages) {

        List<PackageInfo> packs = getPackageManager().getInstalledPackages(0);
        try{
            app_labels = new String[packs.size()];
        }catch(Exception e){
            Toast.makeText(getApplicationContext(),e.getMessage(),Toast.LENGTH_SHORT).show();
        }
        for(int i=0;i < packs.size();i++) {
            PackageInfo p = packs.get(i);
            if ((!getSysPackages) && (p.versionName == null)) {
                continue ;
            }
            PackageInfoStruct newInfo = new PackageInfoStruct();
            newInfo.appname = p.applicationInfo.loadLabel(getPackageManager()).toString();
            newInfo.pname = p.packageName;
            newInfo.versionName = p.versionName;
            newInfo.versionCode = p.versionCode;
            newInfo.icon = p.applicationInfo.loadIcon(getPackageManager());
            res.add(newInfo);

            app_labels[i] = newInfo.appname;
        }
        return res;
    }

A: I'd suggest you to atleast search stackoverflow before posting a question.
From a duplicate question :  via @karan
Following is the code to get the list of activities/applications installed on Android :
final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final List pkgAppsList = context.getPackageManager().queryIntentActivities( mainIntent, 0);

A: An updated solution based on COD3BOY's post above. I added the declaration of the struct. I should note also, maybe due to the large time gap between posts, that ArrayLists are accessed via arrList.get(i) instead of arrList[i].
First the imports...
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;

Then the functions...
public class PackageInfoStruct {
        String appname = "";
        String pname = "";
        String versionName = "";
        int versionCode = 0;
        Drawable icon;
        String datadir = "";
    }

private ArrayList<PackageInfoStruct> getInstalledApps(boolean getSysPackages) {

        List<PackageInfo> packs = getPackageManager().getInstalledPackages(0);
        ArrayList<PackageInfoStruct> res = new ArrayList<PackageInfoStruct>();

        for(int i=0;i < packs.size();i++) {
            PackageInfo p = packs.get(i);
            if ((!getSysPackages) && (p.versionName == null)) {
                continue ;
            }
            PackageInfoStruct newInfo = new PackageInfoStruct();
            newInfo.appname = p.applicationInfo.loadLabel(getPackageManager()).toString();
            newInfo.pname = p.packageName;
            newInfo.versionName = p.versionName;
            newInfo.versionCode = p.versionCode;
            newInfo.icon = p.applicationInfo.loadIcon(getPackageManager());
            res.add(newInfo);
        }
        return res;
    }


text:
Q: How to redirect post request from controller action? I have been integrating a payment gateway in Cakephp. Below are the versions used:

*

*Cakephp: 3.4.13

*PHP: 5.6.15
Problem:
I need to submit a form using POST request to payment gateway website but some fields contains confidential data(merchant id etc) so I cannot show them in the form. Otherwise someone can read them using developer tools(inspecting element). Also I need to add some custom fields before submit the form.
So I would like to redirect the user to payment gateway website with  required fields using POST request from the Controller's action.
I tried to find solution but couldn't succeeded. Found a similar question here but there is no answer. Is there any way to do the same in Cakephp 3.x?
Payment gateway form:
<?= $this->Form->create(false, ['url' => <URL>, 'id'=>'payForm']) ?>
<?= $this->Form->hidden('payment_notification_url', ['value'=> $this->Url->build('/payment/notify', true)]); ?>
<?= $this->Form->hidden('payment_redirect_url', ['value'=>$this->Url->build('/payment/getMoney', true)]); ?>
<?= $this->Form->hidden('merchant_id', ['value'=> <merchant_id>]); ?>
<?= $this->Form->hidden('reference', ['value'=> <reference>]); ?>
<?= $this->Form->hidden('email', ['value'=> <email>]); ?>
<?= $this->Form->hidden('fname', ['value'=> <first_name>]); ?>
<?= $this->Form->hidden('lname', ['value'=> <last_name>]); ?>
<?= $this->Form->hidden('address', ['value'=> <address>]); ?>
<?= $this->Form->hidden('town', ['value'=> <state>]); ?>
<?= $this->Form->hidden('country', ['value'=> <country>]); ?>
<?= $this->Form->hidden('postcode', ['value'=> <zipcode>]); ?>
<?= $this->Form->hidden('amount', ['class' => 'amount', 'value'=> <amount>]); ?>
<?= $this->Form->hidden('currency', ['value'=> 'US']); ?>

<?php echo $this->Form->end() ?>

A: Read the documentation this might help. You can submit a form to particular action then from there you can make http request using the below code.
For full documentation Http Client
use Cake\Http\Client;

$http = new Client();

// Simple get
$response = $http->get('http://example.com/test.html');

// Simple get with querystring
$response = $http->get('http://example.com/search', ['q' => 'widget']);

// Simple get with querystring & additional headers
$response = $http->get('http://example.com/search', ['q' => 'widget'], [
  'headers' => ['X-Requested-With' => 'XMLHttpRequest']
]);

To redirect to external url you can use this
$this->redirect('http://www.google.com');


text:
Q: How to enable drag for transparent AnchorPane? I need to make my bottom AnchorPane transparent, and I used below code to do that. It works, but after that I cannot move my application by drag?
Parent root = FXMLLoader.load(getClass().getResource("view/DashBoardForm.fxml"));
primaryStage.initStyle(StageStyle.TRANSPARENT);
Scene scene = new Scene(root);
scene.setFill(Color.TRANSPARENT);
primaryStage.setScene(scene);
primaryStage.show();

I cannot move application around the workspace; how can I fix it ?

A: You can see this example
    public class Demo extends Application {

    double x = 0;
    double y = 0;

    double sceneX = 0;
    double sceneY = 0;

    @Override
    public void start(Stage primaryStage) {
        var anchorPane = new AnchorPane();
        var button = new Button("button");
        var background = new Background(new BackgroundFill(Paint.valueOf("#FFB5C5"), new CornerRadii(15), new Insets(0)));
        anchorPane.setBackground(background);
        anchorPane.setBorder(new Border(new BorderStroke(Color.valueOf("#912CEE"), BorderStrokeStyle.SOLID, new CornerRadii(15), new BorderWidths(2), new Insets(0))));

        button.setOnMousePressed(event -> {
            x = event.getX();
            y = event.getY();
        });

        button.setOnMouseDragged(event -> {
            var sceneX = event.getSceneX();
            var sceneY = event.getSceneY();
            AnchorPane.setLeftAnchor(button, sceneX - x);
            AnchorPane.setTopAnchor(button, sceneY - y);
        });

        anchorPane.getChildren().add(button);
        AnchorPane.setTopAnchor(button, 100.0);
        AnchorPane.setLeftAnchor(button, 100.0);
        var scene = new Scene(anchorPane);
        scene.setFill(Paint.valueOf("#ffffff00"));

        scene.setOnMousePressed(event -> {
            sceneX = event.getSceneX() - primaryStage.getX();
            sceneY = event.getSceneY() - primaryStage.getY();
        });

        scene.setOnMouseDragged(event -> {
            primaryStage.setX(event.getScreenX() - sceneX);
            primaryStage.setY(event.getScreenY() - sceneY);
        });

        primaryStage.initStyle(StageStyle.TRANSPARENT);
        primaryStage.setScene(scene);
        primaryStage.setTitle("JavaFx");
        primaryStage.setWidth(800);
        primaryStage.setHeight(800);
        primaryStage.show();
    }
}

But I think there will be a better way


text:
Q: Can you read a CSV file as one column? I know this sounds silly, but is it possible to read a CSV file containing multiple columns and combine all the data into one column? Let's say I have a CSV file with 6 columns and they have different delimiters. Is it possible to read these files, but spit out the first 100 rows into one column, without specifying a delimiter? My understanding is that this isn't possible if using pandas.
I don't know if this helps, but to add context to my question, I'm trying to use Treeview from Tkinter to display the first 100 rows of a CSV file. The Treeview window should display this data as 1 column if a delimiter isn't specified. Otherwise, it will automatically split the data based on a delimiter from the user input.
This is the data I have:

This should be the result:

A: you can use

open('file.csv') as f: data=list(f.readlines())

to read file line by line

A: Pandas isn't the only way to read a CSV file.  There is also the built in csv module in the python standard lib as well as the basic builtin function open that will work just as well.  Both of these methods can generate single rows of data like your question indicates.
Using open function
filepath = "/path/to/file.csv"
with open(filepath, "rt", encoding="utf-8") as fd:
    header = next(fd)
    for row in fd:
        # .... do something with row data
        # row will be a string of all the data for a single row.
        # example: "Information,44775.4541667,MicrosoftWindowsSecurity,16384..."
        # then you can break at any time you want to stop reading.

or using the csv module:
import csv

reader = csv.reader(open("/path/to/file.csv", "rt", encoding="utf8"), delimeter=',')
header = next(reader)
for row in reader:
    # this time the row will be a list split by the delimiter which
    # by default is a comma but you can change it in the call to the reader

A: As other answers have explained, you can use various ways to read first n-lines of text from a file. But if you insist on using pandas then there is a trick you can use.
Find a character which will never appear in your text and use it as dummy delimiter to read_csv(), so that all text will be read as one column. Use nrows parameter to control number of lines to read:
pd.read_csv("myfile.csv", sep="~", nrows=100)


text:
Q: Linq to SQL DynamicInvoke(System.Object[])' has no supported translation to SQL I have a class, Users.
Users has a UserId property.
I have a method that looks something like this:
static IQueryable<User> FilterById(this IQueryable<User> p, Func<int, bool> sel)
{
   return p.Where(m => sel(m.UserId));
}

Inevitably, when I call the function:
var users = Users.FilterById(m => m > 10);

I get the following exception:

Method 'System.Object DynamicInvoke(System.Object[])' has no
  supported translation to SQL.

Is there any solution to this problem? How far down the rabbit hole of Expression.KillMeAndMyFamily() might I have to go?
To clarify why I'm doing this: I'm using T4 templates to autogenerate a simple repository and a system of pipes. Within the pipes, instead of writing:
new UserPipe().Where(m => m.UserId > 10 && m.UserName.Contains("oo") && m.LastName == "Wee");

I'd like to generate something like:
new UserPipe()
  .UserId(m => m > 10)
  .UserName(m => m.Contains("oo"))
  .LastName("Wee");

A: Let's take UserId as an example. You want to write:
new UserPipe().UserId(uid => uid > 10);

and want this to be the same as:
new UserPipe().Where(user => user.UserID > 10);

What you need to do is to take the expression tree of the first version and translate it to the second version.

So, first change the signature of UserId to accept an expression tree instead of a compiled lambda:
public static IQueryable<User> UserId(
    IQueryable<User> source, Expression<Func<int, bool>> predicate)

Then, write a method that converts the first expression tree to the second version. Let's have a look at the two expression trees:
Input:

        Lambda
         uid
          |
       BinaryOp
          >
    /            \
Parameter     Constant
   uid           10

Output:

         Lambda
          user
            |
        BinaryOp
            >
     /            \
 Property         Constant
  UserID             10
     |
Parameter
   user

As you can see, all you need to do is take the body of the lambda, recursively replace all occurrences of the parameter uid with the property UserIdon the parameter user and create a new lambda expression with the transformed body and the parameter user.
You can use an ExpressionVisitor to do the replacement.

A: Thanks to dtb, here's what I came up with:
public class ExpressionMemberMerger : ExpressionVisitor
{
    MemberExpression mem;
    ParameterExpression paramToReplace;

    public Expression Visit<TMember, TParamType>(
        Expression<Func<TParamType, bool>> exp,
        Expression<Func<TMember, TParamType>> mem)
    {
        //get member expression
        this.mem = (MemberExpression)mem.Body;

        //get parameter in exp to replace
        paramToReplace = exp.Parameters[0];

        //replace TParamType with TMember.Param
        var newExpressionBody = Visit(exp.Body);

        //create lambda
        return Expression.Lambda(newExpressionBody, mem.Parameters[0]);
    }

    protected override Expression VisitParameter(ParameterExpression p)
    {
        if (p == paramToReplace) return mem;
        else return base.VisitParameter(p);
    }
}

Now, I can convert the predicate, methinks, with something like the code below. I've done a wee bit of testing on this code; it seems to be working, but I'd be interested to hear any comments/concerns:
static IQueryable<User> FilterById(this IQueryable<User> p, Expression<Func<int, bool>> sel)
{
   var merger = new ExpressionMemberMerger();

   Expression<Func<User, int>> mem = m => m.UserId;

   var expression = (Expression<Func<User, bool>>)merger.Visit(sel, mem);

   return p.Where(expression);
}

A: At first glance, it looks like you're building some expressions that Linq isn't going to know how to translate into T-SQL.
I might be misunderstanding what you're trying to do, but if you want to build chain-able expressions that Linq To Sql can understand, I'd highly recommend looking at the PredicateBuilder extensions here. Even if it's not exactly what you want, understanding how it works could give you some insight on what you need to achieve under the covers to make what you're doing work.


text:
Q: Unexpected INSERT ... SET query behavior I have a table where I need to store two id's from another table. While doing some debugging I noticed some strange behavior of SQL.
Example of wrong sql:
INSERT INTO follower_list set `followerUserId` = '3' AND `followingUserid` = '4'

The above query was inserting the zero's as value in DB. I studied the query closer and realized I had made a mistake of putting and in place of ,. The real query I need to fulfill my purpose is:
INSERT INTO table SET col1 = '3' , col2 = '4'

Which worked as I expected. My question is related to the first (incorrect) query - since it executed and is syntactically correct, where would queries like it be used?

A: The reason why the INSERT statement doesn't generates syntax error and it is also working is because MySQL implicitly (one thing I don't like in MySQL :D) parses the statement as boolean expression.
In your INSERT statement, only followerUserId column is updatable because the rest are part of the boolean expression. The query was evaluated as:
INSERT INTO follower_list SET followerUserId = ('3' and (followingUserid='4'))

*

*SQLFiddle Demo (SELECT statement)
here:
followerUserId = ('3' and (followingUserid='4')) // assuming followingUserid <> 4
followerUserId = ('3' and (0))
followerUserId = 0

another,
followerUserId = ('3' and (followingUserid='4')) // assuming followingUserid = 4
followerUserId = ('3' and (1))
followerUserId = 1      // will only return zero if one of the values is zero


text:
Q: regexp.test() returns boolean but not on 'if' statement - always evaluates to I am working on a standalone interface.
I have several text boxes, and all have Names and IDs.
If I run this code:
var re = /someregexp/g;
var k ="sometext";

textBoxOne.setText(re.test(k)); //textBoxOne was selected first

The correct result 'true' or 'false' is displayed.
asking for a 'typeof(re.test(k))' correctly returns boolean.
However this code:
if (re.test(k)) {
  textBoxTwo.setText("matched.");
} else {
  textBoxTwo.setText("NOT matched.");
}

Always goes into the 'else' branch. if (re.test(k) == true) renders the same result.
Looks like a bug to me, anyone else also found this?

A: Edit: AdamL has pointed out (thanks Adam), in his comments below, that there is more to this than I supposed. I leave my original code below for reference.
The myFunction2() below follows the "matched" branch as you would expect a correctly working regex (so perhaps this can be used to work around the bug):
function myFunction2() {
  var k ="sometext";

  Logger.log(  /ome/g.test(k)  );
  if ( /ome/g.test(k)  ) {
    Logger.log("matched.");
  } else {
    Logger.log("NOT matched.");
  }
}

Conversely, as you have observed, the myFunction() below unexpectedly follows through to the "NOT matched" branch.
function myFunction() {
  var re = /ome/g;
  var k ="sometext";

  Logger.log(re.test(k));

  if (re.test(k)) {
    Logger.log("matched.");
  } else {
    Logger.log("NOT matched.");
  }
}


text:
Q: vb6, Call entry point of dynamically load dll, last step I want to load a dll dynamically and call a function of this dll (VB6).
The function "getservice" takes 2 Longs and returns a Long (it is an ID for a service).
So far I have the lines:
Private Declare Function LoadLibrary Lib "kernel32" ...
Private Declare Function GetProcAddress Lib "kernel32" ...

Dim lib_timing As Long
Dim pa_getservice As Long

lib_timing = LoadLibrary("l:\abc\runtime\mvc_timing.dll)
pa_getservice = GetProcAddress(lib_timing, "getservice")

Now, I do not know how to call the getservice function of lib_timing
call pa_getservice ??? or
call .. (..)

I have seen the stackoverflow question number 1667397, but I do not understand the last part, how I can use this for my call.
I now have - from GetProcAddress - this long. But what do I do with this long in order to call the function of my own dll?
Thanks alot in advance for all helpful information
Wolfgang

A: Assuming that the DLL you are calling does not support COM and thus late binding to it my solution to problems like this is to write a small .NET wrapper DLL that does support COM interop to VB6 and then call the wrapper from VB. you can then choose to late or early bind like this.
This question has a suitable answer.

A: I found the solution to my question on
http://www.xtremevbtalk.com/archive/index.php/t-227349.html
If it is a standard DLL (you'll notice you can't reference it if you attempt to)
then you'll have to use LoadLibrary, GetProcAddress to get a function pointer.
Since VB has no good means of calling a function pointer, you'd then pass that
pointer off to a dll in a language that can call one.


text:
Q: App crashes with intent method my app crash every time when I try to use the intentmethod.
MainActivity.java
package de.kwietzorek.fulcrumwebview;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    String selected;
    Spinner spinner;
    WebView myWebView;

    /* Menu */
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle item selection
        switch (item.getItemId()) {
            case R.id.add_server:
                Intent intent = new Intent(this, AddIP.class);
                this.startActivity(intent);
                return true;
            case R.id.menu_refresh:
                myWebView.reload();
                return true;
            default:
                return true;
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //WebView
        myWebView = (WebView) findViewById(R.id.webView);
        myWebView.setWebViewClient(new WebC());
        WebSettings webSettings = myWebView.getSettings();

        //JavaScript enable
        webSettings.setJavaScriptEnabled(true);

        //Server name spinner
        ArrayList<String> server_name_list = getIntent().getStringArrayListExtra(
                "int_new_server_name");

        spinner = (Spinner) findViewById(R.id.server_spinner);

        ArrayAdapter<String> server_adapter = new ArrayAdapter<String>(this,
                android.R.layout.simple_spinner_item, server_name_list);

        server_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter(server_adapter);

        spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

            public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {

                selected = parent.getItemAtPosition(pos).toString();

                myWebView.loadUrl(selected);
            }

            public void onNothingSelected(AdapterView<?> parent) {

            }
        });
    }

    //WebVie Client
        public class WebC extends WebViewClient {

        @Override
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            super.onReceivedError(view, errorCode, description, failingUrl);

        }
    }
}

AddIP.java
package de.kwietzorek.fulcrumwebview;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import java.util.ArrayList;

public class AddIP extends AppCompatActivity {

    Button btn_back, btn_add;
    EditText server_ip, server_name;
    String new_server_ip, new_server_name;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.add_ip);

        server_ip = (EditText)this.findViewById(R.id.edit_server_address);
        server_name = (EditText)this.findViewById(R.id.edit_server_name);

        /* Back Button */
        btn_back = (Button)findViewById(R.id.btn_back);
        btn_back.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                Intent intent = new Intent(getApplicationContext(), MainActivity.class);
                startActivity(intent);
            }
        });

        /* Add IP Button */
        btn_add = (Button)findViewById(R.id.btn_add);
        btn_add.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                /*new_server_ip = server_ip.getText().toString();
                MainActivity.server_array_ip.add(new_server_ip);*/

                ArrayList<String> server_name_list = new ArrayList<String>();

                new_server_name = server_name.getText().toString();
                server_name_list.add(new_server_name);

                Intent intent = new Intent(AddIP.this, MainActivity.class);
                intent.putStringArrayListExtra("int_server_name_list", server_name_list);
            }
        });
    }
}

Error
    11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime: FATAL EXCEPTION: main
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime: Process: de.kwietzorek.fulcrumwebview, PID: 4035
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{de.kwietzorek.fulcrumwebview/de.kwietzorek.fulcrumwebview.MainActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.app.ActivityThread.-wrap11(ActivityThread.java)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:102)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:148)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5417)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:  Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.widget.ArrayAdapter.getCount(ArrayAdapter.java:337)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.widget.AbsSpinner.setAdapter(AbsSpinner.java:115)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.widget.Spinner.setAdapter(Spinner.java:508)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.support.v7.widget.AppCompatSpinner.setAdapter(AppCompatSpinner.java:383)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at de.kwietzorek.fulcrumwebview.MainActivity.onCreate(MainActivity.java:75)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.app.Activity.performCreate(Activity.java:6237)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.app.ActivityThread.-wrap11(ActivityThread.java)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:102)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:148)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5417)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
11-13 22:13:49.542 4035-4035/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

A: Change
ArrayList<String> server_name_list = null;

to
ArrayList<String> server_name_list = new ArrayList<String>();

since server_name_list is null, a NullPointerException is thrown when you get to server_name_list.add(new_server_name);, and the execution fails.

A: Look in MainActivity
    //Server name spinner
    ArrayList<String> server_name_list = getIntent().getStringArrayListExtra(
            "int_new_server_name");

And in AddIP
    intent.putStringArrayListExtra("int_server_name_list", server_name_list);

Your key (name) is different, so you are trying to get something that doesn't exist, thats why NullPointerException is thrown.

Code for your MainActivity
package de.kwietzorek.fulcrumwebview;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    String selected;
    Spinner spinner;
    WebView myWebView;

    /* Menu */
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle item selection
        switch (item.getItemId()) {
            case R.id.add_server:
                Intent intent = new Intent(this, AddIP.class);
                this.startActivity(intent);
                return true;
            case R.id.menu_refresh:
                myWebView.reload();
                return true;
            default:
                return true;
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //WebView
        myWebView = (WebView) findViewById(R.id.webView);
        myWebView.setWebViewClient(new WebC());
        WebSettings webSettings = myWebView.getSettings();

        //JavaScript enable
        webSettings.setJavaScriptEnabled(true);

        //Server name spinner
        ArrayList<String> server_name_list = getIntent().getStringArrayListExtra(
                "int_new_server_name");

        if (server_name_list != null) {

        spinner = (Spinner) findViewById(R.id.server_spinner);

        ArrayAdapter<String> server_adapter = new ArrayAdapter<String>(this,
                android.R.layout.simple_spinner_item, server_name_list);

        server_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter(server_adapter);

        spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

            public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {

                selected = parent.getItemAtPosition(pos).toString();

                myWebView.loadUrl(selected);
            }

            public void onNothingSelected(AdapterView<?> parent) {

            }
        });
        }
    }

    //WebVie Client
        public class WebC extends WebViewClient {

        @Override
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            super.onReceivedError(view, errorCode, description, failingUrl);

        }
    }
}


text:
Q: OpenSSL::PKCS7.sign with a specific date I'm using origami to digitaly sign a pdf.
Is it possible to use OpenSSL::PKCS7.sign to sign a pdf and pass as a parameter or as an attribute an specific date to be the date of signing?
If not is there any way of accomplishing this?
I have been searching but found nothing on it.

A: What you want makes no sense from security point of view. You are actually asking "how do I spoof signing time in my documents". Well, you can't do this without capturing control over one of authorized TSA (timestamping authorities) in one way or another.
Update: In general it's possible to put any time to PDF signature as one of its attributes. As I look into Origami's source code, I don't see any way to put time to the signature.


text:
Q: XSL Transform help needed I have scoured the internet and have not been able to figure out how to do this.
Essentially, I need to rename the root element, and wrap all of the nodes in some tags.
Please see below.
Thank you for your help!
Actual Xml
    <?xml version="1.0" encoding="utf-8"?>
    <RefundInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <header>
        <cell>TBD</cell>
        <client>TBD</client>
        <notification_address>TBD</notification_address>
        <password>TBD</password>
        <source>TBD</source>
        <target>TBD</target>
        <version>TBD</version>
      </header>
      <ImageHost>NotImplemented</ImageHost>
      <OriginalOrder>
        <AmountCharged>26.5000</AmountCharged>
        <AmountChargedLessFees>24.0000</AmountChargedLessFees>
        <Fees>0</Fees>
        <Movie>
          <ShowTime>2012-05-05T15:45:00</ShowTime>
          <Title>Marvel's The Avengers 3D</Title>
        </Movie>
        <Theater>
          <Name>Regal Arroyo Grande Stadium 10</Name>
        </Theater>
        <Tickets>
          <Ticket>
            <Description>3D Matinee</Description>
            <Quantity>1</Quantity>
          </Ticket>
          <Ticket>
            <Description>3D Child</Description>
            <Quantity>1</Quantity>
          </Ticket>
        </Tickets>
        <Total>0</Total>
        <TransactionID></TransactionID>
      </OriginalOrder>
      <RefundOrder>
        <PaymentInstruments>
          <PaymentInstrument>
            <ItemType>Credit Card</ItemType>
            <ItemCode />
            <Amount>-1.5000</Amount>
          </PaymentInstrument>
          <PaymentInstrument>
            <ItemType>Promotion Codes</ItemType>
            <ItemCode />
            <Amount>-25.0000</Amount>
          </PaymentInstrument>
        </PaymentInstruments>
        <TransactionID></TransactionID>
      </RefundOrder>
    </RefundInfo>

Required Xml
    <?xml version="1.0" encoding="utf-8"?>
    <request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <header>
        <cell>TBD</cell>
        <client>TBD</client>
        <notification_address>TBD</notification_address>
        <password>TBD</password>
        <source>TBD</source>
        <target>TBD</target>
        <version>TBD</version>
      </header>
      <data>
        <row>
          <ImageHost>NotImplemented</ImageHost>
          <OriginalOrder>
            <AmountCharged>26.5000</AmountCharged>
            <AmountChargedLessFees>24.0000</AmountChargedLessFees>
            <Fees>0</Fees>
            <Movie>
              <ShowTime>2012-05-05T15:45:00</ShowTime>
              <Title>Marvel's The Avengers 3D</Title>
            </Movie>
            <Theater>
              <Name>Regal Arroyo Grande Stadium 10</Name>
            </Theater>
            <Tickets>
              <Ticket>
                <Description>3D Matinee</Description>
                <Quantity>1</Quantity>
              </Ticket>
              <Ticket>
                <Description>3D Child</Description>
                <Quantity>1</Quantity>
              </Ticket>
            </Tickets>
            <Total>0</Total>
            <TransactionID></TransactionID>
          </OriginalOrder>
          <RefundOrder>
            <PaymentInstruments>
              <PaymentInstrument>
                <ItemType>Credit Card</ItemType>
                <ItemCode />
                <Amount>-1.5000</Amount>
              </PaymentInstrument>
              <PaymentInstrument>
                <ItemType>Promotion Codes</ItemType>
                <ItemCode />
                <Amount>-25.0000</Amount>
              </PaymentInstrument>
            </PaymentInstruments>
            <TransactionID></TransactionID>
          </RefundOrder>
        </row>
      </data>
    </request>

What I have so far, it works, but I know this is the wrong way of doing this
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="xml" encoding="utf-8" indent="yes"/>

      <!--Remove empty lines-->
      <xsl:strip-space  elements="*"/>

      <!--Remove Empty Nodes-->
      <xsl:template match="*[not(child::node())]"/>

      <!--Get All Summary Fields-->
      <xsl:variable name="dataRow" select="//OriginalOrder|//RefundOrder|//ImageHost" />

      <xsl:template match="/">
        <request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
          <xsl:copy-of select="//header"/>
          <data>
            <row>
              <xsl:for-each select="$dataRow">
                <xsl:copy>
                  <xsl:copy-of select="node()|@*"/>
                </xsl:copy>
              </xsl:for-each>
            </row>
          </data>
        </request>
      </xsl:template>
    </xsl:stylesheet>

A: There are 3 approaches here. You can pull nodes with for-each, push approach with apply-templates or a combination of both. There are many ways to do what you want. Here is one example of a combined approach:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="utf-8" indent="yes"/>
    <!--Remove empty lines-->
    <xsl:strip-space elements="*"/>
    <!--Remove Empty Nodes-->
    <xsl:template match="*[not(child::node())]"/>
    <!--Get All Summary Fields-->
    <xsl:template match="/">
        <request>
            <xsl:apply-templates select="/RefundInfo/header"/>
            <data>
                <row>
                    <xsl:for-each select="//OriginalOrder|//RefundOrder|//ImageHost">
                        <xsl:copy>
                            <xsl:copy-of select="@*"/>
                            <xsl:apply-templates/>
                        </xsl:copy>
                    </xsl:for-each>
                </row>
            </data>
        </request>
    </xsl:template>
    <xsl:template match="*">
        <xsl:copy>
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates/>
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>

And here is complete push approach:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="utf-8" indent="yes"/>
    <!--Remove empty lines-->
    <xsl:strip-space elements="*"/>
    <!--Remove Empty Nodes-->
    <xsl:template match="*[not(child::node())]"/>
    <!--Get All Summary Fields-->
    <xsl:template match="/">
        <request>
            <xsl:apply-templates select="/RefundInfo/header"/>
            <data>
                <row>
                    <xsl:apply-templates select="//OriginalOrder|//RefundOrder|//ImageHost"/>
                </row>
            </data>
        </request>
    </xsl:template>
    <xsl:template match="*">
        <xsl:copy>
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates/>
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>

Your way works, but its not very pretty. For one, you create a variable called dataRow which is not needed to hold the xpath value. You can just call the xpath as //OriginalOrder|//RefundOrder|//ImageHost.
Using // followed by the node name selects all the nodes with that name no matter where they are in your xml. If this is not is an issue, then its fine, but could be an issue.


text:
Q: iOS - Reasons for app crashing besides low memory? Trying to figure out why my app crashes sometimes. I just ran it in Leaks, and it crashed even though Live Bytes was only 3.09 MB. So it doesn't appear that I'm using too much memory. There are no errors logged to the console when the crash occurs when running on the device through Xcode. Also there are no crash logs on the device.
What else can I do to troubleshoot?

A: There could be multitude of reasons for Application Crash. Here are a few most common ones.

*

*Bad Memory Access.
Occurs when you access an over released memory object. To solve, use NSZombies using the Simulator. Sometimes crashes are not simulated in simulator, in those cases, you are on your own.

*Invalid Argument Exception
Usually occurs if you access a property or invoke method call on an object that it does not have. Commonly due to invalid casting of objects for example casting NSArray to NSMutableArray from id type and trying to add object to it.
Solution is to debug using breakpoints and see what is the actual class of the object using following command and cast the object to appropriate type.
po [object class]

*UIViewControllers issues
Creating a view controller with xib file that does not exist.
Creating a view controller with view outlet not set in IB.
Setting IBOutlet of a UIControl like UITextField in File Owner and then accidentally removing it from File Owner and not resetting in XIB file.
And plenty more .. !!


text:
Q: Timer on Mouse Down in c# So I want to know for how long the user presses down on a button. I am using the button1_MouseDown method as you can see below. However  the count variable is staying 0.
Can someone please help me solve this problem please?
Thanks in advance!
    private void button1_MouseDown(object sender, MouseEventArgs e)
    {
        foreach(MusKey mk in this.Controls)
        {
            if(sender == mk)
            {
                if(e.Button == MouseButtons.Left)
                {
                    timer1.Enabled = true;
                    count = 0;
                    timer1.Tick += new EventHandler(timer1_Tick);
                    timer1.Start();
                    sp.SoundLocation = ( ---directory---- + mk.musicNote + ".wav");
                    sp.Play();
                }
            }
        }
    }

    private void timer1_Tick (object sender, EventArgs e)
    {
        count = count++;
    }

A: Your problem is due to the assignment using a post increment.
count = count++;

The order of events is to evaluate the right hand side including side effects before the assignment - so the current value of count is stored (=0) count is then incremented & now the stored value is assigned - the original value of zero is being written back over the incremented value.
You only need to use count++;
private void timer1_Tick (object sender, EventArgs e)
{
    count++;
}


text:
Q: How do I make math.random print a string how do you make math.random print a string
and not an int value from a table.
this is some of the code I wrote
local Menu = {"","",""}

local Item = math.random(1,#Menu)

print(Item)

Sorry if this is a question if like everyone knows. I just started scripting about 6 days ago. I coudnt find the answer anywhere on google so I decided to come here.

A: You are close: using print(Menu[Item]) should do what you need.
You can also use math.random(#Menu), as it's the same as math.random(1,#Menu).


text:
Q: How to Update Array Passed Into Function I am passing an array of the sort int * foo = new int[n] into a method void bar(int * foo, int size). My issue is, when I alter the array inside the function, I can print it and see the changes, however, in main I call another function separately to print foo and it appears to not be updating. Can someone help me with this?
Edit: Actual functions
Note: This is a coding exercise I am doing, so I cannot change the data structure to a vector, nor can I change the way the memory for the array is being stored. The only parts of the code I can edit is the blocks inside the heapRemove and heapPrint functions.
Another Edit: I changed the way I am passing the array pointer to the method. Now, it appears to update the first two items, but not the rest. Any ideas why? I updated the below code.
#include <iostream>
#include <string>
#include <sstream>
int readheap(int * theheap)
{
    //your code here
    //use std::cin to read in the data
    //return the size of the heap
    int value, count;
    while ( std::cin >> value) {
        theheap[count] = value;
        count++;
    }
    return count;
}

void heapRemove(int *& theheap, int& size)
{
   //your code here
    theheap[0] = theheap[size - 1];
    int tempHeapArr[10];
    for (int i = 0; i < size - 1; i++) {
        tempHeapArr[i] = theheap[i];
    }
    theheap = tempHeapArr;
    size -= 1;

    int parent = 0;
    while (true) {
        int l = (2 * parent) + 1;
        int r = l + 1;
        int minChild = l;
        if (l >= size) {
            break;
        }
        if (r < size && theheap[r] < theheap[l]) {
            minChild = r;
        }
        if (theheap[parent] > theheap [minChild]) {
            int temp = theheap[parent];
            theheap[parent] = theheap[minChild];
            theheap[minChild] = temp;
            parent = minChild;
        }
        else
            break;
    }
        for ( int i = 0; i < size; i++) {
            std::cout << theheap[i] << " ";
        }
        std::cout << std::endl;
}

void heapPrint(int * theheap, int size)
{
    //use cout to print the array representing the heap
    for ( int i = 0; i < size; i++) {
            std::cout << theheap[i] << " ";
    }
}

int main()
{
    int * theheap = new int[10];
    int size = readheap(theheap);
    heapRemove(theheap, size);
    heapPrint(theheap, size);
}

A: Below is the code with static size of 5
#include <string>
#include <iostream>
using namespace std;

void bar(int * foo, int size){
    foo[0] = 0;
    foo[1] = 1;
    foo[2] = 2;
    foo[3] = 3;
    foo[4] = 4;
}

int main(){
    int * foo = new int[5];
    bar(foo, 5);
    for(int i=0; i<5;i++){
       cout<<foo[i]<<endl;
    }
}

Updating the value inside bar and printing in main and it works.


text:
Q: How to retrieve a component from a list, using a variable name in R I have a variable called temp, the value of which is always a string, meant to retrieve a component from a list.
The line:
> list$temp
does not work, since it only retrieves the component called 'temp', not the component with the same name as temp's value.
How do I use temp's value to retrieve a component from the list?

A: You need to use [[ subsetting instead of $ subsetting:
list[[temp]]


text:
Q: Is it possible to create a warning when pushing to a specific (i.e. live) git source? I run two Heroku servers, one dev and one production.  I set up Git with targets so I can do
git push dev ...

and
git push production ...

I push unfinished features that I'm testing all the time to the dev with
git push dev newBranch:master

I know that one of these days, when I'm tired, or overworked or just absent-minded, I'm going to mistakenly type
git push production newBranch:master

and push an untested, unworking feature to our live server and not realize it. Is there some way to build in a warning, so that, when I run
git push production

I get

Warning, you are about to push to the live server, do you want to
  continue (y/n)

or some other indication shows up on the screen?  I would sleep easier at night knowing a guard like that exists.

A: You could use git's pre-push hook.
You can learn more about hooks here, and you likely have example scripts installed with your git distribution (or even in your repo!)


text:
Q: Find the remainder when $P(x)$ is divided by $(x-a)(x-b)$. Q: Let $P(x)$ by a polynomial leaving remainder A when divided by $(x-a)$, and remainder B when divided by $(x-b)$, where $a$ does not equal $b$.
Find the remainder when $P(x)$ is divided by $(x-a)(x-b)$.
A: $(\frac{A-B}{a-b})(\frac{Ba-Ab}{a-b})$
My working so far:
$P(a)=A=(a-b)G(x)+B)$
$P(b)=B=(b-a)Q(x)+A)$
$\frac{A-B}{a-b}=\frac{(B-A)G(x)}{(b-a)Q(x)}$
But I can't work out how to get rid of the G(x) and Q(x) or what to do next

A: The remainder you are looking for is of the form $ux + v$ for some $u$ and $v$.
Now $$ P(a) = ua+v$$ and $$P(b) = ub+v $$ so $u = \frac{P(a)-P(b)}{a-b}$ and $v = P(a) - a \frac{P(a)-P(b)}{a-b}$


text:
Q: How to use JQUERY in ASP.NET Core? I am a newbie in ASP.NET Core, and I want to use the downloaded jQuery package. I have downloaded a jQuery package now, but how do I introduce it into my view?
I already have the nuget package
<ItemGroup>
    <PackageReference Include="jQuery" Version="3.6.0" />
    <PackageReference Include="Microsoft.AspNetCore" Version="2.1.7" />
    <PackageReference Include="Microsoft.AspNetCore.CookiePolicy" Version="2.1.14" />
    <PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="2.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.3" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.1.1" />
</ItemGroup>

A: For client library,when you install the nuget package,it would not shown in your project.It would exist in %UserProfile%\.nuget\package by default.
But we usually use LibMan to manage common client-side library files,here is the official doc of LibMan.
You need to

*

*choose filesystem in Provider

*choose the library location

*choose Include all library files

*type target location
Then you can use

After click Install,it will generate a libman.json.Then you can use the following code to reference js in wwwwroot/lib.
<script src="~/lib/..."></script>


text:
Q: Generate a new table from current table I have a table with only dates for sundays:
dbo.Calendar:
[DatesInCalendar] (DateTime (yyyy-MM-dd))
2022-06-19
2022-06-26
...
Now I want to generate values into another table where I add bookable time slots:
dbo.BookableTimeSlots
[TimeSlots] (DateTime (yyyy-MM-dd hh:mi:ss)) | [Booked] (Bit) | [BookedBy] (NvarChar(10))
So Each value in [TimeSlots] should be based on each value in [DatesInCalendar]:
2022-06-19 10:00:00
2022-06-19 10:30:00
...
2022-06-19 16:00:00
I've used the following query to create my Calendar table, but I'm unable to modify it for my second table BookableTimeSlots.
USE [MyDatabase]
GO

declare @startDate date,@enddate date
set @startDate='2022-06-01'
set @enddate='2025-06-01'

while @startDate<=@enddate
begin
if(DATENAME(dw,@startDate)='Sunday')
INSERT INTO [dbo].[Calendar]
           ([DatesInCalendar])
     VALUES
           (convert(date,@startDate,103))
set @startDate=DATEADD(DD,1,@startDate)
end
GO

Does anyone have a suggestion for how I can populate my second table based on dates from my first table and adding a timestamp with 30 min intervals (10 am to 4p)?
[Booked] = 0
[BookedBy] = Null

A: Create a table, or use a derived table or cte, with 1 row per wanted timeslot in a single day. Cross join these rows to your calendar table, and using dateadd to suit, that query will generate all the needed timeslot rows and these can be inserted into your target table. e.g.
with cte (mysunday) as (
    select cast('20220605' as date) as mysunday
    union all
    select dateadd(day,7,cte.mysunday)
    from cte
    where cte.mysunday < '20220731'
    )
, tally as (
    select digit from ( values(1),(2),(3),(4),(5),(6),(7),(8) ) d (digit)
    )
select
    mysunday, dateadd(hour,tally.digit,cast(cte.mysunday as datetime)) as slot, tally.digit
from cte
cross join tally

mysunday   | slot                    | digit
:--------- | :---------------------- | ----:
2022-06-05 | 2022-06-05 01:00:00.000 |     1
2022-06-05 | 2022-06-05 02:00:00.000 |     2
2022-06-05 | 2022-06-05 03:00:00.000 |     3
2022-06-05 | 2022-06-05 04:00:00.000 |     4
2022-06-05 | 2022-06-05 05:00:00.000 |     5
2022-06-05 | 2022-06-05 06:00:00.000 |     6
2022-06-05 | 2022-06-05 07:00:00.000 |     7
2022-06-05 | 2022-06-05 08:00:00.000 |     8
2022-06-12 | 2022-06-12 01:00:00.000 |     1
2022-06-12 | 2022-06-12 02:00:00.000 |     2
2022-06-12 | 2022-06-12 03:00:00.000 |     3
2022-06-12 | 2022-06-12 04:00:00.000 |     4
2022-06-12 | 2022-06-12 05:00:00.000 |     5
2022-06-12 | 2022-06-12 06:00:00.000 |     6
2022-06-12 | 2022-06-12 07:00:00.000 |     7
2022-06-12 | 2022-06-12 08:00:00.000 |     8
etc.

db<>fiddle here


text:
Q: Approximating data by using NN with tensorflow I am having some problems when changing an equation in a working code.
The terms of the equation mean:

*

*idmat:Identity matrix  of size K. (dimension 215 x 215)

*self.__psiNNx: the output from a 3-layer neural network (data_x has passed through the NN to get an approximation) (dimension 30000 x 215)

*self.__psiNNy: the output from a 3-layer neural network (data_y has passed through the NN to get an approximation) (dimension 30000 x 215)

*K_reg: mapping matrix calculated using self.__psiNNx and  self.__psiNNy. (dimension 215 x 215)
import numpy as np
import matplotlib.pyplot as plt

import tensorflow as tf
from tensorflow.keras import layers
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Lambda
import tensorflow.keras.backend as K
from sklearn.utils.extmath import randomized_svd

#Import Data
data = genfromtxt('x_data_L22_nx_64_tend_20000_deltaT_05_traj_1.csv', delimiter=',')
data=data.T

model_koopman = edmd_dict.EDMD_DL()
dim=64
ddim = 150 # number of trainable dictionary elements
hdim = 50 # number of hidden nodes per layer
kmatdim = 1+dim+ddim # dimension of K matrix (ddim + constant + identity map)
model_koopman.build(dim=64, ddim=ddim, hdim=hdim, init_lr=1e-2)

# Train model
# Can use bigger batch sizes (e.g. 1000 to 5000) if training on GPU

x_data= data[0:-1,:]  # X(t,)
y_data= data[1:,:] #  X(t+dt,)

losses = model_koopman.train(num_epochs=500, batch_size=64,
                             log_interval=100,verbose=True, x_data=x_data, y_data=y_data)

The main code works fine, the only thing that I replaced was the following lines:
xtx_inv = tf.matrix_inverse(self.__reg*idmat +
                                tf.matmul(tf.transpose(self.__psiNNx), self.__psiNNx))
xty = tf.matmul(tf.transpose(self.__psiNNx), self.__psiNNy)
self.__K_reg = tf.matmul(xtx_inv, xty)
self.__assignK = tf.assign(self.__K, self.__K_reg)

For a SVD calculation
Syx, Uyx, Vyx =tf.linalg.svd(tf.matmul(self.__psiNNy, tf.transpose(self.__psiNNx)),full_matrices=True, compute_uv=True)
self.__K_reg= tf.matmul(Uyx,tf.transpose(Vyx))
self.__assignK = tf.assign(self.__K, self.__K_reg)

But the code gives the following problem:
---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
~/opt/anaconda3/envs/edmd_DL_new/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
   1333     try:
-> 1334       return fn(*args)
   1335     except errors.OpError as e:

~/opt/anaconda3/envs/edmd_DL_new/lib/python3.6/site-packages/tensorflow/python/client/session.py in _run_fn(feed_dict, fetch_list, target_list, options, run_metadata)
   1318       return self._call_tf_sessionrun(
-> 1319           options, feed_dict, fetch_list, target_list, run_metadata)
   1320

~/opt/anaconda3/envs/edmd_DL_new/lib/python3.6/site-packages/tensorflow/python/client/session.py in _call_tf_sessionrun(self, options, feed_dict, fetch_list, target_list, run_metadata)
   1406         self._session, options, feed_dict, fetch_list, target_list,
-> 1407         run_metadata)
   1408

InvalidArgumentError: ConcatOp : Dimensions of inputs should match: shape[0] = [215,1] vs. shape[1] = [30000,64]
     [[{{node Model_1/concat}} = ConcatV2[N=3, T=DT_DOUBLE, Tidx=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"](Model_1/ones_like, _arg_Placeholder_1_0_1, Model_1/Output_projection/add, Model_1/concat/axis)]]

During handling of the above exception, another exception occurred:

InvalidArgumentError                      Traceback (most recent call last)
<ipython-input-44-d9ca4247fadc> in <module>
      8
      9 losses = model_koopman.train(num_epochs=500, batch_size=64,
---> 10                              log_interval=100,verbose=True, x_data=x_data, y_data=y_data)

I have solved the problem by transposing tf.transpose(self.__psiNNy) and tf.transpose(self.__psiNNx). But not sure that this is correct.


text:
Q: ECONNREFUSED when trying to connect to redis via node using docker-compose I'm trying to switch over to docker, for some reason my Node.js application won't connect to redis running on docker.
This is my docker compose:
version: "3"
services:
  chatty-backend:
    container_name: chatty-backend
    build: ./
    volumes:
      - ./:/usr/src/chatty-backend
    command: npm start
    working_dir: /usr/src/chatty-backend
    ports:
      - "5000:5000"
    links:
      - redis
      - mongo
    depends_on:
      - redis
      - mongo

  mongo:
    image: mongo:bionic
    ports:
      - "27017:27017"

  redis:
    image: redis
    ports:
      - "6379:6379"
    command:
      redis-server

This is where I'm connecting to redis:
import * as Redis from 'ioredis';

const redis = new Redis({ host: 'redis', port: 6379 });

export default redis;

Also tried new Redis('redis://redis:6379')
I'm getting this error currently:
 Error: connect ECONNREFUSED 127.0.0.1:6379
   at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) {
     errno: 'ECONNREFUSED',
     code: 'ECONNREFUSED',
     syscall: 'connect',
     address: '127.0.0.1',
     port: 6379
}

A: The issue caused by graphql-redis-subscriptions.
I forgot to pass the updated confifg.


text:
Q: Using http service and its client in the same computer I am going to develop a http service and an application as its client which both of them are in the same computer.
I have 2 questions :

*

*Might any firewall block this application?

*If so, how can i solve the problem?

Tanx in advance.

A: No the firewall will not block the application.
You can use 127.0.0.1:80 to access the local http service.  80 is the default port number and you can drop it.  Alternatively, you can use something like http://localhost to test it.


text:
Q: Uncaught SyntaxError: Unexpected token var in javascript? I am working on javascript but when I am calling one method i got
 SyntaxError: missing ; before statement
[Break On This Error]

 var table = document.getElementById("dataTable");

jquery.min.js (line 2, col 3)

Please check my code below
function addSelectedData(orgName,deptValues)
 {
 var table = document.getElementById("dataTable");
 var rowCount = table.rows.length;
 var checkBoxId ="checkbox"+orgName;
 }
in browser console SyntaxError: missing ; before statement
  [Break On This Error]

 var table = document.getElementById("dataTable");

  jquery.min.js (line 2, col 3)

Any one help me

A: Sounds like your jquery.min.js is messed up somehow? I'd try getting downloading it again - you're not even using jQuery in your example code so I don't think that's the problem. jQuery statements begin with $ or jQuery


text:
Q: Timeseries: SQL or NoSQL? I don't care about the general differences between SQL and NoSQL (or their traditional differences).
I am currently looking at altering the storage of our internal time series. They all contain financial data from a number of different sources. Currently, we are storing our data in a proprietary database. It's very much NoSQL, that has its own query language.
I'm interested in the community input: How would you store the data in a SQL database? What merits are there for using SQL over a NoSQL, specifically for time series? Am I insane for considering storing this in SQL?
Our data set consist of millions of time series, with around 10% of these containing millions of records each.
The time series are organised hierarchically: /Market/Instrument/Value/Frequency, where:

*

*Market is a securities exchange, etc, basically a collection of instruments, usually similar instruments.

*Instrument is an instrument. This could be an indicator (Brent Crude), an equity (GOOG), etc

*Value is one of multiple types of data for an instrument. This could be a close, high, low, etc

*Frequency is the frequency of a particular time series values. Weekly, daily, monthly, tick, arbitrary, etc.

How would the data be stored in a SQL db? One big table (maybe partitioned by something), one table per market or instrument, one table per time series.
Thank you in advance.

A: In general, for such a structured dataset I suspect you could write a custom data format which was faster for most daily operations (i.e. small data pulls from an arbitrary time).  The benefit of moving to a standard DB tool is likely in some of the extras, for example ad hoc queries, multiple access, replication, availability etc.  It's also easier to hire help to maintain a standards based data store.
If I were asked to set up a database to store that data, I would do the following:
Proposed schema
(1)  Core data is placed into numerous (1000's) of individual tables, each containing two columns:

*

*time: either a SQL DATETIME data type or a numeric type from some epoch (this is the primary key)

*value: typed as appropriate for your data. I would default to single precision float, however a fixed-point data type may be more appropriate for financial transactions.  This is probably unindexed.

These tables will get quite large, and you may want to manually partition them by (for example) year.  But you'll have to check system performance and tune as appropriate.
These tables need unique names, and there are a couple of options.  They could be human readable (e.g. nyse_goog_dailyhighs_2010) or (my preference) random.  Either way a set of metadata tables is required, and random table names prevent developers from inferring anything into the name that was not meant to be inferred.
(2)  Meta data is stored in separate tables, as required by the application:
An additional table or set of tables is required to keep track of the metadata.  These tables will contain data about exchange, instrument, value, frequency, date ranges, provenance (where did the data come from), plus anything else you need.  These are mapped to data table names.
If there is enough data, this lookup could actually provide a table name and database name, allowing a sort of self-implemented data sharding (if that is the correct use of the term).  But I would hold that in reserve.
Then at the application layer I would query the metadata tables to determine where my data was located, and then perform relatively simple queries on the big data tables to get my data.
Advantages:

*

*My (relatively limited) experience is that databases can generally handle a large number of small tables easier than a smaller number of large tables.  This approach also enables easier maintenance (e.g. purging old data, rebuilding a corrupt table, creating/reloading from backups, adding a new entity).  This completely decouples the different kinds of data, if (for example) you have data at different rates, or requiring different data types.

*This skinny table concept should also allow fast disk access for what I suspect is the most common query, a contiguous range of data from a single entity.  Most data applications are disk I/O limited, so this is worth considering.  As a commenter has already implied, this my be an ideal application for a column-oriented database, but I have yet to find a column oriented product that is mainstream enough for me to bet my career on.  This schema gets pretty close.
Disadvantages:

*

*About half of your disk space is dedicated to storing time stamps, when quite frankly 100's or 1000's of the tables will have the exact same data in the timestamp column.  (In fact this is a requirement if you want to perform easy table joins).

*Storing table names and performing the dynamic lookup requires a lot of application complexity and string operations, which kind of makes me cringe.  But it still seems better than the alternatives (discussed below).
Considerations:

*

*Be careful of rounding in your time field.  You want your values round enough to enable joins (if appropriate), but precise enough to be unambiguous.

*Be careful of time-zones and daylight savings time.  These are hard to test.  I would enforce a UTC requirement on the data store (which may make me unpopular) and handle conversions in the application.
Variations:
Some variations that I have considered are:
Data folding:  If the timeseries is equally spaced, then use one timestamp column and (for example) 10 data columns.  The timestamp now refers to the time of the first data column, and the othe data columns are assumed equally spaced between that timestamp and the next one.  This saves a lot of storage that was previously used to store timestamps, at a cost of significant query and/or application complexity.  Contiguous range, single entity queries now require less disk access.
Multi-plexing:  If multiple time series are known to use the same time series, then use one timestamp and (for example) 10 data columns as described above.  But now each column represents a different time series.  This requires an update to the metadata table, which is not a lookup into table and column name.  Storage space is reduced.  Queries remain simple.  However contiguous range, single entity queries now require significantly more disk access.
Mega-table:  Take the "multi-plexing" concept to the extreme, and put all data into a single table, once time series per column.  This requires large amounts of disk access for contiguous range, single entity queries, and is a maintenance nightmare.  For example adding a new entity now requires a MODIFY TABLE command on a many TB table.
For additional discussion on this format, see the various answers in:
Too many columns in MySQL
Fully normalized table:
Instead of using many 2-column tables, you could use one, three-column table, where the columns are time, dataid, and value.  Now your metadata tables only need to lookup ID values, rather than tablenames or column names, which enables pushing more logic into the SQL queries, rather than the application layer.
Approximately 2/3 of Storage is now consumed with the normalizing columns, so this will use a lot of disk space.
You can use a primary key order of (dataid, timestamp) for fast contiguous, single entity queries.  Or, you can use a primary key order of (timestamp. dataid) for faster inserts.
However, even after considering these variations, my plan for my next development is lots of tables, two-columns each.  That, or the method soon to be posted by someone wiser than I :).

A: Use MongoDB, you can create collections on-the-fly very quickly. Look at arranging your data into separate databases, and collections within those databases. Consider how much memory you would need to try to keep each shard within system memory - if you need fast retrieval. Silly to stick with an in-house solution, if there is something fresher out there that will evolve along the lines you need. Sounds like a good initiative.