text:
Q: yum proxy error while creating a docker image I have a dockerfile that should create a linux image and oracle database and few other things. However running the docker command i get the following error

http://yum.oracle.com/repo/OracleLinux/OL7/UEKR4/x86_64/repodata/repomd.xml:
  [Errno 14] curl#5 - "Could not resolve proxy: www-proxy.us.oracle.com;
  Unknown error"

I am creating this docker from inside a proxy and the proxy is appropriately setup in the environment and also in the dockerfile.
The lines from where i get this error are
yum install zip
yum -y install oracle-database-preinstall-18c

Interestingly, if i remove the yum commands and create a base docker and run the same yum commands from within the container, it works quite well.

# LICENSE UPL 1.0
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.

FROM oraclelinux:7.4

MAINTAINER Temporary Name <temporary.name@oracle.com>

ENV JAVA_PKG=server-jre-8u*-linux-x64.tar.gz \
JAVA_HOME=/usr/java/default \
http_proxy=http://www-myproxy.cn.company.com:80 \
https_proxy=http://www-myproxy.cn.company.com:80 no_proxy=localhost,127.0.0.1,192.168.0.0/16,10.0.0.0/8,.cn.company.com,.companycorp.com,/var/run/docker.sock

RUN yum-config-manager --save --setopt=ol7_UEKR4.skip_if_unavailable=true  && \
yum install zip && \
 yum -y install oracle-database-preinstall-18c

A: Sorted this out with the help of a friend in my office. The issue was with the build command. I had to use the --network=host flag while 'build'ing docker.
I did the following
sudo docker build --build-arg http_proxy=http://www-proxy.cnt.company.com:80 -t  oracle:183 .
instead of
sudo docker build --network=host --build-arg http_proxy=http://www-proxy.cnt.company.com:80 -t  oracle:183 .
If someone faces a similar issue, please use --network flag to get that sorted.
Thanks
Bala


text:
Q: ActionController::UnknownFormat when using custom actions to change user password in rails with devise I want to make a custom action for updating my user account information. This wiki has been very helpful, but I get a ActionController::UnknownFormat in UsersController#account error when following option 3.
My routes are looking like this:
devise_for :users, :controllers => {
 registrations: 'users/registrations',
 sessions: 'users/sessions',
 passwords: 'users/passwords',
 confirmations: 'users/confirmations',
 unlocks: 'users/unlocks'
}

resource :user, only: [:edit], path: "settings" do
 member do
  get 'account'
  get 'password'
  patch 'update_account'
  patch 'update_password'
 end
end

And then the controller they say to set up looks like this:
class UsersController < ApplicationController
 before_action :authenticate_user!

 def account
  @user = current_user
 end
end

rake routes looks like this:
account_user GET    /settings/account(.:format)                             users#account

And when I go to localhost:3000/settings/account (where I have an account.html.erb file), I get this error: UsersController#account is missing a template for this request format and variant. request.formats: ["text/html"] request.variant: [] NOTE! For XHR/Ajax or API requests, this action would normally respond with 204 No Content: an empty white screen. Since you're loading it in a web browser, we assume that you expected to actually render a template, not… nothing, so we're showing an error to be extra-clear. If you expect 204 No Content, carry on. That's what you'll get from an XHR or API request. Give it a shot.
Why?

A: Templates for UsersController must contains in app/views/users directory by default.
If you want use custom template directory for controller's action use something like:
def account
  @user = current_user
  respond_to do |format|
    format.html { render '/users/settings/account.html.erb' }
  end
end

redpajama_set_name: RedPajamaStackExchange


text:
Q: Button, Timeout, Alerts Uncaught TypeError: I have 2 buttons and I want to click "Button1" first and after 5 sec. "Button2"
and after 10 more sec. redirect to another url.
document.getElementById('Button1').click();
alert("After clicking Button1");
setTimeout(function(){
document.getElementById('Button2').click();
}, 5000);
alert("After clicking Button2");
setTimeout(function(){
window.location.href="http://google.com";
}, 10000);

I get

Uncaught TypeError: Cannot read property 'click' of null.

The buttons work and click but the code for redirecting doesn't. The strange thing is I used alerts to check the code and it first runs the alerts and after that clicks "Button1" and after that "Button2" and after that I get the Error and it doesn't continue to execute the last code. I have no idea what to do..

A: I think your second alert statement is misplaced.
Try this:
document.getElementById('Button1').click();
alert("After clicking Button1");

// wait 5 seconds
setTimeout(function(){
    document.getElementById('Button2').click();
    alert("After clicking Button2");

    // wait 10 seconds
    setTimeout(function(){
        window.location.href="http://google.com";
    }, 10000);
}, 5000);

Make sure that Button2 exists, as the error you are getting indicates that it does not.
Your HTML should look something like this:
<button id="Button1">this is button 1</button>
<button id="Button2">this is button 2</button>


text:
Q: Updating view based on API response I'm having an issue with showing information in my App.js state object in a child component. Below are the relevant parts. App.js, WeatherDetail is the aforementioned component, and then the response from API request.
App.js
import React from "react";
import openweather from "../api/openweather";
import SearchBar from "./SearchBar";
import WeatherDetail from "./WeatherDetail";

class App extends React.Component {
  state = { weather: [], daily: [] };

  onSearchSubmit = async zip => {
    const currentWeather = openweather.get("/data/2.5/weather", {
      params: { zip }
    });

    const fiveDayForecast = openweather.get("/data/2.5/forecast", {
      params: { zip }
    });

    const [weather, daily] = await Promise.all([
      currentWeather,
      fiveDayForecast
    ]);

    this.setState({ weather: weather.data, daily: daily.data.list });
  };

  render() {
    return (

        <SearchBar onSubmit={this.onSearchSubmit} />
        <WeatherDetail weather={this.state.weather} />

    );
  }
}

export default App;

WeatherDetail.js
const WeatherDetail = ({ weather }) => {
  return (

Today

City: {weather.name}

Temperature:

  );
};

>forecast:
   base: "stations"
  >clouds: {all: 75}
   cod: 200
  >coord: {lon: -82.54, lat: 40.7}
   dt: 1553023267
   id: 420031370
  >main:
     humidity: 45
     pressure: 1030
     temp: 44.22
     temp_max: 46.99
     temp_min: 41
   name: "Elyria"

Now, weather.name shows up in the view with no problem. If I try to grab any information deeper than that I get an error saying the property is undefined. For example, weather.main.temp is how I thought I would get the temperature but it shows that error. weather.main alone gives an obvious error, but it shows the object I'm trying to access in the message. So I'm confused about how that can be when weather.main.temp also says the property (main) is undefined. Am I trying to access the object incorrectly or is something else set up wrong?

A: The problem comes with the initial render, before you have received results from the API. The first time WeatherDetail renders, it has the default state, which you've set to state = { weather: [], daily: [] };. This means that on initial render there is no main attribute existing on state.weather. It's just an empty array. The attributes only exist when you populate them on running onSearchSubmit.
I would add some validation in your WeatherDetail component. Something like the below:
const WeatherDetail = ({ weather }) => {
  const { name, main } = weather;
  return (

Today

City: { name ? name : ''}

Temperature: { main ? main.temp : '' }

  );
};

That way on initial render if the attributes don't exist you can still render empty strings, and when the state gets populated and the correct attributes exist, it will render the correct content.


text:
Q: Using separate model for each column in table ng-repeat I like to create a table. for each column in this table I like to use a different model. So if I drop a element in one of my two columns it should store the element in the model with respect to the column. Here is link to a fiddle page where I tried something. Is that the easiest way to do so?

        {{ person.name }}

      Add your items here
      Add your items here

      {{ person.name }}
      {{ tar[$index].name }}


text:
Q: Show traceback of an exception raised by a manually invoked function in ipdb ipdb> def aaaa(q): q[2]
ipdb> aaaa([1,2,3,4])
ipdb> aaaa([])
*** IndexError: list index out of range
ipdb>

I want to have a full traceback displayed (pretty one - with stack frames, locals, etc.), not only '*** IndexError: list index out of range'. How do I do that?


text:
Q: Javascript to auto-close a tab based on the URL I was trying to figure out how to make a chrome extension (new to experimenting with this) that would automatically close a tab if the URL contained a specified string, but everything I've read says you can't do that in javascript - trying to do so with window.close() just generates the error message "VM145:1 Scripts may close only the windows that were opened by it."
However, I've just found out that an extension exists that will do exactly what I wanted to do (tested - works on the latest version of Chrome), called "Ad Close Gold" - how could this be working if Javascript can't close tabs?


text:
Q: Construction of a diffeomorphism Let $M$ be an arbitrary smooth manifold with dimenison $n$, and $\{U_i\}$ be an open covering of $M$.
Can we construct a diffeomorphism $f_i:U_i \to B_i$?, where $B_i$ is the open unit ball in $\mathbb{R}^n$.

A: If $(U_i)$ is an arbitrary open covering, then no. Think of the case where $M$ is an open subset of $\mathbb R^n$, with covering just itself. Is it true that any open subset of $\mathbb R^n$ is diffeomorphic to $B_i$?


text:
Q: PHP if else endif and wordpress's loop I've a problem with the loop in wordpress, my website is a feed aggregator and basically I want my website to display an image if the feed contains an image or a specified image if it doesn't.
here's the code I actually use:
    <?php $enclosure =  get_post_meta($post->ID , 'enclosure', $single = true); ?>
    <?php $image=explode(chr(10),$enclosure); ?>
    <?php if(!is_null($image)) : ?>

    <a href="<?php the_permalink() ?>" rel="bookmark" title="Link all'articolo: <?php     the_title_attribute(); ?>"><img src="<?php echo $image[0]; ?>" alt="<?php the_title_attribute(); ?>" style="width:150px; text-align:center;"/>

    <?php endif; ?>

It works very well but now I want to show a "default" image if the feed doesn't provide one, I tried in this way:
    <?php $enclosure =  get_post_meta($post->ID , 'enclosure', $single = true); ?>
    <?php $image=explode(chr(10),$enclosure); ?>
    <?php if(!is_null($image)) : ?>

    <a href="<?php the_permalink() ?>" rel="bookmark" title="Link all'articolo: <?php     the_title_attribute(); ?>"><img src="<?php echo $image[0]; ?>" alt="<?php the_title_attribute(); ?>" style="width:150px; text-align:center;"/>

    <?php else : ?>

    <a href="<?php the_permalink() ?>" rel="bookmark" title="Link all'articolo: <?php     the_title_attribute(); ?>"><img src="PATH TO THE DEFAULT IMAGE" alt="<?php the_title_attribute(); ?>" style="width:150px; text-align:center;"/>

    <?php endif; ?>

But it doesn't work...
Where am I wrong?
Sorry for my english!
Thanks!

A: try
if(file_exists("file path")){

}

instead of
`if(!is_null($image)) :`

A: try to use
if($image=="" && $image=="null")
{

}


text:
Q: Meteor exception in Meteor.flush when updating a collection breaks reactivity across clients When I'm calling Collection.update from the front end (the method call is allowed), the update does work ok, but the exception below is being thrown (in Chrome's JS console, not in the server). Although the update took place, other clients connected to the same collection do not see the updates until they refresh the browser - I suspect because of the exception.
Any idea what might cause this?
Exception from Meteor.flush: Error: Can't create second landmark in same branch
    at Object.Spark.createLandmark (http://checkadoo.com/packages/spark/spark.js?8b4e0abcbf865e6ad778592160ec3b3401d7abd2:1085:13)
    at http://checkadoo.com/packages/templating/deftemplate.js?7f4bb363e9e340dbaaea8d74ac670af40ac82d0a:115:26
    at Object.Spark.labelBranch (http://checkadoo.com/packages/spark/spark.js?8b4e0abcbf865e6ad778592160ec3b3401d7abd2:1030:14)
    at Object.partial [as list_item] (http://checkadoo.com/packages/templating/deftemplate.js?7f4bb363e9e340dbaaea8d74ac670af40ac82d0a:114:24)
    at http://checkadoo.com/packages/handlebars/evaluate.js?ab265dbab665c32cfd7ec343166437f2e03f1a54:349:48
    at Object.Spark.labelBranch (http://checkadoo.com/packages/spark/spark.js?8b4e0abcbf865e6ad778592160ec3b3401d7abd2:1030:14)
    at branch (http://checkadoo.com/packages/handlebars/evaluate.js?ab265dbab665c32cfd7ec343166437f2e03f1a54:308:20)
    at http://checkadoo.com/packages/handlebars/evaluate.js?ab265dbab665c32cfd7ec343166437f2e03f1a54:348:20
    at Array.forEach (native)
    at Function._.each._.forEach (http://checkadoo.com/packages/underscore/underscore.js?772b2587aa2fa345fb760eff9ebe5acd97937243:76:11)

EDIT 2
The error will also occur if the update call is run in the console. It happens on the first run of the update but by then reactivity is broken on any other browser attached to it.
EDIT
Here is my template for the clickable item that triggers the update:
<template name="list_item">

    <input type="checkbox" name="item_checked" value="1" id="clcheck_{{index}}" class="checklist_item_check" {{checkbox_ticked}}> {{title}}

</template>

and here's the event handler for clicks on 'list_item':
Template.list_item.events = {
  'click .checklistitem' : function(ev) {
    this.checked = !this.checked;
    var updateItem = {};
    updateItem['items.'+this.index+'.checked'] = this.checked;
    console.log("The error happens here");
    Lists.update({_id: this._id}, {$set:updateItem}, {multi:false} , function(err) {
      console.log("In callback, after the error");
    });
  }
}

The whole thing is available at http://checkadoo.com (Its a port of a Tornado based Python app of mine)

A: I've found this is usually an issue with duplicate ids.  @Harel's question doesn't include the code that actually renders the collection so we can't tell the root cause of his problem but the repro that @Drew supplied in the comments is throwing this error because it is rendering an array of objects that have duplicate '_id' values.
I have put together a working version of @Drew's repro:
  https://github.com/alanning/meteor-buggy-fix
The key fix is to ensure the inserted drink items do not have duplicate '_id' fields:
  Template.drink_from_menu.events({
    'click .buy_drink': function () {
      var drink = {name: this.name, price: this.price};

      console.log("this = ", this);

      // using 'this' doesn't work because it already has a '_id' field and
      // you would be trying to render multiple drinks with the same id
      // which causes Spark to throw the "Can't create second landmark
      // in same branch" error
      //Tabs.update({_id:Session.get('tabId')}, {$push: {ordered_drinks: this}});

      // either ensure that the objects you want Spark to render have a
      // unique id or leave off the _id completely and let Spark do it for you
      Tabs.update({_id:Session.get('tabId')}, {$push: {ordered_drinks: drink}});
    }
  });


text:
Q: Synchronization between c# app and Active directory I'm developing an application that manages information about users and save the data in a SQL Server. I would like to 'somehow' connect this application with our Active Directory, so all the changes this app will make will be reflected in the Active Directory too (if we add a new user in the app, it will be added also in the Active Directory)
Is it possible? if so, which are my options?
Thanks in advance

A: Don't do it. Let AD be the authoritative copy of your user base, and let the users always be created in AD first and then propagate to SQL. By letting users be added through a different path (SQL first) you open a huge can of worms with regard to security. If a user is defined in SQL but not in AD, what exactly is taht user? How can he log in? To what groups does he belong? IS he allowed access or not to this resource or that resource? How about cases when an user is added in AD and in SQL with different characteristics and then you need to reconcile.
Modify your application do always create the user in AD, in conformance with the AD policies and security requirements (password complexity being the most trivial example). Then let AD synchronize with SQL.

A: The way I chose to solve this problem was to add an event that was triggered when I saved my user object. The listener on this event would then send an update to Active Directory. In my case I was doing a one way sync to Active Directory and it was also a best effort attempt, meaning if it failed I was fine with it. If you need to do some more reliability around it you will want to wrap your SQL updates inside of a transaction and only commit after active directory is updated.
If you need a two way sync with Active Directory you will need to look at doing some sort of a background synchronization with Active Directory where you iterate over your users and check for updates in AD.

A: If you are doing a one-way sync to AD, I agree with Aaron that you should simply have a Trigger in SQL server.  Note that this solution may suffer from some problems, like the user accounts already created, user name or password doesn't meet the AD complexity rule.  You need to then find some ways to log the error.  You may also need a tool to do initial provisioning of your database accounts.
If you want to do two-way sync, I suggest you to read up DirSync.  You probably need to write a NT service to do it.  I hope you don't store password in your database.  I highly suggest you to use Windows authentication.  If you do need to sync up the password, you may need to write your own passwordsync and install it in all the domain controllers in your machine.
If you are developing a solution for enterprise, you should look up the existing meta-directory solution products from Microsoft, MIIS, ILM, FIM.
They are all the same thing except with the names different.  Many enterprise has adopted this as their meta directory solution.  You just need to write up an extension to leverage on its provided infrastructures to do the identity synchronization.


text:
Q: Creating Identification/Classification trees I have data given in following format; from which I need to create identification/classification trees (three different trees from three different criterion, that is average disorder, gain ratio and information gain).
Weather  Light  Ground  Decision
Sunny    Good   Dry     Play
Overcast Good   Dry     Play
Raining  Good   Dry     No Play
Overcast Poor   Dry     No Play
Overcast Poor   Damp    No Play
Raining  Poor   Damp    No Play
Overcast Good   Damp    Play
Sunny    Poor   Dry     Play

Clustering won't help much since it directly maps the values with averages to generate clusters, which might be "rough"; and I can't find any built in function for the task I need to perform in Mathematica. Is there any built in function which might just create a classification tree depending on implicit parameters (entropy, information gain and gain ratio)?

A: The first thing I want to say is that I think Anton Antonov's solution is great.
But, you wanted to be able to change the criteria for splitting, and that might be hard given that it is a library (I haven't checked the code, so I don't know). There is no in-built function either. So I got the idea that I would try to create some straight-forward code where one could replace the splitting criteria. However: 1) I don't know the conventions of decision trees. 2) The code became messy.
Yet, here it is:

attributes = {"Weather", "Light", "Ground"};

data = {{{"Sunny", "Good", "Dry"},
    "Play"}, {{"Overcast", "Good", "Dry"},
    "Play"}, {{"Raining", "Good", "Dry"},
    "No-Play"}, {{"Overcast", "Poor", "Dry"},
    "No-Play"}, {{"Overcast", "Poor", "Damp"},
    "No-Play"}, {{"Raining", "Poor", "Damp"},
    "No-Play"}, {{"Overcast", "Good", "Damp"},
    "Play"}, {{"Sunny", "Poor", "Dry"}, "Play"}};

InformationGain[attr_] := Module[{probabilities, information},
   (* The information gain, the decrease in entropy. *)
   probabilities = Tally[attr][[All, 2]];
   probabilities = probabilities / (Total @ probabilities);
   information = Total @ (# Log[1/#] & /@ probabilities);
   (* Return information gain from attribute attr. *)
   information
   ];

SplitSet[elems_] := Module[{infoGain, attrPos, newSets},
   (* Split the set by the attribute that gives the most information. \
*)
   infoGain = N@(InformationGain /@ (Transpose @ elems[[All, 1]]));
   attrPos = First@Ordering[infoGain, -1];
   newSets = GatherBy[elems, #[[1, attrPos]] &];
   (* Return new sets. *)
   {newSets, attrPos}
   ];

CheckStop[set_] := Module[{},
   (* Every element in the subset belongs to the same class. *)
   If[Length @ Union @ set[[All, 2]] == 1, Return@False];
   (* No more information to be gained. *)
   If[N@(Total@(InformationGain /@ (Transpose @ set[[All, 1]]))) ==
     0, Return@False];
   (* Continue. No reason to stop. *)
   True
   ];

FormatLeaf[leaf_, attr_] := Module[{def, outcome},
   (* Retrieve the most common outcome. *)
   outcome = First@Commonest[leaf[[All, 2]], 1];
   (* Select the attributes,
   and corresponding choices (from any element in leaf.) *)
   def = {Transpose[{attributes[[attr]], leaf[[1, 1]][[attr]]}],
     outcome};
   (* Return *)
   def
   ];

(* Main function. *)
Iterate[dat_, nodePath_] :=
  Module[{elem, nodes, newNodes, leafs, newNodePath},
   elem = SplitSet@dat;
   newNodePath = Append[nodePath, elem[[2]]];
   nodes = Select[elem[[1]], CheckStop];
   leafs =
    FormatLeaf[#, newNodePath] & /@
     Select[elem[[1]], CheckStop[#] == False &];
   (* Send nodes into the function again. *)
   newNodes = Join @@ (Iterate[#, newNodePath] & /@ nodes);
   leafs = Join[leafs, newNodes];
   (* Return leafs. *)
   leafs
   ];
result = Iterate[data, {}];

(* Visualize a tree. *)
CreateEdges[path_, start_, heads_] := Module[{edges, edgeRules},
   edges = Replace[Flatten[path], "Weather" -> "Data", {1}];
   edges = DeleteCases[edges /. (Rule[#, Null] & /@ heads), Null];
   edgeRules =
    Table[Rule[ToString[i]  ". "  edges[[i]],
      ToString[i + 1]  ". "  edges[[i + 1]]], {i, 1,
      Length@edges - 1}];
   (* Return edge rules. *)
   edgeRules
   ];

splitList =
  First@Sort[result, Length@#1 > Length@#2 &][[All, 1, All, 1]];
allRules =
  Union@Flatten@(CreateEdges[#, splitList[[1]], splitList] & /@
      result);
(* Show plot. *)
LayeredGraphPlot[allRules, VertexLabeling -> True]

Will output the decision tree:

You can then create rules for prediction:

(* Create rules for prediction. *)
PredictionRules[elem_] := Module[{r, param, attrOrder, rightOrder},
   r = {_, _, _};
   param = elem[[1, All, 2]];
   attrOrder = elem[[1, All, 1]];
   rightOrder = Thread[attributes -> Range[Length@attributes]];
   param = param[[ Ordering @ (attrOrder /. rightOrder)]];
   r[[Range[Length@param]]] = param;
   (* Return rule. *)
   Rule[r, elem[[2]]]
   ];

DecisionTreeRules = PredictionRules /@ result;
data /. DecisionTreeRules

Which will output:

{{"Play", "Play"}, {"Play", "Play"}, {"No-Play",
  "No-Play"}, {"No-Play", "No-Play"}, {"No-Play",
  "No-Play"}, {"No-Play", "No-Play"}, {"Play", "Play"}, {"Play",
  "Play"}}

It's an attempt at implementing the ID3 Algorithm. If you'd like to change the criteria for splitting you would have to at least look at the InformationGain-function which calculates the information gain from each potential split. As well as the CheckStop-function that determines whether a node should be split further or if it's a leaf.

A: Some time ago (before Mathematica had the function Classify) I developed a package for construction of Decision trees and classification with them. The trees produced by that package might be a good start for making the trees from the three different perspectives listed in the question.
More precisely, with the package one can build a tree using entropy driven splitting and prune it afterwards using the Minimum Description Length (MDL) principle.
See these blog posts for application examples:
Decision trees posts at MathematicaForPrediction at WordPress.
Below is an example with the sample data in the question.
Assign data:
data = {{"Sunny", "Good", "Dry", "Play"}, {"Overcast", "Good", "Dry",
    "Play"}, {"Raining", "Good", "Dry", "No-Play"}, {"Overcast",
    "Poor", "Dry", "No-Play"}, {"Overcast", "Poor", "Damp",
    "No-Play"}, {"Raining", "Poor", "Damp", "No-Play"}, {"Overcast",
    "Good", "Damp", "Play"}, {"Sunny", "Poor", "Dry", "Play"}};
colNames = {"Weather", "Light", "Ground", "Decision"};
TableForm[data, TableHeadings -> {None, colNames}]

Import the package:
Import["https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/AVCDecisionTreeForest.m"]

Build a decision tree using "Entropy" as an impurity function ("Gini" is an alternative and used by default):
dtree = BuildDecisionTree[data, "ImpurityFunction" -> "Entropy"]

(* Out[123]= {{0.215762, "Raining", 1, Symbol, 8},
{{{2, "No-Play"}}}, {{0.318257, "Good", 2, Symbol, 6},
{{{3, "Play"}}}, {{0.636514, "Overcast", 1, Symbol, 3},
{{{2, "No-Play"}}}, {{{1, "Play"}}}}}} *)

Visualize the tree:
trules = dtree // DecisionTreeToRules;
trules = trules /. ({m_, v_, cInd_Integer, s_, n_} :> {m, v,
     colNames[[cInd]], s, n});
LayeredGraphPlot[trules, VertexLabeling -> True]

The last commands produce the plot:

In the plot:

*

*Each non-leaf node of the tree has the format:
{impurity, splitting value, splitting variable, variable type, number of rows}.
Where "variable type" is wither Number of Symbol, and "number of rows" refers to the size of the part of the data that was observed (scanned) at that point of splitting.

*The leaf nodes are numbered, each leaf shows a label and how many observations adhere to the predicate formed from the root to the leaf.
Using the built tree classification can be done like this:
DecisionTreeClassify[dtree, #] & /@ {{"Overcast", "Good", "Dry"},
{"Overcast", "Poor", "Dry"}}

(* Out[17]= {{{3, "Play"}}, {{2, "No-Play"}}} *)


text:
Q: a link in  suddenly behaves like a has a hover that's different from the other links Just to start off, I am new to html and CSS and have only been coding for the last two weeks or so. I might have missed something or overseen some vital thing. But I hope you can help me anyway.
I implemented a simple contact form in one of my pages, which resulted in my links behaving differently. I have made it so that my links have a hover function, which changes the border color and background color from white and black to black and white. Pretty simple. After I implemented the contact form these links now behave like I have made a a:active in my css that makes my links text and border go from white to a blue-ish/purple color. I have build the structure of this contact form from top to bottom multiple times to see where the error takes place, but I can't seem to find it. Funny thing is, if I remove the styling of this contact form, the links still change to the blue-ish/purple color, which makes me believe that the css isn't the problem but rather the html.
I've used  in this contact form, which I haven't used before. I don't know if it might have some tag attributes that makes my links turn purple.
Hope you can help.
Here's my code:

/*contact form*/
input[type=text],
select {
  width: 100%;
  padding: 12px 20px;
  margin: 8px 0;
  display: inline-block;
  border: 1px solid #ccc;
  box-sizing: border-box;
}
input[type=submit] {
  width: 20%;
  background-color: black;
  color: white;
  padding: 14px 20px;
  margin: 8px 0;
  border: none;
  cursor: pointer;
}
input[type=question] {
  width: 100%;
  min-height: 100px;
  padding: 12px 20px;
  margin: 8px 0;
  display: inline-block;
  border: 1px solid #ccc;
  box-sizing: border-box;
}

/*hover code*/
nav div:hover a {
 display:block;
 position:relative;
 height:62px;
}

nav div:hover a:hover {
 background-color:#E3E3E3;
 color:black;
 border-color:black;
}

nav div:hover a:hover {
 background-color:#E3E3E3;
 color:black;
 border-color:black;
}

nav div:hover a:first-child {
 background-color:#E3E3E3;
 color:black;
}

a:hover{
 transition: 0.4s linear;
 background-color:#E3E3E3;
}

  <form action="mailto:someone@example.com" method="post" enctype="text/plain">
    Fornavn og Efternavn

    <input type="text" name="name">

E-mail:

    <input type="text" name="mail">

Spørgsmål:

    <input type="question" name="comment" size="50">

    <input type="submit" value="Send">
  </form>


text:
Q: Package shown as github link in pip freeze not packagename==1.0.0 I have setup a project as per this solution:
Sibling package imports and installed as an 'editable' package by navigating to the root folder and running pip install -e .
This installs successfully but when I run pip freeze the installed package is shown as:
-e git+https://github.com/username/project.git@123456789#egg=packagename

rather than the expected:
packagename==1.0.0

*

*What is this happening?

*Is the package now linked to github?

*How can I get it installed with its name rather than github URL?


text:
Q: how to remove a specific character from a tuple using python I have a tuple:
tuple = ('one', ('two', 'three'))
I want to print remove the ' from this tuple so I can print it as (one, (two, three)).
I have tried this
tuple = str(tuple)
print tuple.strip(')

But I get this error:
    print tuple.strip(')
                       ^
SyntaxError: EOL while scanning string literal

How can I turn my tuple into the desired string?

A: t = ('one', ('two', 'three'))
t2 = str(t)
print(t2.replace("'",""))

It's considered bad practice to use keywords like tuple as variable names, you might run into trouble with that.

A: You can print with replace:
print(str(tuple).replace("'", ''))

output
(one, (two, three))


text:
Q: Kendo UI (Multi Select Dropdown) - Change data values from External file I am using Kendo UI (Multi Select Dropdown) and I want to change the option values of it from external script file.
This is working as expected {Online DEMO} only if I am not initializing the Kendo feature in html page.
So, I have already options in html page:
My HTML Page:
    <select id="multiselect" multiple="multiple" class="mySelectBox">
      <option>Option 1</option>
      <option>Option 2</option>
    </select>
    <select id="multiselect2" multiple="multiple">
      <option>Option 3</option>
      <option>Option 4</option>
    </select>

    <script language="Javascript">
      $("#multiselect, multiselect2").kendoMultiSelect();
    </script>

and trying to replace the values from external.js file as:
     var dataMultiselect = ["New Value 1", "New Value 2", "New Value 3"];
      $("#multiselect").kendoMultiSelect({
        dataSource: dataMultiselect
      });
      $("#multiselect2").kendoMultiSelect({
        dataSource: dataMultiselect
      });

It is not working... Any Help can save my day
Getting Error as "Uncaught TypeError: Cannot set property 'selected' of undefined"

A: You can change data values with function setDataSource
var data2 = ["Five", "Six"];
var multiselect = $("#multiselect").data("kendoMultiSelect");
multiselect.setDataSource(new kendo.data.DataSource({ data: data2 }));

Dojo example


text:
Q: SSH Tunneling IIS "Bad Request - Invalid Hostname" When Accessed Through Public IP I had deployed an ASP.NET project.
It works well in localhost and domain name, but raise an error while accessed through site public IP.
http://wildanmuhlis.com:9000/traders

http://45.127.134.46:9000/traders

IIS Binding Configuration:

Notes:
The IIS forwarded to VPS hosting through SSH Tunnel.

A: make sure there is no Firewall or ips on your network that block the acess & check the .htacess file & the port forwarding


text:
Q: Set default value to an Input field but make it editable (to be able to change it manually)? I have an online form that takes values from some input fields and does some calculations on them. please check fiddle URL:
https://jsfiddle.net/moeadas/fv027knx/44/
I basically need to set a default value to a specific input field named (Rounded Valuation) name="B200". I want this input to take the value from another field name="B52" as default but I want users to be able to manually edit this field to enter another number (which will be used for other calculations).
Finally I want to hide the "Submit" button in the last stage as this is not really a form and its just an online form which users can play with.
I really appreciate all your kind comments and efforts. Please have a look at the fiddle link to better understand the current structure.
JAVASCRIPT CODE BELOW. CHECK THE JSFIDDLE FOR THE FULL STRUCTURE
    function milesIt(num) {
  return Math.floor(num).toString().split("").reverse().map((n, i, a) =>
    (i + 1) % 3 === 0 && i + 1 != a.length && "," + n || n).reverse().join("");
}

var inputs = document.querySelectorAll("[type='text']");
inputs.forEach(function(input) {
  //change the values to include the thousand separator each time the user changes an input
  input.onchange = function(e) {
    inputs.forEach(function(inp) {
      inp.value = inp.value.replace(/[,]/g, '');
    });
    calcule2();
    inputs.forEach(function(inp) {
      inp.value = milesIt(inp.value);
    });

  }

  input.value = milesIt(input.value);
});
////////////////////////////////////////////

var currentTab = 0; // Current tab is set to be the first tab (0)
showTab(currentTab); // Display the current tab

function showTab(n) {
  // This function will display the specified tab of the form ...
  var x = document.getElementsByClassName("tab");
  x[n].style.display = "block";
  // ... and fix the Previous/Next buttons:
  if (n == 0) {
    document.getElementById("prevBtn").style.display = "none";
  } else {
    document.getElementById("prevBtn").style.display = "inline";
  }
  if (n == (x.length - 1)) {
    document.getElementById("nextBtn").innerHTML = "Submit";
  } else {
    document.getElementById("nextBtn").innerHTML = "Next";
  }

  // ... and run a function that displays the correct step indicator:
  fixStepIndicator(n)
}

function nextPrev(n) {
  // This function will figure out which tab to display
  var x = document.getElementsByClassName("tab");
  // Exit the function if any field in the current tab is invalid:
  if (n == 1 && !validateForm()) return false;
  // Hide the current tab:
  x[currentTab].style.display = "none";
  // Increase or decrease the current tab by 1:
  currentTab = currentTab + n;
  // if you have reached the end of the form... :
  if (currentTab >= x.length) {
    //...the form gets submitted:
    document.getElementById("CreativeAcquisitions").submit();
    return false;
  }
  // Otherwise, display the correct tab:
  showTab(currentTab);
}

function validateForm() {
  // This function deals with validation of the form fields
  var x, y, i, valid = true;
  x = document.getElementsByClassName("tab");
  y = x[currentTab].getElementsByTagName("input");
  // A loop that checks every input field in the current tab:
  for (i = 0; i < y.length; i++) {
    // If a field is empty...
    if (y[i].value == "") {
      // add an "invalid" class to the field:
      y[i].className += " invalid";
      // and set the current valid status to false:
      valid = false;
    }
  }
  // If the valid status is true, mark the step as finished and valid:
  if (valid) {
    document.getElementsByClassName("step")[currentTab].className += " finish";
  }
  return valid; // return the valid status
}

function fixStepIndicator(n) {
  // This function removes the "active" class of all steps...
  var i, x = document.getElementsByClassName("step");
  for (i = 0; i < x.length; i++) {
    x[i].className = x[i].className.replace(" active", "");
  }
  //... and adds the "active" class to the current step:
  x[n].className += " active";
}

function calcule2() {

  var i = 0;
  for (i = 0; i <= 50; i++) {
    calcule();
  }
}

function calcule() {

  CreativeAcquisitions.B28.value = parseFloat(CreativeAcquisitions.B17.value) + parseFloat(CreativeAcquisitions.B19.value) + parseFloat(CreativeAcquisitions.B21.value) + parseFloat(CreativeAcquisitions.B23.value) + parseFloat(CreativeAcquisitions.B25.value);

  CreativeAcquisitions.B52.value = (parseFloat(CreativeAcquisitions.B4.value) * parseFloat(CreativeAcquisitions.B6.value)) + parseFloat(CreativeAcquisitions.D81.value) +
    parseFloat(CreativeAcquisitions.B300.value);

  CreativeAcquisitions.B55.value = parseFloat(CreativeAcquisitions.B4.value) * parseFloat(CreativeAcquisitions.B6.value);
  CreativeAcquisitions.B56.value = parseFloat(CreativeAcquisitions.B28.value);

  //CreativeAcquisitions.B200.value = CreativeAcquisitions.B52.value; //testing
  //document.getElementById("B200").value = CreativeAcquisitions.B52.value;

  CreativeAcquisitions.B66.value = parseFloat(CreativeAcquisitions.B200.value);
  CreativeAcquisitions.B67.value = parseFloat(CreativeAcquisitions.D81.value);

  CreativeAcquisitions.B68.value = parseFloat(CreativeAcquisitions.B36.value) + parseFloat(CreativeAcquisitions.B37.value) + parseFloat(CreativeAcquisitions.B38.value) + parseFloat(CreativeAcquisitions.B39.value) + parseFloat(CreativeAcquisitions.B40.value);

  CreativeAcquisitions.B300.value = (parseFloat(CreativeAcquisitions.B36.value) + parseFloat(CreativeAcquisitions.B37.value) + parseFloat(CreativeAcquisitions.B38.value) + parseFloat(CreativeAcquisitions.B39.value) + parseFloat(CreativeAcquisitions.B40.value)) * -1;

  CreativeAcquisitions.B69.value = parseFloat(CreativeAcquisitions.B41.value);
  CreativeAcquisitions.B70.value = (parseFloat(CreativeAcquisitions.B200.value) * parseFloat(CreativeAcquisitions.B46.value)) / 100;
  CreativeAcquisitions.B71.value = (parseFloat(CreativeAcquisitions.B200.value) * parseFloat(CreativeAcquisitions.B47.value)) / 100;
  CreativeAcquisitions.B72.value = parseFloat(CreativeAcquisitions.B66.value) - parseFloat(CreativeAcquisitions.B67.value) - parseFloat(CreativeAcquisitions.B70.value) - parseFloat(CreativeAcquisitions.B69.value) - parseFloat(CreativeAcquisitions.B71.value);
  CreativeAcquisitions.B76.value = parseFloat(CreativeAcquisitions.B17.value);
  CreativeAcquisitions.D76.value = (parseFloat(CreativeAcquisitions.B76.value) * parseFloat(CreativeAcquisitions.C76.value)) / 100;
  CreativeAcquisitions.B77.value = parseFloat(CreativeAcquisitions.B19.value);
  CreativeAcquisitions.D77.value = (parseFloat(CreativeAcquisitions.B77.value) * parseFloat(CreativeAcquisitions.C77.value)) / 100;
  CreativeAcquisitions.B78.value = parseFloat(CreativeAcquisitions.B21.value);
  CreativeAcquisitions.D78.value = (parseFloat(CreativeAcquisitions.B78.value) * parseFloat(CreativeAcquisitions.C78.value)) / 100;
  CreativeAcquisitions.B79.value = parseFloat(CreativeAcquisitions.B23.value);
  CreativeAcquisitions.D79.value = (parseFloat(CreativeAcquisitions.B79.value) * parseFloat(CreativeAcquisitions.C79.value)) / 100;
  CreativeAcquisitions.B80.value = parseFloat(CreativeAcquisitions.B25.value);
  CreativeAcquisitions.D80.value = (parseFloat(CreativeAcquisitions.B80.value) * parseFloat(CreativeAcquisitions.C80.value)) / 100;
  CreativeAcquisitions.B81.value = parseFloat(CreativeAcquisitions.B76.value) + parseFloat(CreativeAcquisitions.B77.value) + parseFloat(CreativeAcquisitions.B78.value) + parseFloat(CreativeAcquisitions.B79.value) + parseFloat(CreativeAcquisitions.B80.value);
  CreativeAcquisitions.D81.value = parseFloat(CreativeAcquisitions.D76.value) + parseFloat(CreativeAcquisitions.D77.value) + parseFloat(CreativeAcquisitions.D78.value) + parseFloat(CreativeAcquisitions.D79.value) + parseFloat(CreativeAcquisitions.D80.value);
  CreativeAcquisitions.B91.value = parseFloat(CreativeAcquisitions.B36.value);

  CreativeAcquisitions.B92.value = parseFloat(CreativeAcquisitions.B37.value);

  CreativeAcquisitions.B93.value = parseFloat(CreativeAcquisitions.B38.value);

  CreativeAcquisitions.B94.value = parseFloat(CreativeAcquisitions.B39.value);

  CreativeAcquisitions.B95.value = parseFloat(CreativeAcquisitions.B40.value);

  CreativeAcquisitions.B96.value = (parseFloat(CreativeAcquisitions.B52.value) * parseFloat(CreativeAcquisitions.B46.value)) / 100;

  CreativeAcquisitions.B97.value = parseFloat(CreativeAcquisitions.B41.value);

  CreativeAcquisitions.B98.value = (parseFloat(CreativeAcquisitions.B91.value) + parseFloat(CreativeAcquisitions.B92.value) + parseFloat(CreativeAcquisitions.B93.value) + parseFloat(CreativeAcquisitions.B94.value) + parseFloat(CreativeAcquisitions.B95.value) + parseFloat(CreativeAcquisitions.B96.value) + parseFloat(CreativeAcquisitions.B97.value)) * -1;

  CreativeAcquisitions.C98.value = (parseFloat(CreativeAcquisitions.C91.value) + parseFloat(CreativeAcquisitions.C92.value) + parseFloat(CreativeAcquisitions.C93.value) + parseFloat(CreativeAcquisitions.C94.value) + parseFloat(CreativeAcquisitions.C95.value) + parseFloat(CreativeAcquisitions.C96.value) + parseFloat(CreativeAcquisitions.C97.value)) * -1;

  CreativeAcquisitions.B101.value = parseFloat(CreativeAcquisitions.B4.value);
  CreativeAcquisitions.B105.value = (parseFloat(CreativeAcquisitions.B101.value) * parseFloat(CreativeAcquisitions.B103.value)) / 100;
  CreativeAcquisitions.B107.value = parseFloat(CreativeAcquisitions.C98.value);
  CreativeAcquisitions.B108.value = parseFloat(CreativeAcquisitions.B101.value) - parseFloat(CreativeAcquisitions.B105.value) + parseFloat(CreativeAcquisitions.B107.value);
}

A: I don't know how these fields are created but following your code, this may be helpful:
//////////Newcode///////////////////////////
function milesIt(num) {
  return Math.floor(num).toString().split("").reverse().map((n, i, a) =>
    (i + 1) % 3 === 0 && i + 1 != a.length && "," + n || n).reverse().join("");
}

var inputs = document.querySelectorAll("[type='text']");
inputs.forEach(function(input) {
  //change the values to include the thousand separator each time the user changes an input
  input.onchange = function(e) {
    inputs.forEach(function(inp) {
      inp.value = inp.value.replace(/[,]/g, '');
    });
    calcule2();
    inputs.forEach(function(inp) {
      inp.value = milesIt(inp.value);
    });
    //e.target.value = milesIt(e.target.value.replace(/[.]/g, ''));
  }
  //change the values of the inputs at the beginning, although you could write them as HTML with the thousand separator values in the source code
  input.value = milesIt(input.value);
});
////////////////////////////////////////////

var currentTab = 0; // Current tab is set to be the first tab (0)
showTab(currentTab); // Display the current tab

function showTab(n) {
  // This function will display the specified tab of the form ...
  var x = document.getElementsByClassName("tab");
  x[n].style.display = "block";
  // ... and fix the Previous/Next buttons:
  if (n == 0) {
    document.getElementById("prevBtn").style.display = "none";
  } else {
    document.getElementById("prevBtn").style.display = "inline";
  }
  if (n == (x.length - 1)) {
    document.getElementById("nextBtn").style.display='none';
  } else {
    document.getElementById("nextBtn").innerHTML = "Next";
  }

  // ... and run a function that displays the correct step indicator:
  fixStepIndicator(n)
}

function nextPrev(n) {
  // This function will figure out which tab to display
  var x = document.getElementsByClassName("tab");
  // Exit the function if any field in the current tab is invalid:
  if (n == 1 && !validateForm()) return false;
  // Hide the current tab:
  x[currentTab].style.display = "none";
  // Increase or decrease the current tab by 1:
  currentTab = currentTab + n;
  // if you have reached the end of the form... :
    if (n < (x.length - 2))
        document.getElementById("nextBtn").style.display='inline';
  // Otherwise, display the correct tab:
  showTab(currentTab);
}

function validateForm() {
  // This function deals with validation of the form fields
  var x, y, i, valid = true;
  x = document.getElementsByClassName("tab");
  y = x[currentTab].getElementsByTagName("input");
  // A loop that checks every input field in the current tab:
  for (i = 0; i < y.length; i++) {
    // If a field is empty...
    if (y[i].value == "") {
      // add an "invalid" class to the field:
      y[i].className += " invalid";
      // and set the current valid status to false:
      valid = false;
    }
  }
  // If the valid status is true, mark the step as finished and valid:
  if (valid) {
    document.getElementsByClassName("step")[currentTab].className += " finish";
  }
  return valid; // return the valid status
}

function fixStepIndicator(n) {
  // This function removes the "active" class of all steps...
  var i, x = document.getElementsByClassName("step");
  for (i = 0; i < x.length; i++) {
    x[i].className = x[i].className.replace(" active", "");
  }
  //... and adds the "active" class to the current step:
  x[n].className += " active";
}

function calcule2() {

  var i = 0;
  for (i = 0; i <= 50; i++) {
    calcule();
  }
}

function calcule() {

  CreativeAcquisitions.B28.value = parseFloat(CreativeAcquisitions.B17.value) + parseFloat(CreativeAcquisitions.B19.value) + parseFloat(CreativeAcquisitions.B21.value) + parseFloat(CreativeAcquisitions.B23.value) + parseFloat(CreativeAcquisitions.B25.value);

  CreativeAcquisitions.B52.value = (parseFloat(CreativeAcquisitions.B4.value) * parseFloat(CreativeAcquisitions.B6.value)) + parseFloat(CreativeAcquisitions.D81.value) +
    parseFloat(CreativeAcquisitions.B300.value);

  CreativeAcquisitions.B55.value = parseFloat(CreativeAcquisitions.B4.value) * parseFloat(CreativeAcquisitions.B6.value);
  CreativeAcquisitions.B56.value = parseFloat(CreativeAcquisitions.B28.value);

  CreativeAcquisitions.B200.value = Math.round(parseFloat(CreativeAcquisitions.B52.value)); //here is your field

  CreativeAcquisitions.B66.value = parseFloat(CreativeAcquisitions.B200.value);
  CreativeAcquisitions.B67.value = parseFloat(CreativeAcquisitions.D81.value);

  CreativeAcquisitions.B68.value = parseFloat(CreativeAcquisitions.B36.value) + parseFloat(CreativeAcquisitions.B37.value) + parseFloat(CreativeAcquisitions.B38.value) + parseFloat(CreativeAcquisitions.B39.value) + parseFloat(CreativeAcquisitions.B40.value);

  CreativeAcquisitions.B300.value = (parseFloat(CreativeAcquisitions.B36.value) + parseFloat(CreativeAcquisitions.B37.value) + parseFloat(CreativeAcquisitions.B38.value) + parseFloat(CreativeAcquisitions.B39.value) + parseFloat(CreativeAcquisitions.B40.value)) * -1;

  CreativeAcquisitions.B69.value = parseFloat(CreativeAcquisitions.B41.value);
  CreativeAcquisitions.B70.value = (parseFloat(CreativeAcquisitions.B200.value) * parseFloat(CreativeAcquisitions.B46.value)) / 100;
  CreativeAcquisitions.B71.value = (parseFloat(CreativeAcquisitions.B200.value) * parseFloat(CreativeAcquisitions.B47.value)) / 100;
  CreativeAcquisitions.B72.value = parseFloat(CreativeAcquisitions.B66.value) - parseFloat(CreativeAcquisitions.B67.value) - parseFloat(CreativeAcquisitions.B70.value) - parseFloat(CreativeAcquisitions.B69.value) - parseFloat(CreativeAcquisitions.B71.value);
  CreativeAcquisitions.B76.value = parseFloat(CreativeAcquisitions.B17.value);
  CreativeAcquisitions.D76.value = (parseFloat(CreativeAcquisitions.B76.value) * parseFloat(CreativeAcquisitions.C76.value)) / 100;
  CreativeAcquisitions.B77.value = parseFloat(CreativeAcquisitions.B19.value);
  CreativeAcquisitions.D77.value = (parseFloat(CreativeAcquisitions.B77.value) * parseFloat(CreativeAcquisitions.C77.value)) / 100;
  CreativeAcquisitions.B78.value = parseFloat(CreativeAcquisitions.B21.value);
  CreativeAcquisitions.D78.value = (parseFloat(CreativeAcquisitions.B78.value) * parseFloat(CreativeAcquisitions.C78.value)) / 100;
  CreativeAcquisitions.B79.value = parseFloat(CreativeAcquisitions.B23.value);
  CreativeAcquisitions.D79.value = (parseFloat(CreativeAcquisitions.B79.value) * parseFloat(CreativeAcquisitions.C79.value)) / 100;
  CreativeAcquisitions.B80.value = parseFloat(CreativeAcquisitions.B25.value);
  CreativeAcquisitions.D80.value = (parseFloat(CreativeAcquisitions.B80.value) * parseFloat(CreativeAcquisitions.C80.value)) / 100;
  CreativeAcquisitions.B81.value = parseFloat(CreativeAcquisitions.B76.value) + parseFloat(CreativeAcquisitions.B77.value) + parseFloat(CreativeAcquisitions.B78.value) + parseFloat(CreativeAcquisitions.B79.value) + parseFloat(CreativeAcquisitions.B80.value);
  CreativeAcquisitions.D81.value = parseFloat(CreativeAcquisitions.D76.value) + parseFloat(CreativeAcquisitions.D77.value) + parseFloat(CreativeAcquisitions.D78.value) + parseFloat(CreativeAcquisitions.D79.value) + parseFloat(CreativeAcquisitions.D80.value);
  CreativeAcquisitions.B91.value = parseFloat(CreativeAcquisitions.B36.value);

  CreativeAcquisitions.B92.value = parseFloat(CreativeAcquisitions.B37.value);

  CreativeAcquisitions.B93.value = parseFloat(CreativeAcquisitions.B38.value);

  CreativeAcquisitions.B94.value = parseFloat(CreativeAcquisitions.B39.value);

  CreativeAcquisitions.B95.value = parseFloat(CreativeAcquisitions.B40.value);

  CreativeAcquisitions.B96.value = (parseFloat(CreativeAcquisitions.B52.value) * parseFloat(CreativeAcquisitions.B46.value)) / 100;

  CreativeAcquisitions.B97.value = parseFloat(CreativeAcquisitions.B41.value);

  CreativeAcquisitions.B98.value = (parseFloat(CreativeAcquisitions.B91.value) + parseFloat(CreativeAcquisitions.B92.value) + parseFloat(CreativeAcquisitions.B93.value) + parseFloat(CreativeAcquisitions.B94.value) + parseFloat(CreativeAcquisitions.B95.value) + parseFloat(CreativeAcquisitions.B96.value) + parseFloat(CreativeAcquisitions.B97.value)) * -1;

  CreativeAcquisitions.C98.value = (parseFloat(CreativeAcquisitions.C91.value) + parseFloat(CreativeAcquisitions.C92.value) + parseFloat(CreativeAcquisitions.C93.value) + parseFloat(CreativeAcquisitions.C94.value) + parseFloat(CreativeAcquisitions.C95.value) + parseFloat(CreativeAcquisitions.C96.value) + parseFloat(CreativeAcquisitions.C97.value)) * -1;

  CreativeAcquisitions.B101.value = parseFloat(CreativeAcquisitions.B4.value);
  CreativeAcquisitions.B105.value = (parseFloat(CreativeAcquisitions.B101.value) * parseFloat(CreativeAcquisitions.B103.value)) / 100;
  CreativeAcquisitions.B107.value = parseFloat(CreativeAcquisitions.C98.value);
  CreativeAcquisitions.B108.value = parseFloat(CreativeAcquisitions.B101.value) - parseFloat(CreativeAcquisitions.B105.value) + parseFloat(CreativeAcquisitions.B107.value);
}


text:
Q: Asking about absolute convergence of infinite product in complex analysis I am trying exercises in complex analysis from tutorials of an Institute of which I am not a student.
There is a question in infinite products on which I am struct.

Question is - Prove that infinite product $\prod_{n=1}^{\infty} (1- e^{2πin\tau} )$ , $\tau
  $ belongs to Upper Half plane  converges absolutely.

I have studied complex analysis from Ponnusamy and silvermann and from that I know that $\prod_{n=1}^{\infty} (1+ a_n ) $ converges absolutely iff $\sum_{n=1}^{\infty} (a_n) $ converges absolutely.
But I don't know how to prove absolute convergence of  sum $e^{2πin\tau } $ .
Can someone please explain how to do this

A: Hint: Write $\tau = a +ib.$ Then $b>0.$ We have
$$e^{2\pi i n\tau} = e^{-2\pi nb}\cdot e^{2\pi i na}.$$
What is the absolute value of the last expression?


text:
Q: Divide vector of timestamps (/ POSIXcts) into n-minutes intervals in R I have a huge vector of timestamps (double type in R). This is a column in my data.table object. I want to divide these observations into n-minutes intervals - I want to have a character vector representing e.g. time of the first value for this interval.
For example, for 7-minutes (7*60 seconds) interval I may have:
> ts <- c(1400132530, 1400134830)
> ts.intv <- ts - (ts %% (7*60))
>
> POSIXct.intv <- as.POSIXct(ts.intv, origin="1970-01-01")
> format(POSIXct.intv, "%H:%M:%S")
[1] "07:36:00" "08:18:00"

I tried to use sapply operation fot this procedure but it is very time-consuming over my vector of timestamps (length ~ 15kk). Can anyone sugest better solution? Any built-in function?

A: What about cut:
(ts <- seq.POSIXt(from=Sys.time(), by="2 mins", length.out=8))
# [1] "2014-06-07 00:51:10 CEST" "2014-06-07 00:53:10 CEST"
# [3] "2014-06-07 00:55:10 CEST" "2014-06-07 00:57:10 CEST"
# [5] "2014-06-07 00:59:10 CEST" "2014-06-07 01:01:10 CEST"
# [7] "2014-06-07 01:03:10 CEST" "2014-06-07 01:05:10 CEST"
groups <- cut.POSIXt(ts, breaks="7 mins")
levels(groups)
# [1] "2014-06-07 00:48:00" "2014-06-07 00:55:00"


text:
Q: How to send packet another server using dpdk? My question is how to send packet another Physical Server from my Computer using dpdk.
I already watched example code rxtx_callbacks and i want to use this code.
but there is no place to enter a specific ip and port to another server.
how i can send packets to places on a server using dpdk with specified ip and port?
and how i can receive packets using dpdk?
Is l3fwd correct or is this another concept?
help me

A: DPDK is an open-source library that allows one to bypass Kernel and ETH-IP-TCP stack to send packets from userspace directly on NIC or other custom hardware. There are multiple examples and projects like pktgen and TREX which uses to generate user-defined packets (desired MAC address, VLAN, IP and TCP-UDP) payload.
For the queries

*

*how i can send packets to places on a server using dpdk with specified ip and port?
[Answer] make use of DPDK PKTGEN as an easy way to generate. Other examples are pcap based burst replay and trex.
But the easiest way to generate and send traffic is using scapy with DPDK sample application skeleton. Following are the steps required to achieve the same.

*

*Install DPDK to desired platform (preferably Linux)

*build the DPDK example skeleton found in path [dpdk root folder]/examples/skeleton

*bind a physical NIC (if traffic needs to be send out of server) with userspace drivers like igb_uio, uio_pci_generic or vfio-pci

*start the application with options '-l 1 --vdev=net_tap0,iface=scapyEth'. this will create TAP interface with name scapyEth.

*using scapy now create your custom packet with desired MAC, VLAN, IP and Port numbers.

and how i can receive packets using dpdk?
[Answer] on receiver side run DPDK application like testpmd, l2fwd, or skeleton if packets needs to received by Userspace DPDK application or any Linux sockets can receive the UDP packets.
Note: easiest way to check whether packets are received is to run tcpudmp. example tcpdump -eni eth1 -Q in (where eth1 is physical interface on Reciever Server.
Note: Since the request how i can send packets to places on a server is not clear

*

*Using DPDK one can send packets through a physical interface using dedicated NIC, FPGA and wireless devices

*DPDK can send packets among applications using memif interface

*DPDK can send packets between VM using virtio and vhost

*DPDK can send and receive packets to kernel, where Kernel routing stack and ARP table determine which kernel interface will forward the packets.


text:
Q: Can you connect the same AWS user pool to a React Native and React App? I have used AWS Amplify ("amplify add auth" in the terminal) to create a user pool in AWS Cognito with my React Native app but I don't know how to connect this same user pool to my React App. As far as I can see the Amplify Cli only gives options to create a new resource... Does anyone know how to connect it to an already existing/in use user pool?

A: You can use the same pool with any frameworks. Make sure you pass in the right user pool configuration.
// AppSync client instantiation
const client = new AWSAppSyncClient({
  url: AppSync.graphqlEndpoint,
  region: AppSync.region,
  auth: {
    // IAM
    // type: AUTH_TYPE.AWS_IAM,
    // credentials: () => Auth.currentCredentials(),

    // COGNITO USER POOLS
    type: AUTH_TYPE.AMAZON_COGNITO_USER_POOLS,
    jwtToken: async () => (await Auth.currentSession()).getAcceessToken().getJwtToken(),
  },
});

A: I had the same doubt today and after searching, it's possible to use the same user pool.
Check the user pools configuration in your AWS Console and replace as it follows:
import Amplify from 'aws-amplify';
...

Amplify.configure({
  Auth: {
    // REQUIRED only for Federated Authentication - Amazon Cognito Identity Pool ID
    identityPoolId: 'XX-XXXX-X:XXXXXXXX-XXXX-1234-abcd-1234567890ab',
    // REQUIRED - Amazon Cognito Region
    region: 'XX-XXXX-X',
    // OPTIONAL - Amazon Cognito User Pool ID
    userPoolId: 'XX-XXXX-X_abcd1234',
    // OPTIONAL - Amazon Cognito Web Client ID (26-char alphanumeric string)
    userPoolWebClientId: 'a1b2c3d4e5f6g7h8i9j0k1l2m3'
  }
});


text:
Q: Trying to access array offset on value of type null PHP 7.4 Buenas estoy teniendo problema con este código al querer ingresar con login desde la api de steam, arroja este error, el archivo en sidebar.php en la linea 104
PHP Notice:  Undefined offset: 0 in /public_html/app/page/general/sidebar.php on line 104
PHP Notice:  Trying to access array offset on value of type null in /public_html/app/page/general/sidebar.php on line 104

<?php echo $Translate->get_translate_phrase( $Auth->user_auth[0]['rank'], 'ranks_' . $Auth->server_info[0]['ranks_pack'] )?>

Parte del código :

<?php echo $Translate->get_translate_phrase( $Auth->user_auth[0]['rank'], 'ranks_' . $Auth->server_info[0]['ranks_pack'] )?>

<?php for ( $d = 1; $d < $Auth->user_rank_count; ++$d ):?>
    <div class="tooltip-sidebar box-button-srv-treeview-<?php echo $d?>"><?php echo $Translate->get_translate_phrase( $Auth->user_auth[$d]['rank'], 'ranks_' . $Auth->server_info[ 0 ]['ranks_pack'] )?>

<?php endfor;?>

<?php echo $Translate->get_translate_phrase('_Home')?>

<?php
for ( $d = 0, $c = sizeof( $Modules->arr_module_init['sidebar'] ); $d < $c; $d++ ):
    if( ! empty( $Modules->array_modules[ $Modules->arr_module_init['sidebar'][ $d ] ]['sidebar'] ) ):
        for ( $_d = 0, $_c = sizeof( $Modules->array_modules[ $Modules->arr_module_init['sidebar'][ $d ] ]['sidebar'] ); $_d < $_c; $_d++ ):?>
            <div class="tooltip-sidebar box-button-<?php  print $d."-".$_d;?>">
                <?php if(substr( $Modules->array_modules[ $Modules->arr_module_init['sidebar'][ $d ] ]['sidebar'][ $_d ]['name'], 0, 1) == '_') {
                    if ($Translate->get_translate_module_phrase( $Modules->arr_module_init['sidebar'][ $d ],$Modules->array_modules[ $Modules->arr_module_init['sidebar'][ $d ] ]['sidebar'][ $_d ]['name']) == 'No Translation'){
                        print $Translate->get_translate_phrase($Modules->array_modules[ $Modules->arr_module_init['sidebar'][ $d ] ]['sidebar'][ $_d ]['name']);
                    } else {
                        print $Translate->get_translate_module_phrase( $Modules->arr_module_init['sidebar'][ $d ], $Modules->array_modules[ $Modules->arr_module_init['sidebar'][ $d ] ]['sidebar'][ $_d ]['name']);
                    }
                    }else{
                    print $Modules->array_modules[ $Modules->arr_module_init['sidebar'][ $d ] ]['sidebar'][ $_d ]['name'];
                    }?>

<?php   endfor;
    endif;
endfor;?>

Agradezco cualquier ayuda.


text:
Q: "PushPlugin not found" using Cordova 2.5 for iOS I am using PushPlugin https://github.com/phonegap-build/PushPlugin and Cordova 2.5 for an iOS applicaiton.
In my Plugins folder I have these files:

*

*Appdelegate+notification.h

*Appdelegate+notification.m

*PushPlugin.h

*PushPlugin.m

In config.xml I have included the plugin like this:
<plugin name="PushPlugin" value="PushPlugin" />
I have also PushNotification.js in my www folder and included that in index.html.
When I run the application and execute the line in my push.js file:
pushNotification.register(this.tokenHandler,this.errorHandler, {"badge":"true","sound":"true","alert":"true","ecb":app.onNotificationAPN"});
Then I get this error:
Error: Plugin 'PushPlugin' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml
Is PushPlugin compatible with Cordova 2.5?

A: I had this same issue when trying to get the pushplugin to work.  I got it working by putting this block of code inside the config.xml (not the one in the www folder, but the one in the project folder)
<!-- ios -->
<platform name="ios">

    <config-file target="config.xml" parent="/*">
        <feature name="PushPlugin">
            <param name="ios-package" value="PushPlugin"/>
        </feature>
    </config-file>

    <source-file src="src/ios/AppDelegate+notification.m" />
    <source-file src="src/ios/PushPlugin.m" />

    <header-file src="src/ios/AppDelegate+notification.h" />
    <header-file src="src/ios/PushPlugin.h" />

</platform>

If you download the sample project from git, there's a file called plugin.xml that has a bunch of stuff that needs to be added to the xml (I think).
Hope that helps.


text:
Q: Setting Telerik RadTreeView attributes such as OnClientNodeExpanded via Javascript I have a RadTreeView which that can eb referenced by the variable:  TV
I did not know if i could just do jQuery to do $(TV).attr("OnClientNodeExpanded","newvalue") because there might be a server side link that i may be unaware of.
When I defined my RadTreeView in the markup, it has 2 attributes:  OnClientNodeExpanded and OnClientNodeClicked which are set to some javascript functions.
My question is as follows:
Is there a way to change where both OnClientNodeExpanded and OnClientNodeClicked point by some reference like:  *TV.set_ClientNodeExpanded("NEW_FUNCTION");*
I want to depending on what is clicked have the RadTreeView populate different material.
Edit to help clarify my goal: The asp.net control has those attributes.  Which means that the functions, are actually loadNode and clickedNode. What i was wanting to do was to change the reference of those attributes listed above to point to a different function. I wasnt sure i wanted to have an intermediate "judging" function to determine what functions were to be called, but instead a way to override the current declaration as to what fires when the RadTreeView Event Occurs. Does that clarify?

A: In your javascript OnClientNodeClicked function, you can check which item was clicked and then call the function you want.
function OnClientNodeClicked(sender, eventArgs) {
    var node = eventArgs.get_node();

    if(yourConditionHere){
        callFunctionA();
    }
    else{
        callFunctionB();
    }
}

Did I understand you correctly?


text:
Q: Is it possible to remove a row in MySQL based on a column having a specific character in the string? I have a MySQL table, and for this purpose say the database name is 'A_blah', that has several columns but i am interested in removing rows based on a specific column containing a string with a certain character. An example would be say there is a column containing:
A
A{
B
B{
AA
AA{

What i am looking to do is to remove each row that has '{' in the string in this column leaving:
A
B
AA

Is this possible with a query and if so could you show and explain? Thank you so much.

A: Assuming that's the only character your dealing with a simple:
DELETE FROM A_Blah WHERE col LIKE '%{%';

Should suffice.

A: You can also use MySQL Regular Expression
DELETE FROM A_blah WHERE column_name REGEXP '[A-Z]*[{][A-Z]*'


text:
Q: Outlook 2013 detected a slow addin I developed an Addin which consists of Login and the data entry and retrieval functionality. The data entry and retrieval are accessed through REST URL's. The Outlook Startup doesnt has any code, except it checks the outlook version. I implement a plain form which show the user "loading message" initially and the rest of the logic will be handled by a thread. So i hope everything is followed according to the performance, but still  i am receiving an addon error as "Outlook Detected an Addin Problem" The Add-in caused outlook to start slowly. I am able to overcome this problem and more and more i am able to get the time statistics for application start or shutdown events. couldany help me how do i resolve this?

A: Are you trying your AddIn in a debug mode or through an installer ?
First of all, make sure that it has been disabled because it is slow and not because it has errors.
If it has errors, it will cause Outlook to work slowly or even crash.
If it just working slowly, you can try to optimize your AddIn, go through your code again and see what you can do again in a less performance consuming way.
One other thing you can do is, when you will create a setup project for your AddIn to run an installer (instead of debug), you can set your Load Behavior to 16 in the registry.
This will cause the AddIn to load at Outlook startup on the first time after installation and to load on demand the other times. (Load on demand means when the user clicks on the AddIn icon).
This way, your AddIn won't slow Outlook down, except for the first time.


text:
Q: NHibernate and C#: error using nested properties with Criteria The scenario is a MVC.NET application using NHibernate to interact with a SQL Server database.
Every NHibernate query with Criteria works fine, except for the last I have added, that give the following error:

could not resolve property: Reading.Truck.Company.CompanyId of: ADO.Alarms

Related code is the following:
session = NHibernateSessionManager.Instance.GetSession();
            ICriteria criteria = session.CreateCriteria(typeof(Alarms));
            criteria.Add(Expression.Eq("Reading.Truck.Company.CompanyId", companyId));

            alarmsList = criteria.List<Alarms>();

Nested properties are defined in related class file like this:
Alarms.cs
private AlarmsReading _Reading;
public AlarmsReading Reading
    {
        get { return _Reading; }
        set { _Reading= value; }
    }

These properties are defined in mapping files like this:
Alarms.hbm.xml
<hibernate-mapping  ...>
<class name="Alarms" table="Alarms" lazy="false">
<cache usage="read-write"/>
...
<many-to-one name="Reading" class="AlarmsReading">
  <column name="Reading_Id" not-null="true"/>
</many-to-one>
...
</class>
</hibernate-mapping>

All other criteria query, with other nested properties, defined same way, works fine.
Strange thing is if I use normal IQuery syntax with createQuery method, all works smoothly; that is:
session = NHibernateSessionManager.Instance.GetSession();
IQuery query = null;
query = session.CreateQuery("FROM Alarms al WHERE Reading.Truck.Company.CompanyId = (:companyId) ");
query.SetParameter("companyId", companyId);
alarmsList = query.List<Alarms>();

I've also find this similar question, and I know there are various way to solve, but I'm looking for the cause of this misbehaviour.
Any help will be appreciated.
Thank you in advance.

A: Ok.
I've understood how to use Criteria properly, reading answers to this post, and following this example on the NHibernate official site.
Dot notation with Criteria seems to work only for the components of the current object (and their properties: i.e. Reading.ReadingId).
If we want to reach deeper properties we would use Associations.
So this code works fine for my task:
session = NHibernateSessionManager.Instance.GetSession();
ICriteria criteria = session.CreateCriteria(typeof(Alarms));
criteria.CreateCriteria("Reading").CreateCriteria("Truck")
        .Add(Expression.Eq("Company.CompanyId", companyId));

alarmsList = criteria.List<Alarms>();


text:
Q: SQL error when migrating data I am currently trying to migrate databases from one server to the next, I am using a VPN to remote into one server and I am trying to move this data onto another sql server on a remote desktop server. I have been at this for a while and keep getting this error:

I am puzzled by this, because SQL authentication to log into the server where the data is located on and I use Windows Authenticaion to log onto the target server, If i try and use sql authentication it wont work, but if I type something into the username and password and then still select windows auth then the error will display whatever I typed into the username, like it needs to be sql authentication. I am not sure what to do, I tried messing with the TCP/IC ports and destination ports and I even tried connecting to the VPN on both my computer and the remote client so that I could ping both servers so I know that they can atleast communicate. My only other idea to solve this is to mess with the Server Browser and the logins stored there but im not exactly sure what im doing there and dont want to mess anything up. I am not sure what to do next so any help would be appreciated.

A: You need to verify that you do have the proper login and permissions for both servers and make sure that the server is configured to accept that authentication form.
Check you server settings.


text:
Q: Object is not clickable when it is a child of another object in unity So, i made a simple code in unity that outputs "clicked" when the object is clicked by using this simple code :
private void OnMouseDown()
{
     Debug.Log("clicked");
}

it displays the message when clicked, but when the same object is a child of another object it is not clickable and doesn't display the message.
How do i make it clickable when it is a child ?

A: You should always be aware of the colliders of parented objects. When the collider of your child object is within the collider of the parent object the OnMouseDown trigger will only hit the first collider it (well) collides with.
You need the collider of the child object to be reachable.
You can deativate the collider of the parent object.
You can scale the collider of the child object up.
Or you write your own method, which only checks colliders with a given tag.

A: Just add a Rigidbody to the parent object (probably in your case you also need to set "Is Kinematic" to true) and make sure child objects have colliders.


text:
Q: Organizing non-Maven source code in Eclipse projects I am working with some sample source code that comes with a book that I recently purchased.  This sample source code does not use Maven.  When I imported the sample source code into Eclipse, it created a zillion new projects, cluttering my Project Explorer.  I want to organize all the source code from the book under one Master project, whose name is derived from the book.  After playing around quite a bit, I came up with a working solution that is reproduced below:

*

*Created a Maven project, choosing the book title as the Artifact Id
{thereby organizing all the child projects under the book title}

*In the Maven project, created multiple directories from Eclipse,
one for each chapter of the book (New --> New Folder --> Folder name) {this ensures that Eclipse has visibility to the directories}

*Closed Eclipse

*Copied the source code, chapter by chapter, to each of the directories created under the Maven project

*Relaunched Eclipse

*Sequentially imported the projects from each directory created under the Maven project directory in Step #2 (Import --> General --> Projects from Folder or Archive)

Although I have been able to realize my goal, I am uncomfortable with the fact that I am creating the Maven project solely for the purpose of organizing multiple non-Maven projects under one parent project.  I am not making any use of neat Maven features like dependency management.

Q)  What is the best way to organize multiple non-Maven projects under one parent project in Eclipse?

A: First of all, if these projects are all test projects unrelated to other projects, you can just create a new Workspace in Eclipse.
If this is not what you want, you can define Working Sets that organise projects.
It is usually not necessary to put projects into subfolders to organise them.


text:
Q: How to determine if the file download has completed in google chrome? I have downloaded a file using google chrome. Now I am wanting to know when it has finished downloading. Possibly through an external app (or command line). I have a direct way. There are issues with it.
If you have the checksum and the filename (somehow) available I can run a powershell program for the same:
$ Get-FileHash ~/Downloads/foo.img

Issue is that some web servers don't provide the filename directly, or, at all. Further, if the filename is not directly accessible, and, its name is quite long such that it appears truncated in the chrome's Downloads bar, there is the apparent chance of assuming the wrong (complete) filename.
Further, we don't have a way to know the status of download. Specifically when the download has interrupted. I am hoping there is some workarounds around this.

A: If there is a slow ongoing download you can run the following bash script:
#!/bin/bash

file=$1
# echo "File: $file"

while [ 1 ];
do

        if test -e "$file"; then
                break;
        fi
        sleep 5
done

Simply pass the location of the yet-to-exist (YTE) file as argument to the script.
To determine YTE file name, simply access Google Chrome's downloads page.

The YTE file will be in the user's corresponding folder in the file system. This code can be suitably adapted on Windows 10 machines (or older) through a cygwin-based bash shell, or, powershell.
This approach does not notifiy you of mid-download failures due to network errors.
E.g.
./check-file.sh ~/Downloads/foo.zip && echo "done"


text:
Q: How to autoplay an anchor tag with JavaScript I have a player and an anchor as a button. When I click on the button, I take its id via JavaScript and send it to the server. I take back from server, the URL that should start playing in the player. (I am using jwplayer) I am obligated to use links for the android version of the page, because jwplayer doesn't have it properly covered. But I also need to protect my streams with tokens, and that's why I should take a new stream from the server each time the button is clicked.
My problem is that I don't know how to make the stream play, after is taken from server.
Example code:

Loading the player...

    Big Buck Bunny trailer

    Tears of Steel trailer

What I want to achieve is this:

Loading the player...

Big Buck Bunny trailer

Tears of Steel trailer

'data' and 'data1' will be the URLs send back from server.
The user will click the button, which will cause the call to server, once the answer is back. How do I play it?
I hope I can get some advice from you guys.
Kind regards!


text:
Q: Auto-populate GL account based on WO classification I have work order classifications in Maximo 7.6.1.1:

I plan to add a field called GL Account to the classifications:

When I create a work order, I would like to automatically populate the WO's GL Account value via the selected WO classification.
What would it take to do this?

A: You should be able to populate your classification GL account with a custom crossover domain that you'd set on the WORKORDER.CLASSSTRUCTUREID field. Your custom GL field would be bound to WORKORDER.GLACCOUNT.
Look at the WORKORDER CLASSSTRUCTURE relationship to get the where clause that you'd need to set on your new domain's validation and list where clauses. This should look like this:classstructureid = :classstructureid
Check the other crossover domains associated to the WORKORDER objects such as ASSET2WO, LOC2WO, etc. to get an idea on how it works.
Also, have a look at this IBM documentation for more info on crossover domains:
https://www.ibm.com/support/knowledgecenter/en/SSLKT6_7.6.0/com.ibm.mt.doc/domainadm/t_add_crossover_domain.html


text:
Q: How to transform mouse to world coordinates? I have the a SlimDX Matrix for each of the world, view and projection transforms. According to http://msdn.microsoft.com/en-gb/library/windows/desktop/bb147302(v=vs.85).aspx the projection transform leaves coordinates in the (-1,1)^3 cube.
I thought that by translating the mouse position relative to the render target into projection space (i.e. scale it into the (-1,1) range and fix it at -1 in the z axis) and then applying the inverted worldviewprojection.
The code below shows my attempt. My test is to run the app and zoom in and out using the mouse wheel and see if the printed X coordinate changes while keeping the mouse cursor over the left edge of the window - it doesn't so something must be wrong somewhere.
form.MouseMove += (obj, eargs) =>
        {
            SlimDX.Matrix worldview = SlimDX.Matrix.Multiply(SlimDX.Matrix.Identity, viewMatrix);
            SlimDX.Matrix worldviewprojection = SlimDX.Matrix.Multiply(worldview, projectionMatrix);
            worldviewprojection.Invert();

            var pointX = (float)((2.0 * ((float)eargs.Location.X) / (float)form.Width) - 1.0f);
            var pointY = (float)((2.0 * (((float)eargs.Location.Y) / (float)form.Height)) - 1.0f) * -1.0f;
            var mouseInProjectionSpace = new Vector4(pointX, pointY, -1.0f, 1.0f);
            var mouseInWorldSpace = Vector4.Transform(mouseInProjectionSpace, worldviewprojection);
            Console.WriteLine(mouseInWorldSpace);
        };

        form.MouseWheel += (_, __) =>
            {
                if (__.Delta > 0)
                    cam.Z /= 2.0f;
                else
                    cam.Z *= 2.0f;
                viewMatrix = GetView(cam);
                Console.WriteLine("zzz="+cam.Z);
            };

Any help appreciated

A: your z is wrong, since in projective space z is 0 (near plane) to 1 (far plane)
So it does:
Vector2 mouse = //Normalized as -1 to 1 (as you did)
Vector3 orig = new Vector3(mouse.X,mouse.Y,0.0f);
Vector3 far = new Vector3(mouse.X,mouse.Y,1.0f);

//This gets mouse position on near plane
Vector3 origin = Vector3.TransformCoordinate(orig,worldviewprojectioninverse);

//This gets mouse position on far plane
Vector3 posfar = Vector3.TransformCoordinate(far,worldviewprojectioninverse);


text:
Q: Converting one struct to another using map/reduce functions How can i map/reduce values of one struct array to another using swift's higher order function?. Currently iam iterating over the array and appending each values to new array. Is there any "swifty" method to map the elements to other?
/// Code sample
let priorityList = [Priority]()
let pushRowList = [PushRowList]()

for priority in priorityList {
  let id = priority.priorityID
  let state = priority.priorityState
  let item = PushRowList(optionId: id, optionTitle: state)
  pushRowList.append(item)
}

Iam expecting the "swifty" methods like map, reduce etc to perform the operation.

A: You can simply use map, since you just want to access certain properties of each element of an array and use them to create another type.
let pushRowLists = priorityList.map{PushRowList(optionId: $0.priorityID, optionTitle: $0.priorityState}


text:
Q: Sails JS Installation Error and Advice I am starting to taste the sweetness of Node and I am thinking of using Sails for a new free service I am trying to create.
But I am having problems installing Sails. I get the following error when it goes to install.
npm ERR! error installing sails@0.8.91
npm ERR! error rolling back sails@0.8.91 Error: UNKNOWN, unknown error '/usr/local/lib/node_modules/sails'

npm ERR! Unsupported
npm ERR! Not compatible with your version of node/npm: forever@0.10.0
npm ERR! Required: {"node":"0.8.x"}
npm ERR! Actual:   {"npm":"1.1.4","node":"0.6.12"}
npm ERR!
npm ERR! System Linux 3.2.0-23-generic-pae
npm ERR! command "node" "/usr/bin/npm" "-g" "install" "sails"
npm ERR! cwd /var/www/test/ruby
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! code ENOTSUP
npm ERR! message Unsupported
npm ERR! errno {}

Is this some sort of compatibility with my Node version. I updated it to latest I guess a couple weeks back. I use NVM.
How can I rectify this and go ahead the installation before the enthusiasm dies :)
One extra advice, I would really appreciate and a thumb up for any good answer/s.
I am looking in to Node to create a free web service. Performance is my utmost concern to reduce cost.
The service is basically pull and show from the database or store. I am good with PHP alright with Rails and Sinatra. I see Sinatra to be light weight. Some where I red that the way node works it could scale better than Sinatra. Am I correct? What would be the best option of all. Btw, I am expecting to host in Hiroku.
Thanks in advance.


text:
Q: How to know the which javascript file is responsible for which logic in web page I want little help in web page debugging.
I have an xhtml page in which various javascript files are embedded where logics are written.
Now if i have to enhance the functionality of web page then how can i know which javascript file is responsible for which functionality.
How to get the flow if the code is very massive say for example in one xhtml page 20 scripts are embedded
Currently using firebug debugging tool

A: There is no other way. You have to go through all over the JS script to trace the flow. Normally in most browser, it will tell you what's wrong with the code. Perhaps it conflict everywhere. Try spend your time to remove one by one to see how is the code flowing through your webpage


text:
Q: Problems with accessing char*** Im trying to access a char * in strcasestr and it seems to have no effect
Heres the code:
#define NUMOFADDTYPES 5

const char* milkAdditions[] = {"Cream", "Half-and-half", "Whole-Milk",
                   "Part-skim", "skim", "non-dairy", NULL};
const char* syrupAdditions[] = {"Vanilla", "Almond", "Raspberry", NULL};
const char* sweetenerAdditions[] = {"white-sugar", "sweetener",
                    "Raw-cane", "honey", NULL};
const char* spiceAdditions[] = {"Cinnamon", "cardamon", NULL};
const char* alcoholAdditions[] = {"Brandy", "Rum", "Whiskey",
                  "Aquavit", "Kahlua", NULL};

const char** additions[] = {milkAdditions, syrupAdditions,
                sweetenerAdditions, spiceAdditions,
                alcoholAdditions};

  char *ptr;
  int i, j;

  printf("Dump of additions[j][i]\n");
  for(j = 0; j < NUMOFADDTYPES; j++)
    {
      for(i = 0; (additions[j])[i] != NULL; i++)
    {
      printf("%d %d\t%s\n", j, i, additions[j][i]);
      if((ptr = strcasestr((additions[j])[i], string)) != NULL)
      {
        ptr += strlen((additions[j])[i]);
        getVolume(ptr);
      }
    }

Output is:
Dump of additions[j][i]
0 0 Cream
0 1 Half-and-half
0 2 Whole-Milk
0 3 Part-skim
0 4 skim
0 5 non-dairy
1 0 Vanilla
1 1 Almond
1 2 Raspberry
2 0 white-sugar
2 1 sweetener
2 2 Raw-cane
2 3 honey
3 0 Cinnamon
3 1 cardamon
4 0 Brandy
4 1 Rum
4 2 Whiskey
4 3 Aquavit
4 4 Kahlua

any help would be greatly appreciated
Edit:
sorry didnt add
  char string[] = "AcceptAdditions: Cream;lots white-sugar;dash\r\n\r\n";
  getAddition(string);

Solved

A:
char *strcasestr(const char *haystack, const char *needle);

The strcasestr() function finds the first occurrence of the substring needle in the string haystack.
So, isn't it need to be
strcasestr(string, (additions[j])[i])
instead of
strcasestr((additions[j])[i], string)
?

A: Sorry guys I misread the man page and was searching the substring with the main string
char *strcasestr(const char *haystack, const char *needle);

Thanks for the answers anyways

A: After edit:

You are comparing each of "Cream", "Half and half", ... "Kahlua" to "AcceptAdditions: Cream;lots white-sugar;dash\r\n\r\n".
The strcasestr will never find a match!
I think you want to break your string in smaller parts and check the little parts.
char string[] = "AcceptAdditions: Cream;lots white-sugar;dash\r\n\r\n";
const char *accepted[] = {"cream", "white-sugar", "dash"};

and then check each item against each accepted element
      for (int k = 0; k < sizeof accepted / sizeof *accepted; k++) {
          if ((ptr = strcasestr((additions[j])[i], accepted[k])) != NULL)
          {
            //ptr += strlen((additions[j])[i]);
            getVolume(ptr);
          }
      }


text:
Q: Duplicated Save and Cancel buttons in Settings View I am trying to define a settings view for a custom module.
I have followed both the official documentation and a blog which helps you to adapt the code to Odoo 10:
http://odoo-development.readthedocs.io/en/latest/dev/py/res.config.settings.html
http://ludwiktrammer.github.io/odoo/custom-settings-odoo.html
Currently this is my code to display the form:
    <record id="mymodule_configuration_form" model="ir.ui.view">
        <field name="name">TEST Settings</field>
        <field name="model">mymodule_settings</field>
        <field name="arch" type="xml">
            <form class="oe_form_configuration">
                <header>
                    <button string="Save" type="object"
                        name="execute" class="oe_highlight"/>
                    <button string="Cancel" type="object"
                        name="cancel" class="oe_link"/>
                </header>
                <sheet>
                    <group>
                        <label for="color"/>
                        <field name="color"/>
                    </group>
                </sheet>
            </form>
        </field>
    </record>

And this is the code for the menus:
    <menuitem id="mymodule_menu"
              name="Custom Saleorder"
              parent="base.menu_custom" />

    <act_window id="mymodule_settings_action"
                name="Custom Saleorder Settings Action"
                res_model="mymodule_settings"
                view_mode="form" />
    <menuitem id="mymodule_settings_menu"
              name="Settings"
              action="mymodule_settings_action"
              parent="mymodule_menu" />

But while doing this I find that I have duplicated the buttons, how do I remove the above ones?

I think that the fact that I am dealing with a model which inherits res.config.settings is relevant.

A: Remove the buttons you have added, these buttons are automatically created and shown by Odoo (depending on the user's rights).
When you click Save, any method that starts with set_ is invoked, so do create a method for example named def set_settings and that method will be automatically invoked (assuming your settings model inherits from res.config.settings) in that method save the your settings.
Take a look at the docstring of odoo/addons/base/res/res_config.py


text:
Q: NUnit and testing in different threads I'm testing an application. A [TearDown] methods contains another method which sends a request a server. This one is pretty slow. Meanwhile a server is unable to handle more than 3 requests at the same time.
So I decided to use a semaphore.
   [TestFixture]
    public class TestBase
    {
        private const int MaxThreadsCount = 3;
        private readonly Semaphore _semaphore = new Semaphore(MaxThreadsCount, MaxThreadsCount);

        [SetUp]
        public virtual void Setup()
        {
        }

        [TearDown]
        public void CleanUp()
        {
            //...some code
            new Thread(_ => SendRequestAsync("url/of/a/server", parameters)).Start();
        }

        private void SendRequestAsync(string url, NameValueCollection parameters)
        {
            _semaphore.WaitOne();
            string result = MyServerHelper.SendRequest(url, parameters);
            Assert.That(string.IsNullOrEmpty(result), Is.False, "SendRequest returned false");
        }

        [Test]
        public void Test01()
        {
            Assert.AreEqual(1, 1);
        }

        [Test]
        public void Test02()
        {
            Assert.AreEqual(1, 1);
        }

        [Test]
        public void Test03()
        {
            Assert.AreEqual(1, 1);
        }
        //...........................
        [Test]
        public void TestN()
        {
            Assert.AreEqual(1, 1);
        }
    }

However it seems like it does not work properly. Now in log file on a server there are no records, which means a server does not receive any requests.
1) What did I do wrong?
2) How do I initialize a semaphore:
private readonly Semaphore _semaphore = new Semaphore(MaxThreadsCount, MaxThreadsCount);

or
private readonly Semaphore _semaphore = new Semaphore(0, MaxThreadsCount);

A:
1) What did I do wrong?

The test runner is probably ending the test process before the thread has finished (or even started). You can verify it using something like Fiddler to verify there is no communication between the test and the server.
Is there a reason why you need to run it in a separate thread? Unless you are specifically testing threaded code, avoid it because it just creates complexities. Call it as you would normally. It also means any exception or error thrown will be caught by the test runner and reported in the test results.
If a test is taking too long (and you cannot fix the root cause like the server speed) consider an IoC container like AutoFac or reference counting to share this between tests that need it. Also consider running the tests in parallel, too.

2) How do I initialize a semaphore:

The first argument to the Semaphore class constructor is the initial number of requests. In this case, you probably want to initialize it to 0 since you have no requests running initially.
Note that a semaphore may help the test not send more than three requests but it will not help the server if tests are running concurrently but you probably realise that.

A: My understanding is that unit tests should be testing small units of functionality.  You shouldn't need to create multiple threads to get your tests working.  If you have slow external dependencies (like a network connection or database); you can define interfaces to abstract that away.
You should be able to test the behaviour you want without the threads.  We can just assume that threads work - we're worried about the code you have.  Presumably, somewhere in your code you have a counter that indicates the number of active connections or requests; or some other way of determining if you can accept another connection.
You want to test what happens when a request comes in, when you are already at the max.
So write a test that does that.  Set that counter to the max, call the open connection code, and verify that it fails with the error you expect.


text:
Q: Ask for input, then redirect to website using the inputed data [HTML]
So I want a simple website where the user is asked for input (will be order number) and when they click submit it sends them to a website using the inputted data in the URL.
I searched everywhere and cant find out how to do this.
I tried this with no luck.

 Whats your name ?

<form method="POST">
  <input type="text" id="tt" placeholder="Enter Name : ">
</form>
<button onclick="my()">Submit now</button>

A: You need to send a GET request if you want to send data in the URL:
<form action="yourURL" method="get">
  Order number:
  <input type="text" id="orderNumber" name="orderNumber">
  <button>Submit now</button>
</form>

For more information about HTML forms, please read the MDN docs.


text:
Q: break apart formatted date into individual month/day/year hour/minute/second in php I have a date in the following format
November 18, 2009, 3:00PM

How can i break that up so that i can store each value as its own variable?
such as...
$month //November
$day //18
$year //2009
$hour //03
$minute //00
$ampm //PM

A: Use the 'date_parse' (http://nl2.php.net/manual/en/function.date-parse.php) function. It returns an array with the parsed items:
Array
(
    [year] => 2006
    [month] => 12
    [day] => 12
    [hour] => 10
    [minute] => 0
    [second] => 0
    [fraction] => 0.5
    [warning_count] => 0
    [warnings] => Array()
    [error_count] => 0
    [errors] => Array()
    [is_localtime] =>
)

A: Convert your date into a timestamp, then with the timestamp you can easily get your parts. An other way is using a regular expression.

A: $str = "November 18, 2009, 3:00PM";
list($month,$day,$year,$time) = preg_split('/[ ,]/',$str,false,PREG_SPLIT_NO_EMPTY);
preg_match('/([0-9]+):([0-9]+)([AP]M)/',$time,$timeparts);
list($time,$hour,$minute,$ampm) = $timeparts;

echo "\$month  $month\n";
echo "\$day    $day\n";
echo "\$year   $year\n";
echo "\$hour   $hour\n";
echo "\$minute $minute\n";
echo "\$ampm   $ampm\n";

Output
$month  November
$day    18
$year   2009
$hour   3
$minute 00
$ampm   PM

A: More complex solution.
If your dates may be in the different standards you can use date() function (http://php.net/manual/en/function.date.php) + strtotime() function (http://php.net/manual/en/function.strtotime.php), which parse string and returns the unix timestamp.
For example, if you want to get a year from your date string you could write next code:
$date = 'November 18, 2009, 3:00PM';

$year = date('Y', strtotime($date));

Or, if you want to know how much days in the month in date you get, you could write such code:
$date = 'November 18, 2009, 3:00PM';

$num_of_days = date('t', strtotime($date));

't' returns the number of days in the given month.


text:
Q: Definite integral $ \int_0^{\infty}e^{-A\,x^m-B\,x^p}x^n(x-\alpha)^{\sigma}\,dx$ in terms of of special functions Working on asymptotic expansion of certain integrals, it appear the following family of integrals
$$F(m,p,n,\alpha,\sigma)=\int_{\alpha}^{\infty}e^{-A\,x^m-B\,x^p}x^n(x-\alpha)^{\sigma}\,dx$$
with $m,n,p\in\mathbb{N}$ , $m\neq p$ , $\alpha\in(0,\infty)$ and $\sigma\in[0,1)$. Also $A,B>0$.
I wonder if is possible write $F(m,p,n,\alpha)$ in a closed form in terms of (probably) special functions.
Any help is welcomed.