text:
Q: Unable to use today's date as a criteria in a query Ok, been a good decade since I've worked with Access and SQL, so a little forgiveness please.
Short version - when I add the query criteria to only display rows which match today's date, the query returns no rows; despite there indeed being matching rows there.
I have a sneaking suspicion that [FG Orders by Date].[FG Date] is somehow somewhere being treated as text, because after looking at the sort results of a query, it isn't sorting the field properly regardless of sort order.
Hope the following information is enough for someone to help me understand where I've gone wrong.
Problem being addressed
The query, and report coming from it, is a Kitchen Production Report that shows the Component Goods that need to be produced for the Finished Goods they have to dispatch that day.
There's a complexity of nicely laid out tables which manage things nicely, which will become apparent from the SQL below.
Due to the workflow, this report only ever needs to show the information for the current day.
Summary
I have a query, where the date column [FG Orders by Date].[FG Date], which is formatted as a Short Date (DD/MM/YYYY).
I've tested it's correctly formatted by creating an Expression column to transform it into a different format, which works perfectly.
Rows are returned by the query without an issue.
Whenever I add criteria to the query to only return rows for today's date (13/06/2019) - using Date(), the query returns no rows despite there being 11 rows with that date value.
Remove the criteria agaun, and everything comes back nicely.
SQL
This is the query code without the criteria added:
SELECT [FG Orders by Date].FGOrderID,
       [FG Orders by Date].[FG Date],
       [FG Orders by Date].[FG Date] AS ExpTodaysDate,
       [FG Orders by Date].FGSKU,
       [Finished Goods].[FG Name],
       [FG to CG mapping].CGSKU,
       [Component Goods].[CG Category],
       [CG Category].[CG Category Name],
       [Component Goods].[CG Name],
       [Component Goods].[CG Unit],
       Units.[Unit name],
       [Component Goods].[CG Unit value],
       [FG Orders by Date].[FGSKU Quantity],
       [FG to CG mapping].[CG Qty Required for FGSKU],
       [FGSKU Quantity]*[CG Qty Required for FGSKU] AS TotalQtyOfCGSKU
FROM (Units INNER JOIN ([CG Category] INNER JOIN [Component Goods] ON [CG Category].[CG Category ID] = [Component Goods].[CG Category]) ON Units.[Unit Symbol] = [Component Goods].[CG Unit]) INNER JOIN (([Finished Goods] INNER JOIN [FG Orders by Date] ON [Finished Goods].[FGSKU] = [FG Orders by Date].[FGSKU]) INNER JOIN [FG to CG mapping] ON [Finished Goods].[FGSKU] = [FG to CG mapping].[FGSKU]) ON [Component Goods].[CGSKU] = [FG to CG mapping].[CGSKU];

And with the criteria added:
SELECT [FG Orders by Date].FGOrderID,
       [FG Orders by Date].[FG Date],
       [FG Orders by Date].[FG Date] AS ExpTodaysDate,
       [FG Orders by Date].FGSKU,
       [Finished Goods].[FG Name],
       [FG to CG mapping].CGSKU,
       [Component Goods].[CG Category],
       [CG Category].[CG Category Name],
       [Component Goods].[CG Name],
       [Component Goods].[CG Unit],
       Units.[Unit name],
       [Component Goods].[CG Unit value],
       [FG Orders by Date].[FGSKU Quantity],
       [FG to CG mapping].[CG Qty Required for FGSKU],
       [FGSKU Quantity]*[CG Qty Required for FGSKU] AS TotalQtyOfCGSKU
FROM (Units INNER JOIN ([CG Category] INNER JOIN [Component Goods] ON [CG Category].[CG Category ID] = [Component Goods].[CG Category]) ON Units.[Unit Symbol] = [Component Goods].[CG Unit]) INNER JOIN (([Finished Goods] INNER JOIN [FG Orders by Date] ON [Finished Goods].[FGSKU] = [FG Orders by Date].[FGSKU]) INNER JOIN [FG to CG mapping] ON [Finished Goods].[FGSKU] = [FG to CG mapping].[FGSKU]) ON [Component Goods].[CGSKU] = [FG to CG mapping].[CGSKU]
WHERE ((([FG Orders by Date].[FG Date])=Date()));

SQL Create statements for relevant tables
(This is based on an export using DBWScript)
CREATE TABLE [CG Category] (
    [CG Category ID] AUTOINCREMENT,
    [CG Category Name] TEXT(255) WITH COMPRESSION,
    CONSTRAINT [ID] PRIMARY KEY ([CG Category ID])
);
ALTER TABLE [CG Category] ALLOW ZERO LENGTH [CG Category Name];
ALTER TABLE [CG Category] FORMAT [CG Category Name] SET "@";
CREATE TABLE [Component Goods] (
    [CGSKU] DOUBLE NOT NULL,
    [CG Name] TEXT(255) WITH COMPRESSION,
    [CG Unit] TEXT(255) WITH COMPRESSION NOT NULL,
    [CG Unit value] DOUBLE,
    [CG Category] LONG,
    [CG Pick Location] TEXT(255) WITH COMPRESSION,
    CONSTRAINT [CGSKU] PRIMARY KEY ([CGSKU])
);
ALTER TABLE [Component Goods] ALLOW ZERO LENGTH [CG Name];
ALTER TABLE [Component Goods] ALLOW ZERO LENGTH [CG Unit];
ALTER TABLE [Component Goods] ALLOW ZERO LENGTH [CG Pick Location];
ALTER TABLE [Component Goods] FORMAT [CGSKU] SET "General Number";
ALTER TABLE [Component Goods] FORMAT [CG Name] SET "@";
ALTER TABLE [Component Goods] FORMAT [CG Unit value] SET "General Number";
ALTER TABLE [Component Goods] FORMAT [CG Pick Location] SET "@";
CREATE TABLE [FG Category] (
    [CG Category ID] AUTOINCREMENT,
    [CG Category Name] TEXT(255) WITH COMPRESSION,
    CONSTRAINT [ID] PRIMARY KEY ([CG Category ID])
);
ALTER TABLE [FG Category] ALLOW ZERO LENGTH [CG Category Name];
ALTER TABLE [FG Category] FORMAT [CG Category Name] SET "@";
CREATE TABLE [FG Orders by Date] (
    [FGOrderID] AUTOINCREMENT,
    [FG Date] DATETIME DEFAULT Now(),
    [FGSKU] DOUBLE,
    [FGSKU Quantity] LONG DEFAULT 0,
    CONSTRAINT [PrimaryKey] PRIMARY KEY ([FGOrderID])
);
ALTER TABLE [FG Orders by Date] FORMAT [FG Date] SET "Short Date";
ALTER TABLE [FG Orders by Date] DECIMAL PLACES [FGSKU Quantity] SET 0;
ALTER TABLE [FG Orders by Date] FORMAT [FGSKU Quantity] SET "General Number";
CREATE TABLE [FG to CG mapping] (
    [FGCG ID] AUTOINCREMENT,
    [FGSKU] DOUBLE,
    [CGSKU] DOUBLE,
    [CG Qty Required for FGSKU] DOUBLE,
    CONSTRAINT [ID] PRIMARY KEY ([FGCG ID])
);
ALTER TABLE [FG to CG mapping] FORMAT [FGSKU] SET "General Number";
ALTER TABLE [FG to CG mapping] FORMAT [CGSKU] SET "General Number";
ALTER TABLE [FG to CG mapping] FORMAT [CG Qty Required for FGSKU] SET "General Number";
CREATE TABLE [Finished Goods] (
    [FGSKU] DOUBLE NOT NULL,
    [FG Name] TEXT(255) WITH COMPRESSION,
    [FG Category] LONG,
    [FG Category Old] TEXT(255) WITH COMPRESSION,
    [FG Pick Location] TEXT(255) WITH COMPRESSION,
    [FG Handle in System] BIT NOT NULL DEFAULT =Yes,
    CONSTRAINT [FGSKU] PRIMARY KEY ([FGSKU])
);
ALTER TABLE [Finished Goods] ALLOW ZERO LENGTH [FG Name];
ALTER TABLE [Finished Goods] ALLOW ZERO LENGTH [FG Category Old];
ALTER TABLE [Finished Goods] ALLOW ZERO LENGTH [FG Pick Location];
ALTER TABLE [Finished Goods] FORMAT [FGSKU] SET "General Number";
ALTER TABLE [Finished Goods] FORMAT [FG Name] SET "@";
ALTER TABLE [Finished Goods] FORMAT [FG Category Old] SET "@";
ALTER TABLE [Finished Goods] FORMAT [FG Pick Location] SET "@";
ALTER TABLE [Finished Goods] FORMAT [FG Handle in System] SET "Yes/No";
CREATE TABLE [Units] (
    [Unit ID] AUTOINCREMENT,
    [Unit name] TEXT(255) WITH COMPRESSION,
    [Unit Symbol] TEXT(255) WITH COMPRESSION,
    CONSTRAINT [PrimaryKey] PRIMARY KEY ([Unit ID])
);
ALTER TABLE [Units] ALLOW ZERO LENGTH [Unit name];
ALTER TABLE [Units] ALLOW ZERO LENGTH [Unit Symbol];
ALTER TABLE [Units] FORMAT [Unit name] SET "@";
ALTER TABLE [Units] FORMAT [Unit Symbol] SET "@";
CREATE INDEX [CG Category]
    ON [Component Goods] ([CG Category]);
CREATE INDEX [CG Unit]
    ON [Component Goods] ([CG Unit]);
CREATE INDEX [FGSKU]
    ON [FG Orders by Date] ([FGSKU]);
CREATE INDEX [FG to CG mappingCGSKU]
    ON [FG to CG mapping] ([CGSKU]);
CREATE INDEX [FG to CG mappingFGSKU]
    ON [FG to CG mapping] ([FGSKU]);
CREATE INDEX [FG Category]
    ON [Finished Goods] ([FG Category]);
CREATE INDEX [Unit ID]
    ON [Units] ([Unit ID]);
CREATE INDEX [Unit Symbol]
    ON [Units] ([Unit Symbol]);
ALTER TABLE [Component Goods]
    ADD CONSTRAINT [CG CategoryComponent Goods]
    FOREIGN KEY NO INDEX ([CG Category]) REFERENCES
        [CG Category] ([CG Category ID]);
ALTER TABLE [Component Goods]
    ADD CONSTRAINT [UnitsComponent Goods]
    FOREIGN KEY NO INDEX ([CG Unit]) REFERENCES
        [Units] ([Unit Symbol]);
ALTER TABLE [FG Orders by Date]
    ADD CONSTRAINT [Finished GoodsFG Orders by Date]
    FOREIGN KEY NO INDEX ([FGSKU]) REFERENCES
        [Finished Goods] ([FGSKU]);
ALTER TABLE [FG to CG mapping]
    ADD CONSTRAINT [Component GoodsFG to CG mapping]
    FOREIGN KEY NO INDEX ([CGSKU]) REFERENCES
        [Component Goods] ([CGSKU]);
ALTER TABLE [FG to CG mapping]
    ADD CONSTRAINT [Finished GoodsFG to CG mapping]
    FOREIGN KEY NO INDEX ([FGSKU]) REFERENCES
        [Finished Goods] ([FGSKU]);
ALTER TABLE [Finished Goods]
    ADD CONSTRAINT [FG CategoryFinished Goods]
    FOREIGN KEY NO INDEX ([FG Category]) REFERENCES
        [FG Category] ([CG Category ID]);

Example of query where date isn't sorting properly
(Apologies, i've tried posting this in markdown, but I can't figure out why the generated code isn't formatting properly)

A: You missed the time portion of [FG Orders by Date].[FG Date] as it is defined as
[FG Date] DATETIME DEFAULT Now()

Your table displays the data formated (only date part),
ALTER TABLE [FG Orders by Date] FORMAT [FG Date] SET "Short Date"

but in database  it is stored with the time portion (open table [FG Orders by Date] and click on a [FG Date] field, it will show its true value).
Don't hide data structure (format at table level, multivalue fields, ..), the formatting could be done in the query:
SELECT Format([FG Orders by Date].[FG Date],"Short Date") As [FG Date Formatted], ... .

Datetime is stored as double value where the fraction is the time portion (elapsed time of day / whole time of day), but a date without a time is just an integer value E.g:
CDbl(#2019-06-18 00:00:00#) = 43634 = CInt(#2019-06-18#)

(0 hours / 24 hours, fraction is 0)
and:
CDbl(#2019-06-18 12:00:00#) = 43634.5 <> CInt(#2019-06-18 12:00:00#) =  43634

(12 hours / 24 hours, fraction is .5)
If your [FG Orders by Date].[FG Date] is stored with the time portion (it hasNow()as default value, notDate()), it doesn't match your criteria=Date()as the only matchtes for a date in a datetime are the midnight datetimes.
Criteria for a whole day 2019-06-18
([FG Orders by Date].[FG Date] >= #06/18/2019# AND [FG Orders by Date].[FG Date] < #06/19/2019#)

as the datetime could be somewhere between this day and not the next day.
Criteria for todays date could be expressed as:
([FG Orders by Date].[FG Date] >= Date() AND [FG Orders by Date].[FG Date] < DateAdd("d", 1, Date())

You may want to be clever and just use the Date part of [FG Date] with:
DateValue([FG Orders by Date].[FG Date]) = Date()

This can return the same results, but you need to know that this prevents the usage of an index on [FG Orders by Date].[FG Date], what slows down the query and if [FG Orders by Date].[FG Date] Is Null this raises an error inDateValue()function.


text:
Q: If $2^{12^{7}+3}\equiv x \pmod{36}$, then what is the value of $x$?
If $2^{12^{7} + 3} \equiv x \pmod{36}$, then what is the value of $x$?

We have:
$$
\begin{align}
2^5 & \equiv - 4 \pmod{36} \\
2^{10} & \equiv 16 \pmod{36} \\
2^{12} & \equiv - 8 \pmod{36} \\
(2^{12})^{12} & \equiv 8^{12} \pmod{36} \\
2^{12^2} & \equiv - 8 \pmod{36} \text{, as } 8^{12} \equiv - 8 \pmod{36} \\
(2^{12^2})^{12^5} & \equiv - 8 \pmod{36} \\
2^{12^7} & \equiv - 8 \pmod{36} \\
2^{{12^7} + 3} & \equiv - 64 \pmod{36} \\
2^{{12^7} + 3} & \equiv 8 \pmod{36} \\
\end{align}
$$
Am I right or wrong? Is there any simpler way to find it?

A: It's probably easier to work modulo $4$ and modulo $9$, and use CRT.
First we have
$$x \equiv 2^{12^{7}+3}\equiv 0 \pmod{4}$$
To compute
$$x \equiv 2^{12^{7}+3} \pmod{9},$$
it suffices to compute $12^{7} + 3 \equiv 3 \pmod{6}$, as $6 = \varphi(9)$. (Or, if you prefer, as $2^{6} \equiv 1 \pmod{9}$.) So
$$2^{12^{7}+3}\equiv 2^{3} \equiv 8 \pmod{9}.$$
Clearly, then, the solution is indeed $x = 8$ as you found it, as $8 \equiv 0 \pmod{4}$.

A: We need $x \in \{0,1,2,\ldots,35\}$ such that $2^{12^7+3} = 36M + x$. Note that $4$ divides $2^{12^7+3}$ and $36M$. Hence, $x$ must be a multiple of $4$, say $4y$. We now need $y$ such that
$$2^{12^7+1} = 9M + y$$
where $y \in \{0,1,2,\ldots,8\}$. Since $\gcd(2,9) = 1$, we have $$2^{\phi(9)} \equiv 1 \pmod9 \implies 2^6 \equiv 1\pmod9$$
We have $12^7+1 = 6t+1$. Hence,
$$2^{12^7} \equiv 1 \pmod9 \implies 2^{12^7+1} \equiv 2 \pmod9$$
Hence, $y=2$, which gives us that $x=8$.

redpajama_set_name: RedPajamaStackExchange


text:
Q: CSS Source maps doesn't report the correct line when using nested selectors When I have sub-selectors (indented selectors) the line reported in Chrome Dev Tools when inspecting the sub-selector, is not the correct line but the line of its ancestor.
[1] #main {
[2]  max-width: 500px;
[3]  color: white;
[4]  .sub-container {
[5]    color: blue;
[6]  }
[7] }

inspecting .sub-container reports [1] instead of [4].
Is there something wrong with how my maps are generated, or is it a flaw of LESS?


text:
Q: If a user returns after being deleted from AD, can they have the same username? "Jan Smith" is returning to my small organization after a few years elsewhere. Her old AD profile ("jsmith") was deleted years ago and does not exist in Deleted Objects. We retained her network folder, so I have the SID for her old account. We haven't had any other users with her last name, so "jsmith" could only have been used for her; she has not used another name with us, so she has not had a different username here. The same applies to her long-deleted email, jsmith@company.com.
I've heard that it's bad practice to reuse AD usernames, but I couldn't find much information on why (except for the possibility of getting two individuals with the same name mixed up) so I don't know if that applies here, or if there are other reasons to avoid reassigning the same name.
If I create a new account for "Jan" and name it "jsmith" like the old one, what problems could happen? Am I overthinking a simple situation here?
Edit: The idea that usernames shouldn't be reused has come from several people I've worked with, often tied to debate on whether to delete or disable disused AD accounts. Partly because it's not uncommon for people in my industry to return to previous workplaces, I've come across lots of different perspectives on "delete vs disable" and accompanying arguments, but not so much for  username reuse. I suspect it's just superstition, but I want to see what basis there might be.

A:
I've heard that it's bad practice to reuse AD usernames

I've not heard that and I personally wouldn't have an issue with doing this. The only caveat is that you'll need to give her new user account access to the old network folder, or create a new network folder and copy the contents of the old folder to the new folder. Some other things to look out for are any line of business applications that may still have her username from her old user account that you may need to deal with.


text:
Q: Very basic calculator issues I'm a fairly new to c++. I'm trying to create a very basic calculator and the results I'm getting are completely wrong. I've come to a standstill after 2 hours of trying everything in my knowledge. What am I doing wrong?
#include <iostream>
using namespace std;

int main()
{

    int a = 0.0;
    int b = 0.0;
    float sum = 'a' + 'b';
    float diff = 'a' - 'b';
    float prod = 'a' * 'b';
    float quot = 'a' / 'b';
    float rem = 'a' % 'b';

    //Input
    cout << "Enter a number: " << endl;
    cin >> a;
    cout << "Enter another number: " << endl;
    cin >> b;

    cout << a << " + " << b << " = " << sum <<endl;
    cout << a << " - " << b << " = " << diff <<endl;
    cout << a << " / " << b << " = " << quot <<endl;
    cout << a << " * " << b << " = " << prod <<endl;
    cout << a << " % " << b << " = " << rem <<endl;

    return 0;
}

A: you are calculating with character literals. 'a' is not the same as a here.
remove the quotes when calculating, but add them when you print the actual literal "a"
float sum = 'a' + 'b';

You are calculating the ASCII value of the character "a" (which is 65) with the ASCII value of "b" (which is 66)
It should be
float sum = a + b;

instead.
When you print the values, you did the reverse:
cout << a << " + " << b << " = " << sum <<endl;

You want it to be
cout << "a" << " + " << "b" << " = " << sum <<endl;

instead. You want to print characters for the equation and only a number for the result.
You also calculate the values of a and b before they have an actual value.
You should put the calculation after you enter them.

A: Fixed, by moving the calculations after the input; and by using variables, not literals.
#include <iostream>
using namespace std;

int main()
{
    int a = 0.0;
    int b = 0.0;

    //Input
    cout << "Enter a number: " << endl;
    cin >> a;
    cout << "Enter another number: " << endl;
    cin >> b;

    float sum  = a + b;
    float diff = a - b;
    float prod = a * b;
    float quot = a / b;
    float rem  = a % b;

    cout << a << " + " << b << " = " << sum <<endl;
    cout << a << " - " << b << " = " << diff <<endl;
    cout << a << " / " << b << " = " << quot <<endl;
    cout << a << " * " << b << " = " << prod <<endl;
    cout << a << " % " << b << " = " << rem <<endl;

    return 0;
}


text:
Q: Automapper with ninject and generic interface won't work (error activating/no matching bindings available) I'm trying to use automapper in combination with ninject and a generic interface, abstract class. However it doesn't seem to work.
Below you will find the code which I'm trying to use. What am I missing?
IMapper
 public interface IMapper<in TTypeFrom, TTypeTo>
{
    TTypeTo Map(TTypeFrom typeFrom);
    List<TTypeTo> Map(IEnumerable<TTypeFrom> itemToMap);
}
public abstract class Mapper<TTypeFrom, TTypeto> : IMapper<TTypeFrom, TTypeto>
{
    private readonly IMappingEngine _mappingEngine;
    private readonly IConfiguration _configuration;

    protected Mapper(IMappingEngine mappingEngine, IConfiguration configuration)
    {
        _mappingEngine = mappingEngine;
        _configuration = configuration;

        _configuration.CreateMap<TTypeFrom, TTypeto>();
    }

    public TTypeto Map(TTypeFrom typeFrom)
    {
        return Map<TTypeFrom, TTypeto>(typeFrom);
    }
    protected TTo Map<TFrom, TTo>(TFrom itemToMap)
    {
        return _mappingEngine.Map<TFrom, TTo>(itemToMap);
    }

    public List<TTypeto> Map(IEnumerable<TTypeFrom> itemToMap)
    {
        return Map<TTypeFrom, TTypeto>(itemToMap);
    }
    protected List<TTo> Map<TFrom, TTo>(IEnumerable<TFrom> itemsToMap)
    {
        return itemsToMap.Select(Map<TFrom, TTo>).ToList();
    }
}

CategoryRepresentationMapper
public interface ICategoryRepresentationMapper : IMapper<CategoryRepresentation, CategoryRepresentationDto>
{

}
public class CategoryRepresentationMapper : Mapper<CategoryRepresentation, CategoryRepresentationDto>, ICategoryRepresentationMapper
{
    public CategoryRepresentationMapper(IMappingEngine mappingEngine, IConfiguration configuration) : base(mappingEngine, configuration)
    {
    }
}

Setting things up with ninject
IKernel kernel = new StandardKernel();

        Mapper.Initialize(map =>
        {
            map.ConstructServicesUsing(f => kernel.Get(f));
        });

        kernel.Bind<IMappingEngine>().ToMethod(x => Mapper.Engine);
        kernel.Bind<IConfigurationProvider>().ToMethod(x => Mapper.Engine.ConfigurationProvider);
        kernel.Bind<IConfiguration>().ToMethod(x => Mapper.Configuration);

        kernel.Bind(
          x =>
              x.FromAssemblyContaining(typeof(IMapper<,>))
                  .SelectAllClasses()
                  .InheritedFrom(typeof(IMapper<,>))
                  .BindAllInterfaces());

        var categoryRepresentationMapper = kernel.Get<ICategoryRepresentationMapper>();

I get the following error:
 Ninject.ActivationException occurred
  HResult=-2146233088
  Message=Error activating ICategoryRepresentationMapper
No matching bindings are available, and the type is not self-bindable.
Activation path:
  1) Request for ICategoryRepresentationMapper

Suggestions:
  1) Ensure that you have defined a binding for ICategoryRepresentationMapper.
  2) If the binding was defined in a module, ensure that the module has been loaded into the kernel.
  3) Ensure you have not accidentally created more than one kernel.
  4) If you are using constructor arguments, ensure that the parameter name matches the constructors parameter name.
  5) If you are using automatic module loading, ensure the search path and filters are correct.

Edit
If i do this, it will work, BUT I don't want to bind ICategoryRepresentationMapper explicitly. It must be generic since I will have numerous mappers.
    IKernel kernel = new StandardKernel();

            Mapper.Initialize(map =>
            {
                map.ConstructServicesUsing(f => kernel.Get(f));
            });

            kernel.Bind<IMappingEngine>().ToMethod(x => Mapper.Engine);
            kernel.Bind<IConfigurationProvider>().ToMethod(x => Mapper.Engine.ConfigurationProvider);
            kernel.Bind<IConfiguration>().ToMethod(x => Mapper.Configuration);
// This line below will actualy work but it isn't generic
            kernel.Bind(
              x =>
                  x.FromAssemblyContaining< ICategoryRepresentationMapper>()
                      .SelectAllClasses()
                      .InheritedFrom(typeof(IMapper<,>))
                      .BindAllInterfaces());

A: It seems I found an answer to this problem. The assemblies were to look at where wrong.
Instead of doing this:
kernel.Bind(
      x =>
          x.FromAssemblyContaining(typeof(IMapper<,>))
              .SelectAllClasses()
              .InheritedFrom(typeof(IMapper<,>))
              .BindAllInterfaces());

I needed to do this and It works:
var codeBase = Assembly.GetExecutingAssembly().CodeBase;
        var uri = new UriBuilder(codeBase);
        var path = Uri.UnescapeDataString(uri.Path);

        _kernel.Bind(
          x =>
              x.FromAssembliesInPath(Path.GetDirectoryName(path))
                  .SelectAllClasses()
                  .InheritedFrom(typeof(IMapper<,>))
                  .BindAllInterfaces());


text:
Q: robots.txt is redirecting to default page Hullo,
Typically, if I type into my address bar, "oneofmysites.com/robots.txt", any browser will display the content of robots.txt.   As you can see, this is pretty standard behaviour.
I have just one web server which does not. Instead, robots.txt redirects to the default web page (i.e. "thesiteinquestion.com/"). This notable difference (only one of seven sites) worries me.
Questions: Is this something to be concerned about? If so, what is the likely error that I am missing?
Notes:

*

*This site is the only one with a separate service provider that I
use.

*CentOS release 6.10 (Final)

*Webmin

*robots.txt file permissions
are 644

A: It depends on the server configuration, .txt files may not be allowed. It is possible that there is a rule somewhere in the config or some .htaccess that specifies if a url doesn't match a certain pattern (say .html, .php, .htm, etc) it then redirects the rest to the index page of the web root.

A: To add a bit of information, the web provider is not at all forced to respect the robots.txt standard, thus can make what ever he want with it and like Serge told it can be redirected anywhere.

A: A crawler should read robots.txt and follow its restrictions, but the web server cannot enforce this.
.htaccess (or the server confía file) can be used to keep out crawlers that don't comply, if you know who they are.


text:
Q: Power BI dynamic column reference with DAX formula I have a Orders and ExchangeRates tables connected via a date key:

What I am trying to do is to fetch the correct currency exchange rate from ExchangeRates, which are organized in columns, with the column name matching the currency codes from Orders.
I'm basically trying to make a dynamic column reference to the EUR or JPY columns by using the matching Orders[orderCurrency] like this:
orderExchangeRate = LOOKUPVALUE(ExchangeRates[Orders[orderCurrency]],
ExchangeRates[date],Orders[date])

or:
orderExchangeRage = SELECTCOLUMNS(ExchangeRates,Orders[orderCurrency], ....)

But none of the functions accept a dynamic column reference, they expect the actual name of the column
How can I dynamically refer to the EUR and JPY columns based on Orders[orderCurrency]? Isn't there something similar to INDIRECT to make a dynamic reference in PowerBI?

A: As far as I know, there is no such function as INDIRECT in DAX.
You have (at least) two options:

*

*If it's just EUR and JPY, you could create two formulas and based on the currency switch between them with IF() or SWITCH(). Like: If (Currency = "EUR", LOOKUPVALUE(EUR), LOOKUPVALUE(JPY). Pseudo code, of course.

*Unpivot the EUR and JPY column in the ExchangeRate table. Then you'll have a line for each date and currency, and you can reference it as you like. Especially usefull with more currency combinations. You can Unpivot in the Query Editor, Transformation Tab.


text:
Q: Replace only framework.jar & its relevant libraries on Android MarshMallow Anyone know steps to replace frameworks.jar and relevant libraries on Android Marshmallow device?
My work is to modify Android Marshmallow framework source code, do full-build then update to device then verify result. It takes about 1,2 hours each time.
It is OK if I do it 1,2,3 times but actually I had to repeat it even 100 times if my modification not work. But I only modify only a small piece of code in frameworks/ so I think it would save me much time if I can rebuild only frameworks/ module in Android code and replace only frameworks/ part in device.
I know how to use mmm to rebuild just frameworks/ module. But I don' know how to replace frameworks/ part in device because just replace frameworks.jar not work in Marshmallow case.

A: Assuming you're modifying things under frameworks/base/, as it's where framework.jar comes from, the steps I use are:

*

*If you already have a full-build, use mm command in the directory where you're modifying any code. It's faster than mmm since it doesn't compile framework dependencies again.

*Go to <aosp-root>/out/target/product/<product-name>/system/framework/ directory and get framework.jar and services.jar items.

*Go to <aosp-root>/out/target/product/<product-name>/system/lib/ directory and get any libandroid*.so file.

*With device already rooted, adb push *.jar /system/framework/.

*adb push *.so /system/lib/.

*Factory reset the device and reboot it.
Changes made on your framework might work now. If your target device is 64 bits, replace lib by lib64 on above destinations.
Explanation
Above steps will vary according to what we modify inside AOSP framework. Here a quick description on what goes inside each file:

*

*framework.jar: APIs accessible to applications

*services.jar: Implementation of managers and system services located under frameworks/base/services.

*libandroid*.so: Libraries generated from native code (C/C++) like the .cpp files located at frameworks/base/core/jni.

But, in general, each Android.mk inside frameworks will generate at least one output named by the LOCAL_MODULE variable and the type of the module depends on the following include instruction:
# JAR file
include $(BUILD_JAVA_LIBRARY)

# Library to be used by other modules
include $(BUILD_SHARED_LIBRARY)

# Executables
include $(BUILD_EXECUTABLE)

For example, the frameworks/base/cmds folder generates a Java library and an executable for each item inside it, like the pm command commonly used to install apps via ADB. In any case, the rule is: Java libraries go to /system/framework/, Shared libraries go to /system/lib/ and executables go to /system/bin.
More official information about Android.mk can be found here, but it doesn't cover all variables and macros used by Android Build System, I get most of that info from AOSP code itself.
Hope it helps.


text:
Q: Accessing tables from 2 different server in a single query in python I tried to create a table from 2 tables of different server.
I am really stuck on how to establish the connection to 2 servers in a single SQL query.
If anyone know how to do this, please help.
I have given a sample example of what I want.
The below is the query that I need to execute:
(SELECT A.period AS period,c.date AS date,b.time as time
FROM ABC.PERIOD_DATE a,
    DEF.DATE_WEEK b,
    DEF.TIME_WEEK c
)

Below are the credentials that is needed to connect to the server:
where the table PERIOD_DATE is from "MYPERIOD" server , where schema=ABC,
user='abc_999',password='abc_999', host name ='abc.999.org',port = 9999

DATE_TIME and TIME_WEEK is from "MYDATETIME" server , where schema=DEF,
user='def_111',password='def_111', host name ='def.111.org',port = 1111

Thanks in advance!


text:
Q: IE javascript problem with break or classname i'm not really sure whats the problem here, it works with chrome and ff but not ie.
var newdiv = document.createElement("div");
newdiv.innerHTML = xhr.responseText;
el = newdiv.firstChild.nextSibling;
var next;
do{
next = addpoint.nextSibling;
if(next.className != "commentstyle golduser") break;
}while(addpoint = next);
document.getElementById("testimonialcommentlisting"+id).insertBefore(el,next);

error is at this line document.getElementById("testimonialcommentlisting"+id).insertBefore(el,next);

**UPDATE**

ok this is werid, i did some test and i found the problem. the problem is with var el
for chrome and ff el is div element while ie is null.
here comes the weirder problem. By right, newdiv.firstChild should be the div element but i dont know why ff and chrome register it as a text element and clearly my responseText is something like this

blahblah

i hope somebody understands what i'm talking about.

A: Your loop follows an odd construction. You're fetching addpoint.nextSibling then looking at its className attribute, and only then checking to see if the node is valid. This means on the last iteration through the loop, when next is null, you're trying to access the className property of null.
while (next) {
    if (next.className != 'commentstyle golduser') break;
    next = next.nextSibling;
}

Without more context from what surrounds this loop I don't know how addpoint fits in. It's not necessary just to make the loop work, though if you do need to change addpoint there's no reason you can't do so using this loop construction.
The point is that you are never checking next.className when next is null.


text:
Q: Getting a specific process of task manager in c# I have to 2 list box, the other one is for getting the specific process(I listed it in like chrome, mspaint, notepad etc.) when these programs are running my label color would go green and when one of these programs closes label would go red follow by the name of the program that was close. My problem is I can't specify the closed program all it does it when I close any program my label always go red.
Here's my code:
private void running_process()
{
    Process[] processes = Process.GetProcesses("PCNAME");

    foreach (Process p in processes)
    {
        foreach (string item in listBox2.Items)
        {
            if (item == p.ProcessName)
            {
                listBox1.Items.Add(p.ProcessName);
            }
            if (listBox1.Items.Contains(item))
                label4.BackColor = Color.Green;
            else

                label4.BackColor = Color.Red;
        }
    }
}

private void timer1_Tick(object sender, EventArgs e)
{
    listBox1.Items.Clear();
    running_process();
}

private void button2_Click(object sender, EventArgs e)
{
    timer1.Enabled = true;
}

A: The problem with your code is that you setting label4.BackColor for every iteration, thus it would keep only the value for the last one. So if your last process in listBox2 is in listBox1 then the label should be green and if no - then red.
I am not sure if I get your requirement correctly (in terms of listBox1) but if you want it to keep processes that are running AND listed in the listBox2 (as it is in your code) then this should work:
label4.BackColor = Color.Green; //by default the label color is Green
foreach (string item in listBox2.Items)
{
    var processDeleted = true; //and by default we suppose that every process was deleted
    foreach (var process in processes)
    {
        if (process.ProcessName == item)
        {
            listBox1.Items.Add(process.ProcessName);
            processDeleted = false;
        }
    }
    if (processDeleted) label4.BackColor = Color.Red;
}

But that way you can get a big list of similar entries in the listBox1, so I would write something like:
label4.BackColor = Color.Green;
foreach (string item in listBox2.Items)
{
    if (processes.Any(x => x.ProcessName == item))
        listBox1.Items.Add(item);
    else
        label4.BackColor = Color.Red;
}


text:
Q: Replacing Consecutive Values in Delimited File The ultimate objective is to replace all instances of ^NULL^ with ^^.  For this question, to increase readability, I'll try to replace ^NULL^ with ^fred^.  Here is my test data.
/usr/redbrick_dir $ cat temp
a^NULL^b^c^
e^NULL^NULL^f^
g^h^i^NULL^

This is what I expect to work.
/usr/redbrick_dir $ cat temp | sed "s/\^NULL\^/\^fred\^/g"
a^fred^b^c^
e^fred^NULL^f^
g^h^i^fred^

Note that in line 2, only the first instance of ^NULL^ is replaced.  However, if I run the command with only one delimiter,
/usr/redbrick_dir $ cat temp | sed "s/NULL\^/fred\^/g"
a^fred^b^c^
e^fred^fred^f^
g^h^i^fred^

I get the desired results.  I also get those results if I only use the trailing delimiter.  The question is, why does this command only replace the first instance of ^NULL^ ?
cat temp | sed "s/\^NULL\^/\^fred\^/g"

Edit starts here
Here is what happened when I tried a couple of the answers posted below.
cat temp | sed "s/(?<=\^)NULL(?=\^)/fred/g"
a^NULL^b^c^
e^NULL^NULL^f^
g^h^i^NULL^

cat temp | sed ":a s/\^NULL^/^fred^/;ta"
sed: 0602-417 The label :a s/\^NULL^/^fred^/;ta is greater than eight characters.

I'll have to check out the link provided by Utopik.

A:
why does this command only replace the first instance of ^NULL^ ?

Because the expression doesn't match the second ^NULL^ in the second line, after the expression finds the first^NULL^, it now tries to find a match at the character right after ^:
e^NULL^ NULL^f^
       ^
   it is now trying to find a match here but there is no ^NULL^ here, there is NULL^ only.

Regex101 Demo
I don't know if sed supports lookbehinds or lookaheads but if it did, then I would do the replacement like this:
cat temp | sed "s/(?<=\^)NULL(?=\^)/fred/g"

Or in your case replace fred with empty string of course.

A: Tested with GNU sed
First, you can remove some backslash : sed "s/\^NULL^/^fred^/g" without any change (^ has no meaning but at start of regex)
Then, sed will match ^NULL^ and no character from that match can be reused for another match. So, it can't match the second ^NULL^ but only NULL^, that is why it doesnt work.
You can do it that way :
sed ":a s/\^NULL^/^fred^/;ta"
Why ? Because it will substitute the first ^NULL^, then restarting the substitution over and over until no more substitution happens and, because it's a new cycle of substitution, every character can be matched
$ cat temp

a^NULL^b^c^
e^NULL^NULL^NULL^NULL^NULL^NULL^NULL^NULL^NULL^f^
g^h^i^NULL^

$ cat temp | sed ":a s/\^NULL^/^fred^/;ta"

a^fred^b^c^
e^fred^fred^fred^fred^fred^fred^fred^fred^fred^f^
g^h^i^fred^

it's ok.
( lots of good resources : http://sed.sourceforge.net/grabbag/tutorials/ )

A: There are two different scenarios:-

1) In First sed command it is like that
sed "s/\^NULL\^/\^fred\^/g"

When it is coming to the second line. It is searching two string as first one is ^NULL^ and second one is NULL^. so here it is unmatched. and because of that it is not replacing the same. For example how sed is searching the word
                Search word          Replace word
    found       ^Null^               ^fred^
    Not found    Null^
2) In second sed command it is like that sed "s/NULL\^/fred\^/g"

here it is only searching the word Null^ and replacing with fred^ . So it is matching the word correctly.


text:
Q: Getting all rows from a oracle table Suppose a oracle table has many rows. How can i fetch specific column for all rows?
Let, in a table named teacher_description, there are 100 rows with columns teacher_id,teacher_name. How can i get the teacher_id for 100 rows?
Thank you.

A: select teacher_id  from teacher_description

A: As Ashish Pandya said, you can use just a simple select.
If you get PLS-00428: an INTO clause is expected in this SELECT statement error, I think you are calling this statement inside a code block; in this case you need to get the result in a cursor.
Take a look on the following code:
set serveroutput on;
declare
  cursor v_cursor is select teacher_id from teacher_description;
begin

  for idx in v_cursor loop
    dbms_output.put_line(idx.teacher_id);
  end loop;
end;
/

If you need to understand the cursors you can find here a fast link, http://www.tutorialspoint.com/plsql/plsql_cursors.htm, but I suggest you start reading here: http://www.oracle.com/technetwork/issue-archive/2013/13-mar/o23plsql-1906474.html.


text:
Q: How to destroy pod with status "Unknown" in openshift? My pods are showing status as Unknown; and attempts to scale them down to 0 have failed from command prompt as well as UI.
And this is not allowing me to start new pods as well. See error below:

Unable to mount volumes for pod
  "mysql-1-v9lcr_cloud-apps(1e9beb72-e3cf-11e8-943e-02ec8e61afcf)":
  timeout expired waiting for volumes to attach or mount for pod
  "cloud-apps"/"mysql-1-v9lcr". list of unmounted volumes=[mysql-data].
  list of unattached volumes=[mysql-data default-token-zsbnc]

Location: starter-ca-central-1


text:
Q: Excluding file from optimizing in Durandal build I'm using Grunt to build the Durandal starter kit pro package.
It all works fine, except for one tiny detail. I would like to exclude one file (app-config below) from the optimizer and keep it as a non minified file when my build is done.
Based on other SO thread suggestions, I'm currently excluding it using empty:, which removes it from the optimized file as expected. However, when I open the built project I get an error in the console:
Uncaught Error: main missing app-config
options: {
    name: '../lib/require/almond-custom',
    baseUrl: requireConfig.baseUrl,
    mainPath: 'app/main',
    paths: mixIn({ }, requireConfig.paths, {
         'almond': 'lib/require/almond-custom',
         'app-config': 'empty:'
    }),
    optimize: 'none',
    out: 'build/app/main.js',
    preserveLicenseComments: false
}

Is almond the problem? I tried switching it to the full requirejs using include: ['path/to/require'], without success.
If you want to reproduce it locally you can either download the starter kit from the above link, or use a slightly configurated version which is closer to my example. Just run an npm install in the folder and you're all set.

A: I have downloaded you source code and do the following steps.

*

*Extract zip file, open cmd and change the directory to this folder.

*Run npm install to install all the dependencies.

*Run grunt to start to build the project.

And when I open http://localhost:8999/ and saw the alert 1 which is alert(appConfig.foo); in your main.js.
After clicked Ok to hide the alert, the web page works fines. Any more input for you ?

So I am not sure how you are facing with this issue.

A: From the reference of the durandal issues found in this particular link
grunt-durandal
The main module controls the implementation of the durandal services
The link can be found in main.js
Here you can see the system.debug(true).You can remove it as written in the post here document.
The function as quoted in the article Overrides request execution timeout making it effectively infinite.
Also while using uglify in grunt the debug is set to false as per the documentation.
As per the documentation you need to set the system.debug(false)
Hope this might help a bit.

A: try:
....
paths: mixIn({ }, requireConfig.paths, {
     'almond': ['lib/require/almond-custom', '!lib/require/almond-custom/app-config.js']
}),
....

just note the second path of app-config.js is correct. I think you should find your way, the above is a hint, if not a direct solution.


text:
Q: Save user provided number with prompt from first message? Hi I'm using C# in Visual studio with Microsoft's bot emulator and I'm wondering how can I prompt the user for a number input in the first message and store it in the conversation. Here's what I have so far in my MessagesController:
public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
    {
        if (activity.Type == ActivityTypes.Message)
        {
            await Conversation.SendAsync(activity, () => new Dialogs.LuisHandler());
        }
        else
        if (activity.Type == ActivityTypes.ConversationUpdate)
        {
            if (activity.MembersAdded.Any(o => o.Id == activity.Recipient.Id))
            {
                PromptDialog.Number(activity,setUserID,"Please enter your number code","Error please enter the number again",3,"",0,999);
            }
        }
        else
        {
            HandleSystemMessage(activity);
        }
        var response = Request.CreateResponse(HttpStatusCode.OK);
        return response;
    }

This is obviously not the correct way to do it since both the activity and setUserId attributes display an error, how can I fix this?
Also, this my SetUserId method:
public void setUserID(int id, Activity act)
    {
        IDialogContext cxt = act;
        cxt.UserData.SetValue("userId", id);
    }

Where id will be the number provided by the user and I save it in the context of the conversation to use it in queries later, how can I achieve this behavior?

A:
how can I prompt the user for a number input in the first message and store it in the conversation.

The PromptDialog.Number() method accepts IDialogContext object as a parameter, so we can not directly call it from Messages controller (outside of Dialog) to prompt for a number.
public static void Number(IDialogContext context, ResumeAfter<long> resume, string prompt, string retry = null, int attempts = 3, string speak = null, long? min = null, long? max = null);

To achieve the requirement: prompting the user for a number input in the first message and storing it in the conversation, you can try the following sample as an workaround.
In Messages controller:
//...

else if (message.Type == ActivityTypes.ConversationUpdate)
{
    // Handle conversation state changes, like members being added and removed
    // Use Activity.MembersAdded and Activity.MembersRemoved and Activity.Action for info
    // Not available in all channels

    IConversationUpdateActivity update = message;
    var client = new ConnectorClient(new System.Uri(message.ServiceUrl), new MicrosoftAppCredentials());
    if (update.MembersAdded != null && update.MembersAdded.Any())
    {
        foreach (var newMember in update.MembersAdded)
        {
            if (newMember.Id != message.Recipient.Id)
            {
                var reply = message.CreateReply();
                reply.Text = $"Welcome {newMember.Name}! Please enter your number code!";
                client.Conversations.ReplyToActivityAsync(reply);

            }
        }
    }

}

In dialog:
[Serializable]
public class RootDialog : IDialog<object>
{
bool thenumberisentered = false;

    public Task StartAsync(IDialogContext context)
    {
        context.Wait(MessageReceivedAsync);

        return Task.CompletedTask;
    }

    private async Task MessageReceivedAsync(IDialogContext context, IAwaitable<object> result)
    {
        var activity = await result as Activity;

        if (!thenumberisentered)
        {
            string pattern = @"^(?:0|[1-9]\d{0,2})$";
            System.Text.RegularExpressions.Regex rgx = new System.Text.RegularExpressions.Regex(pattern);

            if (rgx.IsMatch(activity.Text))
            {
                //save the number code as user data here

                thenumberisentered = true;

                await context.PostAsync($"The number code you entered is: {activity.Text}");
            }
            else
            {
                PromptDialog.Number(context, setUserID, "Please enter your number code", "Error please enter the number again", 2, "", 0, 999);
                return;
            }

        }
        else
        {
            await context.PostAsync($"You sent {activity.Text}");
        }

        context.Wait(MessageReceivedAsync);
    }

    private async Task setUserID(IDialogContext context, IAwaitable<long> result)
    {
        long numcode = await result;

        await context.PostAsync($"The number code you entered is: {numcode}");

        thenumberisentered = true;

        //save the number code as user data here

        context.Wait(MessageReceivedAsync);
    }

}

Test result:


text:
Q: Semantic: should the image in an article list wrapped in figure? In typical index of articles (like a blog, news portal), such as this:

Should it have the image thumbnail contained in figure, or letting it alone would be fine?
The HTML5 spec defines figure as,

The figure element represents a unit of content, optionally with a
  caption, that is self-contained, that is typically referenced as a
  single unit from the main flow of the document, and that can be moved
  away from the main flow of the document without affecting the
  document's meaning.

But I'm still having problems grasping if it means we should/should not put the image thumbnail inside a figure.
For example, even without the image it won't change the article meaning, so that qualifies. But on the other hand, the thumbnail image isn't exactly self-contained.
In another question @unor suggested that only use figure if the image itself should have a separate caption. But in the spec we see that caption is optional.
Can anyone help me here?

A: Think of <figure> as something like a chart, or a callout image, or a table, or a code block, that you might see in a news article or tutorial.
If it warrants a caption of any kind, then use <figure> as it has a figcaption element to support that. Lack of caption does not mean that <figure> is not allowed, and <figure> does not require a figcaption. You can
Not all images belong in <figure>. For example, if it gets no alt text or other text description (longdesc, for example), then it probably does not qualify to use <figure> as its absence likely affects nothing.
If the image is simply there as eye candy, perhaps a lead-in image that is primarily decoration, then you can probably just skip using <figure>. Whether your choose to wrap it in a <p> or not (or whatever) is up to you.
Without seeing more context (images, a full page, etc), since you describe it as an index with thumbnails and their absence does not damage the meaning, I think you should ignore <figure>.
There is some relatively recent discussion on this 2010 article: http://html5doctor.com/the-figure-figcaption-elements/


text:
Q: A characterization of flat metrics via global vector fields Let  $(M,g)$ be  a  Riemannian  manifold with $LC$ conncection $\nabla$.
Assume  that for  every three  global vector  fields $X,Y,Z \in \chi^{\infty}(M)$ with $[X,Y]=0$  we  have $\nabla_{X} \nabla_{Y} Z=\nabla_{Y} \nabla_{X} Z$

Is  the  metric necessarily   a  flat  metric?

A: To see that $g$ is flat, we need enough pairs of commuting global vector fields. To construct these, let $f(r)\colon[0,\infty)\to[0,1)$ be a monotone function with $f(r)=1-\frac1{\log r}$ for $r\gg 1$. Consider the diffeomorphism $\mathbb R^n\to B^n$ given by $\Phi(x)=f(|x|)\,\frac x{|x|}$. We can map constant (and therefore commuting) vector fields $V$, $W$ on $\mathbb R^n$ to vector fields on $B^n$ that decay sufficiently fast near the boundary of $B^n\subset\mathbb R^n$ so that we can extend them by $0$ to compactly supported vector fields $\bar V$, $\bar W$ on $\mathbb R^n$. By naturality of the Lie bracket, these vector fields still commute.
The same construction in local coordinates gives sufficiently  many pairs of commuting vector field of manifolds to conclude that the connection $\nabla$ is flat.
In the comments you ask for global vector fields that are independent almost everywhere. It seems to me that the construction above can be modified to give pairs of commuting vector fields that vanish along the $(n-1)$-skeleton of a smooth triangulation of a manifold $M$, and are linearly independent otherwise.


text:
Q: Get the very first -layoutSubviews call in iOS I'm constantly dealing with the recurring problem - I have to set up some things only once before view or view controllers appears. Usually frames should be already determined. For example when setting corner radius. So I find myself repeating the same pattern over and over in many classes. It goes like this:
@property (nonatomic, assign) BOOL initialLayoutCompleted;

- (void)layoutSubviews {

    [super layoutSubviews];
    if (!self.initialLayoutCompleted) {

        self.initialLayoutCompleted = YES;
       //do initial set up.

    }

}

Is this the most efficient way? Is there something to simplify the condition check? Is there a better practice?


text:
Q: Use of Toolkit.getDefaultToolkit() This piece of code is used to set the icon of JFrame
this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/Eserver/Dictionaryicon.png")));

Here what is the use of Toolkit.getDefaultToolkit()


text:
Q: How make scrollable whitespace on start and end of recyclerView I would do put white space on top and on bottom of a recyclerView.
in html/css for example i can make a scrollable parent-container with fixed height and insert a child-container with adaptable height and set paddingTop and paddingBottom of child-container.
i tryed to repeat this system in layout.xml
    <ScrollView
        android:id="@+id/ScrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/RecyclerView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingTop="50dp"
            android:paddingBottom="35dp"
            android:clipChildren="false"
            android:nestedScrollingEnabled="false"
            tools:itemCount="10" />

    </ScrollView>

but i see the "wrap_content" adapt height ONLY if that is minor of "match_parent", as the View is scrollable(in theory) (or that is what i undestand).
But this break my system because i need the child-container is NOT scrollable.
if i set nestedScrollingEnabled="false" cuts the elements out of the viewport, if i set "true" the recycleView scrolls normally but the whitespaces stay fixed
exist another way to get what I want?
attempted result

A: try to use this way by adding clipToPadding and set to false you can add white space in top and bottom
<android.support.v7.widget.RecyclerView
    android:id="@+id/list_data"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingLeft="@dimen/view_padding"
    android:paddingRight="@dimen/view_padding"
    android:clipToPadding="false"
    android:paddingBottom="90dp"
    android:paddingTop="90dp"/>


text:
Q: how can set counter limit? Hi i have a counter code. I want to stop when (example) 11 result. how can i stop curl when script count 11 result?
<?php
class instaAuth
{
    public function _userlistesi() {
        $klasor = opendir("cookieboq/");
        while(false !== ($veriler = readdir($klasor))) {
            if(strstr($veriler,'selco')) {
            $bir_veri = str_replace('.selco','',$veriler);
            $user_ekle .= "$bir_veri,";
        }
    }
    $userler = substr($user_ekle,0,-1);
    $users_arr = explode(",",$userler);
    return $users_arr;
    }

public function _authLike($_ID,$userlist, $DELETE = NULL)
    {
        if ( !empty($userlist) )
        {
            $type = ($DELETE == TRUE) ? 'unlike' : 'like';

            $members = array();
            $params = array();
            foreach ( $userlist as $username )
            {
                $_cookie = $this->_cookieFolder . $username . $this->_cookieExtension;
                $randomProxy = ( count($this->_proxy) > 0 ) ? $this->_proxy[rand(0, (count($this->_proxy) - 1))] : NULL;

                if ( !file_exists($_cookie) )
                {
                    continue;
                }
                $members[] = $username;
                $fake_ip = $this->fakeIP();
                $header = array(
                    "Accept: */*",
                    "Accept-Language: tr;q=1",
                    "HTTP_CLIENT_IP"        => $fake_ip,
                    "HTTP_FORWARDED"        => $fake_ip,
                    "HTTP_PRAGMA"           => $fake_ip,
                    "HTTP_XONNECTION"       => $fake_ip,);

                $options = array(
                    CURLOPT_POST => TRUE,
                    CURLOPT_POSTFIELDS => $this->signed(json_encode(array())),
                    CURLOPT_HTTPHEADER => $header,
                    CURLOPT_COOKIEJAR => $_cookie,
                    CURLOPT_COOKIEFILE => $_cookie,
                    CURLOPT_USERAGENT => $this->_useragent,
                );

                $params[] = array(
                    'url' => "https://i.instagram.com/api/v1/media/{$_ID}/{$type}/",
                    'options' => $options
                );
            }
        } else {
            throw new Exception('Error: _authLike() - Beğeni yaptırabilmeniz için {cookies} tanımlamalısınız.');
        }
        $multiCURL = new \RollingCurl\RollingCurl();
        foreach ($params as $param) {
            $request = new \RollingCurl\Request($param['url'], 'POST');
            $request->setOptions($param['options']);
            $multiCURL->add($request);
        }

        $this->_result = 0;
        $multiCURL
            ->setCallback(function(\RollingCurl\Request $request, \RollingCurl\RollingCurl $rollingCurl) {

                $result = $request->getResponseText();
                if ( is_string($result) )
                {
                    $result = json_decode($result);
                    if ( is_object($result) )
                    {
                        if ($result->status == 'ok') $this->_result++;
                    }
                }
            })
            ->setSimultaneousLimit(100)
            ->execute()
        ;

        $result = array(
            'success' => $this->_result,
            'errors' => NULL
        );

        return json_decode(json_encode($result));

    }
}

and this insterested other code page
<form action="" method="POST">

Pictures ID : <input type="text" name="apifotoId">

Limits : <input type="text" name="limit">

<input type="submit" value="Like Send">
</form>
<?php
include("class.php")
if(isset($_POST['apifotoId'])) {
$start = time();
$y = new instaAuth();
$user_list = $y->_userlistesi();
$limit = $_POST["limit"];
$_ID = $_POST['apifotoId'];
$y->_authLike($_ID,$user_list);

$fark = round(time()-$start)/60;
echo "Likes Complete (".$fark." dk.)";

}

?>

I want to stop when (example) 11 result. how can i stop curl when script count 11 result?

A: you can make an if statement only in function "authLike"  condition if(result ==11) break;
 and you if you clear your answer to help you more .


text:
Q: converting ObjectId as type:String from mongoexport back to type:ObjectId after ingesting into Mongo Database What has been done:

*

*I have exported a collection from my database using mongoexport as CSV. I found that the _id field is exported as String (ObjectId(5eeb6f8e0795936999a10110)). Note missing "". It should be like this ObjectId("5eeb6f8e0795936999a10110")

*I have done some text processing on the CSV file and made a new collection with exported _id as the new field (display_id).

*I have imported the new collection using mongoimport.

Now the problem is display_id is imported as a String, not as mongo ObjectId.  How to convert this String to ObjectId?
I read this article where we can convert from String to Int but in my case, I think I also have to do some processing on String and then convert to ObjectId.


text:
Q: HomeAsUpIndicator Custom View I'm looking at adding a custom view for the HomeAsUpIndicator whenever there are new message. I want to bring attention to the hamburger icon when there are new messages, and then use the default hamburger icon when there aren't new messages.
I have two functions to display custom icon and display default, but I want to use a custom View.
protected void setCustomIcon() {
    getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(false);
    mDrawerToggle.setDrawerIndicatorEnabled(false);
    mDrawerToggle.setHomeAsUpIndicator(R.drawable.ic_menu_hamburger);
    mDrawerToggle.setToolbarNavigationClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mDrawerLayout.openDrawer(mDrawerList);
        }
    });
}

protected void setDefaultIcon() {
    mDrawerToggle.setDrawerIndicatorEnabled(true);
}

Is there a way to use a custom View instead of a resId or a drawable?


text:
Q: How to return values from the Object Promise in Jquery I am trying to return the values from the object of Promises, the values are printed in the console but when I am displaying it on the HTML, it is showing "OBJECT PROMISE" in place of the returned Value.
My code is
const priceConversion = async(data) =>{
    const url = 'http://www.geoplugin.net/json.gp?'
    const response = await  fetch (url)
    const resJSON = await response.json()
    const val =  resJSON['geoplugin_currencySymbol'] + Math.round(data * resJSON['geoplugin_currencyConverter'])
    return val

  }

The type of val returned is String here. but as soon as it is called from an object, it gives the above mentioned output, i.e "Object Promise"
The code for the Object is
  let price = {
      basic:{
          monthly: priceConversion(0),
          annual:priceConversion(0)
        },
        standard:{
            monthly:priceConversion(9),
            annual:priceConversion(4.5),
        },
        premium:{
            monthly:priceConversion(17),
            annual:priceConversion(7)
        }
    }

For Document manipulation, I am using the following method
let monthly = true
if (monthly === true){
    $("#freeMonthly").empty().text(`${price.basic.monthly}`)
    $("#standardMonthly").empty().text(`${price.standard.monthly}`)
    $("#premiumMonthly").empty().text(`${price.premium.monthly}`)
}

It would be really great if anyone could help with this one as I couldn't find any solution that could resolve this issue.
Thank You!

A: Try to wrap everything in an async function and use await every time you call your function:

const priceConversion = async(data) => {
  const url = 'http://www.geoplugin.net/json.gp?'
  const response = await fetch(url)
  const resJSON = await response.json()
  const val = resJSON['geoplugin_currencySymbol'] + Math.round(data * resJSON['geoplugin_currencyConverter'])
  return val

}

const calculatePrice = async() => {
  return {
    basic: {
      monthly: await priceConversion(0),
      annual: await priceConversion(0)
    },
    standard: {
      monthly: await priceConversion(9),
      annual: await priceConversion(4.5),
    },
    premium: {
      monthly: await priceConversion(17),
      annual: await priceConversion(7)
    }
  }

}

const main = async() => {
  try {
    console.log("In the main")

    const price = await calculatePrice()

    let monthly = true
    if (monthly === true) {
      $("#freeMonthly").empty().text(`${price.basic.monthly}`)
      $("#standardMonthly").empty().text(`${price.standard.monthly}`)
      $("#premiumMonthly").empty().text(`${price.premium.monthly}`)
    }
  } catch (err) {
    console.log(err)
  }

}

main()

freeMonthly

standardMonthly

premiumMonthly


text:
Q: a PHPpunit test fail randomly I have a Quiz class.
This class load 10 questions from a database depending on the level and the type of the quiz Object:
level 0 load the ten first, level 1 load the next ten and so on.
So in my test i create in a test database 30 questions.
Then i create quiz object with different level and i check that the first question in the quiz steps array match what i expect.
This test "quiz_contain_steps_depending_on_type_and_level()" failed randomly at least once every 5 launches.
This is the QuizTest class
<?php

namespace App\Tests\Quiz;

use App\Quiz\Question;
use App\Quiz\Quiz;
use App\Quiz\QuizQuestionRepositoryManager;
use App\Quiz\QuizStep;
use App\Quiz\QuizType;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ObjectRepository;
use Faker\Factory;
use Faker\Generator;
use ReflectionException;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Config\Definition\Exception\Exception;

class QuizTest extends KernelTestCase
{
    use QuestionLoremTrait;
    use PrivatePropertyValueTestTrait;

    private Generator $faker;
    private ?EntityManagerInterface $em;
    private ObjectRepository $questionRepo;
    private QuizQuestionRepositoryManager $quizQuestionManager;

    protected function setUp(): void
    {
        $kernel = self::bootKernel();
        $this->faker = Factory::create();
        $this->em = $kernel->getContainer()->get('doctrine')->getManager();
        $this->em->getConnection()->beginTransaction();

        $this->questionRepo = $kernel->getContainer()->get('doctrine')->getRepository(Question::class);
        $this->quizQuestionManager = new QuizQuestionRepositoryManager($this->questionRepo);
    }

    protected function tearDown(): void
    {
        parent::tearDown();
        $this->em->getConnection()->rollBack();
        $this->em->close();
        $this->em = null;
    }

    /**
     * @test
     * @dataProvider provideQuizDataAndFirstQuestionExpectedIndex
     * @param array $quizData
     * @param int $firstQuestionExpectedIndex
     * @throws ReflectionException
     * @throws \Exception
     */
    public function quiz_contain_steps_depending_on_type_and_level(array $quizData, int $firstQuestionExpectedIndex)
    {
        //We have questions in db
        $questions = [];

        for ($q = 1; $q <= 30; $q++) {
            $question = $this->persistLoremQuestion($this->faker, $this->em);
            $questions[] = $question;
        }
        $this->em->flush();

        //When we create Quiz instance $quiz
        $quiz = new Quiz($this->quizQuestionManager,quizData:  $quizData);

        //When we look at this $quiz steps property
        $quizSteps = $quiz->getSteps();
        /** @var QuizStep $firstStep */
        $firstStep = $quizSteps[0];

        //We expect
        $this->assertNotEmpty($quizSteps);
        $this->assertCount(10, $quizSteps);

        //We expect if quiz is type normal and level variable questions depends of level:
        $this->assertEquals($firstStep->getQuestion(), $questions[$firstQuestionExpectedIndex]);

    }

    public function provideQuizDataAndFirstQuestionExpectedIndex(): array
    {
        return [
            [[], 0],
            [['type' => QuizType::NORMAL, 'level' => '1'], 10],
            [['type' => QuizType::NORMAL, 'level' => '2'], 20]
        ];
    }
}

This is the Trait who generate fake question
<?php

namespace App\Tests\Quiz;

use App\Quiz\Question;
use Doctrine\ORM\EntityManagerInterface;
use Exception;
use Faker\Generator;

Trait QuestionLoremTrait{

    /**
     * This function persist a aleatory generated question, you must flush after
     * @param Generator $faker
     * @param EntityManagerInterface $em
     * @return Question
     * @throws Exception
     */
    public function persistLoremQuestion(Generator $faker, EntityManagerInterface $em): Question
    {
        $nbrOfProps = random_int(2,4);
        $answerPosition = random_int(0, $nbrOfProps - 1);
        $props = [];

        for ($i = 0; $i < $nbrOfProps; $i++){
            $props[$i] = $faker->sentence ;
        }

        $question = new Question();

        $question
            ->setSharedId(random_int(1, 2147483647))
            ->setInfo($faker->paragraph(3))
            ->setStatement($faker->sentence ."?")
            ->setProps($props)
            ->setAnswerPosition($answerPosition)
        ;

        $em->persist($question);

        return $question;
    }
}

This is my Quiz class:
<?php

namespace App\Quiz;

use Symfony\Component\Config\Definition\Exception\Exception;

class Quiz
{
    /**
     * Quiz constructor.
     * @param QuizQuestionManagerInterface $quizQuestionManager
     * @param array $quizData
     * This array of key->value represent quiz properties.
     * Valid keys are 'step','level','type'.
     * You must use QuizType constant as type value
     * @param string $type
     * @param int $level
     * @param int $currentStep
     * @param array $steps
     */
    public function __construct(
        private QuizQuestionManagerInterface $quizQuestionManager,
        private string $type = QuizType::FAST,
        private int $level = 0,
        private array $quizData = [],
        private int $currentStep = 0,
        private array $steps = [])
    {

        if ($quizData != []) {
            $this->hydrate($quizData);
        }
        $this->setSteps();
    }

    private function hydrate(array $quizData)
    {
        foreach ($quizData as $key => $value) {
            $method = 'set' . ucfirst($key);

            // If the matching setter exists
            if (method_exists($this, $method) && $method != 'setQuestions') {
                // One calls the setter.
                $this->$method($value);
            }
        }
    }

    public function getCurrentStep(): int
    {
        return $this->currentStep;
    }

    public function getLevel(): int
    {
        return $this->level;
    }

    public function getType(): string
    {
        return $this->type;
    }

    public function getSteps(): array
    {
        return $this->steps;
    }

    private function setCurrentStep($value): void
    {
        $this->currentStep = $value;
    }

    private function setLevel(int $level): void
    {
        $this->level = $level;
    }

    private function setType($type): void
    {
        if (!QuizType::exist($type)) {
            throw new Exception("This quiz type didn't exist, you must use QuizType constante to define type", 400);
        }
        $this->type = $type;
    }

    private function setSteps()
    {
        $this->steps = [];
        $questions = $this->quizQuestionManager->getQuestions($this->type, $this->level);
        foreach ($questions as $question) {
            $this->steps[] = new QuizStep(question: $question);
        }
    }
}

This is the Question class:
<?php

namespace App\Quiz;

use App\Repository\QuestionRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * @ORM\Entity(repositoryClass=QuestionRepository::class)
 */
class Question
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
    private ?int $id;

    /**
     * @ORM\Column(type="integer")
     */
    private ?int $sharedId;

    /**
     * @ORM\Column(type="string", length=1000, nullable=true)
     * @Assert\Length(max=1000)
     */
    private ?string $info;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private ?string $statement;

    /**
     * @ORM\Column(type="array")
     */
    private array $props = [];

    /**
     * @ORM\Column(type="integer")
     */
    private ?int $answerPosition;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getSharedId(): ?int
    {
        return $this->sharedId;
    }

    public function setSharedId(int $sharedId): self
    {
        $this->sharedId = $sharedId;

        return $this;
    }

    public function getInfo(): ?string
    {
        return $this->info;
    }

    public function setInfo(?string $info): self
    {
        $this->info = $info;

        return $this;
    }

    public function getStatement(): ?string
    {
        return $this->statement;
    }

    public function setStatement(?string $statement): self
    {
        $this->statement = $statement;

        return $this;
    }

    public function getProps(): ?array
    {
        return $this->props;
    }

    public function setProps(array $props): self
    {
        $this->props = $props;

        return $this;
    }

    public function getAnswerPosition(): ?int
    {
        return $this->answerPosition;
    }

    public function setAnswerPosition(int $answerPosition): self
    {
        $this->answerPosition = $answerPosition;

        return $this;
    }
}

If anyone understands this behavior. I thank him in advance for helping me sleep better :-)

A: Thanks to @AlessandroChitolina comments.
The set of questions created in my test was not always recorded in the same order by my in my database.
So instead of testing the expected question from my starting $questions array, i retrieve the questions from the database in a new $dbQuestions array. That solve my problème.
This is the new test:
/**
     * @test
     * @dataProvider provideQuizDataAndFirstQuestionExpectedIndex
     * @param array $quizData
     * @param int $firstQuestionExpectedIndex
     * @throws \Exception
     */
    public function quiz_contain_steps_depending_on_type_and_level(array $quizData, int $firstQuestionExpectedIndex)
    {
        //We have questions in db
        $questions = [];

        for ($q = 1; $q <= 30; $q++) {
            $question = $this->persistLoremQuestion($this->faker, $this->em);
            $questions[] = $question;
        }
        $this->em->flush();

        $dbQuestions = $this->questionRepo->findAll();

        //When we create Quiz instance $quiz
        $quiz = new Quiz($this->quizQuestionManager,quizData:  $quizData);

        //When we look at this $quiz steps property
        $quizSteps = $quiz->getSteps();
        /** @var QuizStep $firstStep */
        $firstStep = $quizSteps[0];

        //We expect
        $this->assertNotEmpty($quizSteps);
        $this->assertCount(10, $quizSteps);

        //We expect if quiz is type normal and level variable questions depends of level:
        $this->assertEquals($firstStep->getQuestion(), $dbQuestions[$firstQuestionExpectedIndex]);
    }


text:
Q: Laravel: same table relationship error I am developing a directory hierarchy with JSTree.
I am setting up database columns and relatioships with the Schema builder.
here's what I have.
 Schema::create('directories', function (Blueprint $table) {
        $table->increments('id');
        $table->string('name');
        $table->string('text');
        $table->integer('parent_id')->default(0)->unsigned();
        $table->foreign('parent_id')->references('id')->on('directories')->onUpdate('cascade')->onDelete('cascade');
        $table->timestamps();

    });

during migration I get no error, but when I try to insert a record I get the error saying
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails ('dms'.'directories', CONSTRAINT 'directories_parent_id_foreign' FOREIGN KEY ('parent_id') REFERENCES 'directories' ('id') ON DELETE CASCADE ON UPDATE CASCADE) (SQL: insert into 'directories' ('name', 'text', 'parent_id', 'updated_at', 'created_at') values (Project, Project, 0, 2018-01-20 12:50:37, 2018-01-20 12:50:37))
what could be wrong with this. Thanks

A: You can't set a foreign key to 0, rather provide a real id as parent_id from directories Or you could change your schema to following to allow null as parent_id.
Schema::create('directories', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name');
    $table->string('text');
    $table->integer('parent_id')->nullable()->unsigned();
    $table->foreign('parent_id')->references('id')->on('directories')->onUpdate('cascade')->onDelete('cascade');
    $table->timestamps();

});

And in your insert method, you can skip parent_id or set to null.


text:
Q: xlrd named range not working for Excel 2013 workbooks? I am using Excel 2013, Python 3.4.1 (Anaconda 64-bit) and xlrd 0.9.3.
I made a workbook with the value 34 in cell B2, and gave B2 the name TestName.  Then I saved the workbook as a 2013-version (test13.xlsx) and a 97-03 version (test03.xls) file.
I can only get the xlrd.Name object to work as expected with the 97-03 version file.
For example:
import xlrd

rb_03 = xlrd.open_workbook("test03.xls")
rb_13 = xlrd.open_workbook("test13.xlsx")
nm_03 = rb_03.name_map.get("TestName".lower())[0]
nm_13 = rb_13.name_map.get("TestName".lower())[0]
print("nm_03.result:", nm_03.result)  # prints: nm_03.result: Operand(kind=oREF, value=[Ref3D(coords=(0, 1, 1, 2, 1, 2))], text='Sheet1!$B$2')
print("nm_13.result:", nm_13.result)  # prints: None
print(nm_03.cell())  # prints: number:34.0
print(nm_13.cell())  # fails in line 253 of xlrd/book.py with: AttributeError: 'NoneType' object has no attribute 'logfile'

Is this a bug? If not, how can I read the value of the cell named TestName in test13.xlsx?


text:
Q: Synchronize sending to a spring integration channel with spring aspect transaction I have some spring aspect. The aspects have a sequential order. In the last aspect, I send a message to a spring integration channel. I need that send to be in transactional which it syncs with all my aspects, it means when the transaction of aspects commit, then message send to the channel.
I read about ChainedTransactionManager class. but I don't understand how can I get aspects transactions and pass to this object.

A: Not sure what you can try to obtain from the ChainedTransactionManager, but for me it more sounds like a TransactionSynchronization. You register an instance of this with the TransactionSynchronizationManager.registerSynchronization() and in its afterCommit() implementaiton you send your message to the channel.
There is no reason to wrap a send to the channel if channel is not a transactional resource.


text:
Q: Prove $\sin x$ is uniformly continuous on $\mathbb R$ How do I prove $\sin x$ is uniformly continuous on $\mathbb R$ with delta and epsilon?
I proved geometrically that $\sin x<x$ and thus, $$|f(x_1)-f(x_2)|=|\sin x_1 - \sin x_2|\le|\sin x_1|+|\sin x_2|<|x_1|+|x_2|$$
But this doesn't help me much finding a delta...
Thanks for any help!
P.S. I'm only at the beginning of calculus so I can't use many theorems and derivation  (because they haven't been regorously proven).

A: There is an elementary geometric way to do this.  Let $x$ and $y$ be real numbers; for now, assume $x, y\in(-\pi, \pi]$.  Start off at $(1,0)$ and march off signed distance $x$ to get to point $a$ and $y$ to get to point $b$ on the unit circle.  Then $|x - y|$ is the distance from $a$ to $b$ along the unit circle.  $|\sin(x) - \sin(y)|$ is the distance between the $y$-coordiates of $a$ and $b$.  Hence, in this case
$$|\sin(x) - \sin(y) | \le |x - y|.$$
This gives us uniform continuity on $(-\pi, \pi]$, so by periodciity the sine function is uniformly continuous on the entire line.

A: Let $\epsilon>0$ and $x,y\in \mathbb{R}$. We want
$$\left|f(x)-f(y)\right|<\epsilon\implies \left|\sin x-\sin y\right|<\epsilon\implies \left|2\cos\frac{x+y}2\sin\frac{x-y}2\right|$$
Because
$$\left|2\cos\frac{x+y}2\sin\frac{x-y}2\right|\le 2\left|\sin\frac{x-y}2\right|$$
it suffices
$$2\left|\sin\frac{x-y}2\right|<\epsilon$$
when
$$\left|x-y\right|<\delta\implies \left|\frac{x-y}2\right|<\delta$$
SInce $\left|\sin x\right|\le \left|x\right|$,
$$2\left|\sin\frac{x-y}2\right|\le 2\left|\frac{x-y}2\right|<2\delta$$
Choosing $\delta=\frac{\epsilon}{2}>0$ will do the trick. Because $\delta$ doesn't depend on $x,y$, the continuity is uniform

A: By Mean Value Theorem,
$$ |\sin{x}- \sin{y}| \leq |x-y| |\cos{\xi}| \leq |x-y|, \quad x\leq\xi \leq y.$$
Hence, you may choose $\epsilon=\delta$.

A: Since $\sin x$ is a periodic continuous function with a period $2\pi$, it suffices to prove that it is uniformly continuous on $[0, 2\pi]$. Since $[0, 2\pi]$ is compact, this follows from the well-known theorem.


text:
Q: Adding missing LFS files that causes: Encountered X file(s) that should have been pointers, but weren't I've got a git repository that had existing files in it. I then setup git-lfs to handle files of particular types (e.g. pdf, tif etc). This works fine for new files and they are stored in LFS as expected. However, files that were already in the repo but should have been stored in LFS aren't. This leads to the error below when cloning the repo:
Encountered 361 file(s) that should have been pointers, but weren't:

How can I convert these files over so that they are stored in LFS rather than in git? I don't care about rewriting history, just need to tidy this up for moving forward.

A: How I solved it:
git lfs migrate import --no-rewrite path

See: https://tech-notes.maxmasnick.com/fixing-files-that-should-have-been-pointers-in-lfs-but-werent

A: How I solved it:

*

*Created a new branch

*Took a copy of all the files

*Deleted the ones listed that should have been pointers. Committed this change

*Copied over the files to re-add them

*Committed the new files to git (this then added them into LFS rather than the git repository)

*Pushed the changes

A: For the problem of having many many paths to fix this for, it was suggested under derekhh's answer to use git lfs migrate import --no-rewrite **/*; however—even IF everyone had extended wildcard support in their shell–this quickly fails as soon as it reaches a file in Git that doesn't match the lfs patterns in the .gitattributes file.
Here's two ways that worked for me:
Way 1

*

*assumes I know some pattern(s) that all problem paths fall under (i.e. they're all jpegs)

git lfs migrate import --no-rewrite $(find . -type f -iname '*.jpg')

Way 2

*

*if I don't care if (or actually want) a separate new commit for each fixed file

*again, assumes I know ahead of time a path pattern

find . -type f -iname '*.jpg' | while read jpg; do
  git lfs migrate import --no-rewrite "$jpg"
done

Edit 1: side note about find
Above I utilize the bash find command to list files, but I could've also used git ls-files -- '*.jpg' to the same effect. (note: the case-insensitive pathspec would be ':(icase)*.jpg'.)
It might interest you to know that git ls-files is typically faster than the find command—significantly faster on certain operating/file systems (Windows NTFS )—which might be desirable if you're dealing with a ton of files. Of course there is the general caveat that git ls-files (by default) only lists files that are tracked by the current Git repo, but in the context of this post that might actually be a good thing! I.e. It would prevent matching files in, say, submodules from getting mixed into LFS; find would not be able to differentiate.


text:
Q: How can I loop JsonModel in sapui5? I'm making my first app in sapui5.
I want create a login page with sign up and login.
In sing up I want save user name and password in a external JSON. How I can export the JSON Data?
In login I want validate password and username but i don't know how to loop the JsonModel.
I try this but of course didn't work.
var acountsJson = sap.ui.getCore().getModel("acountsModel");
for(var i = 0; i < acountsJson.length; i++) {
    var obj = acountsJson[i];

    console.log(acountsJson.id);
}

Can sap.ui.core has multiple Models?

A:
Can sap.ui.core has multiple Models?

Yes, UI5-Core can hold multiple data models. In your case the model is named "acountsModel". You can add more models with different names.
Once you access your model, by sap.ui.getCore().getModel("acountsModel").getProperty("/"); you can either loop through an array using native for() or using jQuery:

$.each(acountsJson, function(value, index, array){
  console.log(value.id);
});

Personally, I like the jQuery approach much more than the for-loop.

A: To get the JSON, you need to access your JSON Property, e.g. "/" for top node ...
var acountsJson = sap.ui.getCore().getModel("acountsModel").getProperty("/");
for(var i = 0; i < acountsJson.length; i++) {
    var obj = acountsJson[i];

    console.log(acountsJson[i].id);
}


text:
Q: Discord 'Cannot send messages to this user' error I don't know exactly how to use catch err, send a message instead of giving an error when it blocks the bot in the private message I want to do.
This code:
     try{
     message.member.send("trying private message.")
     } catch(e) {
     message.channel.send("Your private message is closed.");
     };

When I get an error the catch err part doesn't work.

A: Sending a message returns a promise. You can handle the promise error by using the catch() method.
message.member.send('Trying to send a DM!')
   .catch(error => {
      console.log(error);
      message.channel.send('Your DMs are closed.');
   });


text:
Q: UIScrollView image/photo viewer with paging enabled and zooming OK, I think it's time to make an official place on the internet for this problem: How to make a UIScrollView photoviewer with paging and zooming. Welcome my fellow UIScrollView hackers.
I have a UIScrollView with paging enabled, and I'm displaying UIImageViews like the built-in photos app. (Does this sound familiar yet?)
I found the following project on github:
https://github.com/andreyvit/ScrollingMadness/wiki
Which shows how to implement zooming in a scroll view while paging is enabled. If anyone else tries this out, I actually had to remove the UIScrollView subclass and use the native class otherwise it doesn't work. I think it's because of changes in the 3.0 SDK relating to how the scroll view intercepts touch events.
So the the idea is to remove all the other views when you start zooming, and move the current view to (0, 0) in the scrollview, updating the contentsize etc. Then when you zoom back to 1.0f it adds the other views back and puts things all back in order.
Anyway, that project works perfectly in the simulator, but on the device there is some nasty movement of the view you are resizing, which looks like it's caused by the fact we are changing the contentsize/offset etc. for the view being resized. You have to do this view moving otherwise you can pan left through the whitespace left by the other views.
I found one interesting note in the "Known Issues" of the 3.0 SDK release notes:

UIScrollView: After zooming, content inset is ignored and content is left in the wrong position.

This kind of sounds like what is happening here. After zooming in, the view will shift offscreen because you have changed the offset etc.
I've spent hours on this already and I'm slowing coming to the sad realization that this just isn't going to work.
Three20's photo viewer is out of the question: it's too heavy weight and there is too much unnecessary UI and other behaviour.
The built in Photo app seems to do some magic. If you zoom in on an image and pan to the far edges, the current photo moves independently of the photo next to it which isn't what you get when trying this with a standard UIScrollView.
I've seen discussion about nesting the UIScrollView's but I really don't want to go there.
Has anybody managed this with the standard UIScrollView (and works in the 2.2 and 3.0 SDK)? I don't fancy rolling my own zoom + bounce + pan + paging code.

A: I did some playing around with the native Photos app, and I think I can say with confidence they are using a single UIScrollView.  The giveaway is this: zoom in on an image, and pull to the left or right.  You will see the next or previous photo.  If you tug hard enough, it will even page to the next photo at 1.0f zoom.  Flip back and the previously zoomed photo will be back to 1.0f zoom as well.
Obivously I didn't write Photos.app, but I'll take a wild guess at how they did it:

*

*A single UIScrollView and a single UIScrollViewDelegate

*Populate the UIScrollView with UIImageView children

*Listen for scrollViewDidScroll:

*Do some math and figure out what page you are currently on

*Listen for viewForZoomingInScrollView:

*Return a different view depending on the page index

*Listen for scrollViewDidEndZooming:withView:atScale: and optionally do some anti-aliasing, etc based on the content

If you decide to try that out, let me know how it works out for you.  I'd love to know how you finally end up getting this to work.  Even better, post it to github.

A: UPDATE
I deleted my previous answer because of the news below...
Big news for those who haven't heard. Apple has released the 2010 WWDC session videos to all members of the iphone developer program. One of the topics discussed is how they created the photos app!!! They build a very similar app step by step and have made all the code available for free.
It does not use private api either. Here is a link to the sample code download. You will probably need to login to gain access.
Check This
And, here is a link to the iTunes WWDC page:
Check This

A: I've written a simple and easy to use photo browser called MWPhotoBrowser. I decided to create it as Three20 was too heavy/bloated as all I needed was a photo viewer.
MWPhotoBrowser can display one or more images by providing either UIImage objects, or URLs to files, web images or library assets. The photo browser handles the downloading and caching of photos from the web seamlessly. Photos can be zoomed and panned, and optional (customisable) captions can be displayed. The browser can also be used to allow the user to select one or more photos using either the grid or main image view.

A: You say you've seen discussions of nesting UIScrollViews but don't want to go there - but that is the way to go!  It works easily and well.
It's essentially what Apple does in its PhotoScroller example (and the 2010 WWDC talk linked to in Jonah's answer).  Only in those examples, they've added a whole bunch of complex tiling and other memory management.  If you don't need the tiling etc. and if you dont want to wade through those examples and try and remove the bits related to it, the underlying principle of nesting UIScrollViews is actually quite simple:

*

*Create an outer UIScrollView and set its pagingEnabled = true.  Add it to your main view and set its width and height to your main view's width and height.

*Create as many inner UIScrollViews as you want images. Set their width and height to your main view's width and height.  Add them as subviews to your outer UIScrollView, each one next to the other, left to right.

*Set the content size of the outer UIScrollView to the total of the widths of all the inner UIScrollViews side by side (which is equal to [your main view's width]*[number of images]).

*Add your images' UIImageViews to the inner UIScrollViews, one UIImageView to each inner UIScrollView.  Set each UIScrollView's content size to each UIImageView's size.

*Set min and max zoom scales for each inner UIScrollView and set each of the inner UIScrollView's delegate to your View Controller.  In the delegate's viewForZoomingInScrollView, return the appropriate UIImageView for the UIScrollView that is passed.  (To do this, just keep each of the UIImageViews in an NSArray and set the corresponding UIScrollView's tag property to the index of the appropriate UIImageView.  You can then read the tag in the UIScrollView passed to viewForZoomingInScrollView and return the appropriate UIImageView from the NSArray).
That's it.  Works just like the photo app.
If you have a lot of photos, to save memory you can just have two inner UIScrollViews and two UIImagesViews.  You then dynamically flip between them, moving their position within the outer UIScrollView and changing their images as the user scrolls the outer UIScrollView. It's a bit more complex but the same principle.

A:
I did some playing around with the
  native Photos app, and I think I can
  say with confidence they are using a
  single UIScrollView. The giveaway is
  this: zoom in on an image, and pull to
  the left or right. You will see the
  next or previous photo. If you tug
  hard enough, it will even page to the
  next photo at 1.0f zoom. Flip back and
  the previously zoomed photo will be
  back to 1.0f zoom as well.

This is wrong. I'm using nested scrollviews, and getting exactly the same effect. If you're using some memory management scheme (which I had to start using... my page number is fairly high ('bout 50 each in 2 scrollViews)), then you can use a mechanism similar to whatever you have triggering your page loads / unloads to trigger a zoom reset for the pages -1 and +1 from the current page.
I suspect that apple sets this off as soon as the previous pic has disappeared.
What I don't understand is how to achieve smooth scrolling between pages - there's always a very short hang at the moment of transition. Do not get it. I've gotten pretty deep into fixing it - NSInvocationOperations were my first stop, then I made a reusable views queue for the page views (which retain their image views)... still this durned hang.
I only have one NSOperationQueue running, and I've tried fiddling with the max number of concurrent operations. My thought was that the main thread was getting clogged by competing Queues, or maybe even one queue trying to do to much... still, the hang.
I even tried creating super low-qual versions of my media, in case that was the problem. With each image weighing in at around 10k (these are jpegs, mind you)... you guessed it. The hang's still there.
I'm pretty much resolved to do what I've done before and use TTPhotoViewController from Three20. I've spent some hours swimming through that code, and it's always a great education. At this point, though, I would really like to know where the heck this hang comes from, if only so I can spend my can't-sleep hours wondering about something less brain boiling.

A: sure would be nice if apple built an image viewer like the photos app into the SDK for us to use. I'm currently using three20 and it works great. But it is a lot of extra stuff to carry around when all you really want is the photo viewer.

A: i write a code for that , and can be as reference

*

*load current view scrollview and imageview ..
and for the screen next to the current view , only imageview

*remove all view when current page load to save memory , so good for many photo project

*use tag to differentiate different scrollview
_xxxxxxx
the download link click here

A: Take a look at https://github.com/facebook/three20/blob/master/src/Three20UI/Headers/TTPhotoViewController.h Not sure if that's what you are looking for


text:
Q: Xtext terminal rule for float I have tried to define a float type in Xtext however I receive a error message when generate aritifact :
    The following token definitions can never be matched because prior tokens match the same input:RULE_FLOAT,RULE_INT

My terminal for float is as follows:
    terminal FLOAT returns ecore::EFloat: INT '.' INT;

My float is to replicate a float that is able to be accepted by Java:
1.1 ,
1 ,
0.1

A: Terminal rules are order dependent. The first match usually wins. Your grammar seems to contain another rule that already matches INT.INT but that's impossible to tell from the information that you provide. Generally speaking it's a good idea to use data type rules to describe the syntax of floats.
That would read (note the missing terminal keyword):
Float returns ecore::EFloat: INT '.' INT;


text:
Q: Set input textfield with form validation jQuery? Here is the code;
<form data-test="loginForm-container" novalidate="" method="POST" enctype="multipart/form-data">

            Email Address*

            <input data-test="guestForm-email" aria-invalid="true" aria-required="true" id="guestForm-email" type="email" name="email" aria-labelledby="guestForm-email-label" class="css-15uq4zo e1eu3ser9" value="" aria-describedby="guestForm-email-error">

Please enter email address

<button type="submit" data-test="guestForm-submitButton" class="e1ovefus0 css-1wqqz58 e1y6awi20">Continue as Guest</button>

I tried doing;
$("#guestForm-email").value = "test@gmail.com"

but when submit it deletes the text in textfield.
I just need to learn how to validate it in JQUERY.
Can anyone help?
Thanks.

A: Not sure what exactly this has to do with validation, but this is not how you set a value to a form element in jQuery:
$("#guestForm-email").value = "test@gmail.com"

This is:
$("#guestForm-email").val("test@gmail.com")

A: First of all you cant write this as
$("#guestForm-email").value = "test@gmail.com"

this is the correct syntax
$("#guestForm-email").val("test@gmail.com")

and try to do this in function that return true if the data is valid an call it in
<form onSubmit="return validate()">

A: I guess what you are trying to do is to validate the e-mail sent on the input text field using jQuery. You can use a reg expression for this within your button's click event handler like so:
$(document).ready(function() {
    $("button[type=submit]").click(function() {
        if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test($("#guestForm-email").value)) {
            return $("#guestForm-email").value;
        } else {
            alert("Invalid E-mail");
        }
    }
}

A: I think you want to append text inside input:
$("#guestForm-email").val($("#guestForm-email").val()+"test@gmail.com")