Q: Unit test custom IActionResult.ExecuteResultAsync(ActionContext) in ASP.NET Core 2.0 Having the below class
/// <summary>
/// An unsuccessful HTTP result.
/// </summary>
public class UnsuccessfulActionResult : IActionResult, IHttpStatusCodeResult, IErrors
{
    /// <inheritdoc />
    /// <summary>
    /// The HTTP status code.
    /// </summary>
    public HttpStatusCode StatusCode { get; }

    /// <summary>
    /// The corresponding error messages, if any.
    /// </summary>
    public IReadOnlyCollection<string> Errors { get; }

    /// <summary>
    /// The request Transaction ID.
    /// </summary>
    public string TransactionId { get; }

    /// <summary>
    /// Default ctor.
    /// </summary>
    /// <param name="transactionId">The request Transaction ID.</param>
    /// <param name="errors">The corresponding error messages, if any.</param>
    /// <param name="httpStatusCode"></param>
    public UnsuccessfulActionResult(
        string transactionId,
        HttpStatusCode httpStatusCode,
        IReadOnlyCollection<string> errors = null)
    {
        TransactionId = transactionId;
        StatusCode = httpStatusCode;
        Errors = errors ?? new List<string>();
    }

    /// <summary>
    /// Convenient method to create an unsuccessful response model.
    /// </summary>
    /// <param name="statusCode"></param>
    /// <returns></returns>
    protected UnsuccessfulResponseModel CreateResponseModel(int statusCode)
    {
        return new UnsuccessfulResponseModel(TransactionId, statusCode, Errors);
    }

    /// <inheritdoc />
    public virtual Task ExecuteResultAsync(ActionContext context)
    {
        var objectResult = new ObjectResult(CreateResponseModel((int)StatusCode))
        {
            StatusCode = (int)StatusCode
        };

        return objectResult.ExecuteResultAsync(context);
    }
}

I need to test this class to make sure that ActionContext has the response provided in overridden ExecuteResultAsync.
Just started going deep into ASP.NET Core 2.0 and missing some parts, in Web API 2 I would just check the HttpResponseMessage returned in the equivalent method of IHttpActionResult.
Task<HttpResponseMessage> ExecuteAsync(
    CancellationToken cancellationToken
)


Q: I have error while building the angular application Please help me solve this error. I have seen some solutions on stack overflow, but they are not working for me.

*

*Here is the error code
ERROR in ./src/app/remedies/Remedy.model.ts
Module build failed: Error: /Volumes/Prince/MyApp/Angular/health/src/app/remedies/Remedy.model.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Volumes/Prince/MyApp/Angular/health/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:674:23)
    at plugin.done.then (/Volumes/Prince/MyApp/Angular/health/node_modules/@ngtools/webpack/src/loader.js:467:39)
    at <anonymous>

*

*links that I have tried but not working

*

*Module build failed: Error: index.ts is missing from the TypeScript compilation

*main-aot is missing from the typeScript compilation


Q: How to use GIT in web development team I am trying to implement GIT in my company for web development.
Our current workflow is:

*

*Implementing and testing features on a test server in our environment

*Copy/Paste the files on the production server.

Now I am trying to figure out how I would do this with GIT.
My idea is that the developers should push changes on the local(test) server and when the project is finished the production server will pull the updates.
My question is how the test server will see the git files?
Do you have any recommendations for this approach?

A: I don't think it is a good idea to push to the test server. Since shared repository is usually a bare repository.
It would be best to keep the shared repository somewhere on a third server.
Everyone can push to this server, and you can maintain several branches there if you wish.
The test server pulls the changes before running the test.
Or for a more complete test - it would clone the entire repository fresh each time before test.

A: There are really plenty of approaches to this problem, you should consider read more about "Auto deployment", "GIT + deploy" etc.
Personally I'm using special script to export all the files between specific tags in GIT repository and upload them directly on the server.

A: Take a look on the git workflow(s) modal.
https://www.atlassian.com/git/tutorials/comparing-workflows/
http://nvie.com/posts/a-successful-git-branching-model/
You simply have to figure out which workflow suits you the best and you can grab the most suitable one.
If you choose to use nvie gitworkflow you can customize it to your own needs by modifing teh scripts


Q: Comparing field values using reflection I am trying to compare the field values of two different objects in a generic way. I have a function (seen below) that takes in two Objects and then gets the fields and then compares the fields in a loop and adds the fields to a list if they are not the same - is this the proper way to do this?
public void compareFields(Object qa, Object qa4) throws FieldsNotEqualException
{

  Field[] qaFields = qa.getClass().getFields();
  Field[] qa4Fields = qa4.getClass().getFields();

  for(Field f:qaFields)
  {

    for(Field f4:qa4Fields)
    {
       if(f4.equals(f))
       {
           found = true;
           break;
       }
       else
       {
           continue;
       }
    }
  }

 if(!found)
 {
    report.add(/*some_formatted_string*/) //some global list
    throw new FieldsNotEqualException();
 }
}

I was googling and I saw that C# had like a PropertyInfo Class - does Java have anything like that?
ALSO, is there a way to do like f.getFieldValue() -I know there is no method like this but maybe there is another way???

A: Libraries like commons-beanutils can help you if you want to compare bean properties (values returned by getters) instead of comparing field values.
However, if you want to stick with plain reflection, you should:

*

*Use Class.getDeclaredFields() instead of Class.getFields(), as the latter only returns the public fields.

*Since fields only depend on their class, you should cache the result and keep the fields in a static / instance variable rather than invoking getDeclaredFields() for each comparison.

*Once you have an object of that class (say o), in order to get the value of some field f for that particular object, you need to call: f.get(o).

A: You might check out org.apache.commons.lang.builder.EqualsBuilder which will save you a lot of this hassle if you're wanting to do a field by field comparison.
org.apache.commons.lang.builder.EqualsBuilder.reflectionEquals(Object, Object)

If you're wanting to compare fields yourself, check out java.lang.Class.getDeclaredFields() which will give you all the fields including non-public fields.
To compare the value of the fields use f.get(qa).equals(f.get(qa4))  Currently, you are actually comparing the field instances and not the values.

A: // If you want to have some fields, not all field then use this.
  public boolean compareObject(Object object) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException
{

 String[] compareFields = { "fieldx", "fieldy","fieldz", "field15",
        "field19"}; // list of all we need
for(String s : compareFields) {
Field field = DcrAttribute.class.getDeclaredField(s); // get a list of all fields for this class
    field.setAccessible(true);
    if(!field.get(this).equals(field.get(object))){  //if values are not equal
    return true;
    }

    }

    return false;
}


Q: Usability: How do I provide & easily deploy a (preferably node.js + MongoDB based) server backend for my users? I'm currently planing an application (brainstorming, more or less), designed to be used in small organizations. The app will require syncronization w/ a backend-server, e.g. for user management and some advanced, centralized functionality. This server has to be hosted locally and should be able to run on Linux, Mac and Windows. I haven't decided how I'm going to realize this, mainly I simply don't know which would be the smartest approach.
Technically speaking, a very interessting approach seemed to be node.js + mongoose, connecting to a local MongoDB. But this is where I'm struggeling: How do I ensure that it's easy and convienient for a organization's IT to set this up?
Installing node.js + MongoDB is tedious work and far from standartized and easy. I don't have the ressources to provide a detailled walthrough for every major OS and configuration or do take over the setup myself. Ideally, the local administrator should run some sort of setup on the machine used as server (a "regular" PC running 24/7 should suffice) and have the system up and running, similar to the way some games provide executables for hosting small game-servers for a couple friends (Minecraft, for instance).
I also thought about Java EE, though I haven't dug into an details here. I'm unsure about whether this is really an option.
Many people suggest to outsource the backend (BaaS), e.g. to parse.com or similar services. This is not an option, since it's mandatory that the backend will be hosted locally.
I'm sorry if this question is too unspecific, but unfortunately, I really don't know where to start.

A: I can give you advice both from the sysadmin's side and the developers side.
Sysadmin
Setting up node.js is not a big task. Setting up a MongoDB correctly is. But that is not your business as an application vendor, especially not when you are a one man show FOSS project, as I assume. It is an administrators task to set up a database, so let him do it. Just tell them what you need, maybe point out security concerns and any capable sysadmin will do his job and set up the environment.
There are some things you underestimate, however.
Applications, especially useful ones, tend to get used. MongoDB has many benefits, but being polite about resources isn't exactly one of them. So running on a surplus PC may work in a software development company or visual effects company, where every workstation has big mem, but in an accountant company your application will lack resources quite fast. Do not make promises like "will run on your surplus desktop" until you are absolutely, positively sure about it because you did extensive load tests to make sure you are right. Any sensible sysadmin will monitor the application anyway and scale resources up when necessary. But when you make such promises and you break them, you loose the single most important factor for software: the users trust. Once you loose it, it is very hard to get it back.
Developer
You really have to decide whether MongoDB is the right tool for the job. As soon as you have relations between your documents, in which the change of of document has to be reflected in others, you have to be really careful. Ask yourself if your decision is based on a rational, educated basis. I have seen some projects been implemented with NoSQL databases which would have been way better of with a relational database, just because NoSQL is some sort of everybody's darling.
It is a FAR way from node.js to Java EE. The concepts of Java EE are not necessarily easy to grasp, especially if you have little experience in application development in general and Java.
The Problem
Without knowing anything about the application, it is very hard to make a suggestion or give you advice. Why exactly has the mongodb to be local? Can't it be done with a VPC? Is it a webapp, desktop app or server app? Can the source ode be disclosed or not? How many concurrent users per installation can be expected? Do you want a modular or monolithic app? What are your communication needs? What is your experience in programming languages? It is all about what you want to accomplish and which services you want to provide with the app.

A: Simple and to the point: Chef (chef solo for vagrant) + Vagrant.
Vagrant provides a uniform environment that can be as closed to production as you want and Chef provides provisioning for those environments.
This repository is very close to what you want: https://github.com/TryGhost/Ghost-Vagrant
There are hundreds of thousands of chef recipes to install and configure pretty much anything in the market.


Q: Sending FILE to a External API REST from Django I'm trying to send a file from a DJANGO FORM to an API REST service, if i send only the text it works but i need to send a file an i tried all that i found but i doesn't work.
This is my form:
class Publicacion(forms.Form):

publicacion = forms.CharField(label=False,  widget=forms.Textarea(attrs={'rows': '3', 'cols': '40'}))
imagen = forms.FileField(required=False)

This is the html of that form:
            <form name="publicion" enctype="multipart/form-data" id="publicacion" method="POST">{% csrf_token %}
            <div class="post post_form" style="padding:0;">
                {{ formpublicar|crispy }}
                <button class="post_form_extra"></button>
                <input value=" " type="submit" class="post_form_submit" name="publicar"/>
            </div>

            </form>

and this is my views.py method:
def sesionactiva(request):
if 'token' in request.session:
    token = request.session['token']
    crearpublicacion = Publicacion(request.POST or None, request.FILES or None)
    if 'publicar' in request.POST and request.POST['publicar']:
        if crearpublicacion.is_valid():
            publicacion_data = crearpublicacion.cleaned_data
            publicaciontexto = publicacion_data.get("publicacion")
            imgpublicacion = request.FILES['imagen']
            apipublicar = 'http://localhost/apiSocial/publicacion/createPublication'
            payloadpublicacion = {'token': token, 'texto': publicaciontexto, 'imagen': imgpublicacion}
            responsepublicacion = requests.post(apipublicar, data=payloadpublicacion)
            crearpublicacion = Publicacion()

A: You should use requests as such:
requests.post(url, files=files, data=data)


Q: how to remove uiview with animation I added an UIView with some animation by using the following code:
CGRect a = CGRectMake(10,10,295,460);
UIView *customView = [[UIView alloc]initWithFrame:a];
customView.tag=10;
[self.tableView addSubview:customView];

[UIView animateWithDuration:1.0
                 animations:
 ^{
     customView.transform = CGAffineTransformMakeScale(1.0f, 1.0f);
 }
 ];

When I try to remove the UIView with animation, the animation seems not working. The view is just getting removed without any animation.
Here is what I have to remove the UIView with animation:
UIView *removeView=[self.tableView viewWithTag:10] ;

        removeView .transform = CGAffineTransformMakeScale(1.0f, 1.0f);

        [removeView removeFromSuperview];

[UIView animateWithDuration:1.5
                 animations:
 ^{
     removeView .transform = CGAffineTransformMakeScale(0.0f, 0.0f);
 }
 ];

I tried by placing the [UIView animateWithDuration:1.5 ... block before and after the [removeView removeFromSuperview], but none gave me the animation. Kindly help me out in this.

A: [UIView animateWithDuration:1.5 animations:^ {
     removeView.transform = CGAffineTransformMakeScale(0.0f, 0.0f);
} completion:^(BOOL finished) {
     [removeView removeFromSuperview];
}];

A: Some changes:
UIView *removeView=[self.tableView viewWithTag:10] ;

    removeView .transform = CGAffineTransformMakeScale(1.0f, 1.0f);

    [removeView performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1.5];

    [UIView animateWithDuration:1.5
                     animations:
     ^{
         removeView .transform = CGAffineTransformMakeScale(0.01f, 0.01f);
     }
     ];

Try setting your final transform to something small but nonzero.

A: Try waiting to remove the view until the animation is over:
    [removeView performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:2.0];

A: Try this one, it's worked for me:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.5f];
removeView.transform = CGAffineTransformMakeTranslation(removeView.frame.origin.x,1000.0f + (removeView.frame.size.height/2));
aview.alpha = 0;
[UIView commitAnimations];

A: Refer the following sample from Apple.
[UIView transitionWithView:containerView
           duration:0.2
           options:UIViewAnimationOptionTransitionFlipFromLeft
           animations:^{ [fromView removeFromSuperview]; [containerView addSubview:toView]; }
           completion:NULL];

The above code creates a flip transition for the specified container view. At the appropriate point in the transition, one subview is removed and another is added to the container view. This makes it look as if a new view was flipped into place with the new subview, but really it is just the same view animated back into place with a new configuration.
May be the animation type you need to manage.
Refer:-
https://developer.apple.com/documentation/uikit/uiview/1622574-transition


Q: Express Routes params to define react page components I am learning Express.js, this is my case, i have 2 urls
/security/1

/security/2

The answer to that request will be the following, depending on the answer, the "/security/{id}" will return a Web page that will show and enable a certain number of "elements".
app.get('/security/:id', (req, res) => {
  setTimeout(
    () =>
      res.send({
        access: req.params.id === '1' ? ['EDIT', 'DELETE', 'VIEW', 'ADD'] : ['VIEW'],
      }),
    Math.floor(Math.random() * 2000 + 100)
  );
});

My question is now that i have flagged the elements based on the request parameter, how can i render my react page ( for example index.js ) flagging these elements
I would appreciate any example or code answer helping me to figure it out the approach

A: I did not fully understand your question but you can make request from your frontend React page and based on the result you can render whatever you want.


Q: Points of tracklog inside a polygon with a re-enter tolerance I have points in PostGIS that represent GPS coordinates with a timestamp from a tracklog.  I'm interested in selecting the times at which the tracklog entered and exited the polygon with a certain tolerance for reentrance.
I have been able to setup a table of points with an M timestamp from that I can do aggregation and get the tracklog as a linestring, doing an intersection only shows points inside the polygon.  My key problem is that tracklog may re-enter the polygon several times, I would like to have a tolerance setup and if the re-entrance happens before x seconds, consider as if it was not an exit so rather make the exit time the last exit that lasted more than x seconds outside the polygon.
If there are more entrances made after the x seconds tolerance, consider it as an additional enter/exit result.
Is there a simple way to query for this?
I've checked How to estimate time spent within a location using GPS/timestamp data in PostGIS? but the problem is different and solution not so encouraging.
This other post does something similar but my limited PostGIS experience does not allow me to modify the query for the tolerances
Polygon intersection with LineString in PostGis

A: A generic query I use to generate AOI trajectory traversal sets:
SELECT ply.id AS ply_id, ln.id AS ln_id,
       ROW_NUMBER() OVER(PARTITION BY ply.id, ln.id ORDER BY _its.path) AS seg_id,
       _sm, _em,
       _inside::GEOMETRY(LINESTRINGM, <SRID>) AS geom
FROM   <lines> AS ln
JOIN   <polygons> AS ply
  ON   ST_Intersects(ln.geom, ply.geom)
CROSS JOIN LATERAL
       ST_Dump(ST_Intersection(ln.geom, ply.geom)) AS _its
CROSS JOIN LATERAL
       ST_LineLocatePoint(ln.geom, ST_StartPoint(_its.geom)) AS __sfrac
CROSS JOIN LATERAL
       ST_LineLocatePoint(ln.geom, ST_EndPoint(_its.geom)) AS __efrac
CROSS JOIN LATERAL
       ST_M(ST_LineInterpolatePoint(ln.geom, __sfrac)) AS _sm
CROSS JOIN LATERAL
       ST_M(ST_LineInterpolatePoint(ln.geom, __efrac)) AS _em
CROSS JOIN LATERAL
       ST_LineSubstring(ln.geom, __sfrac, __efrac) AS _inside
WHERE  _inside IS NOT NULL
;

LATERAL JOINs are executed in sequence, and each consecutive LATERAL expression has access to all previously generated rows and their values - it's a nifty and highly performant way to expand sets of records or values into rows, and to keep certain expressions out of the SELECT list.
Here

*

*we first ST_Dump a (possible) collection of ST_Intersections between intersecting <lines> and <polygons> into individual LINESTRINGs

*then retrieve the fractions of line length (ST_LineLocatePoint) on which both the ST_StartPoint and ST_EndPoint of the ST_Intersections project onto the trajectory

*with which we extract the ST_M values at the interpolated point at these fractions (ST_LineInterpolatePoint) - the enter and exit times _sm & _em

*and generate the ST_LineSubstrings (LINESTRINGM) of the initial <lines> that traverse the <polygons> - the _inside trajectories

*we also create a sequence in which these _inside trajectories appear along the initial <lines> - seg_id

The merge of consecutive rows and the extension of their exit times is a "gaps-and-islands" problem (here slightly altered to include both a LAG and LEAD check condition for the flag column), which is somewhat nasty to write and more so to explain; please hunt down relevant information yourself:
SELECT ply_id, ln_id,
       MIN(_sm) AS entry, MAX(_em) AS exit
FROM   (
    SELECT ply_id, ln_id, seg_id,
           _sm, _em, __sgap, __egap, COALESCE((__sgap OR __egap), __egap),
           ROW_NUMBER() OVER wa AS __seq,
           ROW_NUMBER() OVER wb AS __cseq
    FROM   (
        SELECT ply_id, ln_id, seg_id,
               _sm, _em,
               _sm - LAG(_em) OVER wa < <threshold> AS __sgap,
               LEAD(_sm) OVER wa - _em < <threshold> AS __egap
        FROM   <above_query>
        WINDOW
             wa AS (PARTITION BY ply_id, ln_id ORDER BY seg_id)
    ) q
    WINDOW
         wa AS (PARTITION BY ply_id, ln_id ORDER BY seg_id),
         wb AS (PARTITION BY ply_id, ln_id, COALESCE((__sgap OR __egap), __egap) ORDER BY seg_id)
) q
GROUP BY
      ply_id, ln_id, (__seq - __cseq)
ORDER BY
      MIN(_sm)
;

Wrap in the <above_query> or any other expressions that has the same information, and define the <threshold> below which you want to have exits merged with the next.


Q: How do I read in a series of numbers using "Textscan" in MATLAB if the file is mostly text? I have a text file that have a string of 3 numbers that I need to read into MATLAB.
For Example:
#######################
#
#
#    Text Text Text
#
#
#######################

Blah blah blah = ####
Blah blah blah = ####
Blah blah blah = ####
Blah blah blah = ####
Blah blah blah = ####
Blah blah blah = ####

I_NEED_THIS_STRING =  1234.5 6789.0 1234.5 !Comment blah blah blah

I need to read in those 3 numbers into an array.
PLEASE HELP.
Thanks

A: If most of the file is irrelevant to your application, I suggest preprocessing with your favorite scripting language or command line tool to find the relevant lines and use textscan() on that.
e.g., from a shell prompt:
grep ^I_NEED_THIS_STRING infile > outfile

in matlab:
fid = fopen('outfile');
C = textscan(fid, 'I_NEED_THIS_STRING = %f %f %f')
fclose(fid)

See the textscan documentation for more details.

A: An alternative is to use IMPORTDATA to read the entire file into a cell array of strings (with one line per cell), then use STRMATCH to find the cell that contains the string 'I_NEED_THIS_STRING', then use SSCANF to extract the 3 values from that cell:
>> data = importdata('mostly_useless_text.txt','\n');  %# Load the data
>> index = strmatch('I_NEED_THIS_STRING',data);  %# Find the index of the cell
                                                 %#   containing the string
>> values = sscanf(data{index},'I_NEED_THIS_STRING = %f %f %f')  %# Read values

values =

  1.0e+003 *

    1.2345
    6.7890
    1.2345

If the file potentially has a lot of useless text before or after the line you are interested in, then you may use up a lot of memory in MATLAB by loading it all into a variable. You can avoid this by loading and parsing one line at a time using a loop and the function FGETS:
fid = fopen('mostly_useless_text.txt','r');  %# Open the file
newLine = fgets(fid);                        %# Get the first line
while newLine ~= -1                          %# While EOF hasn't been reached
  if strmatch('I_NEED_THIS_STRING',newLine)  %# Test for a match
    values = sscanf(newLine,'I_NEED_THIS_STRING = %f %f %f');  %# Read values
    break                                    %# Exit the loop
  end
  newLine = fgets(fid);                      %# Get the next line
end
fclose(fid);                                 %# Close the file


Q: Remove comment and edit karma walls for an individuals own question I asked an anonymous question under a fake account recently (it contained semi-identifiable life-situations so I didn't also want to put my name on it as well)
I realized in doing this -- new users cannot comment or edit their own questions! I know SE has undergone some majors changes in an effort to be more welcoming to new users, and I understand the impetus for not letting users comment or edit questions that aren't their own for a little while, but not being able to comment on or edit their own questions is a problematic loophole where they can't provide any extra information or modify a bad question even at the bequest of other commenters.

A: As stated in the comments, you can usually comment on your own posts and the answers to your questions, even if you're unregistered (or low reputation).
In your case, there was a bit of a snafu with the account creation process, which lead to a second account being created, which is why you couldn't comment on your post... it technically wasn't yours!
The two accounts have been merged now so you should be able to comment and edit at your leisure.
Apologies for the bug on our end and do let us know if you have any other issues in the future!


Q: Finding text width in jquery I am trying to to calculate text width in px.
I will take a string from html, this string may contain some special characters as well (in this example just a hyphen), and make this string an html content of a div, and calculate string width.
But I am getting strange results.
If there is an better way to get text width, cross-browser!, please let me know.
I have made a fiddle:
http://jsfiddle.net/YaPcP/39/
Thank you!

A: <div> elements are set to span the width of their parent element, so changing the font size will have no effect on its actual width.  Changing your <div> to a <span> should give you what you're looking for.

A: Add float: left; to #holder
#holder which is the test container for width, is defaulting to width: auto;. In other words, it is spanning 100% of the browser window and giving you the mixed results.
You might consider adding white-space: nowrap; as well to #holder should it ever exceed the width of it's container.
Updated fiddle

A: It may look nasty but gives you the width:
http://jsfiddle.net/adaz/YaPcP/43/


Q: Is there any way to get smart sheet rows based on column value I want to use smart sheet api to read sheet data. my sheet has changedtm column. I want to fetch rows which are greater than certain date. is there any way to do this using smart sheet API

A: You can't do this kind of filtering via the Smartsheet API exactly. One approach would be you could do a GET Sheet request and use the columnIds query string parameter to provide the id number of the specific column you are looking to review. Then you would get back a response that only contained data for that specific column. The filtering based on the date values would then have to be done by you in your code.
If you will need other data in the rows I would then just do the GET Sheet request to get all of the data in the sheet and do the filtering of the response in your code.


Q: How does node.js handle simultaneous http requests? I am learning node.js, and I am not managing to find a direct  answer to this question. How does node.js deal with HTTP incoming requests, if they come in virtually at the same time? Let's say that one HTTP request comes in at a given time. As a result, the value of a global variable might change. However, at virtually the same time, another request comes in. In order to service the new request, the value of that one global variable is needed, but the code for the first request is still executing. How does node react to this?

A: Node.js processes the request one after the other. There is only one thread.
However, if you for example query the database for some information and pass a callback, while the query is executed, node.js can process new requests. Once the database query is completed, node.js calls the callback and finishes processing the first request.
EDIT:
Simple server example:
var http = require('http');
var numresponses = 0;
http.createServer(function (request, response) {
     res.writeHead(200, {'Content-Type': 'text/plain'});
     res.end('This is response #' + (++numresponses));
}).listen(80);

this server will always print out the number of the request even if two requests happen simultaneously, node will choose one that gets processed first, and both will have different numbers.


Q: What is the linear functional associated with the dense subspace of polynomials in $\mathcal{C}[a,b]$? According to the Wierstrauss Approximation Theorem, the set of polynomials on an interval $[a,b]$ are a dense linear subspace in $\mathcal{C}[a,b]$, the set of continuous functions with the sup norm. I am learning functional analysis. I believe this means that there must be some discontinuous linear function $L:\mathcal{C}[a,b]\to \mathbb{R}$ such that the set of polynomials equals the set $ \{x \vert L(x) = \alpha\}$ for some $\alpha \in \mathbb{R}$.
Just to get a better grip on these concepts, I'd like to know what that discontinuous linear functional $L$ "is". Is it possible to describe it in some intuitive way?


Q: Windows 10 can’t boot after latest fall creators update 1709. USB safe mode not working I updated my hp envy running windows 10 professional this morning to the fall creators update 1709. After successful update and restart I tried logging into my profile but the screen just goes black and returns to the locked screen.
I then tried booting into safe mode to uninstall the update using the shift+restart combination many times to no avail. I then created a usb recovery disk with a friends computer and am trying to log in to safe mode from there. With no boot options I am forced to try to use the command line to activate safe mode but the
bcdedit /set {default} safeboot minimal
doesn't work with the error:
The boot configuration data store could not be opened. The requested system device cannot be found.
I have also used diskpart to check if my partitions are available but even though it shows that my recovery partition still exists safe mode and the recovery options are not working when i use the normal shift+restart combination.
I also ran commands like bootrec /fixmbr, bootrec /rebuildBCD, and bootsect /nt60 E:. These worked fine, but every time I try to run bootrec /fixboot, I get an error saying the volume does not contain a recognized file system. Currently i am running chkdsk E: /r to see if there are any errors with my drive even though i strongly doubt it.
I'm just trying to remove the latest windows update through safemode, but I can't get to safe mode for some reason. I also tried rolling the update back and going to a restore point through the recovery USB, but those methods didn't work either.


Q: Continuity of product in Banach Algebras EDIT: The definition literally says that the product is bilinear, as Chris Eagle kindly pointed out. Turns out that my original proof was fine. This question does no longer require an answer and therefore can be closed (if that's appropriate). Thank you.
In the book "Functional Analysis", by Bühler and Salamon, there is the following definition of a Real Banach Algebra:

A real Banach Algebra is a pair consisting of a real Banach space $(\mathcal{A},\|\cdot \|)$ and a bilinear map $\mathcal{A}\times \mathcal{A}\to \mathcal{A}:(a,b)\mapsto ab$ (called the product) that is associative, i.e.$$(ab)c=a(bc)\qquad \forall a,b,c\in \mathcal{A}$$and satisfies the inequality$$\|ab\|\leq \|a\|\|b\|\qquad \forall a,b\in \mathcal{A}.$$

I know that the property $\|ab\|\leq \|a\|\|b\|$ for all $a,b\in \mathcal{A}$ is also called continuity of product, so I wanted to prove that this in fact implies that for a fixed $b$, the map $\mathcal{A}\to \mathcal{A}:a\mapsto ab$ is continuous. If the multiplication by a fixed number were linear, then I could set a sequence $(a_n)$ converging to $a$ and use that$$0\leq \|a_nb-ab\|=\|(a_n-a)b\|\leq \|a_n-a\|\|b\|\xrightarrow{n\to \infty}0$$to obtain that $a_nb\xrightarrow{n\to \infty}ab$, and therefore the product would indeed be continous.
However, whitout the linearity of the product I can only go as far as$$0\leq \|a_nb-ab\|\leq \|a_nb\|+\|ab\|\leq \|a_n\|\|b\|+\|a\|\|b\|=(\|a_n\|+\|a\|)\|b\|$$but this doesn't imply that $\|a_nb-ab\|\xrightarrow{n\to \infty}0$. Is there another way of proving that the product is continuous?

A: The continuity of the product can be  proved exactly the same way as for the real or complex numbers, by recording $|\cdot |$ with $\|\cdot \|.$ Namely $$ a_nb_n-ab =(a_n-a)(b_n-b) +a(b_n-b)+(a_n-a)b$$ Hence
$$\displaylines{\|a_nb_n-ab\|\le \|a_n-a\|\,\|b_n-a\|\\ +\|a\|\,\|b_n-b\|+\|b\|\,\|a_n-a\|}$$


Q: Como cambiar el prefijo ID Signing Certificate de mi proyecto iOS Actualmente tengo varios certificados de varias cuentas de desarrollo en mi puesto de trabajo. Tengo un proyecto que en modo desarrollo y produccion tiene un prefijo ID ( Ejemplo: ABCDEFGHIJ ) y necesito cambiarlo por otro prefijo de equipo de desarrollo ( team ID ) ( Ejemplo: ZWXERTYYHL )
He entrado a la aplicacion 'llaves' pero no aparece o no se ver donde este certificado.


Q: LSL Wrapper for pygame Newbie to Python and gaming. Is there an LSL (lab streaming layer) wrapper for pygame? I want to create a game using EEG signals to create a brain computer interface application. Any help will be deeply appreciated. thanks! :)

A: There is a LSL module for Python called pylsl. You should be able to incorporate this into your game loop.
The following code was adapted from this example:
from pylsl import StreamInlet, resolve_stream
import pygame

# first resolve an EEG stream on the lab network
streams = resolve_stream('type', 'EEG')

# create a new inlet to read from the stream
inlet = StreamInlet(streams[0])

# Pygame setup
pygame.init()
size = width, height = 320, 240

screen = pygame.display.set_mode(size)

samples = []
while True:
    # get a new sample (you can also omit the timestamp part if you're not
    # interested in it)

    # Get a sample from the inlet stream
    sample, timestamp = inlet.pull_sample()
    samples.push(sample)

    #TODO: interpolate streamed samples and update game objects accordingly.
    # You'll probably need to keep a few samples to interpolate this data.

    #TODO: draw game
    ...
    pygame.display.flip()

A: Adding another possibility: engineers from the Foundation Campus Biotech Geneva have created a library using LSL for an online paradigm using EEG, called NeuroDecode.
It relies on pylsl and offers a higher-level implementation.
On my fork version, I dropped the (old) decoding functionalities in favor of improvements to the low-level functionalities, e.g. signal acquisition/visualization.
https://github.com/mscheltienne/NeuroDecode


Q: com.google.cloud.datastore.DatastoreException: Unauthenticated. objectify java I have set up objectify v6 and when I try to save an entity I get this exception

com.google.cloud.datastore.DatastoreException: Unauthenticated.
Caused by:
  com.google.datastore.v1.client.DatastoreException: Unauthenticated., code=UNAUTHENTICATED

NOTE: I am only trying to save this entity on localhost.
Here is my code to save entity using objectify:
        Subscriber subscriber = new Subscriber(phone);
        ofy().save().entity(subscriber).now();


Q: make distance between acronym and description i have a problem with my glossaries format. Is it possible to make a distance (hspace) between the acronym or symbol and their description?
now, it is something like that:
Bsp. Beispiel
Another question: Why I can only define acronyms oder symbols for \begin{document}?
\documentclass[12pt,a4paper,DIV=calc]{scrartcl}
\usepackage[T1]{fontenc}            % Aktiviert EC-Schriftarten
\usepackage[utf8]{inputenc}         % Dateikodierung
\usepackage[ngerman]{babel}         % Deutsche Einstellung
\usepackage{lmodern}                % Latin Modern
\usepackage{url}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{siunitx}                % SI-Einheiten

%% Abkürzungs- und Symbolverrzeichnis
\usepackage[
automake,
nonumberlist,       % keine Seitenzahlen anzeigen
acronym,            % ein Abkürzungsverzeichnis erstellen
toc,                % Einträge im Inhaltsverzeichnis
section]            % im Inhaltsverzeichnis auf section-Ebene erscheinen
{glossaries}
\newglossary[slg]{acronyms}{sym}{sbl}{Abkürzungsverzeichnis}        % Abkürzungsverzeichnis anlegen
\newglossary[slg]{symbols}{sym}{sbl}{Symbolverzeichnis}             % Symbolverzeichnis anlegen
\renewcommand*{\glspostdescription}{}       % Den Punkt am Ende jeder Beschreibung deaktivieren
\makeglossaries                             % Glossar-Befehle einschalten
%% Einträge siehe Ende der Präambel %%

%% Abkürzungsverzeichnis-Einträge mit \newacronym

% Allgemeine Abkürzungen
\newacronym{Bsp}{Bsp.}{Beispiel}
\newacronym{bspw}{bspw.}{beispielsweise}
\newacronym{bzg}{bzg.}{bezüglich}
\newacronym{bzw}{bzw.}{beziehungsweise}

\newacronym{ca}{ca.}{circa}

\newacronym{dh}{d.h.}{das heißt}

\newacronym{etc}{etc.}{et cetera}
\newacronym{evtl}{evtl.}{eventuell}

\newacronym{max}{max.}{maximal}
\newacronym{min}{min.}{minimal}

\newacronym{oÄ}{o.Ä.}{oder Ähnliches}
\newacronym{og}{o.g.}{oben genannt}

\newacronym{s}{s.}{siehe}
\newacronym{S}{S.}{Seite}

\newacronym{ua}{u.a.}{unter anderem}
\newacronym{usw}{usw.}{und so weiter}
\newacronym{uvm}{uvm.}{und vieles mehr}

\newacronym{vgl}{vgl.}{vergleiche}

\newacronym{zT}{z.T.}{zum Teil}
\newacronym{zzt}{zzt.}{zurzeit}
\newacronym{zzgl}{zzgl.}{zuzüglich}

% Spezielle Abkürzungen
\newacronym{pvc}{PVC}{Polyvinylchlorid}
\newacronym{test}{Test}{Dies ist ein test um die länge auszuprobieren}

%% Symbolverzeichnis-Einträge mit \newglossaryentry

\newglossaryentry{ohm}{type=symbols, name={\ensuremath{\Omega}}, %
    sort=Ohm, symbol={\ensuremath{\Omega}}, %
    description={unit of electrical resistance}}

\newglossaryentry{varphi}{type=symbols,name={$\varphi$},description={Phasenverschiebungswinkel}}

%%%%%%%%%%%%%%%%% Dokument-Beginn %%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\printglossary[type=\acronymtype,title=Abkürzungsverzeichnis]
\newpage
\printglossary[type=symbols]
\newpage
Test \gls{Bsp} and \gls{varphi}

\end{document}

A: The acronym list printed with a description list. You can adapt it e.g. with enumitem:
\documentclass[12pt,a4paper,DIV=calc]{scrartcl}
\usepackage[T1]{fontenc}            % Aktiviert EC-Schriftarten
\usepackage[utf8]{inputenc}         % Dateikodierung
\usepackage[ngerman]{babel}         % Deutsche Einstellung

\usepackage[
automake,
nonumberlist,       % keine Seitenzahlen anzeigen
acronym,            % ein Abkürzungsverzeichnis erstellen
toc,                % Einträge im Inhaltsverzeichnis
section]            % im Inhaltsverzeichnis auf section-Ebene erscheinen
{glossaries}

\newglossary[slg]{acronyms}{sym}{sbl}{Abkürzungsverzeichnis}        % Abkürzungsverzeichnis anlegen
\renewcommand*{\glspostdescription}{}       % Den Punkt am Ende jeder Beschreibung deaktivieren
\makeglossaries                             % Glossar-Befehle einschalten

\newacronym{Bsp}{Bsp.}{Beispiel}

\usepackage{enumitem}
\newglossarystyle{listspaced}{%
  \setglossarystyle{list}
  \renewenvironment{theglossary}%
    {\begin{description}[leftmargin=3cm,labelsep=!]}{\end{description}}}

\begin{document}

Test \gls{Bsp}
\printglossary[type=\acronymtype,title=Abkürzungsverzeichnis,style=listspaced]

\end{document}


Q: SQLPLus Decode if value is not null I have a sqlplus script and if a variable is not null then I want to execute a script and pass the value. If it is null then I want to execute a different script. I have the following:
col scr new_value script
set term off
select decode('&partitions', 'true', 'CreateTablesPartitions', 'CreateTables') scr from   dual;
set term on
@@&script &partitions

Which checks if the variable partitions is true then execute CreateTablePartitions. How do I check if the variable partitions is null?

A: just add null and the value to decode to in your decode string.
select decode('&partitions', 'true', 'CreateTablesPartitions',
              null, 'itsnull', 'CreateTables') scr
from   dual;

so if its null, then the result will be itsnull

A: You can just include null as a recognised value in your decode:
col scr new_value script
set term off
set verify off
select decode('&partitions', null, 'CreateTables',
    'CreateTablesPartitions') as scr from dual;
set term on
@@&script &partitions

... which will run CreateTables if the entered partitions value is null.
But, because you have termout off, you won't see the prompt for the value. You might want to use positional variables (&1 etc.) depending on how you're intending to call this, but assuming you do want to be prompted at run-time, you can either leave termout on and add noprint to the column command (col scr new_value script noprint), which will give some blank lines in the output; or set partitions earlier. You can't use define though because that won't like a null value.
The cleanest approach may be to use accept with its own prompt:
accept partitions prompt "Enter partitions: "

col scr new_value script noprint
set verify off
set term off
select decode('&partitions', null, 'CreateTables',
    'CreateTablesPartitions') as scr from dual;
set term on
@@&script &partitions

With simple dummy scripts to call, e.g. CreateTables.sql:
prompt In CreateTables

... and CreateTablesPartitions:
prompt In CreateTablesPartitions with passed value "&1"

... this gives:
Enter partitions:
In CreateTables

... and:
Enter partitions: Test
In CreateTablesPartitions with passed value "Test"


Q: Eliminate zeroed values in an array with dataweave function In this array of a list of devices, you would need to delete from the array when any item was zeroed out

[
    {
        "valueTotal": "6.50"
    },
    {
        "bread": "001",
        "value": "3.00"
    },
    {
        "milk": "002",
        "value": "3.50"
    },
    {
        "coffe": "003",
        "value": "0.00"
    }
]

A: Assuming you intend to remove the items in the input, whose "value" field is 0 and then get the totalValue. Here is a quick one I have come up with(could be improved).
%dw 2.0
output application/json

//filter the items whose value is zero
var filteredPayload= ((payload [-1 to 1] map (item1, index1) ->
{
      (if (item1.value as Number != 0)  (item1) else null)
}) filter  ($ != {}))

// get the totalValue from the filteredPayload
var totalFilteredPayload = filteredPayload reduce ($.value + $$.value)

---
// simply add both the arrays
filteredPayload ++ [{  "valueTotal": totalFilteredPayload as String }]

A: If by "zeroed out" you mean value = 0 it is just a basic filter operation
payload filter ($.valueTotal? or ($.value as Number != 0))

The condition $.valueTotal? is to make the object with valueTotal pass the check. And the other one is for the value itself.


Q: What's new in SharePoint 2016 online I have found a few documents about new features in SharePoint 2016 on premise, but I can't find anything about SharePoint 2016 online version. Especially I am interested in BI part. Do you know any resources about this or about do you know Microsoft plans according SharPoint online new release?

A: As Wjervis mention, features that are new in SharePoint 2016 On premise has been and are being deployed and you might be using them right now.
However, Microsoft pushes out new features to servers, not tenants so there is no guarantee that you have access to anything new yet. And there is always a chance that features that will make it to on premise won't be available to O365 and the other way around.
The best place for what new features that are being implemented in Office 365 is found on their roadmap.
Office 365 Roadmap


Q: Background Image Quality Android Development help please.
Can somone tell me how I might increase the quality of background images in my app? I have been using Photoshop where the images look great, then I save for the web as a png...then add it to my app... Then on the phone the image looks a little blurred.
Whats the best way to increase my image quality?

A: I would make sure you're saving it at an adequate resolution. I'm will to bet that "save for web" reduces the resolution to 72 dpi which may not be enough for an android handset.  In photoshop, try bumping the resolution of the final png to something like 300 dpi and see if that makes a difference.  From there you can experiment with different resolutions to figure out what's the smallest value you can use and still have a crisp image.  Alternatively, you could just look for the documented resolution requirements.

A: The apparent quality of your images may also depend in the type of device you are displaying the images on.  For example, if your image is saved as 72px x 72px in your image editor, then displayed with a size defined using 72 scaled pixels (sp) in android on a high pixel-density device, then the OS will stretch the image before display.  As such, the pixel density of the display device can affect the apparent image quality.
You can provide different resolution images for different pixel densities by using the hdpi, mdpi and ldpi folders for drawables.  See these links for more info:

*

*Screens support

*Icon design


Q: actualizar node js a versión 14 con npm para utilizar npx create-react-app Estoy tratando de crear un app de react utilizando el comando (npx create-react-app) y me dice que debo actualizar node js, pero las version 16 de node no se adapta a mi windows 7.
quiera saber si con npm existe un comando para actualizarlo a la version que yo quiero que es la 14


Q: Cast arraylist in recyclerview firebase I have an array of data which I am retrieving from firebase. I am using a recyclerview to display the data but my adapter is not working correctly.I tried adding the arraylist in the adapter but this is not working.
It is saying the adapter is not attached and I am having a blank activity.
Any help on this ?
Here are my details.
Modal Class
public class Order {
    private String ProductId;
    private String ProductName;
    private String Quantity;

    public Order() {
    }

    public String getProductId() {
        return ProductId;
    }

    public void setProductId(String productId) {
        ProductId = productId;
    }

    public String getProductName() {
        return ProductName;
    }

    public void setProductName(String productName) {
        ProductName = productName;
    }

    public String getQuantity() {
        return Quantity;
    }

    public void setQuantity(String quantity) {
        Quantity = quantity;
    }

    public Order(String productId, String productName, String quantity) {
        ProductId = productId;
        ProductName = productName;
        Quantity = quantity;
    }

}

Adapter
public class AllOrdersAdapter extends RecyclerView.Adapter<AllOrdersViewHolder> {

    List<Order> myfoods;

    public AllOrdersAdapter(List<Order> myfoods) {
        this.myfoods = myfoods;
    }

    @NonNull
    @Override
    public AllOrdersViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View itemView = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.allorders_layout,parent,false);
        return new AllOrdersViewHolder(itemView);
    }

    @Override
    public void onBindViewHolder(@NonNull AllOrdersViewHolder holder, int position) {
        holder.foodname.setText(myfoods.get(position).getProductName());
        holder.foodquantity.setText(myfoods.get(position).getQuantity());
        holder.foodId.setText(myfoods.get(position).getProductId());
    }

    @Override
    public int getItemCount() {
        return myfoods.size();
    }

}

Test Class
public class Test extends AppCompatActivity {

    FirebaseDatabase db;
    DatabaseReference requests;
    RecyclerView lstFoods;
    RecyclerView.LayoutManager layoutManager;
    TextView food_id,food_quan,food_name;
//    List foods = new ArrayList<>();
//    RecyclerView.Adapter<AllOrder> adapter;
//    List<String> myOrders = new ArrayList<String>();

//    ArrayList<String> foods=new ArrayList<>();
    List<String> myfoods = new ArrayList<String>();
    AllOrdersAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test);
        //firebase
        db = FirebaseDatabase.getInstance();
        requests= db.getReference().child("Requests");

        lstFoods = (RecyclerView)findViewById(R.id.lstAllFoods);
        lstFoods.setHasFixedSize(true);
        layoutManager = new LinearLayoutManager(this);
        lstFoods.setLayoutManager(layoutManager);

        loadOrderss();

    }
    private void loadOrderss() {

        requests.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {
                    if (postSnapshot.getValue() != null) {
//                        List ingredients = new ArrayList<>();
                        for (DataSnapshot ing : postSnapshot.child("foods").getChildren()) {
//                            String data = String.valueOf(postSnapshot.getValue(Order.class));
                            myfoods.add(ing.child("quantity").getValue(String.class));
                            myfoods.add(ing.child("productName").getValue(String.class));
                            myfoods.add(ing.child("productId").getValue(String.class));
//                            myfoods.add(String.valueOf(Order.class));
                            System.out.println("Gained data: " + ing.child("productName").getValue(String.class));

                        }

                    }
                }
                adapter = new AllOrdersAdapter((ArrayList<String>) myfoods);
                lstFoods.setAdapter(adapter);
               adapter.notifyDataSetChanged();
            }

            @Override
            public void onCancelled(@NonNull DatabaseError databaseError) {

            }
        });
            }

A: There seems to be a couple things wrong with the code. As it is posted I would be surprised if it compiles.
In your Adapter you have:
List<Order> myfoods;

and
public AllOrdersAdapter(List<Order> myfoods) {
    this.myfoods = myfoods;
}

but in your activity code you pass:
adapter = new AllOrdersAdapter((ArrayList<String>) myfoods);

one is a ArrayList of String the other of Order !
You also need to change your adapter class to something like:
public class AllOrdersAdapter extends RecyclerView.Adapter<AllOrdersAdapter.AllOrdersViewHolder> {
    private static final String TAG = AllOrdersAdapter.class.getSimpleName();

    private ArrayList<Order> mData;

    public class AllOrdersViewHolder extends RecyclerView.ViewHolder {
        public TextView mTvFoodname;
        public TextView mTvFoodQuantity;
        public TextView mTvFoodId;

        public AllOrdersViewHolder(View v){
            super(v);
            // TODO:  You need to assign the appropriate View Id's instead of the placeholders ????
            mTvFoodQuantity = v.findViewById(R.id.????);
            mTvFoodname = v.findViewById(R.id.????);
            mTvFoodId = v.findViewById(R.id.????);
        }
    }

    public AllOrdersAdapter(ArrayList<Order> data){
        this.mData = data;
    }

    @Override
    public AllOrdersViewHolder onCreateViewHolder(ViewGroup parent, int viewType){
        View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.business_list_card_view, parent, false);
        return new AllOrdersViewHolder(itemView);
    }

    @Override
    public void onBindViewHolder(final AllOrdersViewHolder holder, final int position){
        //TODO: You need to decide whether you want to pass a string or order object
        Order data = mData.get(position);

        final String name = data.getProductName();
        final String quantity = data.getQuantity();
        final String id = data.getProductId();

        holder.mTvFoodname.setText(name);
        holder.mTvFoodQuantity.setText(quantity );
        holder.mTvFoodId.setText(id)
    }

    @Override
    public int getItemCount(){
        return mData.size();
    }
}

Note: That since I can not know, whether an ArrayList of String or of Order should be used the parameters in either the Activity or Adapter will need to be changed. Also how you assign the data to the RecyclerView will be affected in the onBindViewHolder method.
You should also follow the advice given by Frank.

EDIT
Change your onDataChange() method to this:
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
    for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {
        if (postSnapshot.getValue() != null) {
            List ingredients = new ArrayList<>();
            for (DataSnapshot ing : postSnapshot.child("foods").getChildren()) {
                String name = ing.child("productName").getValue(String.class);
                String quantity = ing.child("quantity").getValue(String.class);
                String productId = ing.child("productId").getValue(String.class);
                // Using your overloaded class constructor to populate the Order data
                Order order = new Order(productId, name, quantity);

                // here we are adding the order to the ArrayList
                myfoods.add(order);
                Log.e(TAG, "Gained data: " + name)
            }
        }
    }
    adapter.notifyDataSetChanged();
}

In your Activity you will need to change the ArrayList class variable "myfoods" to this:
ArrayList(Order) myfoods = new ArrayList<>();
and in your onCreate() method you can now change:
adapter = new AllOrdersAdapter((ArrayList<String>) myfoods);

to simply this:
adapter = new AllOrdersAdapter(myfoods);

Also notice that I have made some changes in my original code above.

A: You'll want to create the adapter, and attach it to the view, straight in onCreate:
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_test);
    //firebase
    db = FirebaseDatabase.getInstance();
    requests= db.getReference().child("Requests");

    lstFoods = (RecyclerView)findViewById(R.id.lstAllFoods);
    lstFoods.setHasFixedSize(true);
    layoutManager = new LinearLayoutManager(this);
    lstFoods.setLayoutManager(layoutManager);

    adapter = new AllOrdersAdapter((ArrayList<String>) myfoods);
    lstFoods.setAdapter(adapter);

    loadOrders();
}

This also means you should declare myfoods as a ArrayList<String>, which saves you from having to downcast it. Something like:
ArrayList<String> myfoods = new ArrayList<String>();

Now in loadOrders you simple add the items to the list, and then notify the adapter that its data has changed (so that it repaints the view):
private void loadOrders() {
    requests.child("foods").addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
            for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {
                for (DataSnapshot ing: postSnapshot.getChildren()) {
                    myfoods.add(ing.child("quantity").getValue(String.class));
                    myfoods.add(ing.child("productName").getValue(String.class));
                    myfoods.add(ing.child("productId").getValue(String.class));
                }
            }
           adapter.notifyDataSetChanged();
        }

        @Override
        public void onCancelled(@NonNull DatabaseError databaseError) {
            throw databaseError.toException(); // don't ignore errors
        }
    });
  }


Q: How to set the default icon for apps in registry using Exe? I created the installer using NSIS. Everything working fine but default
    icon not setting to the particular files.
   WriteRegStr HKCR "Myapp\DefaultIcon" "" "$INSTDIR\Myexe,1"

I need to set default icon by using my Exe not by using icon file

A: You need to provide the full path. If you want the first icon in your .exe then you don't need a icon index:
RequestExecutionLevel Admin

Section
WriteRegStr HKCR ".foo" "" "foofile" ; .foo file extension
WriteRegStr HKCR "foofile\DefaultIcon" "" "$INSTDIR\MyApp.exe"
SectionEnd

Other icons need a icon index:
WriteRegStr HKCR "MyProgId\DefaultIcon" "" "$INSTDIR\MyApp.exe,1"


Q: How to exclude a Java Object Property as part of JSON String? I have a Java POJO. Few properties are there along with a list<>. While converting this object to JSON String, I want to exclude the list property,
So what annotation to use for that?
public class StudentResultSummary {
    private String totMarks;
    private String avgMarks;
    private List<StudentResult> resultList = new ArrayList<StudentResult>();
}

Convert to JSON:
StudentResultSummary resultSummary = new StudentResultSummary();
Json json = new Json();
policySummary = json.encode(resultSummary);

How can I make sure the field resultList is not included as part of the JSON response?

A: From Chris Seline's answer:

Any fields you don't want serialized in general you should use the
  "transient" modifier, and this also applies to json serializers (at
  least it does to a few that I have used, including gson).
If you don't want name to show up in the serialized json give it a
  transient keyword, eg:
private transient String name;

A: If You don't want to that column in response json you can use @JsonIgnore
and if you don't want to that field in table you should use @Transient
 @Transient
    private String password_key_type;

    @JsonIgnore
    public int getUser_id()
    {
    return user_id;
    }


Q: Converting spectral data for given Observer/Illuminant to another Observer/Illuminant I'm working on a simple Measuring Software for HunterLab (Color) instruments (EZ line) (screenshot here) and I hope someone can help out here.
They deliver spectral data from 400nm...700nm by 10nm using a D65 light source and 10° Observer.
I have the observer functions for ASTM D65 which work great and I can reproduce any value from the instrument 1:1, as long as i measure in D65, 10° (converting to XYZ and then CIELab using tristimulus references for perfect reflecting diffuser).
That was done mostly using algorithms from brucelindbloom.com and easyrgb.com, both have some great information!
Now I want to add the ability to convert the spectral data to another observer or another illuminant (or both). But I cant wrap my head around how to do that.
I guess some directions would be enough but I dont know if I would need even more references for that (references for illuminants by wavelength?) or if its done by some other means.

A: OK, here is the answer :)
Spectral data from most spectrophotometers is already corrected in so far that the hardware illuminant and angle dont matter.
What you do is just use the observer functions for every single angle/illuminant, as written in ASTM E308, to convert the spectral data to XYZ instead of only using the table which corresponds to the hardware illuminant/angle.
Thats a lot of reference values but it works perfect.


Q: PageMethods and UpdatePanel I have a page hierarchy as the following

I want to execute a PageMethod if I click the 'SAVE' button, so I coded like the following
On Button Click I called
OnClientClick="return btnSaveAS_Clicked()"

Called the following on PageLoad of the inner user control
private void RegisterJavaScript()
{
    StringBuilder jScript = new StringBuilder();
    jScript.Append("<script type='text/javascript'>");
    jScript.Append(@"function btnSaveAS_Clicked() {
        var txtConditionName = document.getElementById('" + txtConditionName.ClientID + @"').value;
        PageMethods.Combine('hello','world', OnSuccess);
        function onSuccess(result)
        {
            alert(result);
        }
    }");
    jScript.Append("</script>");

    Page.ClientScript.RegisterStartupScript(this.GetType(), "conditions_key", jScript.ToString());
}

Coded page method as
[WebMethod]
public static string Combine(string s1, string s2) {
  return s1 + "," + s2;
}

But it gives the following error...

A: You cannot define page methods in ascx pages. You have to define them in your web form. If you want to have a page method, defined in your user control, you'd have to define a forwarding page method in you aspx page like below (source):
in user control:
[WebMethod]
[ScriptMethod(UseHttpGet = true)]
public static string MyUserControlPageMethod()
{
    return "Hello from MyUserControlPageMethod";
}

in aspx.cs page:
[WebMethod]
[ScriptMethod]
public static string ForwardingToUserControlMethod()
{
    return WebUserControl.MyUserControlMethod();
}

and in aspx page:
 function CallUserControlPageMethod()
 {
     PageMethods.ForwardingToUserControlPageMethod(callbackFunction);
 }

Alternatively, you could use ASMX services and jquery ajax methods (jQuery.ajax, jQuery.get, jQuery.post) to call your methods asynchronously (sample).
Another option would be defining http handlers and call them via jQuery as well (tutorial).


Q: Checking Polynomial Reducibility The book I am reading provides the following example to show how irreducibility works:

Let $f(x) = \frac{3}{7}x^4- \frac{2}{7}x^2+\frac{9}{35}x+\frac{3}{5}$. We will show that $f(x)$ is irreducible over $\mathbb{Q}$. First, let $h(x) = 35f(x) = 15x^4-10x^2+9x+21$. Then $f(x)$ is irreducible over $\mathbb{Q}$ if $h(x)$ is irreducible over $\mathbb{Z}$. Next, applying the Mod 2 Irreducibility Test to $h(x)$, we get $\bar{h}(x)=x^4 + x + 1$. Clearly, $\bar{h}(x)$ has no zeros in $\mathbb{Z}_2$. Furthermore, $\bar{h}(x)$ has no quadratic factor in $\mathbb{Z}_2[x]$ either. [~an argument here about why this is true~] Thus, $\bar{h}(x)$ is irreducible over $\mathbb{Z}_2[x]$. This guarantees that $h(x)$ is irreducible over $\mathbb{Q}$.

My question: Why is it obvious that I don't need to check degree $3$ polynomials on $\bar{h}$?
They skip mentioning this, and the only thing I could think was to divide $\bar{h}$ by all $8$ degree $3$ polynomials and check.
Edit:
I think if I check degree $1$'s, I get degree $3$'s for free. But I don't know how to show this to myself.

A: We do not need to check for degree three factors, since then the other factor would be linear, i.e., we would have a root, which we obviously do not have: $0^4+0+1=1$ and $1^4+1+1=1$. Indeed, having a cubic factor means that $x^4+x+1=(x^3+ax^2+bx+c)(x+d)$ for some $a,b,c,d\in \mathbb{F}_2$.


Q: In Google BigQuery, how to get storage size of a partition in time-partitioned table? I can query for storage size of a table in BigQuery using SELECT size_bytes FROM dataset.__TABLES__ WHERE table_id='mytable', but this only works for finding total size of table. How to get size of a specific partition from a time-partitioned table, for example I want to find out how much data is stored in mytable$20180701.
I know I can for example copy that partition to a non-partitioned table and use the method above, but I feel this can't be the right method.

A: You can use dryRun for this - or in UI just type SELECT * FROM mytable$20180701 and see in Validator how much bytes will be processed - this is the size of the table


Q: cv has no member CAP_PROP_POS_FRAMES I'm trying to run a bit of code to add trackbars onto some video, it's from the Learning OpenCV Second Edition book, but I can't compile my code and gives the error "namespace cv has no member CAP_PROP_POS_FRAMES"
Here's the first bit of the code
#include <opencv2\highgui\highgui.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <iostream>
#include <fstream>

using namespace std;

int g_slider_position = 0;
int g_run = 1, g_dontset = 0; //start out in a single step mode
cv::VideoCapture g_cap;

void onTrackbarSlide(int pos, void *) {
    g_cap.set(cv::CAP_PROP_POS_FRAMES, pos);
    if(!g_dontset)
        g_run = 1;
    g_dontset = 0;
}

A: It's CV_CAP_PROP_POS_FRAMES (note the S) and it should be brought in by highgui.hpp.  It's an unnamed enum in the global namespace.


Q: Is it possible to sync an azure repo with MWAA (Amazon Workflows for Apache Airflow)? I have set up a private MWAA instance in AWS. It has set up a bucket that stores DAGs in S3.
I've created a private repository in Azure DevOps and have set up a role that can access this bucket.
With Azure-Pipelines is it possible to sync the entire repository to control the DAGs created/modified in that S3 bucket?
I've seen it's possible to create artefacts and push them to the S3 bucket, but what if a dag is deleted? The DAG will still persist in the S3 Bucket and will still be available in MWAA.
Any guidance will be appreciated.

A: If you just want to sync entire repository to S3 bucket,you can use the task Amazon S3 Upload in your azure pipeline.

I'm not sure if that will fully address your problem, though.
If there is any misunderstanding, please feel free to add comments related to your issue.


Q: Windows 7(or XP)'s Network Security Tab Missing I am setting a local network of windows xp and windows 7 machines, together with a NAS (Synology Diskstation DS209). And then i set up those windows machines so that the users can access the fileserver as a network drive from their "My Computer". And the weird thing is that, when i view the File Properties of any file in the NAS, the Security Tab is missing. However, when i view the local hard drive's File Properties, the Security Tab is right there!
I found some tutorial saying that, in Win XP, i can simply disable simple file sharing to restore the missing Security Tab, but this method failed. And in Windows 7, i tried to access the Local Group Policy Editor but i'm unable to make any change there.
I wonder if it is my NAS(diskstation)'s problem or Windows's problem.


Q: Xcode skips if else statement my if else statement checks whether some text fields are empty and if so pops an alert. However xcode even if going through everything, moves on to other functions.
There is an if statement which checks the value of a segmented control and accordingly checks some text fields.
@IBAction func calc(_ sender: Any) {

    // Check if dilution text field is empty
    let dilutiontext = self.dilution.text
    if (dilutiontext?.isEmpty ?? true) {
        Alert.showAlert(on: self, with: "Empty Fields", message: "Dilution field is empty")
    }
    if choose.selectedSegmentIndex == 0 {

        if (self.number1.text?.isEmpty) ?? true || self.number2.text?.isEmpty ?? true || self.number3.text?.isEmpty ?? true || self.number4.text?.isEmpty ?? true {
            Alert.showAlert(on: self, with: "Empty Fields", message: "Number 1-4 fields should not be empty")
        } else {
            performSegue(withIdentifier: "turner", sender: self)
        }
    } else {
        if (self.number1.text?.isEmpty) ?? true || self.number2.text?.isEmpty ?? true || self.number3.text?.isEmpty ?? true || self.number4.text?.isEmpty ?? true || self.number5.text?.isEmpty ?? true || self.number6.text?.isEmpty ?? true || self.number7.text?.isEmpty ?? true || self.number8.text?.isEmpty ?? true {
            Alert.showAlert(on: self, with: "Empty Fields", message: "Number 1-8 fields should not be empty")
        } else {
            performSegue(withIdentifier: "turner", sender: self)
        }
    }

}

I have another file alert.swift which controls the alerts:
import Foundation
import UIKit

struct Alert {
    public static func showAlert(on vc: UIViewController, with title: String, message: String) {
        let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
        alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
        vc.present(alert, animated: true)
    }
}

EDIT:
Previously self.dilution.text?.isEmpty and now let dilutiontext = self.dilution.text with dilutiontext?isEmpty
I commented out the prepare for segue function and surprisingly the alerts started working. I still need that function and the alerts working though. Here is the function:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {

    var vc = segue.destination as! SecondViewController

    if choose.selectedSegmentIndex == 0 {
        vc.n1 = Int(number1.text!)!
        vc.n2 = Int(number2.text!)!
        vc.n3 = Int(number3.text!)!
        vc.n4 = Int(number4.text!)!
        vc.dil = Int(dilution.text!)!
        vc.cn = Int(choose.selectedSegmentIndex)

    } else {
        vc.n1 = Int(number1.text!)!
        vc.n2 = Int(number2.text!)!
        vc.n3 = Int(number3.text!)!
        vc.n4 = Int(number4.text!)!
        vc.n5 = Int(number5.text!)!
        vc.n6 = Int(number6.text!)!
        vc.n7 = Int(number7.text!)!
        vc.n8 = Int(number8.text!)!
        vc.cn = Int(choose.selectedSegmentIndex)
        vc.dil = Int(dilution.text!)!
    }

}

When I run it, instead of showing the alerts (which check if a text field is empty) it continues to the segue function and displays Unexpectedly found nil while unwrapping an Optional value, which is expected

A: Obviously neither the "if" nor the "else if" condition are true then. Add
let dilutiontext = self.dilution.text
let celltext = self.cell.text

then set a breakpoint and examine the values.

A: Clearly the alerts were skipped if one of the if conditions in the segue function was true. So if there was something that would initially make the statements false and then after going through the alerts it would make them true, the problem would be solved.
Therefore I made two more functions each for the if and if else statements in the segue func.
func option1() -> Bool {
    if (self.number1.text?.isEmpty) ?? true || self.number2.text?.isEmpty ?? true || self.number3.text?.isEmpty ?? true || self.number4.text?.isEmpty ?? true || self.dilution.text?.isEmpty ?? true || !(self.number5.text?.isEmpty ?? true) || !(self.number6.text?.isEmpty ?? true) || !(self.number7.text?.isEmpty ?? true) || !(self.number8.text?.isEmpty ?? true) {
        return false
    } else {
        return true
    }
}

func option2() -> Bool {
    if (self.number1.text?.isEmpty) ?? true || self.number2.text?.isEmpty ?? true || self.number3.text?.isEmpty ?? true || self.number4.text?.isEmpty ?? true || self.number5.text?.isEmpty ?? true || self.number6.text?.isEmpty ?? true || self.number7.text?.isEmpty ?? true || self.number8.text?.isEmpty ?? true || self.dilution.text?.isEmpty ?? true {
        return false
    } else {
        return true
    }
}

which checked if all the conditions were true and if so returned true, so that the program could move on to the segue func.
The segue would check whether the conditions were true, if not, it would go through the alerts-therefore making the option1() or option2() return true- and so the if conditions in the segue func would be true for the program to continue.
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {

    var vc = segue.destination as! SecondViewController

    if option1() == true {
        vc.n1 = Int(number1.text!)!
        vc.n2 = Int(number2.text!)!
        vc.n3 = Int(number3.text!)!
        vc.n4 = Int(number4.text!)!
        vc.dil = Int(dilution.text!)!
        vc.cn = Int(choose.selectedSegmentIndex)

    } else if option2() == true {
        vc.n1 = Int(number1.text!)!
        vc.n2 = Int(number2.text!)!
        vc.n3 = Int(number3.text!)!
        vc.n4 = Int(number4.text!)!
        vc.n5 = Int(number5.text!)!
        vc.n6 = Int(number6.text!)!
        vc.n7 = Int(number7.text!)!
        vc.n8 = Int(number8.text!)!
        vc.cn = Int(choose.selectedSegmentIndex)
        vc.dil = Int(dilution.text!)!
    }

}


Q: Codebehind is not calling through ajax In the below code i have a dropdown in which when i select a value in dropdown it should move to the method in codebehind and perform the operation.In my case it is not moving to the codebehind .My aim is to make dropdown a dependent pls help me to solve the issue.
Code:
<asp:DropDownList ID="cbField" runat="server" onfocus="setFocus()" CausesValidation="true">
             </asp:DropDownList>

Ajax:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
      <script type ="text/javascript">
          $(document).ready(function () {
              $('#<%=cbField.ClientID %>').click(function () {
                  $.ajax({
                     type: "POST",
                     url: "GmasField.ascx/cbField_Dependent",
                      data: "{}",
                      contentType: "application/json; charset=utf-8",
                    dataType: "json",
                     async: true,
                     cache: false,
                     success: function (msg) {
                         $('#myDiv').text(msg.d);
                    }
               })
               return false;
             });
         });
     </script>

A: You didn't mention it but have you added the WebMethodAttribute to the method you have defined on the code behind?
You seem to have a method in the code-behind called cbField_Dependent()
So just add the attribute like the first line below I think.
[WebMethod]
public void cbField_Dependent() {
  //
}

A: Follow this article, this show step by step method to call web method.
http://www.c-sharpcorner.com/UploadFile/63e78b/call-an-Asp-Net-C-Sharp-method-web-method-using-jquery/


Q: Compact metric spaces without continuous surjective functions between them. There exist two compact metric spaces such that doesn't exist a continuous and surjective function between them? That is, two compact metric spaces $X$ and $Y$ such that for every surjective functions $f:X \to Y$ and $g:Y \to X$, $f$ and $g$ aren't continuous.

A: Let $X=\{0\}\cup\left\{\frac1n:n\in\Bbb Z^+\right\}$ and $Y=[0,1]$, both with the usual metric inherited from $\Bbb R$; both are compact metric spaces. There is no surjection at all from $X$ to $Y$, since $X$ is countable and $Y$ is uncountable, and there is no continuous surjection from $Y$ to $X$, since $Y$ is connected, and $X$ is not. (Recall that continuous functions preserve connectedness.)

A: This is not possible. Let $X, Y$ be non-empty, then there exists a constant function from $X$ to $Y$ and one in the reverse direction. Both are continuous, since constant functions are continuous.
If one of them is empty, the functions between $X$ and $Y$ are all continuous (vacuously).


Q: Trouble clearing spinner data android I have a problem with my spinners in my android app. I have two spinners implemented. Both loads contents from json. The first one look as,
    // Code for First spinner
    loc = json.getJSONArray("location");
    for(int i = 0; i < loc.length(); i++){
        JSONObject c = loc.getJSONObject(i);
        //put json obkject on variable
        String l = c.getString("stock_location");
        locationList.add(l);
    // Set Spinner Adapter
    location.setAdapter(new ArrayAdapter<String>OfferedDiesel.this,android.R.layout.simple_spinner_dropdown_item,locationList));
    // Spinner on item click listener
    location.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
    @Override
    public void onItemSelected(AdapterView<?> arg0,View arg1, int position, long arg3) {
        place = locationList.get(position);
        selected = place;
        new LoadProduct().execute();
        product_title.setVisibility(View.VISIBLE);
        product.setVisibility(View.VISIBLE);
    }

    @Override
   public void onNothingSelected(AdapterView<?> arg0) {
         place = null;

   }
   });
   }

//Following is the LoadProduct
private class LoadProduct extends AsyncTask<String, String, JSONObject> {
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            pDialog = new ProgressDialog(OfferedDiesel.this);
            pDialog.setMessage("Loading Product ...");
            pDialog.setIndeterminate(false);
            pDialog.setCancelable(true);
         }
        @Override
        protected JSONObject doInBackground(String... args) {
            UserFunctions userFunction = new UserFunctions();
            JSONObject json = userFunction.getProductFromLocation(selected);
            return json;
        }

        protected void onPostExecute(JSONObject json) {
            if(pDialog.isShowing()){
                pDialog.dismiss();
            }
            // Locate the spinner in activity_main.xml
            /*LOcate site node*/
            try{
                if(json.has("error_msg")){
                    String err = json.getString("error_msg");
                    alert.showAlertDialog(OfferedDiesel.this, "ALert !!", err, null);
                }else{
                    prod = json.getJSONArray("product");

                    for(int i = 0; i < prod.length(); i++){
                        JSONObject d = prod.getJSONObject(i);
                        //put json obkject on variable
                        String k = d.getString("stock_name");
                        productList.add(k);

                        arrayAdapter = new ArrayAdapter<String>(OfferedDiesel.this,android.R.layout.simple_spinner_dropdown_item,productList);
                        // Set Spinner Adapter
                        product.setAdapter(arrayAdapter);
                         // Spinner on item click listener
                        product.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                        @Override
                        public void onItemSelected(AdapterView<?> arg0,View arg1, int position, long arg3) {
                             good = locationList.get(position);

                                  //selected = place;

                                    }

                                    @Override
                                    public void onNothingSelected(AdapterView<?> arg0) {
                                        place = null;

                                    }
                                });
                    }
                }

            }catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

        }

    }/*End of Spinner Populate*/

Here, whenever I am selecting a new item in above spinner it will execute new LoadProduct().execute(); and on my second spinner I am getting the data but the date are appended. I mean for example if by defalt '1' on my first spiner then at second spinner I will get "First" and when I select '2' (change on first spinner) then I will get "Second" it is appended on 'First' and Hence I get 2 items "First" and "Second" instead of just one i.e'Second'. I now need to clear all the spinner list before loading the new. For both spinners I am using json to load data.
Thanks in advance.

A: I'm going to take a few guesses here about what you are trying to do, because I'm not 100% sure I understood... Here's what I think you are trying to do:

*

*There are two ListViews.

*When you click on the first one, it sets up text in the second one to load.

*It does so via an AsyncTask called LoadProduct.

*selected is used in the LoadProduct to determine what to load.

*You aren't getting quite the results you expect.

Okay, so if I'm right here, I would suggest a few changes.

*

*Pass in the selected value to the AsyncTask.

*Clear the previous adapter from it's values.

*Add the new values.

The AsyncTask should be able to take the input, no problem.

A: You just need to clear array list using clear method before adding new data to array,this would defiantly help you


Q: What kind of security risks does nvidia-340 driver have? Quote from https://wiki.debian.org/NvidiaGraphicsDrivers

Use of the 340-series driver is strongly discouraged. It is not
included in stable releases of Debian anymore, has serious unfixable
security vulnerabilities, and may not be updated for new kernels in a
timely manner. You are highly recommended to use the built-in Nouveau
driver if security is a priority.

Quote from https://nvidia.custhelp.com/app/answers/detail/a_id/3142/~/support-timeframes-for-unix-legacy-gpu-releases

The Linux 340.* legacy driver series is the last to support the G8x,
G9x, and GT2xx GPUs, and motherboard chipsets based on them. Support
for X.Org xserver version 1.20 was added to the 340.* legacy driver
series with version 340.107, and support for Linux kernels up to Linux
5.4 was added with version 340.108. No further releases from the 340.* series are planned.

I see that some patched driver is available for newer kernel, though, in Ubuntu at least, possibly by using PPA. What kind of risks there are in continuing to use nvidia-340?

A: See Security Bulletin: NVIDIA GPU display driver contains multiple vulnerabilities in the kernel mode layer handler and Multiple vulnerabilities in NVIDIA GPU Display Driver, things like allowing local unprivileged users access to all memory and escalation of privileges.


Q: Read Word ActiveX radio button into vb.net form I'm working on some code to read values in a Word document into a windows form using vb.net.  The word document is designed so that the data to be read in is all contained within content controls.  Here is a sample of my code:
Private Sub ImportWordButton_Click(sender As Object, e As EventArgs) Handles ImportWordButton.Click
    Dim oWord As Microsoft.Office.Interop.Word.Application
    Dim oDoc As Microsoft.Office.Interop.Word.Document
    Dim oCC As Microsoft.Office.Interop.Word.ContentControl

    oWord = CreateObject("Word.Application")
    oDoc = oWord.Documents.Open("C:\Temp\PIFFormTest2.docx", [ReadOnly]:=False)

    For Each oCC In oDoc.ContentControls
        Select Case oCC.Tag
            Case "PIFNo"
                NumberBox.Text = oCC.Range.Text
            Case "PIFTitle"
                TitleBox.Text = oCC.Range.Text
            Case "Initiator"
                InitiatorBox.Text = oCC.Range.Text
            Case "PTHealthSafety"
                HealthSafeCheckBox.Checked = oCC.Checked
            Case "PTRegEnviro"
                RegEnvCheckBox.Checked = oCC.Checked

... it goes on.  Some of the content in the Word file is captured with ActiveX radio buttons rather than content controls.  I can't seem to find the correct object for referring to the radio buttons. I've spent significant time searching the web.  Any help is appreciated.

A: I'm working on this too, and it's a nightmare.
For Each f As Field In oDoc.Fields    'notice fields not content controls
    Console.WriteLine(f.OLEFormat.Object.Name) 'notice properties, not methods...
Next

Here's the MSDN reference


Q: Entity framework relationship issue 'Unable to determine the principal end...' I am having two classes, like below
Class One
{
  ID (PK),
  Property 2;
}

Class Two
{
  ID (PK),
  One_ID (FK),
  Nullable_One_ID (FK)
}

While saving I am getting error ' Unable to determine the principal end of the 'x' relationship. Multiple added entities may have the same primary key.'
I tried many combinations WithOutPrincipal and WithOutDependant etc. But no luck, please guide me to the right relationship.

A: Your question is a bit unclear, and you might want to provide more detail, but I suspect that you want only one foreign key property on your class two. Depending on how you're creating these objects, this may also be happening because you're trying to reference an id that's 0, because the object has not yet been saved to the database, so it has not been assigned an id.

A: If you are trying to have 1 to 0 or 1 relationship between class one and class two then  you need to have  primary key and foriegn key same in class 2 and it should be primary key of class one
Class One { ID (PK), Property 2; }
Class Two { One_ID (PK, FK), Nullable_One_ID (FK) }


Q: Maven trying to deploy the same artifact twice I'm using Maven to build my project, but when I run the command mvn clean package deploy, it tries to deploy the artifact twice. I have the build-helper-maven-plugin plugin configured to attach an ear file that I create using a custom plugin.
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.9.1</version>
            <executions>
                <execution>
                    <id>attach-artifacts</id>
                    <phase>package</phase>
                    <goals>
                        <goal>attach-artifact</goal>
                    </goals>
                    <configuration>
                        <artifacts>
                            <artifact>
                                <file>${project.build.directory}/${project.artifactId}-${project.version}.ear</file>
                                <type>ear</type>
                            </artifact>
                        </artifacts>
                    </configuration>
                </execution>
            </executions>
        </plugin>

When I disable build-helper-maven-plugin, the remaining artifact (only the pom) is uploaded only once.
What should I do to let Maven deploy the extra ear file only once?
Erates
EDIT
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>my.group.id</groupId>
    <artifactId>my.artifact.id</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>pom</packaging>

    <name>My Project</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <scm>
        <!-- Config -->
    </scm>

    <distributionManagement>
        <repository>
            <!-- Config -->
        </repository>
        <snapshotRepository>
            <!-- Config -->
        </snapshotRepository>
    </distributionManagement>

    <dependencies>
        <!-- My Dependencies here -->
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.9</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>false</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                            <includeGroupIds>my.group.ids.that.need.to.be.included</includeGroupIds>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>my.group.id</groupId>
                <artifactId>my.custom.plugin</artifactId>
                <version>1.0.1</version>
                <configuration>
                    <params>
                        <!-- My params -->
                    </params>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>my-custom-goal</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Release Plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <goals>clean package deploy</goals>
                    <tagBase>https://my.tagbase</tagBase>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.9.1</version>
                <executions>
                    <execution>
                        <id>attach-artifacts</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>${project.build.directory}/${project.artifactId}-${project.version}.ear</file>
                                    <type>ear</type>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <modules>
        <!-- My Modules -->
    </modules>
</project>

A: First you are using module and trying to do weird things in your parent pom (dependency-plugin, build-helper etc.). In a parent there should never be an execution like you have in your pom. You should make the appropriate configuration/execution within the appropriate modules cause this definition will be inherited of all childs.
Would you like to create an ear file? Than you should use packaging ear and your ear file will simply being deployed by using mvn deploy.
Furthermore you seemed to misunderstand the life cycle cause if you call:
mvn clean package deploy

this can be reduced to:
mvn clean deploy

cause the package life cycle is part of deploy so i recommend to read the life cycle information.


Q: href does not run properly I have been working with Mac and TeX Live, the newest version. I want to run videos by a mouse click on the PDF generated by a beamer presentation. I tried with shells and I also used appify to generate an app thereof. I also generated apps directly from the AppscriptEditor. However, when I click in Adobe, it complains that it can not find the application to run the underlying file as set by \href and run:
\href{run:./start.video100.app/Contents/MacOS/start.video100}{something}

I also tried relative paths... nothing is working.
Several users reported that they were successful in their cases. I want to start a script which then runs a playlist of videos, preferably in VLC. Can anybody help?

A: [Converting AlexG's comment to an answer]
If you are under OS X and don't mind using Adobe Reader, try the media9 package. Videos can be played in an embedded fashion, or in a detached player window.


Q: SQL Query Help: Probably Involves Group By My software runs on a few databases so I need to be generic (noticibly, I think a "distinct on" solution might work, but that isn't standard).
Say I have two tables defined as:
Table A: id, time (pk: id)
Table B: id(fk), key, value (pk: id, key)

Where the id of Table B is a foreign key to Table A and the primary keys are as specified.
I need the latest (in time) value of the requested keys. So, say I have data like:
id | key | value
1  | A   | v1
1  | B   | v2
1  | C   | v3
2  | A   | v4
2  | C   | v5
3  | B   | v6
3  | D   | v7

Where time is increasing for the id, and I want values for keys A and C, I would expect a result like:
key | value
A   | v4
C   | v5

Or for keys D and A:
key | value
D   | v7
A   | v4

Ideally, I'd only get n rows back for n key requests.  Is something like this possible with a single query?

A: Here is it working with SQL Server 2008 R2:
Schema
CREATE TABLE B (
   ind integer,
   [key] varchar(8),
   value varchar(16)
);

INSERT INTO B VALUES (1, 'A', 'v1');
INSERT INTO B VALUES (1, 'B', 'v2');
INSERT INTO B VALUES (1, 'C', 'v3');
INSERT INTO B VALUES (2, 'A', 'v4');
INSERT INTO B VALUES (2, 'C', 'v5');
INSERT INTO B VALUES (3, 'B', 'v6');
INSERT INTO B VALUES (3, 'D', 'v7');
INSERT INTO B VALUES (3, 'A', 'v12');
INSERT INTO B VALUES (3, 'C', 'v17');
INSERT INTO B VALUES (3, 'C', 'v101');

Query
select [key], max(CAST(SUBSTRING(value, 2, LEN(value)) as INT)) from B
where [key] in ('A', 'C')
group by [key]

If you want to keep the v as a prefix, do this:
select [key], 'v' + CAST(max(CAST(SUBSTRING(value, 2, LEN(value)) as INT)) as VARCHAR) as Value
from B
where [key] in ('A', 'C')
group by [key]

Output
| KEY |    VALUE |
------------------
|   A |      v12 |
|   C |     v101 |

The SQL Fiddle to play with: http://sqlfiddle.com/#!3/9de72/1

A: I'm assuming that no ID values will have the same TIME value.
I believe the following is about as generic as you can get with the option of running on as many databases as possible. But the trade off for platform flexibility is less than optimal performance.
The sub-query with alias t identifies the latest time available for each key.
select a.id,
       a.time,
       b.key,
       b.value
  from tableB as b
  inner join tableA as a
    on a.id=b.id
  inner join (
      select b2.key,
             max(a2.time) time
        from tableB as b2
       inner join tableA as a2 on a2.id=b2.id
       group by b2.key
  ) as t on a.time = t.time and b.key = t.key
  where b.key in ('D','A')

The WHERE clause could be moved inside the sub-query and it might perform slightly better on a database that has a primitive optimizer. But putting the WHERE clause in the outer query makes it easier to maintain, and also leaves open the possibility of creating a view without the WHERE clause. The WHERE clause can then be added to a select from the view.
A query using ROW_NUMBER() would be more efficient, or even better yet a query using something like Oracle's KEEP LAST. But those features would make the query more restrictive to certain platforms.