text:
Q: How can i fix .take() operator and preserve snapshot || Angular , Ionic 3 I have a problem in .take() operator after they change to AngulaFireObject
and preserveSnapshot.
What can be the problem?
import { Injectable } from '@angular/core';
import { AngularFireDatabase, AngularFireObject } from 'angularfire2/database';
import { User } from 'firebase/app';
import { Profile } from '../../models/profile/profile.interface';
import { Observable } from 'rxjs/observable';
import { take } from 'rxjs/operator/take';

@Injectable()

export class DataService {
  profileObject : AngularFireObject<Profile>
  constructor(private database: AngularFireDatabase) {
  }

  getProfile(user: User) {
    this.profileObject = this.database.object(`/profiles/${user.uid}`, { preserveSnapshot:  true }); <<<in here

    return this.profileObject.take(1); <<<< and here
  }

async  saveProfile(user: User, profile: Profile) {
this.profileObject = this.database.object(`/profiles/${user.uid}`);

When I run my app with ionic serve it gives me this
Typescript Error Expected 1 arguments, but got 2. C:/Users/A7MD/Desktop/WallPapa/src/providers/data/data.service.ts getProfile(user: User) { this.profileObject = this.database.object(/profiles/${user.uid}, { preserveSnapshot: true }); –

and
Typescript Error Property 'take' does not exist on type 'AngularFireObject<Profile>'. C:/Users/A7MD/Desktop/WallPapa/src/providers/data/data.service.ts return this.profileObject.take(1); }
You can see the photo here:


text:
Q: Error: incompatible types: Message cannot be converted to int? I've been trying to make a splashscreen for an Android app, and I've used this tutorial. Everything is supposed to be fine, apart from the fact that Android Studio is giving me an error message saying that

Message can't be converted to int.

I am assigning an int value to msg.what, but that is supposed to work, so I'm not really sure why it's giving me this error.
My code is below:
    private static final long SplashTime = 3000;
    private static final int StopSplash = 0;

    private ImageView splash;

    @SuppressLint("HandlerLeak")
    private Handler splashHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            if (msg.what == StopSplash) {
                splash.setVisibility(View.GONE);
                //break;
            }
            super.handleMessage(msg);
        }
    };

    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.splashsheet);
        splash = (ImageView) findViewById(R.id.splashscreen);
        Message msg = Message.obtain();
        msg.what = StopSplash;

        splashHandler.sendEmptyMessageDelayed(msg, SplashTime);
    }
}

A: For sendEmptyMessageDelayed, you should pass only what code as the first parameter:
splashHandler.sendEmptyMessageDelayed(StopSplash, SplashTime);

On the other hand, you can use sendMessageDelayed:
splashHandler.sendMessageDelayed(msg, SplashTime);

redpajama_set_name: RedPajamaStackExchange


text:
Q: php array after parsing from excel to json how to convert such an array to JSON ?  the array is obtained after parsing excel table , and some fields are empty ,
      0 => array:10 [▼
    0 => "number"
    1 => null
    2 => "274"
    3 => null
    4 => null
    5 => null
    6 => null
    7 => null
    8 => null
    9 => null
  ]

 1 => array:10 [▼
    0 => "step"
    1 => null
    2 => "4"
    3 => null
    4 => null
    5 => null
    6 => null
    7 => null
    8 => null
    9 => null
  ]

  19 => array:10 [▼
0 => "details"
1 => null
2 => null
3 => null
4 => null
5 => null
6 => null
7 => null
8 => null
9 => null

]
to become like this  : i tried to remove all null values but that made it worse and harder to deal with .
{"number":"274","step":"4" , "details": null }

A: In your original array, all the keys are in element 0 and the values are in element 2. You can combine them with:
$new_array = array_combine(array_column($array, 0), array_column($array, 2));
echo json_encode($new_array);

DEMO


text:
Q: First difference or log first difference? I am evaluating the effect of covariances between series on returns. That is I run the following regression: $$ r_t = \beta_0 + \beta_1\text{Cov}(Y_t,r_t) + ...$$
I have conducted my analysis with both first difference and log(first difference) on the series. That is I can take either $r_t = P_{t+1}- P_{t}$ or  $\ln(P_{t+1}/P_{t})$. (and similarly for $Y_t$)
However, the level of significance of my coefficients is considerably reduced (sometimes they are just not significant anymore) when I use the log rather than the simple first difference to compute the covariance.
Is there something incorrect in using only the first difference to compute the covariances rather than a log(first difference)?
What am I missing here?

A: For some time series, like equity prices exchange rates and GDP growth, log returns are approximately invariant, meaning that it is stable over time. One way to see this would be to plot the histogram of the first and second half of the available data, which should be roughly similar, and check a scatter plot of the returns versus their lags, which should show no relationship.
For these series, changes in prices are a function of the lag of the price. As the price increases, the change increases. This means that the mean and variance changes over time. So if you try to perform a regression of the changes of two series without incorporating this heteroskedasticity, then your standard errors will be wrong.
The proper procedure (for these types of time series) is to use the log returns for estimation. If you want to forecast the original series, you have to first project the log returns to the future and then convert back to prices.

A: eviews can forecast the original series and save the time of having to reconvert back to prices. just use brackets when entering the  dependent variable in the equation to be estimated as follows: for example d(log(GBP))


text:
Q: Contiki RPL and unicast DIO I'm trying to learn to use Contiki 3.x.
When launching the "rpl-collect" example in Cooja with one udp-sink and several udp-sender, I see that each sender node regularly unicast DIO message to its preferred parent (in addition of multicast DIO).
The only reason I see to this is either a response to a DIS or a probing mechanism, but there is no DIS message and I disabled probing and saw no change.
Maybe is it worth noting that every time a child node sends a DIO in unicast to its parent seems to be just after that child received a 802.15.4 ACK for a previous communication.
Does somebody knows why child node unicast DIO to their parents ?

A: Seems like it was the probing mechanism still running, I didn't disable it properly the first time !

A: Yes, this is happening due to probing mechanism. The probing is either done using DIO or DIS message. In your case DIO probing must be enabled. 120 system clock seconds is the default interval of probing.


text:
Q: Clicking checkbox on web page using Applescript I'm somewhat new to Applescript, and I am trying to make Applescript check a checkbox to select it. I want the checkbox to be clicked regardless of whether or not it's already checked. Here is the checkbox's location according to the Accessibility Inspector:
<AXApplication: "Safari">
<AXWindow: "Studio">
<AXGroup>
<AXGroup>
<AXGroup>
 <AXScrollArea: "">
  <AXWebArea: "">
   <AXGroup: "">
    <AXCheckBox: "">

Attributes:
AXRole:  "AXCheckBox"
AXSubrole:  "(null)"
AXRoleDescription:  "check box"
AXChildren:  "<array of size 0>"
AXHelp:  ""
AXParent:  "<AXGroup: "">"
AXPosition:  "x=1104 y=825"
AXSize:  "w=18 h=19"
AXTitle:  ""
AXDescription:  ""
AXValue:  "0"
AXFocused (W):  "0"
AXEnabled:  "1"
AXWindow:  "<AXWindow: "Studio">"
AXSelectedTextMarkerRange (W):  "<AXTextMarkerRange 0x101937860 [0x7fff76e43fa0]>{startMarker:<AXTextMarker 0x1019378b0 [0x7fff76e43fa0]>{length = 24, bytes = 0xac01000000000000c0366e23010000001700000001000000} endMarker:<AXTextMarker 0x101938030 [0x7fff76e43fa0]>{length = 24, bytes = 0xac01000000000000c0366e23010000001700000001000000}}"
AXStartTextMarker:  "<AXTextMarker 0x101938030 [0x7fff76e43fa0]>{length = 24, bytes = 0xa00000000000000098975e0d010000000000000001000000}"
AXEndTextMarker:  "<AXTextMarker 0x1019378b0 [0x7fff76e43fa0]>{length = 24, bytes = 0xa200000000000000405e7812010000000000000001000000}"
AXVisited:  "0"
AXLinkedUIElements:  "(null)"
AXSelected:  "0"
AXBlockQuoteLevel:  "0"
AXTopLevelUIElement:  "<AXWindow: "Studio">"
AXTitleUIElement:  "(null)"
AXAccessKey:  "(null)"
AXRequired:  "0"
AXInvalid:  "false"
AXARIABusy:  "0"

Actions:
AXPress - press
AXShowMenu - show menu

I've tried multiple methods to get this to work, and I haven't been able to. Any help is appreciated.

A: Your question with the Accessibility Inspector info is not very helpful I am afraid.
It would help if we could see the actual elements of the web page,
Have a look at this page which I found that shows check boxes and the code that makes it up.
Each element has a name and maybe within some other element.
on the page I can use this Applescript/Javascript to check the check1 checkbox.
Hopefully this will give you an idea of how to go about it.
But remember this code snippet is tailored to this page.
Open the web page and run this applescript
tell application "Safari"

set doc to document 1

    do JavaScript "document.forms['testform']['check1'].checked = true" in doc
end tell

Update: Applescript GUI

Update:2 take into account "clicked regardless of whether or not it's already checked"

Taking a punt with your Accessibility Inspector. Which is a bit useless (not your fault)
try:
   activate application "Safari"
tell application "System Events"
    set theCheckbox to (checkbox 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of group 2 of window 1 of application process "Safari")

    set isEnabled to value of theCheckbox as boolean
    if not isEnabled then
        click theCheckbox
    end if
end tell


text:
Q: InvalidOperationException when saving to DB I have a problem when adding posts to my DB, this "Add" function is called from multiple threads. And usually very quick after eachother, I dont know if this matters, but thats the way it works.
Code:
private object dbLock = new object();

public void Add(string fileName, DateTime collectionTime)
    {
        try
        {
            lock (dbLock)
            {
                var collection = new Collection
                {
                    Filename = fileName,
                    Datetime = collectionTime,
                };
                _entities.AddToCollection(collection);
                _entities.SaveChanges();
                CollectionChanged(collection, null);
            }
        }
        catch (Exception ex)
        {
        }
        finally
        {

        }
    }

My problem is that when SaveChanges is called I get this exception:

The changes to the database were committed successfully, but an
  error occurred while updating the object      context. The
  ObjectContext might be in an inconsistent state. Inner exception
  message: AcceptChanges cannot  continue because the object's key
  values conflict with another object in the ObjectStateManager. Make
  sure that the key values are unique before calling AcceptChanges.

All answers I managed to find has something to do with that you have to add StoreGeneratedPattern="Identity", I allready did this, but it doesn't help
<Property Name="ID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />

So is there any other way to solve this?

A: Ultimately, sharing an object-context between threads is a really really bad idea. An object-context is intended to be used as a unit of work - i.e. short-lived; typical usage:
using(var ctx = new SomeObjectContextType()) // assuming IDisposable
{
    // not shown: get some records, if needed
    ...
    // not shown: update, add, remove some records, if needed

    ctx.SaveChanges();
} // and now it is gone, never to be used again

It might get a bit more complex than that in some scenarios, for example keeping an object-context for the duration of a page / request, but it should not be shared between callers. The reasons for this are many, but fundamentally all competing updates would need to be locked, and "updates" here includes the simple act of reading any record from a database, or lazily loading a property. It should not be surprising that an object-context gets temperamental when accessed by multiple threads: that scenario is not (usually) supported.
Additionally, there are other issues with having a long-lived object context:

*

*occasionally, things go bad (for example a timeout, deadlock, rollback, or just a simple connection error); here the appropriate way to respond is simply to discard your now broken object context (Dispose() it if appropriate) - and forget about it; if you want to reapply your change, you start from a fresh object-context

*the object-context includes an identity map and change management systems; if you keep it for longer than a single operation, you are slowly accumulating more and more objects into it; in addition to causing memory issues, this gradually degrades performance - as every single read / update operation now has ever-increasing amounts of data to trawl through

Basically, the "fix" here is: don't do that. That isn't the correct usage of an object-context. Do not have an application-wide shared object context.


text:
Q: Convert php timestamp to actionScript How can I convert a php timestamp to something that is usable in actionScript? For example, how could I use the following timestamp?
2011-06-16 10:41:08
The timestamp is currently stored in xml.

A: That's not a PHP timestamp, it's just a formatted string. PHP timestamps are the same as unix timestamps - an integer representing seconds since Jan 1/1970.
Actionscripts timestamps are the same, but in milliseconds. So take a native PHP timestamp, multiply by 1000, and there's your AS timestamp.

A: @Marc B's answer is correct. If for some reason you can't use the PHP timestamp (number of seconds since Jan 1, 1970), you can try the static method Data.parse().
It will return the number of miliseconds since Jan 1, 1970 based on your time string. It will process various time string formats, here's a link to the docs.  You might have to tweak your time string into one of these formats (using a regular expression on the Actionscript side, or by generating a different string on the PHP side).
Once you get the number of milliseconds since Jan 1, 1970, you can then create a new Actionscript Date object from that:
var date:Date = new Date( Date.parse(myTimeString) );


text:
Q: Hive Converting from Double to String Not in Scientific I have a table with a column double type, and I am trying to convert that from double to string.
However, when I use the cast command, it "smartly" convert that into scientific notation.  like below:
select
    number,
    cast(number as string),
from ...

it looks like
number     c1_
9999999902  9.999999902E9
9999999902  9.999999902E9
9999999902  9.999999902E9
9999999902  9.999999902E9
9999999909  9.999999909E9

Can anyone show me how to avoid converting that into scientific and keep the raw text?

A: Hive converts double to scientific representation while cast to string because Hive treats double itself in a same way. Therefore, problem is not with cast to string.
See below example:
 select 9999999902.0, cast(9999999902.0 as BIGINT), cast(cast(9999999902.0 as BIGINT)  as string) from ..

Output:
OK
9.999999902E9   9999999902

A: Hive supports good old printf() function so that you can control the output format explicitly - check Language Manual UDF under "String functions"


text:
Q: How can I solve it when run my app it give this error
this error appear when my android app run how can I solve it
enter image description here

A: The error is advising you to install Intel HAXM.
See the answer here for instructions.


text:
Q: Why can't I open Dropbox via Launchpad? The Dropbox app is shown in Launchpad. When I click on it's icon to launch it nothing happens and I return to my browser.  Is this normal?

A: Dropbox has no "Window" to speak of. Everything it does takes place either:

*

*On Dropbox.com

*Via the Finder in the configured Dropbox folder (NB: right click a file in the Dropbox folder), simply named 'Dropbox' in your home directory by default. Or;

*In the MenuBar

Per Dropbox's Documentation, the primary states will be a blue icon with circular arrows indicating a file is synchronizing, or the green checkmark icon like above, indicating everything is up to date.

A: There is no dropbox app - it runs in the background - There is an icon on the menu bar.


text:
Q: how to post code object as string in graphene i declared my input to be graphene.string() but when i put code that includes brackets,slashes,equal signs and other symbol it shows me syntax error , is there any way i could upload mixed string? i have been trying to find solution for the past hours..
sample graphene query that is showing error
mutation{
            newForumAnswer(author:"dan",forum:5,body:"hello",code1:"console.log({nrgerg})",code2:"",code3:"",code1Title:"",code2Title:"",code3Title:""){
              answer{
                id
              }
            }
          }


text:
Q: How to read 16bit png using Lua? I am using Ubuntu and torch7 library to deal with 16bit images.
It would be best if Lua can read/write 16bit png files.
However, I found that if I try to read them by image.load function, it gives result of only higher 8 bit values.
Currently I'm using preprocessed binary files instead, but it is quite cumbersome.
Is there any way to read/write 16 bit png file with Lua?

A: https://github.com/clementfarabet/graphicsmagick
The graphicsmagick package should work for 16-bit pngs.
You can install it via
luarocks install graphicsmagick

A: I have some OpenCV bindings for torch7. Simply because OpenCV has better image resizing/warping/loading than the image library written in torch. It handles the 16bit png images fine.
They work on Height x Width x Channel images instead of the torch7 Channel x Height x Width images. This is no problem in practice, because they're convertible by transpose.
It's not documented properly but should be very useful to someone! (read the init.lua for a description).
https://github.com/Saulzar/lua---opencv


text:
Q: Errors After Partial upgrade from Ubuntu 18.04 to 20.04 I recently tried to upgrade my Ubuntu 18.04 to 20.04 and the following error occurred.

An unresolvable problem occurred while calculating the upgrade.   This
was likely caused by:  * Unofficial software packages not  provided by
Ubuntu Please use the tool 'ppa-purge' from the ppa-purge  package to
remove software from a Launchpad PPA and try the upgrade again.

Hence, I tried to resolve this by following the steps mentioned in this link.
I was unable to update to Ubuntu 20 from Ubuntu 18.04
The first two answers didn't work for me, then I tried the third answer mentioned, that is by removing all obsolete packages.
The upgrade happened but got a Partial upgrade message and I proceeded with that. It has upgraded to 20.04 but since then, No application is working, Icons are distorted and symbols (close, minimize, wifi, shutdown) are missing, the terminal is not working properly.
What should I do? Is there a way to go back to the factory reset setting or initial setting?
Note: Dual Boot on Legion Y530-15ICH.
Following are the errors after resuming the upgrade by sudo apt-get dist-upgrade

Processing triggers for rygel (0.38.3-1ubuntu1) ...

Errors were encountered while processing:

 libfreeimage3:amd64

 libignition-common:amd64

 libogre-1.9.0v5:amd64

 libfreeimage-dev

 libogre-1.9-dev

 libignition-common-dev:amd64

E: Sub-process /usr/bin/dpkg returned an error code (1)

A: Your output clearly explains why some folks encounter this problem "Unofficial software packages not provided by Ubuntu", and indeed your apt output supports that common reason.
The first comment in the duplicate question clearly explains how to fix it: "remove all 3rd party software (ie. return to only using Ubuntu repository software), perform the upgrade, reboot then add back any 3rd party software required."
Since you didn't do that, and then compounded your mistake with a Partial Upgrade, you are now stuck with a Frankensystem.
It seems clear that your 18.04 version of your non-Ubuntu software is incompatible with Ubuntu 20.04. You must locate a version that is compatible with 20.04

*

*You can try following the original advice. It might still work, it might not:

*

*Uninstall all non-Ubuntu software

*dist-upgrade again to eliminate package errors

*When apt is working properly, install a version of your non-Ubuntu software that is compatible with 20.04

*Alternately, you can clean-install 20.04, then install a version of your non-Ubuntu software that is compatible with 20.04.


text:
Q: isdigit() not recognising "1" as a numeric value I am parsing a string, validating whether a number inside the string is an int.
std::string segmentS
if(!isdigit(std::stoi(segmentS))){
    std::cout<<"Not a location +"<<segmentS<<std::endl;

    //does something
    break;
}

segmentS is the substring that is suppose to be the integer
Even when I ensure that segmentS is a number, !isdigit(std::stoi(segmentS)) still holds true. Even when segmentS is printed out after the not a location message, it is 1 which is a number, however it isn't being seen as a number, when it runs into this if statement.

A: std::stoi(segmentS) will convert segmentS to an int value, which is then passed into isdigit, except isdigit assumes the input is a character.
Remove the call to stoi.

A: isdigit takes a single char as an input, not an integer.


text:
Q: Dataweave 2 - Cannot coerce String to DateTime I have a String as DateTime like this 2019-05-21 00:00:00.000.
This is the code that I use in Dataweave 2 to transform String to DateTime:
SourceDate: payload.Source_date as DateTime {format: "yyyy-MM-dd'T'HH:mm:ss.SSSZ"}

But it returns this error:

"Cannot coerce String (2019-05-21 00:00:00.000) to DateTime, caused
  by: Text '2019-05-21 00:00:00.000' could not be parsed at index 10

I need to use 'T' and Z to use the TimeZone automatically.
What could be the problem?

A: You can use LocalDateTime which will use the current timezone:
%dw 2.0
output application/json
---
SourceDate: payload.Source_date as LocalDateTime {format: "yyyy-MM-dd HH:mm:ss.SSS"}

And you can add the timezone:
SourceDate: payload.Source_date as LocalDateTime {format: "yyyy-MM-dd HH:mm:ss.SSS"} >> "GMT+1"


text:
Q: Can one concatenate two given XSD data types into a new XSD data type? Given two simple data types, say, restricted strings type1, type2, is there a possibility to define type3 describing all strings formed by concatenating one type1 string plus one type2 string?
For example, consider
<xsd:simpleType name="type1">
 <xsd:restriction base="xsd:string">
  <xsd:pattern value="[A-Z]"></xsd:pattern>
 </xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="type2">
 <xsd:restriction base="xsd:string">
  <xsd:pattern value="[0-9]"></xsd:pattern>
 </xsd:restriction>
</xsd:simpleType>

Then I would like to define type3 such that
A0 -> valid
B1 -> valid
AA -> invalid
etc...

Note that this example is just for illustration, I know how to combine the regex patterns, but my question is how to combine the types via XSD.

A: XML Schema only allows construction of new simple types by:

*

*restriction (e.g., type1 could be restricted to vowels)

*list (e.g., a list of type1 would have A B D D E in its lexical space)

*union (e.g., the union of the above types would be a new simple type with a value space containing A, 0, C, 2, etc)

It is always risky to give the answer "not possible", but I am afraid that the only way to build a "concatenated type" is thus to construct a new simple type by restricting xs:string with the concatenated regular expressions.
I think that the reason why XML Schema does not provide a general mechanism for concatenating simple types is that, while concatenation makes sense on the lexical space of two simple data types, it is not necessarily meaningful nor straightforward to define on their value spaces, besides the specific use case at hand involving strings and the pattern facet.


text:
Q: Why does jQuery file have two parameters in its function but receives only one parameter
Possible Duplicate:
How does this JavaScript/JQuery Syntax work: (function( window, undefined ) { })(window)?

I am trying to learn about js scopes and anonymous functions. I have tried to read the jQuery.js file and it looks like this:
(function( window, undefined ) {

...

}(window));

Why does it have in the function params undefined when no parameter is being passed to it when it is executed?

A: This method is used so you can be sure that no one has previously redefined undefined value with something like
var undefined = true;

or with other tricky/evil assignments outside the jQuery scoped function. So, inside that function every comparison done against undefined is safe.


text:
Q: Python: Conditional elements in array A question from a complete Python novice.
I have a column array where I need to force certain values to zero depending on a conditional statement applied to another array. I have found two solutions, which both provide the correct answer. But they are both quite time consuming for the larger arrays I typically need (>1E6 elements) - also I suspect that it is poor programming technique. The two versions are:
from numpy import zeros,abs,multiply,array,reshape

def testA(y, f, FC1, FC2):
    c = zeros((len(f),1))
    for n in xrange(len(f)):
        if abs(f[n,0]) >= FC1 and abs(f[n,0]) <= FC2:
            c[n,0] = 1.
    w = multiply(c,y)
    return w

def testB(y, f, FC1, FC2):
    z = [(abs(f[n,0])>=FC1 and abs(f[n,0])<=FC2) for n in xrange(len(f))]
    z = multiply(array(z,dtype=float).reshape(len(f),1), y)
    return z

The input arrays are column arrays as this matches the post processing to be done. The test can be done like:
>>> from numpy.random import normal as randn
>>> fs, N = 1.E3, 2**22
>>> f = fs/N*arange(N).reshape((N,1))
>>> x = randn(size=(N,1))
>>> w1 = testA(x,f,200.,550.)
>>> z1 = testB(x,f,200.,550.)

On my laptop testA takes 18.7 seconds and testB takes 19.3 - both for N=2**22. In testB I also tried to include "z = [None]*len(f)" to preallocate as suggested in another thread but this doesn't really make any difference.
I have two questions, which I hope to have the same answer:

*

*What is the "correct" Python solution to this problem?

*Is there anything I can do to get the answer faster?

I have deliberately not used any time at all using compiled Python for example - I wanted to have some working code first. Hopefully also something, which is good Python style. I hope to be able to get the execution time for N=2**22 below two seconds or so. This particular operation will be used many times so the execution time does matter.
I apologize in advance if the question is stupid - I haven't been able to find an answer in the overwhelming amount of not always easily accessible Python documentation or in another thread.

A: use bool array to access elements in array y:
def testC(y, f, FC1, FC2):
    f2 = abs(f)
    idx = (f2>=FC1) & (f2<=FC2)
    y[~idx] = 0
    return y

A: All of these are slower than HYRY solution by a large factor:
How about
( x[1] if FC1<=abs(x[0])<=FC2 else 0 for x in itertools.izip(f,x)  )
If you need to do random access (very slow)
[ x[1] if FC1<=abs(x[0])<=FC2 else 0 for x in itertools.izip(f,x) ]
or you can also use map
map(lambda x: x[1] if FC1<=abs(x[0])<=FC2 else 0 , itertools,izip(f,x))
or using vectorize (faster than A and B but much much slower than C)
b1v = np.vectorize(lambda a,b: a if 200<=abs(b)<=550 else 0)
b1 = b1v(f,x)


text:
Q: Copy Constructor for Circular Singly Linked List So I have been coding in C++ for not so long and am struggling with a copy constructor and my program keeps on crashing when I use it.
Node:
template <class T>
class Node
{
public:
    Node(T data, Node<T> * n = 0)
    {   element = data;
        next = n;
        prev = n;}
    ~Node()
    {   next = 0;
        prev = 0;}
    T element;
    Node<T>* next;
    Node<T>* prev;

Function Code:
CircularList<T>::CircularList(const CircularList<T> & other)
{
    if(other.tail == NULL)
    {
        this->tail = NULL;
    }
    else
    {
        this->tail = other.tail;
        Node<T> * original = this->tail;
        Node<T> * temp = other.tail->next;
        while(temp != other.tail)
        {
            original->next = temp;
            temp = temp->next;
            original = original->next;
        }
        original->next = temp;

    }

}

(EDIT)
Here is the specification for the CircularList Class. I think I just do not understand what steps to take to make it deep copy rather than shallow copy.
template<class T>
class CircularList;

template<class T>
ostream& operator<<(ostream&,CircularList<T>&);

template<class T>
class CircularList : public LinearStructure<T>
{
public:
    friend ostream& operator<< <T>(ostream&,CircularList<T>&);
    CircularList();
    CircularList(const CircularList<T>& other);
    CircularList<T>& operator=(const CircularList<T>& other);
    virtual CircularList<T>* clone();
    virtual ~CircularList();
    virtual void insert(int index, T element);
    virtual T remove(int index);
    virtual T get(int index) const;
    virtual bool isEmpty();
    virtual void clear();
    Node<T>* getLeader();

protected:
    ostream& print(ostream& os);

private:
    int size() const;
    Node<T>* tail;
};

So yeah when I test it with this (the list isn't empty):
CircularList<int> clist;
clist.insert(0,8);
CircularList<int> clist2(clist);

It crashes. Any help would be appreciated!!


text:
Q: Compiling large image source files under WPF / C# (possible Site of Origin solution?) I am developing a Kinect application in C# using WPF under Visual Studio 2010 Express. The application requires a single Image control to switch between about 700 different source images, amounting to about 260 MB altogether. I did not think it would be too much, but when I make those 700 images resource files, when I try to publish (or just run) the application, the build fails, apparently due to lack of memory (I have 8 GB of RAM). It's the same for Content files. The application works just fine as long as I start it from code and read the images from a specified folder, though.
So I have been thinking about Site of Origin files. I have set Build Action to None and Copy to Output Directory to Copy Always for all the image files and rebuilt the project. However the image files don't appear anywhere in the published application. I have tried setting the output path to different folders, but nothing seems to work.
So my question is, are Site of Origin files the right way to go, and if so, what am I doing wrong? Also, once I do manage to have them published along with the rest of the application, how exactly would I access them from code? (Yes, I know that is reversing the actual process – I just mean in principle. I haven't been able to find much on this – basically just this, but it's for Visual Basic. I'd like to access them from C#, not XAML.)
Or, is there some other way to do this? Have I been doing something wrong when trying to use resource files initially?
Thanks in advance!


text:
Q: Facebook->getSession() I have 2 very simple scripts:
<?php

require_once 'facebook.php';
$facebook = new Facebook(array(
'appId' => 'xxxxxxxxxxxxxxx',
'secret' => 'yyyyyyyyyyyyyyyyyyyy',
'cookie' => true,
));
?>

and
<?php
require_once 'config.php';
/* Get a valid session */
$session = $facebook->getSession();
$me = null;
if($session) {
/* Check if session is valid */
$me = $facebook->api('/me');
}
if ($me) {
echo 'User is logged in and has a valid session';
}
else {
echo 'Session expired or user has not logged in yet.
Redirecting...';
echo '<script> top.location.href="'.$facebook->getLoginUrl()
  .'";</script>';
}
?>

Why do I get Fatal error: Call to undefined method Facebook::getSession() in C:\wamp\www\jt1\index.php on line 4?

A: There is no getSession() method in modern facebook PHP SDKm use getUser() instead.
And see sample at https://github.com/facebook/php-sdk/blob/master/examples/example.php

A: $facebook variable is NOT visible to your second script. To prove this, move the logic from the first script that defines $facebook and put it into the second script. It should all begin working.

A: I think there is something wrong when you transport the array variable to get a instance!
$facebook = new Facebook(array(
'appId' => 'xxxxxxxxxxxxxxx',
'secret' => 'yyyyyyyyyyyyyyyyyyyy',
***'cookie' => true,***
));

you should not have comma at the end. you can use "'cookie' => true"


text:
Q: MySQL - Group By using different values I have a table of messages and below shows 3 rows - the second and third being between 2 users.
When I query this table and use Group By I get both lines show up but I only want one.
This is the query:
SELECT a.receiver ORDER BY a.datetime DESC LIMIT 25;

Is there a way to limit one row return when both users have been senders/receivers.
thanks

A: First you can group by the larger number , then group by the smaller one.
SELECT
    a.sender,
    a.receiver,
    a.message,
    a. READ,
    a.datetime
FROM
    messages AS a
WHERE
    (
        a.sender = '1000000000'
        OR a.receiver = '1000000000'
    )
GROUP BY IF(a.sender > a.receiver, a.sender, a.receiver),
         IF(a.sender > a.receiver, a.receiver,a.sender)
ORDER BY    a.datetime DESC
LIMIT 25;

Note:
The first IF picks up the larger number and the second one picks up the smaller number.


text:
Q: Frequency Distribution by Day I have records of No. of calls coming to a call center. When a call comes into a call center a ticket is open.
So, let's say ticket 1 (T1) is open on 8/1/19 and it stays open till 8/5/19. So, if a person ran a query everyday then on 8/1 it will show 1 ticket open...same think on day 2 till day 5....I want to get records by day to see how many tickets were open for each day.....
In short, Frequency Distribution by Day.
Ticket     Open_date       Close_date
    T1     8/1/2019      8/5/2019
    T2     8/1/2019      8/6/2019

Result:
Result
Date        # Tickets_Open
8/1/2019        2
8/2/2019        2
8/3/2019        2
8/4/2019        2
8/5/2019        2
8/6/2019        1
8/7/2019        0
8/8/2019        0
8/9/2019        0
8/10/2019       0

A: We can handle your requirement via the use of a calendar table, which stores all dates covering the full range in your data set.
WITH dates AS (
    SELECT '2019-08-01' AS dt UNION ALL
    SELECT '2019-08-02' UNION ALL
    SELECT '2019-08-03' UNION ALL
    SELECT '2019-08-04' UNION ALL
    SELECT '2019-08-05' UNION ALL
    SELECT '2019-08-06' UNION ALL
    SELECT '2019-08-07' UNION ALL
    SELECT '2019-08-08' UNION ALL
    SELECT '2019-08-09' UNION ALL
    SELECT '2019-08-10'
)

SELECT
    d.dt,
    COUNT(t.Open_date) AS num_tickets_open
FROM dates d
LEFT JOIN tickets t
    ON d.dt BETWEEN t.Open_date AND t.Close_date
GROUP BY
    d.dt;

Note that in practice if you expect to have this reporting requirement in the long term, you might want to replace the dates CTE above with a bona-fide table of dates.

A: This solution generates the list of dates from the tickets table using CTE recursion and calculates the count:
WITH Tickets(Ticket, Open_date, Close_date) AS
(
SELECT "T1", "8/1/2019", "8/5/2019"
UNION ALL
SELECT "T2", "8/1/2019", "8/6/2019"
),
Ticket_dates(Ticket, Dates) as
(
SELECT t1.Ticket, CONVERT(DATETIME, t1.Open_date)
FROM Tickets t1
UNION ALL
SELECT t1.Ticket, DATEADD(dd, 1, CONVERT(DATETIME, t1.Dates))
FROM Ticket_dates t1
inner join Tickets t2 on t1.Ticket = t2.Ticket
where DATEADD(dd, 1, CONVERT(DATETIME, t1.Dates)) <= CONVERT(DATETIME, t2.Close_date)
)
SELECT CONVERT(varchar, Dates, 1),  count(*)
FROM Ticket_dates
GROUP by Dates
ORDER by Dates

A: A "general purpose" trick is to generate a series of numbers, which can be done using CTE's but there are many alternatives, and from that create the needed range of dates. Once that exists then you can left join your ticket data to this and then count by date.
CREATE TABLE mytable(
   Ticket     VARCHAR(8) NOT NULL PRIMARY KEY
  ,Open_date  DATE  NOT NULL
  ,Close_date DATE  NOT NULL
);
INSERT INTO mytable(Ticket,Open_date,Close_date) VALUES ('T1','8/1/2019','8/5/2019');
INSERT INTO mytable(Ticket,Open_date,Close_date) VALUES ('T2','8/1/2019','8/6/2019');

Also note I am using a cross apply in this example to "attach" the min and max dates of your tickets to each numbered row. You would need to include your own logic on what data to select here.
;WITH
  cteDigits AS (
      SELECT 0 AS digit UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL
      SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9
      )
, cteTally AS (
      SELECT
              [1s].digit
            + [10s].digit * 10
            + [100s].digit * 100  /* add more like this as needed */
            AS num
      FROM cteDigits [1s]
      CROSS JOIN cteDigits [10s]
      CROSS JOIN cteDigits [100s] /* add more like this as needed */
      )
select
      n.num + 1 rownum
    , dateadd(day,n.num,ca.min_date) as on_date
    , count(t.Ticket) as tickets_open
from cteTally n
cross apply (select min(Open_date), max(Close_date) from mytable) ca (min_date, max_date)
left join mytable t on dateadd(day,n.num,ca.min_date) between t.Open_date and t.Close_date
where dateadd(day,n.num,ca.min_date) <= ca.max_date
group by
      n.num + 1
    , dateadd(day,n.num,ca.min_date)
order by
      rownum
;

result:
+--------+---------------------+--------------+
| rownum |       on_date       | tickets_open |
+--------+---------------------+--------------+
|      1 | 01.08.2019 00:00:00 |            2 |
|      2 | 02.08.2019 00:00:00 |            2 |
|      3 | 03.08.2019 00:00:00 |            2 |
|      4 | 04.08.2019 00:00:00 |            2 |
|      5 | 05.08.2019 00:00:00 |            2 |
|      6 | 06.08.2019 00:00:00 |            1 |
+--------+---------------------+--------------+


text:
Q: Property Data Type issue Why the Intellisense displays a "?" character after the datatype? (Long?), what will mean? ...is not sure that the property value will return a Long type? if yes then why not?
Is the first time that I've seen this.

A: That means the type is nullable.
Usually value types aren't nullable.  A few versions ago .NET introduced a struct to help with that, called Nullable(Of T).  Putting a ? after the value type is shorthand for that.
So Long? is the same as Nullable(Of Long).


text:
Q: Slow(ish) WCF connection speed with netTcpBinding I know this subject has been brought up quite a few times here on SO, but I can't find the exact answer I'm looking for regarding expected connection latency from WCF.
Basically I have a self hosted WCF service (server), which does alarm handling in a factory environment. Latency needs to be minimized end-to-end for these alarms, so I'm looking into connection times. The alarms are delivered in different ways, one of them is through a netTcpBinding WCF service. Another service application (client) which atm. is running on the same server is using the server to deliver the alarms through this binding which generally works well.
My problem is the initial connection latency from the client as the IChannel.Open() call takes between 100-500 ms. with an average of ~300 ms. which seems very high for creating a connecting on the same server through TCP/IP. (A quick test with raw sockets I get ~1ms connection speed.)
In the client I create the ChannelFactory manually once on start-up and reuses that to "channelFactory.CreateChannel()" when I need to send an alarm. After this I explicitly Open() the IChannel, which is the time I'm worried about. The service sends a batch of alarms and after that the IChannel is closed and disposed. A quick reconnect takes 0 ms., but often it takes 3-5 minutes between alarms and reopening after a "long" pause is slow considering I run without security etc. enabled right now for testing.
My binding configuration is pretty basic:
<binding name="AlarmService_NetTcpBindingConfig"
            hostNameComparisonMode="StrongWildcard"
            closeTimeout="00:01:00"
            portSharingEnabled="false"
            listenBacklog="20"
            maxConnections="50"
            transactionFlow="false"
            transferMode="Buffered"
            >
    <security mode="None">
        <message clientCredentialType="None" />
        <transport clientCredentialType="None" protectionLevel="None" />
    </security>
    <reliableSession enabled="false" />
</binding>

So basically the question (besides vending frustration :) ) is, if this is the connection latency I can expect through WCF netTcpBinding?
The only thing I can think of that I haven't tried yet, is to follow the "Configuring the Net.TCP Port Sharing Service" article (http://msdn.microsoft.com/en-us/library/aa702669.aspx) and see if that helps any. Could connection sharing (though disabled for the binding as above) be the problem? Anyone else looked into connection speed/latency?

A: You can try proxy pooling.  Here is a sample
nettcp port sharing service must be started if you are hosting the service on IIS.  It allows you to share a single port among multiple wcf services.  I don't think it has any bearing on performance of opening a channel


text:
Q: Duplicate PCI device id (lspci -nn) I have two identical network cards installed in my system (same device, same vendor).
Now I wanted to stub one network card in order to use PCIe passthrough.
I've come to realize that the two network cards have identical device ids:
$ lspci -nn
02:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. Device [10ec:8161] (rev 15)
03:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. Device [10ec:8161] (rev 15)

As you can see the PCI device id 10ec:8161 is the same for both network cards. I expected them to be different (i.e. that each network card has its own unique PCI device id).
Is this normal behaviour? How would I go about just stubbing one of the two network cards (using vfio-pci) ? Is it even possible?

A: This is not a device ID but a product ID – 10ec is the PCI vendor ID for Realtek and 8161 is the product or model ID for their "RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller".  It is not a serial number and is not supposed to be unique, quite the opposite.
The unique "bus ID" of each card on your PCI bus is the leftmost column, with [0000:]02:00.0 being your first card and 03:00.0 being the second. Most tools dealing with PCI reference devices by their bus ID, which usually remains stable as long as the topology doesn't change, e.g. a card installed in that specific slot is going to remain 03:00.
(The format of a bus ID as shown by lspci is "[domain:]bus:device.function".)
Your lspci output does not contain any globally unique ID; in fact I'm not sure whether PCI devices generally have one. (Running sudo lspci -v appears to show a capability "[13c] Device Serial Number:" for some devices, but not all of them.)

If I understand correctly, writing a VID:PID to the "new_id" file of a PCI driver only allows that driver to be bound to matching devices, but doesn't actively kick out any other drivers (i.e. you still have to unbind each device from its original driver and bind it to vfio-pci). Looking at DPDK's tools, the latter part is still done by bus ID:
echo 10ec 8161 > /sys/bus/pci/drivers/vfio-pci/new_id
[...]
echo 0000:03:00.0 > /sys/bus/pci/drivers/r8169/unbind
echo 0000:03:00.0 > /sys/bus/pci/drivers/vfio-pci/bind


text:
Q: concatenating two xPaths in XSLT In my XSLT script I'm calling a recursive template and I want to pass a xPath as a parameter to each iteration. In each iteration I want to concatenate child's xPath(*/) to the current path (please refer the code). So I'm using concat() function, since it returns a string, I'm unable to use that path to print the content of that path.
<xsl:copy-of select="$path" /> <!--This requests a xPath, not a string-->

So can any one tell me how to concatenate two xpaths or how to convert a string to a xpath.
Thank you.
    <xsl:template match="/">
        <xsl:call-template name="repeatable" >
            <xsl:with-param name="limit" select="10" />
        </xsl:call-template>
    </xsl:template>

    <xsl:template name="repeatable">
        <xsl:param name="index" select="1" />
        <xsl:param name="limit" select="1" />
        <xsl:param name="path" select="@*" />

        <xsl:copy-of select="$path" />

        <xsl:if test="($limit >= $index)">
            <xsl:call-template name="repeatable">
                <xsl:with-param name="index" select="$index + 1" />
                <xsl:with-param name="path" select="concat('*/', $path)" />
            </xsl:call-template>
        </xsl:if>
    </xsl:template>

A: While I'm waiting for you to respond to my question above, here's an XSLT that does what you seem to be trying to do:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="text" indent="yes" omit-xml-declaration="yes"/>

  <xsl:template match="@*">
    <xsl:value-of select="concat(name(), ' = ', ., '
')"/>
  </xsl:template>

  <xsl:template match="/">
    <xsl:call-template name="repeatable" >
      <xsl:with-param name="limit" select="10" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template name="repeatable">
    <xsl:param name="index" select="1" />
    <xsl:param name="limit" select="1" />
    <xsl:param name="current" select="." />

    <xsl:apply-templates select="$current/@*" />

    <xsl:if test="($limit >= $index)">
      <xsl:call-template name="repeatable">
        <xsl:with-param name="index" select="$index + 1" />
        <xsl:with-param name="limit" select="$limit" />
        <xsl:with-param name="current" select="$current/*" />
      </xsl:call-template>
    </xsl:if>
  </xsl:template>

</xsl:stylesheet>

When this is run on the following input:
<root a1="a" a2="b">
  <cont a3="c" a4="d">
    <child a5="e" a6="f" />
  </cont>
  <cont a7="g" a8="h">
    <child a9="i" a10="j">
      <subchild a11="k" a12="l" />
    </child>
  </cont>
</root>

The result is:
a1 = a
a2 = b
a3 = c
a4 = d
a7 = g
a8 = h
a5 = e
a6 = f
a9 = i
a10 = j
a11 = k
a12 = l

Is that close to what you are trying to do? If not, please clarify.

A: What you want to do is to dynamically create xpath and use it. This is possible in XSLT3.0 and the function to be used is evaluate().


text:
Q: registerEntityTypeCtor initializers does not seem to trigger when using property path expand I want all Date types in my entities to always be converted to momentjs. The solution (Code 2) I used for this works fine for getResources (Code 1), the initializer is triggered for both the 'Event and 'Shift' entities. But when I call getUser the expand works as it should and I get the right data for both 'Order' and 'Event', but the initializer for 'Event' never triggers. Any ideas why? Is it because I'm using a property path expand?
Also, if you can think of a better solution to convert all Date types in my entities to momentjs I will gladly accept that too.
Code 1:
var getResources = function () {
    var query = breeze.EntityQuery
        .from("Resources")
        .expand("Event, Shift")
        .orderBy("ResourceId");

    return manager.executeQuery(query)
        .fail(fail);
    }

var getUser = function () {
    var query = breeze.EntityQuery
        .from("LoggedInUser")
        .expand("Order.Event")
        .orderBy("Email");

    return manager.executeQuery(query)
         .fail(fail);
}

Code 2:
function configureMetadataStore(metadataStore) {
    metadataStore.registerEntityTypeCtor('Shift', null, momentInitializer);
    metadataStore.registerEntityTypeCtor('Event', null, momentInitializer);
    metadataStore.registerEntityTypeCtor('Order', null, momentInitializer);
}

function momentInitializer(entity) {
    var newMoment,
        prop;

    for (prop in entity) {
        if (ko.isObservable(entity[prop])) {
            if (entity[prop]() instanceof Date) {
                newMoment = ko.observable(moment(entity[prop]()));
                entity[prop] = newMoment;
            }
        }
    }
}

A: I am sure there is a better and more detailed answer for this, but from what I understand you are probably trying to display the date in a given format, not actually convert it in the database, correct?
If you are using a binding handler such as Knockout.js you can just change the format in which it is displayed instead of converting the date/time stamp.  I am always cautious of converting the dates just to display them because I have had issue in the past with the database getting mad at me for such a thing.
Here is an example of a custom binding handler to show date time as May 29th, 2013, 2:22:00 pm
ko.bindingHandlers.DateTime = {
    update: function (element, valueAccessor) {
        var value = valueAccessor();
        var date = moment(value());
        var strDate = date.format('MMMM Do YYYY, h:mm:ss a');
        $(element).text(strDate);
    }
};


text:
Q: jQuery tablesorter widget-filter-formatter-select2 with a predefined filter list? Successfully, I implemented the tablesorter filter widget, to select multiple options at the same time with partial matching without any problems (this plugin is great!):
https://mottie.github.io/tablesorter/docs/example-widget-filter-formatter-select2.html
However, my table is more complex.

Person
Language

A
ENG, DEU, FRZ, SPA

B
ENG, SLO, RUS

C
DEU, FRZ

Desired content of the filter dropdown: ENG / DEU / FRZ etc.
(not each combination once)
Is it possible to give a predefined list instead of using the unique values selected from the all cells of this col?
I went throught the JS code, but could not figure out how do integrate an additional arguments containting such a list.

A: After relooking at the documentation I found what I needed:
// option added in v2.16.0
  filter_selectSource : {
    // Alphanumeric match (prefix only)
    // added as select2 options (you could also use select2 data option)
    2 : function(table, column) {
      return ['ENG', 'DEU', 'FRZ', 'SLO', 'RUS'];
    }
  }

This works fine, but does not include child rows. How can I also filter child rows?


text:
Q: Error variable length column ROWID overflow FireDAC con tablas de tipo IOT Oracle Estoy trabajando con una versión XE7 de Delphi con conexión a Oracle que contiene tablas de tipo IOT, al realizar la activación de mis tablas que son 2931 y posteriormente realizar un First obtengo el siguiente error:
Variable length column ROWID overflow. Value length -24, column maximum length 23

Investigando en internet he encontrado que el valor de ROWID para las tablas de tipo IOT es más grande porque contiene el número de archivos de datos, numero de bloque y numero de fila, en el código llegue a la unidad FireDAC.Phys.OracleCli que contiene la constante IRowIdLen que tiene un valor de 23, justo el valor maximo que me esta devolviendo el error, probé aumentando este valor a 24 y he saltado el error, pero también probé con un valor de 25 y volví a obtener el error, probé con 26 y ya no salió el error, seguí probando con números consecutivos y curiosamente cuando el valor de la constante es par no obtengo el error pero cuando es impar si, mi pregunta es:
¿Cuál es el mejor valor a colocar a esta constante para ya no volver a obtener el error mencionado?


text:
Q: Multiple Instantiate of 1 class affects memory? I am currently struggling with memory handling. I have an if statement and each case instantiate a new object from a class. Does this affect the memory allocation in java?
switch()
{
case 1:
test t1 = new test();

case 2:
test t2 = new test();

case 3:
test t3 = new test();

case 4:
test t4 = new test();

case 5:
test t5 = new test();

case 6:
test t6 = new test();

}

A: No, it doesn't.
Each time your case is executed, exactly one object is allocated (except if you pass in an unhandled value, in which case nothing happens). The fact that there are a lot of new statements in your code doesn't change that; what counts is how often an allocation statement is executed, not when its byte code is loaded.


text:
Q: How to avoid symlinked files shared by Samba from looking like duplicate files (different inode numbers)? I often have directories on a Linux server where symbolic links are used for alternative names for subdirectories or files (e.g. maintaining a "latest" symbolic link to a directory with the latest version, but also for things like "Philips" linking to "NXP/Historic")... but when seen by Samba clients (assuming symlinks are allowed to be followed) there is no hint the files in these directories are actually the same... even the inode numbers (when seen by another linux client using a samba share) make them look to be different.
My worry is that some person (or automated "delete duplicates" app) might try to delete one "copy" thinking there is still another file with the same contents, but deleting one would delete both copies because they are really the same file.  I do want to allow read/write access to these files, but reduce the chance of mistakes. So far all I can think of is telling smb.conf not allow any symlinks, but perhaps what I'd like is to make symlinks look like shortcuts to Windows clients (which, I think, is impossible).  Most people can be careful in obvious cases like the "latest" directory, but when there are lots of links in a shared area (and users are, correctly, periodically trying to clear away useless files), there is a need to reduce the chance of silly mistakes. Any ideas?

A: Unfortunately, I think this is not possible. Windows LNK files are small binary files which containts the path to the true target, while Linux's symlink operate at a lower (libc) level. This means that Samba should "traduce" on the fly a Linux symlink into a LNK files; while theoretically possible with a VFS module, such a module does not exists (as from my understanding).
The best thing you can do is to deny access to symlinks by using the follow symlinks = no in your share definition.


text:
Q: NRST pin of unpowered STLINK V2 I am using the STLINK from a Nucleo board in order to flash and debug a STM32F7 MCU on a custom board.
Everything works fine except when STLINK is connected to my custom board AND unpowered. Indeed, in this case the MCU on my custom board doesn't seem to start.
After some investigation, I realise that it is the NRST pin (CMOS technology) from the STLINK which is shorted to GND when unpowered, shorting to GND NRST on my custom board.
A simple workaround is to disconnect the NRST pin from STLINK when it is unpowered but I would like to know if there is a way prevent NRST from being shorted to GND without having to disconnect this cable.
I tried a 10K pull-up resistor to VDD of my custom board but of course it doesn't change anything as it seems to be a real short to GND and not through a pull-down resistor.
Does anybody have knowledge of the exact architecture of the CMOS driver of NRST pin ? The piece of information provided by datasheet (p.67) is not really helpful as there are no exact characteristics of the CMOS themselves.

A: The GPIO information you're looking for is in the reference manual. Here's the structure of a regular, non-5V-tolerant† GPIO pin on the STM32F103 series (used in the STLink/V2-1 on Nucleo boards):

Note that the top protection diode shunts voltages above the microcontroller's VDD into the supply rail to protect the IO pin. When the microcontroller is unpowered, that means that the IO pin might inadvertently sink current through the protection diode to power the microcontroller.
This parasitic power draw may be enough to overcome the internal/external pullup resistors on NRST and hold your main microcontroller in reset.
Unfortunately, without changing the design of the debug hardware, I don't see a good way to prevent NRST from being pulled to ground without disconnecting it. You might be able to find a series resistor value that allows normal reset operation (pulled to ground through the NMOS of the IO pin) while limiting the voltage drop when the debugger is powered down (pulled to ground through the protection diode).
Equivalent circuit for normal operation:

simulate this circuit – Schematic created using CircuitLab
Equivalent circuit for unpowered operation:

simulate this circuit

  †: Not all GPIO pins are designed this way - if you review Figure 14 on the same page, you'll see that the top protection diode for 5V tolerant pins feeds into a separate 5V rail that does not necessarily backpower the microcontroller.


text:
Q: How Adobe made Photoshop cross-platform? I want just know how Adobe makes Photoshop cross-platform? I know Photoshop is written completely in C++, but what about the GUI? Does Adobe use GUI toolkits?

A: For any natively compiled, cross-platform project, the solution is typically to have small portions of the code called "wrappers" written exclusively for specific platforms.  These wrappers do all the talking directly to the platform.
This makes an app like Photoshop multi-platform, but it wouldn't necessarily build on a platform that Adobe hasn't written wrappers for.

A: Writing cross platform software is tedious but here are the simple rules.
Generally you need to work with an abstraction of the underlying OS / environment, so that your code depends on this abstraction instead of the OS itself. This is called a bridge pattern. It is important to understand the more features you add to the bridge between your program and the OS the more difficult it will be to port the software. In the case of Adobe they use a relatively small part of the OS (tiny bridge) as they have their own UI and text processing so they just need to capture mouse/keyboard input and be able to draw in a window.


text:
Q: Translation for "Learn more" not used in SO for Teams Translation for "Learn more" (that was completed long time ago) is not used in SO for Teams on ruSO:

Other untranslated strings from the image were translated recently and will be on the site in the next builds.
To check the state just open ruSO in private mode.

A: As stated in the initial announcement, this element wasn't supposed to appear in the left navigation at all on international sites. As such, we've removed this element from the left navigation as of earlier this week (Monday the 22nd of March) so this should no longer be an issue. Thanks for reporting it!


text:
Q: Dummy AJAX calls to force a "wait" cursor. Bad idea? I would like the user's cursor to be in "wait-state" during certain actions, but the problems with using the CSS cursor property is forcing me to search for more... creative solutions. (The problem I'm referring to, is that the cursor doesn't change until the user moves the cursor. See, for example: How to get cursor to change before mouse moves when changing the cursor style dynamically.)
I've found however, that most browsers seem to correctly switch back and forth through wait and default cursor when making AJAX requests. So now I was thinking do a dummy AJAX requests for as long as I want the cursor to be in "wait". I feel that this might be a Very Bad Idea, but I can't really point out why. Any good reasons why this is bad? (Or much better solutions?)

A: its a bad idea because it increases load and traffic on the server.

A: Yes, it is a bad idea. A waiting cursor may make the user think his browser (or connection) is frozen.
Web pages give you plenty of options for waiting feedback: progress bars, spinners, feedback text, modal feedback windows, disabling commands... use one (or more) of those instead.

A: I found a possible solution myself. (This is more for future users who come across this problem, really, since I've since come to agree that using the cursor for feedback is A Bad Idea in general.)
I found that if the first change of the cursor is in an eventhandler of a mouse-event (like "click", or "move"), not only will the cursor change immediately, it will also change immediately again if changed at a later time with setTimeout or setInterval, given that setInterval or setTimeout were also called within that eventhandler.
Yes, weird.


text:
Q: Figure out 16*x[n-1] of a sequential BBP formula So, I happened to find a slightly different version of the BBP algorithm (for calculating pi):

Is there any way, perhaps by using the original BBP algorithm, to get that 16*x[n-1] term for an arbitrary value of n? Thanks.
EDIT: I meant without actually summing up {16x[0] + {16x[ 1] ... to 16x[n]}}. Is there a faster way?


text:
Q: When to use Java EE application server? I have been developing rather small web applications but now I need to be able to build actual Enterprise Applications. For the Enterprise I need to know what exactly "middle-tier" means and how to implement such models.
There are many Java EE specifications, many of which I haven't used and do not know their purpose (yet, as I'm currently reading the Java EE 7 tutorial)
But I'm afraid I may waste my time learning specs that I won't need or that I'm already using a replacement for (i.e Tapestry 5: Servlets, JSP, JSF, IoC, Datanucleus/JDO: JPA, JDBC)
The two main specs that I'm eager to understand and decide If I can add them to my skills to improve my output, are EJBs, JMS, WS and RS.
After searching, reading and giving Glassfish a very quick try, I think there is not much to utilize in application servers in my case ! Hopefully I'm wrong...

*

*So will it still be useful to run a whole application server ONLY to make use of it's WS or RS features ? Or basically just a few features ?!

*How much is there in the Java EE specs that I'm missing other than what I mentioned ?

*Is it useful (productivity\efficiency wise) to study or use equivalent Java EE specs to what I'm currently using (i.e. JSF, JPA..etc) ?

A: Your question is too wide and a lot depends on situation specific / depends on other factors.
I will try to give 10K foot overview:
So will it still be useful to run a whole application server ONLY to make use of it's WS or RS features ? Or basically just a few features ?!
It depends on your projected traffic, volume of db transactions, etc. For learning, its perfectly fine to run all in ONE server. And keep in mind, there are two areas: 1.) Application layering like presentation, Bisuiness logic, Data, etc and with in Business Logic layers, there can be sub-layers, like DAOs, etc. 2.) Physical server layers as a. Web server (front-end) which servers JSPs, Servlets, etc, b. Application Server that serves EJBs, etc. and c. database server.
How much is there in the Java EE specs that I'm missing other than what I mentioned ?
Its a vast spec. For instance, there is a JMS, EJBs, etc. But for learning/ beginner, I would say first focus on learning basics. You can start from JSP, Servlets and then move on to EJBs.
Spring is a separate framework. Its not complaint to J2EE standards. But it supports most of the Java EE technologies.
Is it useful (productivity\efficiency wise) to study or use equivalent Java EE specs to what I'm currently using (i.e. JSF, JPA..etc) ?
Its again a question you can probably answer yourself, once you read through the tutorial and understand concepts. Different projects use different java technologies. Not necessarily all. You just need to evaluate which technology fits best for your project.
Hope this answers a bit!


text:
Q: Why do I see "Object of class __NSCFString autoreleased with no pool in place" in this simple Monotouch code? Monotouch 5.0.2.
Running the simple code below I get this in the output panel:
objc[20283]: Object 0x9c08110 of class __NSCFString autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
objc[20283]: Object 0x9c07840 of class __NSCFData autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug

Which NSStrings are leaking here and why? It seems to be enough to just create a new Uri() and a new WebClient() objetc. The event handler doesn't even have to be attached.
using System;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using System.Net;
using System.IO;

namespace DownloadTest
{
    [Register ("AppDelegate")]
    public partial class AppDelegate : UIApplicationDelegate
    {
        UIWindow window;

        public override bool FinishedLaunching (UIApplication app, NSDictionary options)
        {
            window = new UIWindow (UIScreen.MainScreen.Bounds);

            UIButton btn = UIButton.FromType (UIButtonType.RoundedRect);
            btn.Frame = new System.Drawing.RectangleF (40, 40, 100, 30);
            btn.TouchUpInside += delegate {
                // These two lines seem to caus the leak.
                Uri uri = new Uri ("http://silverlightinaction.com/video3.wmv");
                WebClient webClient = new WebClient ();
                // This line does not matter, the info about the leaking NSString alsp appears without an event being attached.
                webClient.OpenReadAsync (uri);
            };
            window.AddSubview (btn);

            window.MakeKeyAndVisible ();

            return true;
        }

        void HandleWebClientOpenReadCompleted (object sender, OpenReadCompletedEventArgs e)
        {
            using (var pool = new NSAutoreleasePool())
            {
                using (Stream stream = e.Result)
                using (FileStream fileStream = File.OpenWrite(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "download.bin")))
                {
                    stream.CopyTo (fileStream, 30000);
                    stream.Close ();
                    fileStream.Close ();
                }
            }
        }
    }
}

A: This is a MonoTouch bug. WebClient uses Thread which does not automagically creates an NSAutoreleasePool around the code being executed (e.g. like you did in your delegate). That can cause some leaks - just like you're seeing with the warning messages.
Note that using (threads from) ThreadPool is already ensuring that an NSAutoreleasePool covers the thread's execution.

A: I created a new class deriving from WebClient and overrode the "OnDownloadedCompleted" and created my own pool within a using block.  This seemed to get rid of the debug messages, not sure if it's the perfect fix though.
using(var a = new MonoTouch.Foundation.NSAutoreleasePool())
{
    base.OnDownloadDataCompleted (args);
}


text:
Q: How to have multif-form application in android? I'm going to develop a shopping application which include several cascading forms.
The development platform is android 3.1. I got two problems.

*

*what is a good strategy to have multiple forms? e.g. start new activity for each cascading form?

*if using multiple activities is a good solution, how can share information between activities like shopping cart data (DB,Shared Class,...)?

I just jumped from C++ over here and I'm not that expert in visual environment application development.

A: I would:
1) Use a different activity/layout for each form (things are easier and more organised).
2) Use an Application instance to store the global information.


text:
Q: Entire function bounded on real line and growth bounded by function of imaginary component Let $f\colon \mathbb{C} \to \mathbb{C}$ be an entire function taking reals to reals
and that is bounded on $\mathbb{R}$. Suppose there exists a continuous function $g\colon \mathbb{R} \to \mathbb{R}$ satisfying
$$
|f(z)| \le g(\text{Im}(z)) \quad\quad (*)
$$
for every $z\in \mathbb{C}$.
One example is
$$
f(z) = e^{-z^2}\,.
$$
Of course, if $h\colon \mathbb{C}\to \mathbb{C}$ is an entire function taking reals to reals and satisfying
$$
|h(z)|\le k(|z|)\quad\text{for some}~ k\colon\mathbb{R}\to \mathbb{R} ~\text{continuous}\,,
$$
and $f$ satisfies ($*$), then the composition $h\circ f$ satisfies ($*$).
Can we say anything else about real entire functions satisfying ($*$)? I'm interested in a Paley–Wiener type theorem for this class of functions but broadly interested in simple examples of this class of entire functions.


text:
Q: NameSpace mismatch fault when calling a axis 2 web service in RESTful way I have a axis2 web services application. Its been built using axis 2 1.7.8.
Following is the wsdl of a webservice call 'close'
<wsdl:definitions targetNamespace="vish_testweb_close" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns="vish_testweb_close" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl">
   <wsdl:documentation>vish_testweb_close</wsdl:documentation>
   <wsdl:types>
      <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="vish_testweb_close">
         <xs:element name="close">
            <xs:complexType>
               <xs:sequence>
                  <xs:element minOccurs="0" name="authToken" nillable="true" type="xs:string"/>
               </xs:sequence>
            </xs:complexType>
         </xs:element>
         <xs:element name="closeResponse">
            <xs:complexType>
               <xs:sequence>
                  <xs:element name="return" type="xs:boolean"/>
               </xs:sequence>
            </xs:complexType>
         </xs:element>
      </xs:schema>
   </wsdl:types>
   <wsdl:message name="closeRequest">
      <wsdl:part name="parameters" element="ns:close"/>
   </wsdl:message>
   <wsdl:message name="closeResponse">
      <wsdl:part name="parameters" element="ns:closeResponse"/>
   </wsdl:message>
   <wsdl:portType name="vish_testweb_closePortType">
      <wsdl:operation name="close">
         <wsdl:input message="ns:closeRequest" wsaw:Action="urn:close"/>
         <wsdl:output message="ns:closeResponse" wsaw:Action="urn:closeResponse"/>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="vish_testweb_closeSoap11Binding" type="ns:vish_testweb_closePortType">
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
      <wsdl:operation name="close">
         <soap:operation soapAction="urn:close" style="document"/>
         <wsdl:input>
            <soap:body use="literal"/>
         </wsdl:input>
         <wsdl:output>
            <soap:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:binding name="vish_testweb_closeSoap12Binding" type="ns:vish_testweb_closePortType">
      <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
      <wsdl:operation name="close">
         <soap12:operation soapAction="urn:close" style="document"/>
         <wsdl:input>
            <soap12:body use="literal"/>
         </wsdl:input>
         <wsdl:output>
            <soap12:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:binding name="vish_testweb_closeHttpBinding" type="ns:vish_testweb_closePortType">
      <http:binding verb="POST"/>
      <wsdl:operation name="close">
         <http:operation location="close"/>
         <wsdl:input>
            <mime:content type="application/xml" part="parameters"/>
         </wsdl:input>
         <wsdl:output>
            <mime:content type="application/xml" part="parameters"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="vish_testweb_close">
      <wsdl:port name="vish_testweb_closeHttpsSoap11Endpoint" binding="ns:vish_testweb_closeSoap11Binding">
         <soap:address location=""/>
      </wsdl:port>
      <wsdl:port name="vish_testweb_closeHttpSoap11Endpoint" binding="ns:vish_testweb_closeSoap11Binding">
         <soap:address location="http://localhost:8080/vish-800_latest/services/vish_testweb_close.vish_testweb_closeHttpSoap11Endpoint/"/>
      </wsdl:port>
      <wsdl:port name="vish_testweb_closeHttpSoap12Endpoint" binding="ns:vish_testweb_closeSoap12Binding">
         <soap12:address location="http://localhost:8080/vish-800_latest/services/vish_testweb_close.vish_testweb_closeHttpSoap12Endpoint/"/>
      </wsdl:port>
      <wsdl:port name="vish_testweb_closeHttpsSoap12Endpoint" binding="ns:vish_testweb_closeSoap12Binding">
         <soap12:address location=""/>
      </wsdl:port>
      <wsdl:port name="vish_testweb_closeHttpsEndpoint" binding="ns:vish_testweb_closeHttpBinding">
         <http:address location=""/>
      </wsdl:port>
      <wsdl:port name="vish_testweb_closeHttpEndpoint" binding="ns:vish_testweb_closeHttpBinding">
         <http:address location="http://localhost:8080/vish-800_latest/services/vish_testweb_close.vish_testweb_closeHttpEndpoint/"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>

I am trying to call the above web service in RESTFUL style.
http://localhost:8080/LabWare-800_latest/services/labware_weblims_close/close
The data is sent as POST in application/json format :
{
    "close": {
        "authToken":"authtoken1112334"
    }
}

But axis machinary throws the following 'Fault'
{"Fault": "<soapenv:Fault xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><faultcode>soapenv:Server<\/faultcode><faultstring>namespace mismatch require vish_testweb_close found vish_testweb_authenticate<\/faultstring><detail/><\/soapenv:Fault>"}
There is another web services by the namespace : vish_testweb_authenticate. Following is the wsdl :
<wsdl:definitions targetNamespace="vish_testweb_authenticate" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns="vish_testweb_authenticate" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl">
   <wsdl:documentation>vish_testweb_authenticate</wsdl:documentation>
   <wsdl:types>
      <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="vish_testweb_authenticate">
         <xs:element name="authenticateWithRole">
            <xs:complexType>
               <xs:sequence>
                  <xs:element minOccurs="0" name="username" nillable="true" type="xs:string"/>
                  <xs:element minOccurs="0" name="password" nillable="true" type="xs:string"/>
                  <xs:element minOccurs="0" name="role" nillable="true" type="xs:string"/>
                  <xs:element minOccurs="0" name="limsDSName" nillable="true" type="xs:string"/>
                  <xs:element minOccurs="0" name="limsServiceName" nillable="true" type="xs:string"/>
               </xs:sequence>
            </xs:complexType>
         </xs:element>
         <xs:element name="authenticateWithRoleResponse">
            <xs:complexType>
               <xs:sequence>
                  <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
               </xs:sequence>
            </xs:complexType>
         </xs:element>
         <xs:element name="authenticate">
            <xs:complexType>
               <xs:sequence>
                  <xs:element minOccurs="0" name="username" nillable="true" type="xs:string"/>
                  <xs:element minOccurs="0" name="password" nillable="true" type="xs:string"/>
                  <xs:element minOccurs="0" name="limsDSName" nillable="true" type="xs:string"/>
                  <xs:element minOccurs="0" name="limsServiceName" nillable="true" type="xs:string"/>
               </xs:sequence>
            </xs:complexType>
         </xs:element>
         <xs:element name="authenticateResponse">
            <xs:complexType>
               <xs:sequence>
                  <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
               </xs:sequence>
            </xs:complexType>
         </xs:element>
      </xs:schema>
   </wsdl:types>
   <wsdl:message name="authenticateRequest">
      <wsdl:part name="parameters" element="ns:authenticate"/>
   </wsdl:message>
   <wsdl:message name="authenticateResponse">
      <wsdl:part name="parameters" element="ns:authenticateResponse"/>
   </wsdl:message>
   <wsdl:message name="authenticateWithRoleRequest">
      <wsdl:part name="parameters" element="ns:authenticateWithRole"/>
   </wsdl:message>
   <wsdl:message name="authenticateWithRoleResponse">
      <wsdl:part name="parameters" element="ns:authenticateWithRoleResponse"/>
   </wsdl:message>
   <wsdl:portType name="vish_testweb_authenticatePortType">
      <wsdl:operation name="authenticate">
         <wsdl:input message="ns:authenticateRequest" wsaw:Action="urn:authenticate"/>
         <wsdl:output message="ns:authenticateResponse" wsaw:Action="urn:authenticateResponse"/>
      </wsdl:operation>
      <wsdl:operation name="authenticateWithRole">
         <wsdl:input message="ns:authenticateWithRoleRequest" wsaw:Action="urn:authenticateWithRole"/>
         <wsdl:output message="ns:authenticateWithRoleResponse" wsaw:Action="urn:authenticateWithRoleResponse"/>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="vish_testweb_authenticateSoap11Binding" type="ns:vish_testweb_authenticatePortType">
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
      <wsdl:operation name="authenticate">
         <soap:operation soapAction="urn:authenticate" style="document"/>
         <wsdl:input>
            <soap:body use="literal"/>
         </wsdl:input>
         <wsdl:output>
            <soap:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="authenticateWithRole">
         <soap:operation soapAction="urn:authenticateWithRole" style="document"/>
         <wsdl:input>
            <soap:body use="literal"/>
         </wsdl:input>
         <wsdl:output>
            <soap:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:binding name="vish_testweb_authenticateSoap12Binding" type="ns:vish_testweb_authenticatePortType">
      <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
      <wsdl:operation name="authenticate">
         <soap12:operation soapAction="urn:authenticate" style="document"/>
         <wsdl:input>
            <soap12:body use="literal"/>
         </wsdl:input>
         <wsdl:output>
            <soap12:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="authenticateWithRole">
         <soap12:operation soapAction="urn:authenticateWithRole" style="document"/>
         <wsdl:input>
            <soap12:body use="literal"/>
         </wsdl:input>
         <wsdl:output>
            <soap12:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:binding name="vish_testweb_authenticateHttpBinding" type="ns:vish_testweb_authenticatePortType">
      <http:binding verb="POST"/>
      <wsdl:operation name="authenticate">
         <http:operation location="authenticate"/>
         <wsdl:input>
            <mime:content type="application/xml" part="parameters"/>
         </wsdl:input>
         <wsdl:output>
            <mime:content type="application/xml" part="parameters"/>
         </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="authenticateWithRole">
         <http:operation location="authenticateWithRole"/>
         <wsdl:input>
            <mime:content type="application/xml" part="parameters"/>
         </wsdl:input>
         <wsdl:output>
            <mime:content type="application/xml" part="parameters"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="vish_testweb_authenticate">
      <wsdl:port name="vish_testweb_authenticateHttpSoap11Endpoint" binding="ns:vish_testweb_authenticateSoap11Binding">
         <soap:address location="http://localhost:8080/vish-800_latest/services/vish_testweb_authenticate.vish_testweb_authenticateHttpSoap11Endpoint/"/>
      </wsdl:port>
      <wsdl:port name="vish_testweb_authenticateHttpsSoap11Endpoint" binding="ns:vish_testweb_authenticateSoap11Binding">
         <soap:address location=""/>
      </wsdl:port>
      <wsdl:port name="vish_testweb_authenticateHttpsSoap12Endpoint" binding="ns:vish_testweb_authenticateSoap12Binding">
         <soap12:address location=""/>
      </wsdl:port>
      <wsdl:port name="vish_testweb_authenticateHttpSoap12Endpoint" binding="ns:vish_testweb_authenticateSoap12Binding">
         <soap12:address location="http://localhost:8080/vish-800_latest/services/vish_testweb_authenticate.vish_testweb_authenticateHttpSoap12Endpoint/"/>
      </wsdl:port>
      <wsdl:port name="vish_testweb_authenticateHttpEndpoint" binding="ns:vish_testweb_authenticateHttpBinding">
         <http:address location="http://localhost:8080/vish-800_latest/services/vish_testweb_authenticate.vish_testweb_authenticateHttpEndpoint/"/>
      </wsdl:port>
      <wsdl:port name="vish_testweb_authenticateHttpsEndpoint" binding="ns:vish_testweb_authenticateHttpBinding">
         <http:address location=""/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>

Any help in this regard will be highly appreciated.

A: Finally solved the problem. The problem was in the services.xml of the close.aar service ( Both the service have been deployed as archive.
The services.xml wrongly had the xmlNamespace  to "vish_testweb_authenticate" in the close service service.xml
<service name="vish_testweb_close" targetNamespace="vish_testweb_close">
   <description>
        This service is to close connection
   </description>
   <schema schemaNamespace="labware_weblims_close"/>
   <parameter name="ServiceClass">vish.web.ws.service.CloseService</parameter>
    <parameter name="xmlToJsonNamespaceMap">
        <mappings>
            <mapping xmlNamespace="vish_testweb_authenticate" jsonNamespace=""/>
        </mappings>
    </parameter>
   <operation name="close">
        <messageReceiver  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
       <messageReceiver class="org.apache.axis2.json.gson.rpc.JsonRpcMessageReceiver"/>
   </operation>
   <module ref="soapmonitor"/>
 </service>

Corrected service.xml is as follows ( Please refer to 'xmlToJsonNamespaceMap' section)
<service name="vish_testweb_close" targetNamespace="vish_testweb_close">
   <description>
        This service is to close connection
   </description>
   <schema schemaNamespace="labware_weblims_close"/>
   <parameter name="ServiceClass">vish.web.ws.service.CloseService</parameter>
    <parameter name="xmlToJsonNamespaceMap">
        <mappings>
            <mapping xmlNamespace="vish_testweb_close" jsonNamespace=""/>
        </mappings>
    </parameter>
   <operation name="close">
        <messageReceiver  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
       <messageReceiver class="org.apache.axis2.json.gson.rpc.JsonRpcMessageReceiver"/>
   </operation>
   <module ref="soapmonitor"/>
 </service>


text:
Q: why does the volume of a n-dimensional sphere converge to $0$ for given radius and $n \to \infty$ I was playing around with the volume of n-dimensional spheres to get a better understanding of the "curse of dimensionality" and I realized that the volume of a n-dimensional sphere tends to 0 for a given radius and $n \to \infty$ Also it increases in the beginning but starts to decrease at some point.  Is there an intiution why this happens?
Recall that the volume of a n-dimensional sphere with radius $r$ is$\frac{\pi^{0.5n}}{\Gamma(0.5n+1)}r^n$


text:
Q: WP Pivot - Element is already the child of another element I am trying to dynamically create and add items to grids in Windows Phone application.
Before I did it on a simple page, worked fine. Now I am doing the same on a Pivot page and I get exception when adding a 2nd item. "Element is already the child of another element."
XAML side of code:
<controls:PivotItem Header="pirmadienis" x:Name="Monday">
            <ScrollViewer Height="600">
                <Grid x:Name="MondayGrid">
                    <TextBlock Text="Laikas" Margin="21,0,-21,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                    <TextBlock x:Name="fatherTime" FontSize="40" Text="44:44" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,21,0,0" Visibility="Collapsed"/>
                    <TextBlock x:Name="fatherText" HorizontalAlignment="Left" Margin="115,21,0,0" Text="WWWWWWWWW" VerticalAlignment="Top" FontSize="40" Width="341" Visibility="Collapsed"/>
                    <TextBlock Text="Pavadinimas" Margin="215,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                </Grid>
            </ScrollViewer>
        </controls:PivotItem>

        <!--Pivot item two-->
        <controls:PivotItem Header="antradienis" x:Name="Tuesday" Visibility="Collapsed">
            <ScrollViewer Height="600">
                <Grid x:Name="TuesdayGrid">
                    <TextBlock Text="Laikas" Margin="21,0,-21,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                    <TextBlock Text="Pavadinimas" Margin="215,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                </Grid>
            </ScrollViewer>
        </controls:PivotItem>

        <!--Pivot item three-->
        <controls:PivotItem Header="trečiadienis" x:Name="Wednesday" Visibility="Collapsed">
            <ScrollViewer Height="600">
                <Grid x:Name="WednesdayGrid">
                    <TextBlock Text="Laikas" Margin="21,0,-21,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                    <TextBlock Text="Pavadinimas" Margin="215,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                </Grid>
            </ScrollViewer>
        </controls:PivotItem>

        <!--Pivot item four-->
        <controls:PivotItem Header="ketvirtadienis" x:Name="Thursday" Visibility="Collapsed">
            <ScrollViewer Height="600">
                <Grid x:Name="ThursdayGrid">
                    <TextBlock Text="Laikas" Margin="21,0,-21,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                    <TextBlock Text="Pavadinimas" Margin="215,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                </Grid>
            </ScrollViewer>
        </controls:PivotItem>

        <!--Pivot item five-->
        <controls:PivotItem Header="penktadienis" x:Name="Friday" Visibility="Collapsed">
            <ScrollViewer Height="600">
                <Grid x:Name="FridayGrid">
                    <TextBlock Text="Laikas" Margin="21,0,-21,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                    <TextBlock Text="Pavadinimas" Margin="215,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                </Grid>
            </ScrollViewer>
        </controls:PivotItem>

        <!--Pivot item six-->
        <controls:PivotItem Header="šeštadienis" x:Name="Saturday" Visibility="Collapsed">
            <ScrollViewer Height="600">
                <Grid x:Name="SaturdayGrid">
                    <TextBlock Text="Laikas" Margin="21,0,-21,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                    <TextBlock Text="Pavadinimas" Margin="215,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                </Grid>
            </ScrollViewer>
        </controls:PivotItem>
    </controls:Pivot>

C# part of code:
void addDateItem(string text)
{
    Thickness tempThick = fatherTime.Margin;
    tempThick.Top += itemsAdded * 58;
    TextBlock temp = new TextBlock()
        {
            Text = text,
            FontSize = 40,
            HorizontalAlignment = HorizontalAlignment.Left,
            VerticalAlignment = VerticalAlignment.Top,
            Margin = tempThick
        };
    temp.Tap += paspaudus;
    MondayGrid.Children.Add(temp);
    TuesdayGrid.Children.Add(temp); // Exception on this line
    WednesdayGrid.Children.Add(temp);
    ThursdayGrid.Children.Add(temp);
    FridayGrid.Children.Add(temp);
    SaturdayGrid.Children.Add(temp);
    itemsAdded++;
}

A: The error message was clear. You can't add an element that is already added as child of a parent to other parent element. You have to instantiate new TextBlock object for each <grid>.


text:
Q: How to configure Workgroup to receive updates from WSUS Hi Guys I have WSUS server and is working fine with active diectory. but how can I connect workgroup pcs running on windows xp to WSUS without joining them to AD?
Thank you in advance.

A: You can make the same changes required by updating the registry directly; a quick search brought me to this link which looks like it has the correct information.  If not, a little bit more thorough search on your part will likely get you the information you're missing.

A: I use the following batch script to flip-flop systems on and off WSUS. It works great to quickly get formatted systems updated before we give them away.
Change [SERVER] to your WSUS server under the :USEWSUS section.

@echo off
:START
cls
echo Temporary WSUS Script
echo ==============================
echo This script will flip between using the internal WSUS server and Microsoft's servers.
echo.
set /p WSUSSETTING=Type [W] to use WSUS or [C] to clear the setting and use MS servers:

IF /i (%WSUSSETTING%) == (W) goto CONTINUE
if /i (%WSUSSETTING%) == (C) goto CONTINUE

echo.
echo Error: Invalid selection
pause
goto START

:CONTINUE
echo Stopping Update Services...
net stop wuauserv
echo Deleting timeout registry entries (Safe to ignore errors)...
reg delete "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v LastWaitTimeout /f
reg delete "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v DetectionStartTime /f
reg delete "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v NextDetectionTime /f

IF /i (%WSUSSETTING%) == (W) goto USEWSUS
IF /i (%WSUSSETTING%) == (C) goto USEMS

:USEWSUS
echo Changing update server to local WSUS server...
reg add "HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate" /v WUServer /t REG_SZ /d "http://[SERVER]:8530" /f
reg add "HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate" /v WUStatusServer /t REG_SZ /d "http://[SERVER]:8530" /f
reg add "HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" /v NoAutoUpdate /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" /v AUOptions /t REG_DWORD /d 3 /f
reg add "HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" /v AutoInstallMinorUpdate /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" /v UseWUServer /t REG_DWORD /d 1 /f
goto COMPLETE

:USEMS
echo Clearing WSUS update server...
reg delete "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate" /v WUServer /f
reg delete "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate" /v WUStatusServer /f
reg delete "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" /v UseWUServer /f
goto COMPLETE

:COMPLETE
echo Starting Update Services...
net start wuauserv

:END
echo ---
echo Complete.
pause

A: If it is Professional Edition, you can use local Group Policy as well.  Run gpedit.msc and browse to "Computer Configuration -> Administrative Templates -> Windows Components -> Windows Update".


text:
Q: cvs - connect to a Windows remote pserver: no such repository I am with Windows 10 and Cygwin with cvs installed. I am trying to connect to a remote Windows CVS pserver to test. In spite of the fact that I can connect with Eclipse CVS client, I cannot connect with Cygwin command line. It says "No such repository".
What I have in Eclipse CVS setting are:

*

*username: my user name

*password: my password

*host: 10.99.64.39 (I guess it's internal)

*repo path: N:\CVSRepositorio\xxxxxx

*port: use default port

The command I use is:
cvs -d :pserver:username@10.99.64.39:2401/N:\\CVSRepositorio\\xxxxxx login

After entering my password, the error occurs.
Having changing \\ to / and not working. I just don't see a possibility of mapping the Windows path to a UNIX-CVS recognisable form.
What is the problem?


text:
Q: Definition of generalized 4-momentum In nonrelativistic mechanics, given a lagrangian $L$, we define the action as
$$S[q]=\int L(q(t),\dot q(t))dt\tag{1}$$
and we can prove (see, for example, this answer for eq. (2))
$$\begin{align}
\frac {\partial L} {\partial \dot q^i} &= \frac {\partial S} {\partial q^i} \tag{2} \\
\dot q^i \frac {\partial L} {\partial \dot q^i} -L&= -\frac {\partial S} {\partial t}\tag{3}
\end{align}
$$
so we call quantity (2) generalized momentum (covariant components) and  quantity (3) energy of the particle.
In special relativity (signature $(+,-,-,-)$) the definition of 4-momentum I know from lesson is $$p_\mu = -\frac {\partial S} {\partial q^\mu}=\left (-\frac 1 c \frac {\partial S} {\partial t} , - \frac {\partial S} {\partial q^i}\right). \tag{4}$$
The spatial part of this 4-vector seems to be the opposite of the nonrelativistic generalized momentum, and this results in the equation $$p_\mu = \left (\frac E c, -p_i \right).\tag{5}$$
Both my professor and Landau-Lifshitz get rid of this extra minus sign, by saying that raising a spatial index changes sign, and covariant and contravariant components in nonrelativistic euclidean metric are equal, so we can write
$$p^\mu = \left (\frac E c, p^i \right). \tag{6}$$
However, this reasoning seems flawed to me, because, in my understanding, the classical equations work with any metric, so they would work even with the metric $g_{ij} = -\delta_{ij}$, which is the one we use when we see $\mathbb R ^3$ as subspace of $\mathbb R ^{1,3}$. In other words, it seems to me that they are just arbitrarily exchanging the covariant and contravariant components of the vector. How can we make this more rigorous?

Clarifying the question by some comments I've made
It is clear that we want to achieve for the free particle
$$p^\mu = mcu^\mu = \gamma m(c, v^i) = - \frac {\partial S} {\partial x_\mu}.\tag{7}$$
But in terms of the nonrelativistic momentum
$$p_{nr}^i = \frac {\partial S} {\partial x_i},\tag{8}$$ we have
$$p^\mu = (E,-p_{nr}^i).\tag{9}$$
So this means in the non relativistic limit
$$p^i = mv^i = -p_{nr}^i,\tag{10}$$
but I thought
$$p_{nr}^i = mv^i.\tag{11}$$
Where's my error?

A: You talk about "the classical equations," by which I assume you mean the nonrelativistic equations. ("Classical" is used in contradistinction to quantum-mechanical.) But in nonrelativistic physics, we have separate conservation of energy and momentum, and there is no such thing as an energy-momentum four-vector. Energy and momentum are just separate objects.
I guess you can define a Galilean four-vector as something that transforms the same was as a displacement in Galilean spacetime, but then $(E,\textbf{p})$ does not transform as a Galilean four-vector. Galilean four-vectors are also not of much interest because there is no physically interesting inner product on such a vector space. Galilean geometry has two separate and unrelated systems of measurement, one for time and one for space.
So in Newtonian mechanics, you can take your two conserved quantities to be $c_1E$ and $c_2\textbf{p}$, where $c_1$ and $c_2$ can be chosen to be any two real numbers with any signs. These choices are independent, because there is no concept of putting them together into one object that transforms in a well-defined way.

However, this reasoning seems flawed to me, because, in my understanding, the classical equations work with any metric, so they would work even with the metric $g_{ij} = -\delta_{ij}$, which is the one we use when we see $\mathbb R ^3$ as subspace of $\mathbb R ^{1,3}$.

Even that would be only if you choose the $+---$ signature. You could just as easily use $-+++$ (and most relativists do).

A: Okay, I got it. (Hoping to be refuted if this is wrong.) Everything works out; eq. (11) was my misconception, due to being used to the flat euclidean metric.
With pedantic Einstein convention to make index posisioning consistent, in nonrelativistic mechanics we have
$$
\begin{align}
L&= \frac 1 2 m \sum _i (v^i)^2 = \frac 1 2 m \delta_{ij}v^i v^j\tag{1'}\\
\frac {\partial L} {\partial v^i}&=m\delta_{ij}v^j=m\delta _{ij} g^{jk} v_k\tag{2'}
\end{align}
$$
So, with the definition
$$p_i = \frac {\partial L} {\partial v^i}\tag{3'}$$eq. (11) is wrong, as with the metric $g_{ij}=-\delta_{ij}$ it should be $p^i=-mv^i$. In general, the covariant components of the momentum are proportional to the contravariant components of the velocity, so we either need the metric to move an index (and let the momentum depend on the metric, so that in general $p^i\neq mv^i$), or define
$$p_h=g_{hn}\delta^{ni}\frac {\partial L} {\partial v^i}=\sum_i g_{hi}\frac {\partial L} {\partial v^i}\tag{4'}$$
so that
$$g_{hn}\delta^{ni}\delta_{ij}g^{jk}=\delta^k_h\tag{5'}$$
and
$$p_h = g_{hn}\delta^{ni}\frac {\partial L} {\partial v^i}=mv_h\tag{6'}$$
independently of the metric.
So I don't know if (3') or (4') is the correct definition for nonrelativistic mechanics, but it seems that (4') is the one used in relativity. In the $(\pm,\mp,\mp,\mp)$ convention, (4') gives
$$p_\mu=\mp\frac {\partial L} {\partial \dot x^\mu}\tag{7'}$$ so that in the nonrelativistic limit (6') holds. (A posteriori, if (4') is commonly used in relativity, probably (4') is the one used in nonrelativistic mechanics, too, so that there is uniformity).
PS: I should note that by defining nonrelativistic energy $$E=v^i \frac {\partial L} {\partial v^i}-L\tag{8'}$$ everything works out independently of the definition of momentum. Relativistic energy, instead, is defined by the time component of (7').
PPS: OP is stated in terms of action, while this answer is in terms of the lagrangian; obviously, since (2) holds in any number of dimensions and in any metric, everything in this answer can be easily expressed in terms of the derivatives of the action instead of the lagrangian.