text:
Q: Is it faster to build a worker, followed by a settler, or the other way around? In Civilization IV, both workers and settlers prevent your city's food store from increasing for as long as they are being built. Surplus food is funneled into the production of both units, speeding their creation.
A common dilemma I have at the start of the game is deciding which one to build first. I'd like to get a settler out as quickly as possible, to start another city. But without any farms, surplus food is low, so it will take longer to complete.
Alternatively, I could build a worker first, set it farming, then build my settler. Workers are significantly cheaper to produce than settlers. Perhaps the extra lead time to produce the worker would be offset by the accelerated production of the settler. But producing both the worker and the farm(s) takes time.
In general, given that I ideally want a settler as quickly as possible, is it a better strategy to build the settler first, or the worker? Are there any other factors to consider?

A: It will almost always be faster to build a worker first, then a settler. The worker can be improving your tiles while you finish the settler, and so your production will go faster. Also, the worker can build roads so that the settler will reach its destination sooner.

A: I think the biggest thing to consider is the surrounding terrain. If you have some kind of food source (rice field, cattle, etc), then I think that building a worker would be the best move. This allows you to have a solid food supply, and it will improve the build time of a subsequent settler.
If you don't have a favorable location, or if you're on the coast (where you can work the water tiles for food), then I think a settler would be a better choice.
You really have to weigh up the expansion of your empire vs the surrounding terrain. Sometimes it's conducive to quick expansion, sometimes you'll have to consolidate first.

A: If the only goal is to have a settler as early as possible, then build the settler first.  Settler costs 100 hammers, and a city with no improved tiles produces 4 hammers per turn(including food converted to hammers), so that's 25 turns.  A worker is 60 hammers, so that takes 15 turns.  In a best case scenario, the worker can immediately start chopping forests for 15 hammers every 4 turns.  After 14 turns, the worker has produced 45 hammers, and the city has produced 56 hammers and the settler is completed.  That's turn 29 of the game, 4 turns later than if you had started with the settler.
But I don't think that getting a settler as quickly as possible is the most important goal.  Usually the best start is to build a worker while researching the techs so he can immediately begin improving a very strong tile like pigs, cattle, or wheat, corn next to fresh water.  That will get you a settler on about turn 32, plus a worker and 1 to 3 improved tiles.

A: If you want a settler as fast as possible, that will come from building the settler first... but the fastest way to get two settlers out is to build a worker first.
Also, you should always consider the threat of wild animals and/or barbarians (assuming you play with them on) which could kill an undefended settler. You also need some time to scout around for the best spot for your additional cities.
Thus, it is generally advisable to get a worker first, followed by either another worker and then a warrior, or just a warrior before you really consider getting a settler up.


text:
Q: Wcf Service method Design I have a Wcf service that serves up a collection of products List to two Different ViewModels.

*

*ViewModel 1 calls WCF Service to Get a collection of Products

*ViewModel 2 calls WCF Service to Get a collection of Products

Is it bad practice to lable my WCF service methods like this

*

*List MyWCFSerive.GetProductsForViewModel1()

*List MyWCFSerive.GetProductsForViewModel2()
Is there a better alternative?

A: Yes that would be bad practice, you'd be coupling your service to a particular presentation implementation and technology.
What happens when you want a list of products on an MVC site via the same service?
If both view models retrieve the same collection of products, then they should invoke the same service method. If each view displays a different collection of products, then the methods should be named based on how the collections differ, for example if different filtering is applied then this should be implied by the method names.

redpajama_set_name: RedPajamaStackExchange


text:
Q: ie position relative bug The following code works in firefox and chrome, but in ie the div that I am trying to make appear in a certain spot doesn't appear at all.  It works the same way in all 3 browsers when position is absolute, but I need position to be relative here.  Anyone know the problem?
$('#main-chat').addClass('shrink').attr('id', '').appendTo('#other-chats' + otherChats).
    css({
        'height':'100%',
        'width':'100%',
        'position':'relative',
        'left': '-30px'
    });

A: When you position a div absolutely, it would not take into consideration the relative divs beside it.
Incase you are using relative, make sure that you are closing any left off div tags which must be closed. IE has a stricter approach towards html.


text:
Q: How to insert UIButton through code with AutoLayout feature enabled - iOS I have been trying to insert a UIButton programatically, as I am using Autolayout I have done something like that...
[self.add_scroll_view addConstraints : [NSLayoutConstraint constraintsWithVisualFormat : @"V:[date_picker_btn]-[button(==date_picker_btn)]"
                                                                                options:0
                                                                                metrics:nil
                                                                                views:NSDictionaryOfVariableBindings(date_picker_btn, button)]];

I have two questions here...
i) Button inserted is not the same width as date_picker_btn even though I mentioned button(==date_picker_btn).
ii) I have inserted properely, however below views should align accordingly down to accommodate new button... How to do that...
Thanx

A: When using the visual format language, the superview of the view for which the constraint is being described is represented by the | character.
Example:
V:|-20-[mybutton1(>=70@500)]-[mybutton2(==mybutton1)]-30-[mybutton3]-|
Refer this link

A: For first question I have mentioned V: so it means (==) will assign height not width. To set width it should start with H:.
Next question, To insert a button between two existing button need to handle already existing constraints, here above I have added new constraints only not handle old existing, so I have to delete the existing constraints, so that it avoid conflicts. Works fine.. Happy coding :)


text:
Q: Clarify one step in the probability integral transform for $Y = h(X)$: $P(Y \leq y ) = P( h(X) \leq y) = P(X \leq h^{-1}(y))$ in the proof of, e.g the probability integral transform, Sklar's theorem etc, there is a step I don't understand. Suppose that $h()$ is a monotonic transformation, hence invertible. Assume, for simplicity (although this can be generalized with the general inverse), that $h()$ is also a bijection.
Now suppose we have a random variables $X,Y$ such that $Y = h(X)$. We can write the probability distribution function of $Y$ as:
$$
P(Y \leq y) = P(h(X) \leq y)
$$
In the proofs then, there is a step which writes:
$$
P(h(X) \leq y) = P(h^{-1}(h(X)) \leq h^{-1}(y)) = P(X \leq h^{-1}(y))
$$
My problem is that I don't understand why this relation holds. Suppose $y = 0.65$, I can understand that if $h(X) \leq 0.65$ then $X \leq h^{-1} (0.65)$  because the inverse is also monotonic, hence if we apply the inverse on both sides, the inequality still holds. However, I cannot understand why the probability mass is also the same.
In other words. I agree that:
$$
h(X) \leq 0.65\\
 X \leq h^{-1} (0.65)
$$
However, I dont see how the following identity holds from the fact that $h()$ is monotonic:
$$
P(h(X) \leq 0.65) = P(X \leq h^{-1} (0.65))
$$
In other words, why the amount of probability mass follows that equality.
Thanks to everybody

A: Don't forget that the notation $P(h(X)≤y)$ is really shorthand for $P(\{\omega \, | \, h(X(\omega))≤y\})$ where $\{\omega \, | \, h(X(\omega))≤y\} \subseteq \Omega$ and $P$ is a measure on the probability space $(\Omega, F, P)$.
So if we're comfortable that
\begin{equation}
\{\omega \, | \, h(X(\omega))≤y\} = \{\omega \, | \, X(\omega)≤ h^{-1}(y)\}
\end{equation}
then you'd better hope that the $P$-measure of those sets are the same! If not, we would be in serious trouble.
Please note that you do have to be careful with $h$, it must be non-decreasing for this to hold as stated.


text:
Q: pandas combine columns without null keep string values I want to combine columns without null and keep string values.
Example data:
a,b,c
123.jpg,213.jpg,987.jpg
,159.jpg,

There is my code:
cols = ['a','b','c']
df['combine_columns'] = df[cols].stack().groupby(level=0),agg(','.join)
print(df)

And the result:
a,b,c,combine_columns
123.jpg,213.jpg,987.jpg,"123.jpg,213.jpg,987.jpg"
,159.jpg,,159.jpg

But I want something like this:
a,b,c,combine_columns
123.jpg,213.jpg,987.jpg,""123.jpg","213.jpg","987.jpg""
,159.jpg,,"159.jpg"

How can I do this?

A: You can use apply with a list comprehension and pandas.notna as filter:
df['combine_columns'] = df.apply(lambda x: ','.join([e for e in x if pd.notna(e)]),
                                 axis=1)

output:
         a        b        c          combine_columns
0  123.jpg  213.jpg  987.jpg  123.jpg,213.jpg,987.jpg
1      NaN  159.jpg      NaN                  159.jpg

Adding extra " in the string:
df['combine_columns'] = df.apply(lambda x: '"%s"' % ','.join([e for e in x if pd.notna(e)]),
                                 axis=1)

output:
         a        b        c            combine_columns
0  123.jpg  213.jpg  987.jpg  "123.jpg,213.jpg,987.jpg"
1      NaN  159.jpg      NaN                  "159.jpg"


text:
Q: React Native: Use component state for a fetch request I'm currently using fetch() to post an HTTP request with the following code:
  getAuthToken = () => {
    fetch('https://example.com/api/auth/login', {
      method: 'POST',
      headers: {
        Accept: 'application/json',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        username: 'userstring',
        password: 'passstring',
      }),
    }
  )
  .then((res) => res.json())
  .then((responseJson) => {
    return responseJson.token;
  });
  }

I would like to pass state from the component as the body data for the request. I am using JSON.stringify() to format a JSON string for the request body, but I don't know how to access the component state at this point:
  body: JSON.stringify({
    username: 'userstring',
    password: 'passstring',
  }),

One attempted I made was to do this:
  body: JSON.stringify({
    username: {this.state.username},
    password: {this.state.password},
  }),

The code above produced an error. I also attempted to use {{this.state.username}} but that also gave the same syntax error.
Is there away I can achieve what I want? I'm passing dynamic input fields and I would like to just have that field be the value of state. Any ideas?

A: If getAuthToken() is defined in your component class, then you should be able to access the state object directly, without the { .. } syntax. One approach might be as follows:
class YourComponent extends React.Component {

    // If getAuthToken defined as class field then it can access this.state
    getAuthToken = () => {

        // If state not initialized, early exit
        if(!this.state) {
            return
        }

        // Extract username and password from state
        const { username, password } = this.state

        fetch('https://example.com/api/auth/login', {
            method: 'POST',
            headers: {
            Accept: 'application/json',
            'Content-Type': 'application/json',
            },
            body: JSON.stringify({
                // Use authentication data from form in request
                username,
                password,
            })
        })
        .then((res) => res.json())
        .then((responseJson) => responseJson.token)
        .then((token) => {
            console.log(`token:${token}`)
        });
    }
}

Depending on the implementation of your component, it may be worth validating the state of your component before attempting to extract and post authentication data from it, as shown above with:
if(!this.state) {
    return
}

Hope this helps


text:
Q: Controller does not have a default constructor 500 internal server error This is my controller
 public class SuggestionController : ApiController
{
    public ISuggestionRepository Repository { get; private set; }

    public SuggestionController(ISuggestionRepository repository)
    {
        this.Repository = repository;
    }

    // to post suggestion
    [HttpPost]
    [ActionName("PostSuggestion")]
    public HttpResponseMessage PostSuggestion(Suggestion suggestion)
    {
        var answerCorrect = this.Repository.CreateSuggestion(suggestion);

        if (answerCorrect == true)
            return Request.CreateResponse(HttpStatusCode.OK);
        else
            return Request.CreateResponse(HttpStatusCode.Conflict);
    }
}

and this is my RegisterServices method in NinjectWebCommon.cs
private static void RegisterServices(IKernel kernel)
    {
        kernel.Bind<ICompetitionRepository>().To(typeof(CompetitionRepository))
            .WithConstructorArgument("serviceContext", new InMemoryDataContext<Competition>());

        kernel.Bind<ISubmissionRepository>().To(typeof(SubmissionRepository))
            .WithConstructorArgument("serviceContext", new InMemoryDataContext<Submission>());

        kernel.Bind<IUserRepository>().To(typeof(UserRepository))
            .WithConstructorArgument("serviceContext", new InMemoryDataContext<User>());

        kernel.Bind<ISuggestionRepository>().To(typeof(SuggestionRepository))
           .WithConstructorArgument("serviceContext", new InMemoryDataContext<Suggestion>());
    }

But am getting an exception that my suggestion controller does not have a default constructor and its showing a 500 internal server when am hitting the controller from a client app
I know that we get the exception of controller not having default constructor if the ninject dependency is not working properly but the below is another controller i have implemeneted similar to suggestion controller and its working absolutely fine.
 public IUserRepository Repository { get; private set; }

    public SSOController(IUserRepository repository)
    {
        this.Repository = repository;
    }

    [HttpPost]
    [ActionName("PostUser")]
    public HttpResponseMessage PostUser([FromBody]string id)
    {
        var accessToken = id;
        var client = new FacebookClient(accessToken);
        dynamic result = client.Get("me", new { fields = "name,email" });
        string name = result.name;
        string email = result.email;

        var existingUser = this.Repository.FindByUserIdentity(name);

        if (existingUser == null)
        {
            var newUser = new User
            {
                Username = name,
                Email = email,

            };

            var success = this.Repository.CreateAccount(newUser);

            if (!success)
            {
                return Request.CreateResponse(HttpStatusCode.InternalServerError);
            }

            //return created status code as we created the user
            return Request.CreateResponse<User>(HttpStatusCode.Created, newUser);
        }

        return Request.CreateResponse(HttpStatusCode.OK);

    }

}

I have no idea where am going wrong. Please let me know if u have any suggestions.
EDIT:
my Global.asax
 public class WebApiApplication : System.Web.HttpApplication
{
    protected void Application_Start()
    {
        AreaRegistration.RegisterAllAreas();

        WebApiConfig.Register(GlobalConfiguration.Configuration);
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        AuthConfig.RegisterAuth();

        GlobalConfiguration.Configuration.IncludeErrorDetailPolicy =
IncludeErrorDetailPolicy.Always;

    }

Dependency resolver am using
 // Provides a Ninject implementation of IDependencyScope
// which resolves services using the Ninject container.
public class NinjectDependencyScope : IDependencyScope
{
    IResolutionRoot resolver;

    public NinjectDependencyScope(IResolutionRoot resolver)
    {
        this.resolver = resolver;
    }

    public object GetService(Type serviceType)
    {
        if (resolver == null)
            throw new ObjectDisposedException("this", "This scope has been disposed");

        return resolver.TryGet(serviceType);
    }

    public System.Collections.Generic.IEnumerable<object> GetServices(Type serviceType)
    {
        if (resolver == null)
            throw new ObjectDisposedException("this", "This scope has been disposed");

        return resolver.GetAll(serviceType);
    }

    public void Dispose()
    {
        IDisposable disposable = resolver as IDisposable;
        if (disposable != null)
            disposable.Dispose();

        resolver = null;
    }
}

// This class is the resolver, but it is also the global scope
// so we derive from NinjectScope.
public class NinjectDependencyResolver : NinjectDependencyScope, IDependencyResolver
{
    IKernel kernel;

    public NinjectDependencyResolver(IKernel kernel)
        : base(kernel)
    {
        this.kernel = kernel;
    }

    public IDependencyScope BeginScope()
    {
        return new NinjectDependencyScope(kernel.BeginBlock());
    }
}

and calling it in CreateKernel() method in NinjectWebCommon
 private static IKernel CreateKernel()
    {
        var kernel = new StandardKernel();
        kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
        kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();

        RegisterServices(kernel);

        // Install our Ninject-based IDependencyResolver into the Web API config
        GlobalConfiguration.Configuration.DependencyResolver = new NinjectDependencyResolver(kernel);

        return kernel;
    }

Suggestion Repository
 public class SuggestionRepository : Repository<Suggestion>, ISuggestionRepository
{
    public SuggestionRepository(IServiceContext<Suggestion> servicecontext)
        : base(servicecontext)
    { }

    public bool CreateSuggestion(Suggestion suggestion)
    {
        this.ServiceContext.Create(suggestion);
        this.ServiceContext.Save();

        return true;
    }
}

ISuggestionRepository
public interface ISuggestionRepository
{
    bool CreateSuggestion(Suggestion suggestion);

}

Repository
public abstract class Repository<T>
{
    public IServiceContext<T> ServiceContext { get; private set; }

    public Repository(IServiceContext<T> serviceContext)
    {
        this.ServiceContext = serviceContext;
    }
}

IserviceContext
 public interface IServiceContext<T>
{
    IQueryable<T> QueryableEntities { get; }

    void Create(T entity);

    void Update(T entity);

    void Delete(T entity);

    void Save();
}

A: Since you're using WebApi, you will need to use the WebApi extension for Ninject.  Unfortunately, the current Ninject.WebApi nuget package is out of date, and doesn't work with the released version of WebApi.
Temporarily, until Remo gets around to updating Ninject.WebApi to the release version, you can use Ninject.WebApi-RC http://nuget.org/packages/Ninject.Web.WebApi-RC
http://www.eyecatch.no/blog/2012/06/using-ninject-with-webapi-rc/
EDIT:
To recap the information discussed in comments, Here are the recommendations:
1) Use Ninject.MVC3 and Ninject.Web.WebApi (but use Ninject.Web.WebApi-RC until the official is updated) as discussed above.  Do not use a custom DependencyResolver, and let Ninject.Web.Mvc and .WebApi do their job.
2) Change your bindings to this:
kernel.Bind<ICompetitionRepository>().To<CompetitionRepository>();
... similar bindings

3) Add a generic binding for your ServiceContext
kernel.Bind(typeof(IServiceContext<>)).To(typeof(InMemoryDataContext<>));

A: I think the problem is you're using the ApiController.
Controllers and apiControllers are using a different dependancy injection container.
Both of them however expose the same methods.
If the working controller is inheriting the Controller class then that's your cause.
For a work around take a look at
this topic

A: I have faced the same issue.
This is how I rectified:
I created a WebContainerManager which is just a static wrapper around container.
Static container wrappers useful when you don't control instantiation and can't rely on injection - e.g. action filter attributes
public static class WebContainerManager
{
    public static IKernel GetContainer()
    {
        var resolver = GlobalConfiguration.Configuration.DependencyResolver as NinjectDependencyResolver;
        if (resolver != null)
        {
            return resolver.Container;
        }

        throw new InvalidOperationException("NinjectDependencyResolver not being used as the MVC dependency resolver");
    }

    public static T Get<T>()
    {
        return GetContainer().Get<T>();
    }
}

Inside your controller, call your empty constructor like this with no parameters:
public SuggestionController() : this(WebContainerManager.Get<ISuggestionRepository>())
{

}

This should work.
This technique i got from the book on MVC4 by Jamie Kurtz @jakurtz.

A: You probably need to do some dependency injection so you can inject the ISuggestionRepository parameter on your SuggestionController constructor. To do that you need to override methods in the DefaultControllerFactory class to customize the creation of controllers. Since you are using NInject, you can have something like:
public class NInjectControllerFactory : DefaultControllerFactory
{
    private IKernel kernel = new StandardKernel(new CustomModule());

    protected override IController GetControllerInstance(System.Web.Routing.RequestContext requestContext, Type controllerType)
    {
        return controllerType == null ? null : (IController)kernel.Get(controllerType);
    }

    public class CustomModule : NinjectModule
    {
        public override void Load()
        {
            this.Bind<ICompetitionRepository>().To(typeof(CompetitionRepository))
                .WithConstructorArgument("serviceContext", new InMemoryDataContext<Competition>());

            this.Bind<ISubmissionRepository>().To(typeof(SubmissionRepository))
                .WithConstructorArgument("serviceContext", new InMemoryDataContext<Submission>());

            this.Bind<IUserRepository>().To(typeof(UserRepository))
                .WithConstructorArgument("serviceContext", new InMemoryDataContext<User>());

            this.Bind<ISuggestionRepository>().To(typeof(SuggestionRepository))
               .WithConstructorArgument("serviceContext", new InMemoryDataContext<Suggestion>());
        }
    }
}

Then in your Global.asax.cs, you can add a line to swap out the controller factory
protected void Application_Start()
{
    AreaRegistration.RegisterAllAreas();

    RegisterRoutes(RouteTable.Routes);
    ControllerBuilder.Current.SetControllerFactory(new NInjectControllerFactory());
}


text:
Q: Error in admin page Ui grid 1 exception(s):
Exception #0 (Exception): Notice: Undefined index: arguments in /var/www/dev-romanl/web/vendor/magento/module-ui/Config/Data.php on line 162
What could it be ? how to fix ?

layout.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <uiComponent name="feedback_feedback_grid" />
        </referenceContainer>
    </body>
</page>

feedback_feedback_grid

<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <argument name="data" xsi:type="array">
        <item name="js_config" xsi:type="array">
            <item name="provider" xsi:type="string">feedback_feedback_grid_listing.feedback_feedback_grid_listing_data_source</item>
            <item name="deps" xsi:type="string">feedback_feedback_grid_listing.feedback_feedback_grid_listing_data_source</item>
        </item>
        <item name="spinner" xsi:type="string">feedback_grid_columns</item>
        <item name="buttons" xsi:type="array">
            <item name="add" xsi:type="array">
                <item name="name" xsi:type="string">add</item>
                <item name="label" xsi:type="string" translate="true">Add New Entity</item>
                <item name="class" xsi:type="string">primary</item>
                <item name="url" xsi:type="string">*/*/new</item>
            </item>
        </item>
    </argument>
    <dataSource name="feedback_feedback_grid_listing_data_source">

    </dataSource>
    <listingToolbar name="listing_top">

    </listingToolbar>
    <columns name="feedback_grid_columns">

    </columns>
</listing>

di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Ronis\Feedback\Api\FeedbackRepositoryInterface" type="Ronis\Feedback\Model\FeedbackRepository" />
    <preference for="Ronis\Feedback\Api\Feedback\FeedbackInterface" type="Ronis\Feedback\Model\Feedback" />
    <virtualType name="FeedbackFeedbackGridFilterPool" type="Magento\Framework\View\Element\UiComponent\FeedbackProvider\FilterPool">
        <arguments>
            <argument name="appliers" xsi:type="array">
                <item name="regular" xsi:type="object">Magento\Framework\View\Element\UiComponent\DataProvider\RegularFilter</item>
                <item name="fulltext" xsi:type="object">Magento\Framework\View\Element\UiComponent\DataProvider\FulltextFilter</item>
            </argument>
        </arguments>
    </virtualType>
    <virtualType name="FeedbackFeedbackGridFeedbackProvider" type="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider">
        <arguments>
            <argument name="collection" xsi:type="object" shared="false">Ronis\Feedback\Model\Resource\Feedback\Collection</argument>
            <argument name="filterPool" xsi:type="object" shared="false">FeedbackFeedbackGridFilterPool</argument>
        </arguments>
    </virtualType>
    <virtualType name="Ronis\Feedback\Model\ResourceModel\Feedback\Grid\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
        <arguments>
            <argument name="mainTable" xsi:type="string">ronis_feedback_feedback</argument>
            <argument name="resourceModel" xsi:type="string">Ronis\Feedback\Model\ResourceModel\Feedback</argument>
        </arguments>
    </virtualType>
    <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
        <arguments>
            <argument name="collections" xsi:type="array">
                <item name="feedback_feedback_grid_feedback_source" xsi:type="string">Ronis\Feedback\Model\ResourceModel\Feedback\Grid\Collection</item>
            </argument>
        </arguments>
    </type>
    <type name="Ronis\Feedback\Controller\Adminhtml\Feedback\MassDelete">
        <arguments>
            <argument name="successMessage" xsi:type="string" translate="true">A total of %1 record(s) have been deleted.</argument>
            <argument name="errorMessage" xsi:type="string" translate="true">An error occurred while deleting record(s).</argument>
        </arguments>
    </type>
    <type name="Ronis\Feedback\Controller\Adminhtml\Feedback\MassDisable">
        <arguments>
            <argument name="successMessage" xsi:type="string" translate="true">A total of %1 data have been disabled.</argument>
            <argument name="errorMessage" xsi:type="string" translate="true">An error occurred while disabling selected data.</argument>
        </arguments>
    </type>
    <type name="Ronis\Feedback\Controller\Adminhtml\Feedback\MassEnable">
        <arguments>
            <argument name="successMessage" xsi:type="string" translate="true">A total of %1 data have been enabled.</argument>
            <argument name="errorMessage" xsi:type="string" translate="true">An error occurred while enabling data.</argument>
        </arguments>
    </type>
</config>


text:
Q: Tomcat Host & port Configuration I have tomcat 5.5 in my windows environment listening to the port:8080.I wanted to change the hostname from localhost to www.mydomain.com.Adding the alias name in the conf/server.xml & adding the entry in /etc/hosts file I achieved this.But I have to access the name with the port number in the URL like http://www.mydomain.com:8080/ .Is there any way with out specifying the port number in the URL, redirect/forward the requests to port 8080 if the URL is www.mydomain.com?

A: you should be able to change this in [tomcat home]/conf/server.xml (at least on a unix-type system, but should be similar on win). search for 8080 and change it there.

A: YOu shoul dfind the following line in server.xml
<Connector port="8080" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" />
change port="8080" to port="80"
Unless you already have something on port 80 of course.


text:
Q: How to bundle multiple javascript libraries with browserify? I'm trying to use Browerifiy in the browser, if I use the standalone option it exposes one module. I don't want to do this.
The website and documentation just seems to cut off everywhere I look after actually compiling the code.
No one has said how to actually use the code in the browser property.
I have a grunt task as such:
browserify: {
      standalone: {
        src: [ '<%= yeoman.server %>/shared-components/**/*.js' ],
        dest: '<%= yeoman.client %>/app/js/browserifed-shared-code.js',
        /* Commented out, zero documentation on this. Can only expose one module it seems.
        options: {
          browserifyOptions: {
            standalone: 'Utility' //Unable to say '**/*' error :-/
          }
        }
        */
      },

This seems to work, it makes a file like this:
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';

var UrlController = function(){};

UrlController.test = function () {
    return 'test';
};

module.exports = UrlController;

},{}],2:[function(require,module,exports){
'use strict';

var Utility = function(){};

Utility.isASCII = function (str) {
    return /^[\x00-\xFF]*$/.test(str);
};

Utility.isAlphaNumeric = function(str) {
    var code, i, len;
    for (i = 0, len = str.length; i < len; i++) {
        code = str.charCodeAt(i);
        if (!(code > 47 && code < 58) && // numeric (0-9)
        !(code > 64 && code < 91) && // upper alpha (A-Z)
        !(code > 96 && code < 123)) { // lower alpha (a-z)
            return false;
        }
    }
    return true;
};

module.exports = Utility;

},{}]},{},[1,2]);

I include it automatically using an injector which works simular to:
<script src="app/js/browserifed-shared-code.js"></script>

Now i expect that I'd be able to call
require('Utility');

But I get
Uncaught ReferenceError: require is not defined(…)

I have no idea/no way of loading these modules in the browser. :'-/

A: You have two choices here. Either you
SOLUTION 1
Create a standalone browserify module for each library you want to access in your browser. This has been answered in your other post. Basically you do multiple browserify bundles.
.
browserify library1.js --standalone Library1 -o library1-bundle.js
browserify library2.js --standalone Library2 -o library2-bundle.js
browserify library3.js --standalone Library3 -o library3-bundle.js

 <script src="library1-bundle.js" type="text/javascript"/>
 <script src="library2-bundle.js" type="text/javascript"/>
 <script src="library3-bundle.js" type="text/javascript"/>

So, in your building tool you would have
browserify: {
      library1 : {
        src: [ '<%= yeoman.server %>/shared-components/library1.js' ],
        dest: '<%= yeoman.client %>/app/js/library1-bundled.js',
        bundleOptions : { standalone : 'Library1' }
      },
      library2 : {
        src: [ '<%= yeoman.server %>/shared-components/library2.js' ],
        dest: '<%= yeoman.client %>/app/js/library2-bundled.js',
        bundleOptions : { standalone : 'Library2' }
      },
      library3 : {
        src: [ '<%= yeoman.server %>/shared-components/library3.js' ],
        dest: '<%= yeoman.client %>/app/js/library3-bundled.js',
        bundleOptions : { standalone : 'Library3' }
      }
}

SOLUTION 2
Or, create a main entry point for all your modules.
// ---- main.js -----
module.exports.Library1 = require('./lib1');
module.exports.Library2 = require('./lib2');
module.exports.Library3 = require('./lib3');

Then, you use browserify
browserify main.js --standalone Library -o bundle.js

Then in your browser
<script src="bundle.js" type="text/javascript"/>

In your grunt task :
browserify: {
      standalone: {
        src: [ '<%= yeoman.server %>/shared-components/main.js' ],
        dest: '<%= yeoman.client %>/app/js/main-bundled.js',
        bundleOptions : { standalone : 'Library' }
      }}

Note on Module Loaders and Browserify
Then, to expand on the answer I made on your previous post, browserify exposes it's bundled modules differently depending on the module manager present in your environment.

*

*If you are in node, it's commonJS (sync) so you can use require('');

*If you are using AMD (async), you can use that AMD syntax.

*If you are in the browser, you muse use either window. or global.

Grunt dynamic task definition
To automate this a little, you can also pass in a configuration :
bundledLibraries : [
    Library1 : {
        src : './../src/lib1.js',
        dest : './../src/lib1-bundled.js'
    },
    Library2 ...
]

Then you iterate to add them to the grunt config (
Check this article for creating them dynamically http://www.integralist.co.uk/posts/dynamic-grunt-tasks.html

A: I got this working my own way without obfuscating the project too much with dependancies.
In grunt I have
browserify: {
      standalone: {
        src: [ '<%= yeoman.server %>/shared-components/exposed-modules.js' ],
        dest: '<%= yeoman.client %>/app/js/browserifed-shared-code.js',
        options: {
          browserifyOptions: {
              standalone: 'Shared'
          }
        }
      },
    }

//In-completed example.
watch: {
      scripts: {
        files: ['<%= yeoman.server %>/shared-components/**/*.js'],
        tasks: ['browserify'],
        options: {
            spawn: false
        }
        },

Then I exposed the modules I want using:
'use strict';

//This is the main entry point for all shared libraries.

var Utility = require('./utility');
var UrlController = require('./url-controller');

var Shared = function(){};

//Added new client modules to be exposed here.
Shared.Utility = Utility;
Shared.UrlController = UrlController;

module.exports = Shared;

In the browser I can now call
shared.Utility.isAscii('test'); //Working.

And anywhere I wanna reuse I just assign in the scope, so
//Some scope.
var Utility = shared.Utility;


text:
Q: get id value from req.body.id for new value of object I have a field with id value in it. It auto created while created a new data. Concatenated with string. I have doing a try, but it gets undefined value.

*

*code:

const { id, nm_acara, tugas, nm_petugas } = req.body;

const result = await prisma.dinas.create({
  data: {
    kd_dinas: `D-${id}`,
    nm_acara,
    tugas,
    nm_petugas,
    rundown: "/texts/" + req.file.filename,
    },
});

*result:

A: Do you sure you sent the id property to the server? or was it just created by the ORM?

A: I think your code is correct
But likely id was not sent properly
So, u should check the existence of id firstly
const { id, nm_acara, tugas, nm_petugas } = req.body;

console.log(id) // print the id

If id still undefined => this issue occurs in client side

A: make sure are you using the below lines for parsing application/json!?
  app.use(express.json());
  app.use(express.urlencoded({extended:true}));

console.log the req.body for check are you getting id or not.


text:
Q: Highlight different events with different colors in a day (cell) ASP.NET calendar I am working on a page where I need to highlight different events in a day with different colors in a ASP.NET Calendar Cell. The events are store in a database with a start date column.
For example, if we have two different events for today, the cell should display half green and half red color. If there are three events for today, it would 1/3 green, 1/3 red, 1/3 blue in the cell for today.
In addition, currently I use tooltip in jquery to hover a cell, it would display a tooltip above the cell. How to handle this when we have different events in one cell?
All the answers are very much appreciated.
Thank you very much.

A: I think I could answer my own question. I used the DayRender event, and in that event, I did a select statement to get all the events information for each day of the calendars. I could get the number of events in one day from the select statement. Based on how many events on a day, I will add how many divs into the day cell; and based on number of events in one day, I can set the width of the div. In addition, when I added the divs, I added the class for the each div so that I can change the colors of each div.

A: The DayRender event on the calendar gives you full control of the cell.  The calendar essentially amounts to a table structure; you will have to use DIV's within the container with a given fixed height and manually apply this logic.  It may also be possible on the client, but I think the easiest is the server.  It won't be easy, but should be possible.


text:
Q: Why won't the spacing around my header go away? I am trying to remove the spacing around the teal box in the header. I want the bottom line to match up with the bottom of the teal box. Here is a picture of what I am trying to achieve what my goal is, followed by my code:
.

#wrap {
  margin: 0 auto;
  width: 960px;
  text-align: center;
}

body {
  margin: 0 auto;
  width: 960px;
}

#firstName {
  color: white;
  background-color: #4aaaa5;
  width: 300px;
  height: 85px;
  float: left;
  font-family: Georgia, 'Times New Roman', Times, serif;
  line-height: 250%;
  text-align: center;
}

#menu {
  color: #777777;
  background-color: white;
  width: 300px;
  height: 85px;
  font-family: Georgia, 'Times New Roman', Times, serif;
  float: right;
  line-height: 125px;
}

hr {
  margin: 0, 0, 0, 0;
  clear: both;
}

img {
  width: 200px;
  height: 200px;
}

#aboutMe {
  clear: both;
}
<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Rob Connolly's Portfolio</title>
  <link rel="stylesheet" href="/Users/georgeconnolly/Desktop/ucsd-bootcamp/homework-trial/style.css">

      Rob Connolly

            About

            Portfolio

            Contact

      About Me

      Welcome to my portfolio page. I would first like to say that I appreciate you taking the time to learn a little bit about who I am. I would describe myself as someone who has a "whatever it takes to get the job done right" outlook. For someone reason,
      it is something I was born with. No matter how large the barrier is to complete the job, I will get my project to the finish line! For example, before my wife and I got married, we needed to build a substantial budget to put on a wedding without
      depleting our savings. I told my girlfriend at the time, wife now, I will find a way to fund this whole wedding in 90 days. I accomplished that goal with 10 days to spare, $25,000. It all started with buying and selling 1100 pairs of women's shoes
      in 72 hours. Check out the pictures HERE.

      Something that sets me apart as a developer is, I look at things as an entrepreneur. I have founded 2 companies, bootstrapped them to scale, and I have had successful exits. I always try and build things in a manner that fits the project. I want to see
      my code help your business scale.

      If you have any more questions about me, my experience, or how many games is Notre Dame going to win in Football, please use the contact form above.

    Copyright ©

A: First, you should move your  to inside your . Second, you can remove the margin for #firstName by adding margin: 0 to the selector:
#firstName {
  margin: 0;
}

Then, you can use Flexbox on #menu to center your menu vertically:
#menu {
  /* Adds Flexbox to element */
  display: flex;

  /* Aligns the menu's children horizontally, putting equal
     spacing between each child  */
  justify-content: space-between;

  /* Aligns the menu's children vertically */
  align-items: center;
}

#wrap {
  margin: 0 auto;
  width: 960px;
  text-align: center;
}

body {
  margin: 0 auto;
  width: 960px;
}

#firstName {
  /* Remove margin from the div */
  margin: 0;
  color: white;
  background-color: #4aaaa5;
  width: 300px;
  height: 85px;
  float: left;
  font-family: Georgia, 'Times New Roman', Times, serif;
  line-height: 250%;
  text-align: center;
}

#menu {
  color: #777777;
  background-color: white;
  width: 300px;
  height: 85px;
  font-family: Georgia, 'Times New Roman', Times, serif;
  float: right;
  line-height: 125px;

  /* Add Flexbox to your menu*/
  display: flex;
  justify-content: space-between;
  align-items: center;
}

hr {
  margin: 0, 0, 0, 0;
  clear: both;
}

img {
  width: 200px;
  height: 200px;
}

#aboutMe {
  clear: both;
}
<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Rob Connolly's Portfolio</title>
  <link rel="stylesheet" href="/Users/georgeconnolly/Desktop/ucsd-bootcamp/homework-trial/style.css">

Rob Connolly

        About
        Portfolio

            Contact

      About Me

      Welcome to my portfolio page. I would first like to say that I appreciate you taking the time to learn a little bit about who I am. I would describe myself as someone who has a "whatever it takes to get the job done right" outlook. For someone reason,
      it is something I was born with. No matter how large the barrier is to complete the job, I will get my project to the finish line! For example, before my wife and I got married, we needed to build a substantial budget to put on a wedding without
      depleting our savings. I told my girlfriend at the time, wife now, I will find a way to fund this whole wedding in 90 days. I accomplished that goal with 10 days to spare, $25,000. It all started with buying and selling 1100 pairs of women's shoes
      in 72 hours. Check out the pictures HERE.

      Something that sets me apart as a developer is, I look at things as an entrepreneur. I have founded 2 companies, bootstrapped them to scale, and I have had successful exits. I always try and build things in a manner that fits the project. I want to see
      my code help your business scale.

      If you have any more questions about me, my experience, or how many games is Notre Dame going to win in Football, please use the contact form above.

    Copyright ©


text:
Q: Install ruby with rbenv ansible I'm trying to bootstrap a rails dev environment with ansible on Ubuntu 14.04, using rbenv to handle managing ruby versions. I have a playbook that does various things that work successfully but I've taken out the relevant parts in this gist
Upon running this task:
- name: Install ruby with rbenv
  sudo_user: "{{ username }}"
  #command: rbenv install {{ ruby_version }}
  command: zsh -lc "rbenv install {{ ruby_version }}"

I get the following error
failed: [localhost] => {"changed": true, "cmd": ["zsh", "-lc", "rbenv install 2.1.2"], "delta": "0:00:00.005791", "end": "2015-04-21 09:31:19.184810", "rc": 127, "start": "2015-04-21 09:31:19.179019"}
stderr: zsh:1: command not found: rbenv

All previous tasks are successful, including getting
For some reason upon running this I get an error that rbenv is not installed.
You can see I commented out just using "rbenv install" because someone suggested that since rbenv counts on your certain things being in your .bashrc (or .zshrc in my case) you need to run it with the shell. But this didn't work either.
I also tried adding a task to restart my shell using the raw module. And I tried running with shell instead of command.
Here's my zshrc in case that's relevant.
I checked this answer but they just mentioned a problem with using "when" with newer version. Also no one answered this question, which is similar.

A: It looks like for some reason the command zsh -lc is not properly loading the value of PATH to include the rbenv command, even though you have it set in your .zshrc.
This is a bit of a hack, but I was able to get rbenv running by replacing
command: zsh -lc "rbenv install {{ ruby_version }}"

with
command: zsh -lc "{{home_dir}}.rbenv/bin/rbenv install {{ ruby_version }}"


text:
Q: How do you correctly and quickly compare Datarows / Datatables? Update: to explain what type of Datatables I Am comparing-
"Compare two Datatables with the same columns, one Datatable is being pulled form an external server and inserted Initially, from then onwards only last 6 months of records are pulled off external database (for various reasons) , and the data is compared with local data (for a 6 month date range) to see if a DataRow has changed,needs to be deleted or added where the Row Identifier (PKey)which is essentially the SalesID + LineRow match and other columns are values to be compared to see if that row needs to be re-added/deleted because incoming columns are different to current columns and also delete rows where the incoming data does not contain those rows
so basically I want a
Exclusive Left Join [to insert that data]
and
Exclusive Right Join [to delete that data]
"
I have been doing some database coding as well as JSON pulling and I want to know what is the standard way / correct way of doing things , I started with 2 hour compare times (on dummy DB table) down to 1 hour to 1 secs (after applying my janky method to DB table Compare) and then finally used it on live pull with what seems to be correct and consistent results and so I started doing testing on Dummy data with it going from 1 hour to 26 minutes to finally <1 seconds (using my own janky way), Table sizes tested and assumed are between 100,000 & 200,000 rows
so lets go through the standard methods I tried and then go onto the janky solution I Made.
The first and obvious idea was to use two ForEach iterations (even mentally this seemed it would be slow however I thought it wouldn't be that bad considering how quick Add is, and how quickly you can compare JSON Tokens when iterating through Jarrays). Code was something like the following:
DataTable dtQueryItemsDiff = dtItems.Clone();
DataTable dtItemsDiff = dtItems.Clone();

int maxRowCountCache = dtItems.AsEnumerable().OrderBy(row => Convert.ToDateTime(row.Field<String>("Date"))).ThenBy(row => row.Field<String>("Name")).Count();
int rowcountCCache = 0;
var query = dtQuery.AsEnumerable().OrderBy(row => Convert.ToDateTime(row.Field<String>("Date"))).ThenBy(row => row.Field<String>("Name"));
foreach (DataRow drDTI in dtItems.AsEnumerable().OrderBy(row => Convert.ToDateTime(row.Field<String>("Date"))).ThenBy(row => row.Field<String>("Name")))
{
    int innerrowcount = 0;
    bool rowfound = false;
    if (query.Count() != 0)
    {
        foreach (DataRow drDTQ in query)
        {
            if (drDTI["SalesID"].ToString() == drDTI["SalesID"].ToString() && drDTI["LineNumber"].ToString() == drDTI["LineNumber"].ToString())
            {
                rowfound = true;
                break;
            }
            innerrowcount++;
        }
    }
    else
    {
        dtItemsDiff.ImportRow(drDTI);
        continue;
    }
    if (rowfound == true)
    {
        orderedDtquery.ElementAt(innerrowcount).Delete();
    }
    else
    {
        dtItemsDiff.ImportRow(drDTI);
    }
    rowcountCCache++;
    BeginInvoke(new MethodInvoker(delegate
    {
        lblDataLoadC.Text = rowcountCCache.ToString() + " / " + maxRowCountCache.ToString();
    }));
}
if (query.Count() != 0)
{
    foreach (DataRow drDTQ in query)
    {
        dtQueryItemsDiff.ImportRow(drDTQ);
    }
}

This took quite a long time about an 1H (1 Hour) to 1.5H depending on data how it was ordered etc. The benefit was that I could granularly change the code and it gave me Non-matched data in both tables, also it reduced query size searched but this wasn't fast enough for me so then I tried Linq searching where I didn't reduce list size as a I went (it was slower to delete then search then it was to just search) and this took about ~40-50 mins and looked like:
int maxRowCountCache = dtItems.AsEnumerable().OrderBy(row => Convert.ToDateTime(row.Field<String>("Date"))).ThenBy(row => row.Field<String>("Name")).Count();
int rowcountCCache = 0;
dtItems.AcceptChanges();
foreach (DataRow drDTI in dtItems.AsEnumerable().OrderBy(row => Convert.ToDateTime(row.Field<String>("Date"))).ThenBy(row => row.Field<String>("Name")))
{
    var checkIfRecordInIDB = progSettings.query.AsEnumerable().Where(row => row.Field<string>("CardRecordID") == drDTI["CardRecordID"].ToString()
    && row.Field<string>("Date") == drDTI["Date"].ToString() && row.Field<string>("SaleID") == drDTI["SaleID"].ToString()
    && row.Field<string>("ItemID") == drDTI["ItemID"].ToString() && row.Field<Int64>("LineNumber") == Convert.ToInt64(drDTI["LineNumber"].ToString())).FirstOrDefault();
    if (checkIfRecordInIDB != null)
    {
        drDTI.Delete();
    }
    rowcountCCache++;
    BeginInvoke(new MethodInvoker(delegate
    {
        lblDataLoadC.Text = rowcountCCache.ToString() + " / " + maxRowCountCache.ToString();
    }));
}
dtItems.AcceptChanges();

Benefit of this is its slightly more lazy, faster and concise, however it only gives you data in one table much like Except does and that is exactly what I tried next using ~100,000 rows of dummy data, this took 26 minutes and 35 seconds.
dtItems.Rows.Clear();
query.Rows.Clear();
Thread start = new Thread(timerAndUIupdate);
start.Start();

dtItems.Rows.Add("4 Beans Cafe", "2af0f4bf-52ea-44fb-b1b3-36181fe7bfdf", "2019-07-01", "2019-07-01", "7fc4f98a-35af-4da3-afe3-f7cfcd922ea7", "72421ee8-459b-46fb-bf5a-f51e80976e5a", "Pioneer 1kg (FT), RRP $42", "100115", 1, 25.0, "N");
dtItems.Rows.Add("4 Beans Cafe", "2af0f4bf-52ea-44fb-b1b3-36181fe7bfdf", "2019-07-01", "2019-07-01", "7fc4f98a-35af-4da3-afe3-f7cfcd922ea7", "8885a911-8d32-4dfe-93e5-2e453fd54db9", "Decaf Beans 250g FT", "1002302", 2, 2.0, "N");
dtItems.Rows.Add("4 Beans Cafe", "2af0f4bf-52ea-44fb-b1b3-36181fe7bfdf", "2019-07-01", "2019-07-01", "7fc4f98a-35af-4da3-afe3-f7cfcd922ea7", "e3aa4b15-b774-4f6a-ac21-77fa05a4332f", "P&R Cups 06oz (1000)", "30056", 3, 1.0, "N");
dtItems.Rows.Add("4 Beans Cafe", "2af0f4bf-52ea-44fb-b1b3-36181fe7bfdf", "2019-07-01", "2019-07-01", "7fc4f98a-35af-4da3-afe3-f7cfcd922ea7", "51e1a867-4079-4a3c-9ddc-e93d87d80b46", "P&R Cups 12oz (1000)", "30058", 4, 1.0, "N");
query.Rows.Add("4 Beans Cafe", "2af0f4bf-52ea-44fb-b1b3-36181fe7bfdf", "2019-07-01", "2019-07-01", "7fc4f98a-35af-4da3-afe3-f7cfcd922ea7", "72421ee8-459b-46fb-bf5a-f51e80976e5a", "Pioneer 1kg (FT), RRP $42", "100115", 1, 25.0, "N");
query.Rows.Add("4 Beans Cafe", "2af0f4bf-52ea-44fb-b1b3-36181fe7bfdf", "2019-07-01", "2019-07-01", "7fc4f98a-35af-4da3-afe3-f7cfcd922ea7", "8885a911-8d32-4dfe-93e5-2e453fd54db9", "Decaf Beans 250g FT", "1002302", 2, 2.0, "N");
query.Rows.Add("4 Beans Cafe", "2af0f4bf-52ea-44fb-b1b3-36181fe7bfdf", "2019-07-01", "2019-07-01", "7fc4f98a-35af-4da3-afe3-f7cfcd922ea7", "e3aa4b15-b774-4f6a-ac21-77fa05a4332f", "P&R Cups 06oz (1000)", "30056", 3, 1.0, "N");
query.Rows.Add("4 Beans Cafe", "2af0f4bf-52ea-44fb-b1b3-36181fe7bfdf", "2019-07-01", "2019-07-01", "7fc4f98a-35af-4da3-afe3-f7cfcd922ea7", "51e1a867-4079-4a3c-9ddc-e93d87d80b46", "P&R Cups 12oz (1000)", "30058", 4, 1.0, "N");
for (int i = 1; i < 100000; i++)
{
    dtItems.Rows.Add("Bennett St Dairy", "ed0c8d30-6469-4e13-af5a-36d7357a4a70", "2019-07-01", "2019-07-01", "8b909a4b-a07b-4a06-bebc-6a3387433aaf", "c8cc1115-da02-42cf-b427-accc1b6d07e3", "Trailblazer 1Kg, RRP $44", "10011", i, (i * 4), "N");
    query.Rows.Add("Bennett St Dairy", "ed0c8d30-6469-4e13-af5a-36d7357a4a70", "2019-07-01", "2019-07-01", "8b909a4b-a07b-4a06-bebc-6a3387433aaf", "c8cc1115-da02-42cf-b427-accc1b6d07e3", "Trailblazer 1Kg, RRP $44", "10011", i, (i * 4), "N");
}
dtItems.Rows.Add("Air Coffee International Cafe Pty Ltd", "bb4fa724-9759-4c60-93fe-70fbdfd00417", "2019-07-01", "2019-07-01", "b972f020-3740-4ef2-941f-78b1a9edefa8", "0be54733-ac0e-43f9-8ea5-204c7cdb5f48", "Custom 1kg", "100116", 1, 4.0, "N");
dtItems.Rows.Add("Allure Cafe & Co.", "f76f383f-e9f4-45c9-bb93-81102629b9c3", "2019-07-01", "2019-07-01", "2ad0667f-2254-4df5-8b24-eb36736cabb0", "6edc584b-a8eb-4f0b-a449-dbcb76a40a24", "Porter St 1Kg, RRP $40", "100111", 1, 10.0, "N");
dtItems.Rows.Add("Mad Hatter Wine Co", "49340e5f-c7ef-41d9-9f1b-200711e6e629", "2021-07-28", "2021-07-28", "e16cbbac-c319-45f3-ac53-89d979fbcdc1", "6edc584b-a8eb-4f0b-a449-dbcb76a40a24", "Porter St 1Kg, RRP $40", "100111", 1, 30.0, "N");
dtItems.Rows.Add("Mad Hatter Wine Co", "49340e5f-c7ef-41d9-9f1b-200711e6e629", "2021-07-28", "2021-07-28", "e16cbbac-c319-45f3-ac53-89d979fbcdc1", "51e1a867-4079-4a3c-9ddc-e93d87d80b46", "P&R Cups 12oz (1000)", "30058", 2, 12.0, "N");
dtItems.Rows.Add("Mad Hatter Wine Co", "49340e5f-c7ef-41d9-9f1b-200711e6e629", "2021-07-28", "2021-07-28", "e16cbbac-c319-45f3-ac53-89d979fbcdc1", "401ce902-e158-4f21-85a5-3312c32457fc", "Lids 06/08/12oz (White) (1000)", "30062", 3, 7.0, "N");
dtItems.Rows.Add("Mad Hatter Wine Co", "49340e5f-c7ef-41d9-9f1b-200711e6e629", "2021-07-28", "2021-07-28", "e16cbbac-c319-45f3-ac53-89d979fbcdc1", "9b80c825-6e9f-4f6b-9c77-f3378cc220e4", "4-Cup Cardboard Holders (300)", "41003", 4, 1.0, "N");
dtItems.Rows.Add("Mad Hatter Wine Co", "49340e5f-c7ef-41d9-9f1b-200711e6e629", "2021-07-28", "2021-07-28", "e16cbbac-c319-45f3-ac53-89d979fbcdc1", "ea4c906e-fab1-4b15-8845-619f20e53c6a", "Organic Panela 1kg", "20014", 5, 2.0, "N");
dtItems.Rows.Add("Mad Hatter Wine Co", "49340e5f-c7ef-41d9-9f1b-200711e6e629", "2021-07-28", "2021-07-28", "e16cbbac-c319-45f3-ac53-89d979fbcdc1", "bb3e1c10-9e67-46d3-99b4-17df45dead90", "Chocolate Powder 1Kg, RRP $25", "20034", 6, 1.0, "N");

query.Rows.Add("Aussie Bites Cafe", "30389aca-9089-4b37-9a1e-5fbc3c2af485", "2019-07-01", "2019-07-01", "85df1af6-3d1e-4e04-8fe9-d90462a59d4c", "ea89ade4-c7ff-4d79-abcd-dcdbb8122562", "X Blend 1Kg, RRP $40", "100112", 1, 4.0, "N");
query.Rows.Add("Aussie Bites Cafe", "30389aca-9089-4b37-9a1e-5fbc3c2af485", "2019-07-01", "2019-07-01", "85df1af6-3d1e-4e04-8fe9-d90462a59d4c", "21fe57ad-08f9-4c8b-81d0-d7b88b291571", "webfreight", "webfreight", 2, 1.0, "N");
query.Rows.Add("Mad Hatter Wine Co", "49340e5f-c7ef-41d9-9f1b-200711e6e629", "2021-07-28", "2021-07-28", "e16cbbac-c319-45f3-ac53-89d979fbcdc1", "6edc584b-a8eb-4f0b-a449-dbcb76a40a24", "Porter St 1Kg, RRP $40", "100111", 1, 30.0, "N");
query.Rows.Add("Mad Hatter Wine Co", "49340e5f-c7ef-41d9-9f1b-200711e6e629", "2021-07-28", "2021-07-28", "e16cbbac-c319-45f3-ac53-89d979fbcdc1", "51e1a867-4079-4a3c-9ddc-e93d87d80b46", "P&R Cups 12oz (1000)", "30058", 2, 1.0, "N");
query.Rows.Add("Mad Hatter Wine Co", "49340e5f-c7ef-41d9-9f1b-200711e6e629", "2021-07-28", "2021-07-28", "e16cbbac-c319-45f3-ac53-89d979fbcdc1", "401ce902-e158-4f21-85a5-3312c32457fc", "Lids 06/08/12oz (White) (1000)", "30062", 3, 2.0, "N");
query.Rows.Add("Mad Hatter Wine Co", "49340e5f-c7ef-41d9-9f1b-200711e6e629", "2021-07-28", "2021-07-28", "e16cbbac-c319-45f3-ac53-89d979fbcdc1", "9b80c825-6e9f-4f6b-9c77-f3378cc220e4", "4-Cup Cardboard Holders (300)", "41003", 4, 1.0, "N");
Stopwatch pullTime = new();
pullTime.Start();

BeginInvoke(new MethodInvoker(delegate
{
    lblTimerAddRowEnd.Text = "Start Time,Except: " + pullTime.Elapsed.ToString("mm\\:ss\\.ff");
}));

var orderedDtItems = dtItems.AsEnumerable().OrderBy(row => Convert.ToDateTime(row.Field<String>("Date"))).ThenBy(row => row.Field<String>("Name"));
var orderedDtquery = query.AsEnumerable().OrderBy(row => Convert.ToDateTime(row.Field<String>("Date"))).ThenBy(row => row.Field<String>("Name"));
DataTable excepteditems = orderedDtItems.Except(orderedDtquery, DataRowComparer.Default).CopyToDataTable();

BeginInvoke(new MethodInvoker(delegate
{
    labelControl1.Text = "End Time,Except: " + pullTime.Elapsed.ToString("mm\\:ss\\.ff");
}));

BeginInvoke(new MethodInvoker(delegate
{
    dgvResults.DataSource = excepteditems;
    btnStart.Enabled = true;
    simpleButton1.Enabled = true;
}));

With this updater code for UI (this was threaded and used for all test comparisons):
private void timerAndUIupdate()
{
    Stopwatch pullTime = new();
    pullTime.Start();
    do
    {
        Thread.Sleep(500);
        BeginInvoke(new MethodInvoker(delegate
        {
            lblTimer.Text = "Timer: " + pullTime.Elapsed.ToString("mm\\:ss\\.ff");
            Application.DoEvents();
        }));
    } while (btnStart.Enabled == false);
    pullTime.Stop();
    BeginInvoke(new MethodInvoker(delegate
    {
        lblTimer.Text = "Timer: " + pullTime.Elapsed.ToString("mm\\:ss\\.ff");
        Application.DoEvents();
    }));
}

And results on Winforms looked like this:

Then I did my janky way and the results were very fast and seemed quite accurate, and because it only took a fractions of a second I could perform this multiple times to get, New rows , Old rows not in pull that should not be deleted and Old Rows that should be Deleted -> code looked like this
dtItems.Rows.Clear();
query.Rows.Clear();
Thread start = new Thread(timerAndUIupdate);
start.Start();

dtItems.Rows.Add("4 Beans Cafe", "2af0f4bf-52ea-44fb-b1b3-36181fe7bfdf", "2019-07-01", "2019-07-01", "7fc4f98a-35af-4da3-afe3-f7cfcd922ea7", "72421ee8-459b-46fb-bf5a-f51e80976e5a", "Pioneer 1kg (FT), RRP $42", "100115", 1, 25.0, "N");
dtItems.Rows.Add("4 Beans Cafe", "2af0f4bf-52ea-44fb-b1b3-36181fe7bfdf", "2019-07-01", "2019-07-01", "7fc4f98a-35af-4da3-afe3-f7cfcd922ea7", "8885a911-8d32-4dfe-93e5-2e453fd54db9", "Decaf Beans 250g FT", "1002302", 2, 2.0, "N");
dtItems.Rows.Add("4 Beans Cafe", "2af0f4bf-52ea-44fb-b1b3-36181fe7bfdf", "2019-07-01", "2019-07-01", "7fc4f98a-35af-4da3-afe3-f7cfcd922ea7", "e3aa4b15-b774-4f6a-ac21-77fa05a4332f", "P&R Cups 06oz (1000)", "30056", 3, 1.0, "N");
dtItems.Rows.Add("4 Beans Cafe", "2af0f4bf-52ea-44fb-b1b3-36181fe7bfdf", "2019-07-01", "2019-07-01", "7fc4f98a-35af-4da3-afe3-f7cfcd922ea7", "51e1a867-4079-4a3c-9ddc-e93d87d80b46", "P&R Cups 12oz (1000)", "30058", 4, 1.0, "N");
query.Rows.Add("4 Beans Cafe", "2af0f4bf-52ea-44fb-b1b3-36181fe7bfdf", "2019-07-01", "2019-07-01", "7fc4f98a-35af-4da3-afe3-f7cfcd922ea7", "72421ee8-459b-46fb-bf5a-f51e80976e5a", "Pioneer 1kg (FT), RRP $42", "100115", 1, 25.0, "N");
query.Rows.Add("4 Beans Cafe", "2af0f4bf-52ea-44fb-b1b3-36181fe7bfdf", "2019-07-01", "2019-07-01", "7fc4f98a-35af-4da3-afe3-f7cfcd922ea7", "8885a911-8d32-4dfe-93e5-2e453fd54db9", "Decaf Beans 250g FT", "1002302", 2, 2.0, "N");
query.Rows.Add("4 Beans Cafe", "2af0f4bf-52ea-44fb-b1b3-36181fe7bfdf", "2019-07-01", "2019-07-01", "7fc4f98a-35af-4da3-afe3-f7cfcd922ea7", "e3aa4b15-b774-4f6a-ac21-77fa05a4332f", "P&R Cups 06oz (1000)", "30056", 3, 1.0, "N");
query.Rows.Add("4 Beans Cafe", "2af0f4bf-52ea-44fb-b1b3-36181fe7bfdf", "2019-07-01", "2019-07-01", "7fc4f98a-35af-4da3-afe3-f7cfcd922ea7", "51e1a867-4079-4a3c-9ddc-e93d87d80b46", "P&R Cups 12oz (1000)", "30058", 4, 1.0, "N");
for (int i = 1; i < 100000; i++)
{
    dtItems.Rows.Add("Bennett St Dairy", "ed0c8d30-6469-4e13-af5a-36d7357a4a70", "2019-07-01", "2019-07-01", "8b909a4b-a07b-4a06-bebc-6a3387433aaf", "c8cc1115-da02-42cf-b427-accc1b6d07e3", "Trailblazer 1Kg, RRP $44", "10011", i, (i * 4), "N");
    query.Rows.Add("Bennett St Dairy", "ed0c8d30-6469-4e13-af5a-36d7357a4a70", "2019-07-01", "2019-07-01", "8b909a4b-a07b-4a06-bebc-6a3387433aaf", "c8cc1115-da02-42cf-b427-accc1b6d07e3", "Trailblazer 1Kg, RRP $44", "10011", i, (i * 4), "N");
}
dtItems.Rows.Add("Air Coffee International Cafe Pty Ltd", "bb4fa724-9759-4c60-93fe-70fbdfd00417", "2019-07-01", "2019-07-01", "b972f020-3740-4ef2-941f-78b1a9edefa8", "0be54733-ac0e-43f9-8ea5-204c7cdb5f48", "Custom 1kg", "100116", 1, 4.0, "N");
dtItems.Rows.Add("Allure Cafe & Co.", "f76f383f-e9f4-45c9-bb93-81102629b9c3", "2019-07-01", "2019-07-01", "2ad0667f-2254-4df5-8b24-eb36736cabb0", "6edc584b-a8eb-4f0b-a449-dbcb76a40a24", "Porter St 1Kg, RRP $40", "100111", 1, 10.0, "N");
dtItems.Rows.Add("Mad Hatter Wine Co", "49340e5f-c7ef-41d9-9f1b-200711e6e629", "2021-07-28", "2021-07-28", "e16cbbac-c319-45f3-ac53-89d979fbcdc1", "6edc584b-a8eb-4f0b-a449-dbcb76a40a24", "Porter St 1Kg, RRP $40", "100111", 1, 30.0, "N");
dtItems.Rows.Add("Mad Hatter Wine Co", "49340e5f-c7ef-41d9-9f1b-200711e6e629", "2021-07-28", "2021-07-28", "e16cbbac-c319-45f3-ac53-89d979fbcdc1", "51e1a867-4079-4a3c-9ddc-e93d87d80b46", "P&R Cups 12oz (1000)", "30058", 2, 12.0, "N");
dtItems.Rows.Add("Mad Hatter Wine Co", "49340e5f-c7ef-41d9-9f1b-200711e6e629", "2021-07-28", "2021-07-28", "e16cbbac-c319-45f3-ac53-89d979fbcdc1", "401ce902-e158-4f21-85a5-3312c32457fc", "Lids 06/08/12oz (White) (1000)", "30062", 3, 7.0, "N");
dtItems.Rows.Add("Mad Hatter Wine Co", "49340e5f-c7ef-41d9-9f1b-200711e6e629", "2021-07-28", "2021-07-28", "e16cbbac-c319-45f3-ac53-89d979fbcdc1", "9b80c825-6e9f-4f6b-9c77-f3378cc220e4", "4-Cup Cardboard Holders (300)", "41003", 4, 1.0, "N");
dtItems.Rows.Add("Mad Hatter Wine Co", "49340e5f-c7ef-41d9-9f1b-200711e6e629", "2021-07-28", "2021-07-28", "e16cbbac-c319-45f3-ac53-89d979fbcdc1", "ea4c906e-fab1-4b15-8845-619f20e53c6a", "Organic Panela 1kg", "20014", 5, 2.0, "N");
dtItems.Rows.Add("Mad Hatter Wine Co", "49340e5f-c7ef-41d9-9f1b-200711e6e629", "2021-07-28", "2021-07-28", "e16cbbac-c319-45f3-ac53-89d979fbcdc1", "bb3e1c10-9e67-46d3-99b4-17df45dead90", "Chocolate Powder 1Kg, RRP $25", "20034", 6, 1.0, "N");

query.Rows.Add("Aussie Bites Cafe", "30389aca-9089-4b37-9a1e-5fbc3c2af485", "2019-07-01", "2019-07-01", "85df1af6-3d1e-4e04-8fe9-d90462a59d4c", "ea89ade4-c7ff-4d79-abcd-dcdbb8122562", "X Blend 1Kg, RRP $40", "100112", 1, 4.0, "N");
query.Rows.Add("Aussie Bites Cafe", "30389aca-9089-4b37-9a1e-5fbc3c2af485", "2019-07-01", "2019-07-01", "85df1af6-3d1e-4e04-8fe9-d90462a59d4c", "21fe57ad-08f9-4c8b-81d0-d7b88b291571", "webfreight", "webfreight", 2, 1.0, "N");
query.Rows.Add("Mad Hatter Wine Co", "49340e5f-c7ef-41d9-9f1b-200711e6e629", "2021-07-28", "2021-07-28", "e16cbbac-c319-45f3-ac53-89d979fbcdc1", "6edc584b-a8eb-4f0b-a449-dbcb76a40a24", "Porter St 1Kg, RRP $40", "100111", 1, 30.0, "N");
query.Rows.Add("Mad Hatter Wine Co", "49340e5f-c7ef-41d9-9f1b-200711e6e629", "2021-07-28", "2021-07-28", "e16cbbac-c319-45f3-ac53-89d979fbcdc1", "51e1a867-4079-4a3c-9ddc-e93d87d80b46", "P&R Cups 12oz (1000)", "30058", 2, 1.0, "N");
query.Rows.Add("Mad Hatter Wine Co", "49340e5f-c7ef-41d9-9f1b-200711e6e629", "2021-07-28", "2021-07-28", "e16cbbac-c319-45f3-ac53-89d979fbcdc1", "401ce902-e158-4f21-85a5-3312c32457fc", "Lids 06/08/12oz (White) (1000)", "30062", 3, 2.0, "N");
query.Rows.Add("Mad Hatter Wine Co", "49340e5f-c7ef-41d9-9f1b-200711e6e629", "2021-07-28", "2021-07-28", "e16cbbac-c319-45f3-ac53-89d979fbcdc1", "9b80c825-6e9f-4f6b-9c77-f3378cc220e4", "4-Cup Cardboard Holders (300)", "41003", 4, 1.0, "N");

Stopwatch pullTime = new();
pullTime.Start();

BeginInvoke(new MethodInvoker(delegate
{
    lblTimerAddRowEnd.Text = "Start Time,Except: " + pullTime.Elapsed.ToString("mm\\:ss\\.ff");
}));
var orderedDtItems = dtItems.AsEnumerable().OrderBy(row => Convert.ToDateTime(row.Field<String>("Date"))).ThenBy(row => row.Field<String>("Name"));
var orderedDtquery = query.AsEnumerable().OrderBy(row => Convert.ToDateTime(row.Field<String>("Date"))).ThenBy(row => row.Field<String>("Name"));

dtOnlyNewRows.Rows.Clear();
HashSet<String> orderedDtItemsHS = new();
HashSet<String> orderedDtqueryHS = new();
HashSet<String> orderedDtItemsHSRemains = new();
HashSet<String> orderedDtqueryHSRemains = new();
foreach (DataRow dr in orderedDtquery)
{
    orderedDtqueryHSRemains.Add(dr["CardRecordID"].ToString() + "⌁" + dr["Date"].ToString() + "⌁" + dr["SaleID"].ToString() + "⌁" + dr["ItemID"].ToString()
        + "⌁" + dr["LineNumber"].ToString() + "⌁" + dr["Quantity"].ToString());
    orderedDtqueryHS.Add(dr["CardRecordID"].ToString() + "⌁" + dr["Date"].ToString() + "⌁" + dr["SaleID"].ToString() + "⌁" + dr["ItemID"].ToString()
        + "⌁" + dr["LineNumber"].ToString() + "⌁" + dr["Quantity"].ToString());
}
foreach (DataRow dr in orderedDtItems)
{
    orderedDtItemsHSRemains.Add(dr["CardRecordID"].ToString() + "⌁" + dr["Date"].ToString() + "⌁" + dr["SaleID"].ToString() + "⌁" + dr["ItemID"].ToString()
        + "⌁" + dr["LineNumber"].ToString() + "⌁" + dr["Quantity"].ToString());
    orderedDtItemsHS.Add(dr["CardRecordID"].ToString() + "⌁" + dr["Date"].ToString() + "⌁" + dr["SaleID"].ToString() + "⌁" + dr["ItemID"].ToString()
        + "⌁" + dr["LineNumber"].ToString() + "⌁" + dr["Quantity"].ToString());
    bool added = orderedDtqueryHSRemains.Add(dr["CardRecordID"].ToString() + "⌁" + dr["Date"].ToString() + "⌁" + dr["SaleID"].ToString() + "⌁" + dr["ItemID"].ToString()
        + "⌁" + dr["LineNumber"].ToString() + "⌁" + dr["Quantity"].ToString());
    if (added == false)
    {
        orderedDtqueryHSRemains.Remove(dr["CardRecordID"].ToString() + "⌁" + dr["Date"].ToString() + "⌁" + dr["SaleID"].ToString() + "⌁" + dr["ItemID"].ToString()
        + "⌁" + dr["LineNumber"].ToString() + "⌁" + dr["Quantity"].ToString());
    }
    else if (added == true)
    {
        dtOnlyNewRows.ImportRow(dr);
        orderedDtqueryHSRemains.Remove(dr["CardRecordID"].ToString() + "⌁" + dr["Date"].ToString() + "⌁" + dr["SaleID"].ToString() + "⌁" + dr["ItemID"].ToString()
        + "⌁" + dr["LineNumber"].ToString() + "⌁" + dr["Quantity"].ToString());
    }
}

foreach (DataRow dr in orderedDtquery)
{
    bool added = orderedDtItemsHSRemains.Add(dr["CardRecordID"].ToString() + "⌁" + dr["Date"].ToString() + "⌁" + dr["SaleID"].ToString() + "⌁" + dr["ItemID"].ToString()
        + "⌁" + dr["LineNumber"].ToString() + "⌁" + dr["Quantity"].ToString());
    if (added == false)
    {
        orderedDtItemsHSRemains.Remove(dr["CardRecordID"].ToString() + "⌁" + dr["Date"].ToString() + "⌁" + dr["SaleID"].ToString() + "⌁" + dr["ItemID"].ToString()
        + "⌁" + dr["LineNumber"].ToString() + "⌁" + dr["Quantity"].ToString());
    }
    else if (added == true)
    {
        DateTime rowTime = Convert.ToDateTime(dr["date"].ToString());
        if (rowTime <= MonthCutOff)
        {
            dtOnlyLeftoverRows.ImportRow(dr);
        }
        else
        {
            dtOnlyDeleteRows.ImportRow(dr);
        }
        orderedDtItemsHSRemains.Remove(dr["CardRecordID"].ToString() + "⌁" + dr["Date"].ToString() + "⌁" + dr["SaleID"].ToString() + "⌁" + dr["ItemID"].ToString()
        + "⌁" + dr["LineNumber"].ToString() + "⌁" + dr["Quantity"].ToString());
    }
}

Debug.WriteLine(dtOnlyNewRows.Rows.Count.ToString());
BeginInvoke(new MethodInvoker(delegate
{
    labelControl1.Text = "End Time,Except: " + pullTime.Elapsed.ToString("mm\\:ss\\.ff");
}));
pullTime.Stop();
BeginInvoke(new MethodInvoker(delegate
{
    dgvRowsRemaing.DataSource = dtOnlyLeftoverRows;
    dgvResults.DataSource = dtOnlyNewRows;
    dgvDeleteRows.DataSource = dtOnlyDeleteRows;
    btnStart.Enabled = true;
}));

And the end result looked as follows:

After all this explanation comes my questions:

*

*What did I do wrong in the other methods, can they be made faster?

*How should I compare Datatables, if my janky methods is not OK?

*As long as it works and is fast even if janky, is it OK?

*What are the possible problems with my janky method?

Edited: 2021-08-03 11:25 PM AEST(Australian Eastern Standard Time)
the Code Juris wrote is Neater and Much Quicker,
What it looks like when applied to my dummy data
Windows Forms
3 x quicker , less messy code, way shorter
this was exactly what I was looking for thank you

A: I'd do this by indexing the datatables with a pair of dictionaries. DataTable can have primary keys defined and perform fast lookups that use dictionaries internally but in general working with datatables is pretty ugly stuff so no point adding to it with more PK ugly
So we have some datatable on the right, and it's downlaoded from a DB, and you have decided that the "Foo" and "Bar" columns are the PK. Foo is a string, Bar is an int:
Dim rIndex = new Dictionary(Of (ValueTuple(Of String, Integer), DataRow)

For Each r as DataRow In rightDt.Rows
  Dim key = ( r.Field(Of String)("Foo"), r.Field(Of Integer)("Bar") )
  rIndex(key) = r
Next r

And we have some file that's been read into the left datatable. The file's columns happen to be called Wit (string) and Woo (int)
Dim lIndex = new Dictionary(Of (ValueTuple(Of String, Integer), DataRow)

For Each r as DataRow In leftDt.Rows
  Dim key = (r.Field(Of String)("Wit"), r.Field(Of Integer)("Woo") )
  lIndex(key) = r
Next r

Now it's probably going to make life easy if we stash the keys into a hashset too as we go; this represents the union of the left and the right
Dim allKeys as New HashSet(Of ValueTuple(Of String, Integer))

Dim rIndex = new Dictionary(Of (ValueTuple(Of String, Integer), DataRow)

For Each r as DataRow In rightDt.Rows
  Dim key = ( r.Field(Of String)("Foo"), r.Field(Of Integer)("Bar") )
  rIndex(key) = r
  allKeys.Add(key)
Next r

Dim lIndex = new Dictionary(Of (ValueTuple(Of String, Integer), DataRow)

For Each r as DataRow In leftDt.Rows
  Dim key = (r.Field(Of String)("Wit"), r.Field(Of Integer)("Woo") )
  lIndex(key) = r
  allKeys.Add(key)
Next r

All that remains is to enumerate the allKeys and ask the dictionaries whether they contain it or not and decide what to do
For Each k in allKeys
  Dim inL = lIndex.ContainsKey(k)
  Dim inR = rIndex.ContainsKey(k)

  If inL AndAlso inR Then
    Dim updateRo = lIndex(k) 'update the db using this datarow
    ...
  ElseIf inL Then
    Dim insertRo = lIndex(k) 'insert this row to the db
    ...
  Else
    Dim deleteRo = rIndex(k) 'delete this row from the db
    ...
  End If
Next k

--
Hah, just realized my brain is still in VB mode. Here's the C# version of the above:
var allKeys = new HashSet<(string, int)>();

var rIndex = new Dictionary<(string, int), DataRow>();

foreach(DataRow r in rightDt.Rows){
  var key = (r.Field<string>("Foo"), r.Field<int>("Bar"));
  rIndex[key] = r;
  allKeys.Add(key);
}

var lIndex = new Dictionary<(string, int), DataRow>();

foreach(DataRow r in leftDt.Rows){
  var key = (r.Field<string>("Wit"), r.Field<int>("Woo"));
  lIndex[key] = r;
  allKeys.Add(key);
}

foreach(var k in allKeys){
  var inL = lIndex.ContainsKey(k);
  var inR = rIndex.ContainsKey(k);

  if(inL && inR){
    var updateRo = lIndex[k]; //update the db using this datarow
    ...
  } else if(inL){
    var insertRo = lIndex[k]; //insert this row to the db
    ...
  } else {
    var deleteRo = rIndex[k]; //delete this row from the db
    ...
  }
}

You can see a working sample at https://dotnetfiddle.net/3jfrPl


text:
Q: Is there a way to validate phone number globally inLaravel? I have validated UAE-based phone numbers in Laravel. Is there any way to validate all countries numbers (not only UAE-based)?
$messages = [
    'required' => 'The :attribute field is required.',
    'integer' => 'The :attribute field value should be an integer.',
    'regex' => 'The :attribute is invalid',
    'digits' => 'The :attribute is invalid',
];

$validator = Validator::make($request->all(),
    [
        'number' => 'required|digits:12|regex:/(9715)[0-9]{8}/',
        'service' => 'required|integer'
    ],
    $messages
);


text:
Q: Creating TIN and contours in ArcGIS for Desktop? I am upgrading from ArcView 3.1 to ArcMap 10.1. I have multiple LIDAR (bare earth) .txt files (x,y,z) that I would like to use to create a "TIN" (or is it Terrain Dataset in 10.1) and then contours?
I am unable to figure out how to do this in 10.1 and I have googled and read just about everything.
It was easy in ArcView 3.1 even though it had limitations (just a few steps). I have the full licensed 10.1 with all the 3D Analyst and variable extensions.
Can anyone point me in the right direction as I am currently working on a project?

A: If you are open to installing a fairly standard, free, standalone set of LiDAR tools, look into FUSION (software here, manual here). XYZ2DTM tool will convert the .xyz to PLANS DTM format, then DTM2ASCII tool will convert the dtm to an ArcGIS-readable format. Then convert to TIN or contour as you choose.
edit: it looks like ArcGIS' ASCII 3D To Feature Class (3D Analyst) may also give you the result you're after.


text:
Q: delete WSFC 2012 cluster role/group fails PS C:\Windows\system32> get-cluster

Name
----
sql2012poc_cl1

PS C:\Windows\system32> get-clustergroup

Name                                    OwnerNode                               State
----                                    ---------                               -----
AG1                                     srvgnpw049                              Failed
Available Storage                       srvgnpw049                              Offline
Cluster Group                           srvgnpw049                              Online

PS C:\Windows\system32> remove-clustergroup AG1
remove-clustergroup : The object has been deleted from the cluster.
At line:1 char:1
+ remove-clustergroup AG1
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (:) [Remove-ClusterGroup], ClusterCmdletException
    + FullyQualifiedErrorId : ClusterObjectNotFound,Microsoft.FailoverClusters.PowerShell.RemoveClusterGroupCommand
PS C:\Windows\system32> get-clusterresource
get-clusterresource : The object has been deleted from the cluster.
At line:1 char:1
+ get-clusterresource
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (:) [Get-ClusterResource], ClusterCmdletException
    + FullyQualifiedErrorId : ClusterObjectNotFound,Microsoft.FailoverClusters.PowerShell.GetResourceCommand
PS C:\Windows\system32>

I am trying to delete Cluster Role from Windows 2012 Failover Cluster but get above error in both WFC Manager GUI and PS.
AG1 cluster role is still visible in GUI and Cluster Core Resources is empty in GUI.
Please advise how AG1 role can be removed and cluster core resources be visible again.

A: As a quick workaround ended up deleting whole cluster:
PS C:\Windows\system32> Import-Module FailoverClusters
PS C:\Windows\system32> clear-clusternode
Clear-ClusterNode
Are you sure you want to forcefully clean up cluster node SRVGNPW049?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y
PS C:\Windows\system32>

And then recreating a new one.

A: You can find details of "How to remove the Availability Group feature" here.

Connect to the server instance that hosts the primary replica, if possible, or connect to another server instance that is enabled for Always On Availability Groups on a WSFC node that possess the correct security credentials for the availability group.
Use the DROP AVAILABILITY GROUP statement, as follows:
DROP AVAILABILITY GROUP group_name
where group_name is the name of the availability group to be dropped.


text:
Q: How can I redirect to a new page after submitting a form using Jinja template? I'm working my way through Google's App Engine Guestbook example (to be found here: https://cloud.google.com/appengine/docs/standard/python/getting-started/creating-guestbook)
I'm trying to redirect the output (the Greetings) to another page as opposed to the index.html where they're currently displayed after a user presses the "Sign the Guestbook" button. I created a separate page called greetings.html where I copied the display code from the index.html page. However, I don't know how to modify guestbook.py to make the output go to the new page.

A: webapp2 has a built-in redirect method:
return redirect('/some-path')
However, I think you would probably rather send the gathered data to the greetings.html template?  Under the POST method, you could do:
template_values = {
    'guestbook_name': guestbook_name,
    # etc.,
}

template = JINJA_ENVIRONMENT.get_template('greetings.html')
self.response.write(template.render(template_values))


text:
Q: How to use complex SQL expression in Laravel I'm using laravel-4. My model scheme created as you would expect.
Here's my database scheme:
CREATE TABLE tags
    (`id` int, `name` varchar(4));

INSERT INTO tags
    (`id`, `name`)
VALUES
    (1, 'tag1'),
    (2, 'tag2'),
    (3, 'tag3'),
    (4, 'tag4');

CREATE TABLE entries
    (`id` int, `body` varchar(5));

INSERT INTO entries
    (`id`, `body`)
VALUES
    (1, 'post1'),
    (2, 'post2'),
    (3, 'post3'),
    (4, 'post4');

CREATE TABLE entry_tag
    (`entry_id` int, `tag_id` int);

INSERT INTO entry_tag
    (`entry_id`, `tag_id`)
VALUES
    (1, 1),
    (2, 1),
    (2, 2),
    (2, 3),
    (3, 2);

And this is my SQL query
SELECT *
FROM entries a
INNER JOIN (
    SELECT p.id
    FROM entry_tag tp
    INNER JOIN entries p ON tp.entry_id = p.id
    INNER JOIN tags t ON tp.tag_id = t.id
    WHERE t.NAME IN (
            'tag1'
            ,'tag2'
            ,'tag3'
            )
    GROUP BY p.id
    HAVING COUNT(DISTINCT t.id) = 3 -- << should the number of tags used in WHERE clause
    ) q ON a.id = q.id

Demo: http://sqlfiddle.com/#!2/cdca7/3
Question
I'll pass tags array to this query. But there's a few thing about SQL expression, I can't use it even raw PDO query without regGUID. You can ask me what did you tried but I have no idea how to do this clean Laravel syntax and Eloquent? (of course I googled)

A: Here you go. To note, Laravel 4.1 (actually Eloquent) is needed to query relationship.
// Eloquent magic here :)
return Entry::has('tags', '=', 3)->get();

// ... and minimal setup for models

class Entry extends Eloquent {

    public function tags()
    {
        return $this->belongsToMany('Tag');
    }
}

class Tag extends Eloquent {

}


text:
Q: SQL Server: converting from text to varchar and then writing into text file I'm having problem with converting the Text data type into varchar. I need to convert that because then it's written into the text file. The problem is that only first 362 characters of Text converts into varchar:
This works
DECLARE @txt varchar(362) = (SELECT Text FROM Whatever WHERE id = 1)

Not working
DECLARE @txt varchar(1000) = (SELECT Text FROM Whatever WHERE id = 1)

The whole procedure fails on this statement, the @txt won't write into text file (using xp_cmdshell)
varchar(MAX) doesn't work
Thx for help


text:
Q: Error adding/editing content after install TinyMCE as add-on in Plone 5 After installing TinyMCE as add-on in plone 5, I got the following error when trying to add or edit content that has rich text field.
 Module Products.TinyMCE.browser.browser, line 127, in jsonConfiguration
  Module Products.TinyMCE.utility, line 959, in getConfiguration
  Module Products.CMFPlone.browser.ploneview, line 324, in bodyClass
  Module plone.app.layout.globals.layout, line 143, in bodyClass
AttributeError: 'View' object has no attribute 'getId'

 - Expression: "widget/@@ploneform-render-widget"
 - Filename:   ... form-1.0-py2.7.egg/plone/app/z3cform/templates/macros.pt
 - Location:   (98:81)
 - Source:     ... place="structure widget/@@ploneform-render-widget"/>
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 - Expression: "python:configuration_method(field=field)"
 - Filename:   ... roducts/TinyMCE/skins/tinymce/tinymce_wysiwyg_support.pt
 - Location:   (14:32)
 - Source:     ... uration_json python:configuration_method(field=field);
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 - Arguments:

Ps: complete traceback

A: TinyMCE is part of plone.app.widgets and shipped with Plone 5. There is no need to install Products.TinyMCE in Plone 5. Products.TinyMCE is just for Plone 3/4.


text:
Q: How to post a variable to a php file using ajax I want to pass a variable to college.php where that variable can be used to fetch data.
I already tried get and post methods using form, but then using get the variable values are visible in address bar and using get form resubmission alert appears
this is what I used.
<form class="morestories"method="get" enctype="multipart/form-data" action="college.php">

                  <input type="hidden" name="collegename" value="<?php $collegename=$row['name']; echo $collegename; ?>">

                  <input class="morestoriesbutton" type="submit" name="collegeselectlink" value="More Stories" />

                </form>

also the variables i am passing to college.php file, on refresh it should be used again to access data so any possible help

A: This is a example where I am passing name and password to a php function ,
you can refer this and apply it accordingly to your condition.
$(document).ready(function(){
    //this is my button
    $("#click").click(function(){
        // getting username and password from my html
        username = $("#name").val();
        password = $("#pad").val();

        if(username=="" || password==""){
            alert("please check the details");
        } else {
            $.ajax({ url: 'reverse.php',
                data: {username:username,password:password},
                type: 'post',
                success: function(output) {
                     alert(output);
                }
            });
        }
    });
});


text:
Q: apex:repeat with Save button, saves only first record in it I have an apex:repeat with Child Name and Edit button displayed. (3 children in the list) ListMember
<apex:repeat value="{!listMember}" var="member">
     <label>Name</label>
     <apex:commandLink>Edit
         <apex:param name="fieldName" value="{!member.name}"/>
     </apex:commandLink>
</apex:repeat>

On click of Edit button I open the below inputField with Save button. ListM.  The correct child is opened based on the rendering condition of FieldName that is being passed.
<apex:repeat value="{!listM}" var="child">
      <apex:outputPanel rendered="{!($CurrentPage.parameters.fieldName == Child.name)}">
           <apex:form>
                <apex:inputField value="{!child.Name}" id="childNewName"/>
                   <apex:commandLink action="{!updateHFProfile}">
                     <apex:commandButton value="Save"/>
                     <apex:param name="pramvalue" assignTo="{!pramvalue}" value="memberRecords"/>
                   </apex:commandLink>
            </apex:form>
    </apex:outputPanel>
</apex:repeat>

ISSUE After editing the 'Child 1' name and clicking on SAVE, it is correctly updating the child name.  But if I Update Child 2 or Child 3, the name is not being saved!!  What could be the issue here?
Apex class
public String pramvalue{get;set{pramvalue=value;}}
public PageReference updateHFProfile(){
   update updatMembersList;
}

     public list<Member__c> updatMembersList{get;set;}
     public list<Member__c> listM{
        get{
            List<Member__c> listlocal;
            listlocal=[Select Id,NameFrom Member__c where Account_Name__c=: profileId__c];
            if(listlocal!=null && listlocal.size()>0){
                System.debug('members size--->'+listlocal.size());
                updatMembersList = listlocal;
            }
    return listlocal;
        }
       set;
     }

A: You need to change your repeat to use updatMembersList:
<apex:repeat value="{!updatMembersList}" var="child">

You don't really need two separate List<Member> properties, though. The problem is, your getter for listM overwrites the results every call. The Lazy Load Pattern can fix this issue. Try replacing updatMembersList and listM with one list that looks like:
public List<Member__c> children
{
    get
    {
        if (children == null)
        {
            // INITIALIZATION LOGIC HERE
            // You only want to run it once
        }
        return children;
    }
    private set;
}
public PageReference updateHFProfile(){
   update children;
}

A: I have figured out the issue.  It is because of <apex:form> inside the apex:repeat.  It is treating as new form for every record.  I put the <apex:form> outside of the <apex:repeat>
<apex:form>
<apex:repeat value="{!listM}" var="child">
    <apex:outputPanel>
        <!--ETC -->
    </apex:outputPanel>
</apex:repeat>
</apex:form>


text:
Q: Is it Possible: Selenium from Web App passing scripts at runtime I am able to make this work locally, but when I publish to Azure App Service or to IIS running on Azure VM, it fails.  This is what I'm doing.
I have a web application where the user can create script with selenium commands.  For example, the user will write this an save as a text file:
script.OpenBrowser("Chrome");

Then save it in a file on the web server.  The user can then navigate to that file and press a run button.  That will wrap the script with the following:
using System;
using System.IO;
using TeamStorm.Web.Services;
namespace InMemoryApp
{
  class Program
  {
    static void Main(string[] args)
    {
      TestServices script = new TestServices();  " + fileContent + "
    }
  }
}

where fileContent is the script previously mentioned.  That is passed to a class I call TestRunner that will compile that code at runtime and run the script.  I'm capturing info about the run to determine if the test pass or failed and storing that in a dB for reporting results.
I am doing all of this in Visual Studio 2019 on my local dev machine.
Now when I publish this application.  Everything works, but the actual running of the test.  I am getting the following errors:
Exception has been thrown by the target of an invocation.  made changes then starting getting:

error CS0009: Metadata file 'D:\xxxx\xxx\xxx\xxx\xxxx\wwwroot\dependencies\chromedriver.exe' could not be opened -- PE image doesn't contain managed metadata.(1,163): error CS7036: There is no argument given that corresponds to the required formal parameter 'env' of 'TestServices.TestServices(IWebHostEnvironment)'

started passing the IWebHostEnvironment to the method and showing the inner exception and then started getting:

The HTTP request to the remote WebDriver server for URL http://localhost:53204/session timed out after 60 seconds.

I have published to Azure App Service and to a VM running IIS. The later thinking was it runs on my local machine from VS2019. So, try to run on a VM that everyone can get via the web.
Nothing is working past this point.
In short I am trying to run Selenium scripts from a web app where the scripts are created and ran at runtime.
Is what I'm doing even possible to do?  I have search high and low and can find no answers as to how to do this or how to get pass the errors. Is this possible?

A: I have been able to publish to my local IIS server and then using ngrok.exe I can connect and have the app run successfully.  However, when I publish to azure vm running IIS.  I can deploy successfully and the application runs. But when I try to run a script is where it blows up.


text:
Q: How to retrieve multiple column from SQL database? I'm trying to get two column details like this way:
    public string GetData()
    {

        using (SqlConnection con = new SqlConnection(this.Connection))
        {
            con.Open();

            SqlCommand command = new SqlCommand("Select TITTLE,VALUE from T_PROJECTS ", con);

            // int result = command.ExecuteNonQuery();
            using (SqlDataReader reader = command.ExecuteReader())
            {
                reader.Read();
                return reader["TITTLE,VALUE"]?.ToString();
            }

        }
    }

How can I do this?

A: You need to have a custom class of columns that you want to retrieve, for example,
 public class Project
        {
          public int Title { get; set; }
          public string Value { get; set; }
        }

and then like this,
 public Project GetData()
    {

        using (SqlConnection con = new SqlConnection(this.Connection))
        {
            con.Open();
            SqlCommand command = new SqlCommand("Select TITTLE,VALUE from T_PROJECTS ", con);
            Project proObj = new Project();
            using (SqlDataReader reader = command.ExecuteReader())
            {
                reader.Read();
                proObj.Title = reader["TITTLE"].ToString();
                proObj.Value = reader["VALUE"].ToString();
            }

        }
     return proObj;
    }

A: You could also return a Tuple although I feel a custom class is a much better solution. -> https://msdn.microsoft.com/en-us/library/system.tuple(v=vs.110).aspx
public IEnumerable<Tuple<string,string>> GetData()
{
    List<Tuple<string,string> results = new List<Tuple<string,string>>();
    using (SqlConnection con = new SqlConnection(this.Connection))
    {
        con.Open();
        SqlCommand command = new SqlCommand("Select TITTLE,VALUE from T_PROJECTS ", con);
        using (SqlDataReader reader = command.ExecuteReader())
        {
            while(reader.Read())
                results.add(new Tuple<string,string>(reader["TITLE"].ToString(),reader["VALUE"].ToString()));
        }
        return results;
    }
}


text:
Q: How to convert value_count result to new data frame? I have some of the value count results show as follows the format:
1    5
0    2
Name: result, dtype: int64

The following is part of the output:
000006.txt 1    2
0    1

000008.txt 1    5

000010.txt 1    4
0    3

000016.txt 1    3

000021.txt 1    3
0    2

000025.txt 1    3
0    1

000031.txt 1    3

000032.txt 1    3
0    2

which here means: for the result, there are 5 results =1, and 2 results =0
I understand the type of value count is series, and I try to convert the series to data frame and pivot it, but the output format is different as what I want.
result = data_result.to_frame('counts') # convert to frame
res = pd.pivot_table(result, columns = 'counts', values='values') # pivot dataframe

I need the result as:
            1    0   # this means the columns name is 1 and 0
000006.txt  2    1   # this line means the value count result for 1 and 0
000008.txt  5
000010.txt  4    3      .........


text:
Q: JavaFX Polygon пересечение есть два корабля. у них есть хитбоксы в виде полигонов. (корабли могут вращаться Bounds не катят).
Мой способ поиска пересечений:
проверить на вхождение в полигон противника родных точек. и наоборот.
из-за этого могут возникнуть ситуации, когда пересечение есть, но вершины не пересекают чужие хитбоксы. Как с этим бороться?
есть какие-то более адекватные алгоритмы поиска пересечения полигонов?


text:
Q: Javafx: copy node by dragging it and paste the copy by dropping it to a location in Pane Is it possible to deep copy a Label (or any other node), so that it creates a new Label object with the same property values and then put it in Dragboard?
I want to implement this functionality: drag a label an drop it at some location in Pane. A new Label object with same property values is created in Pane at the location of the drop.

A: As far as I know, Label does not implement the Java Cloneable interface, and so does not have any built in way to deep copy itself, nor does Node.
You could create your own class which extends Label and implements Cloneable and in that class override the clone method, and do that for every other Node you wish to deep copy as well, this is the most robust solution, but it may be more than you need.
The other option is to just create a new Label with the same properties, which could be as simple as something like
Label newLabel = new Label(oldLabel.getText(), oldLabel.getGraphic());

Note that you may have problems with that method, as it is not a true deep copy, newLabel and oldLabel now reference the same Graphic Node, which again, you may have problems adding the same Graphic Node to the scene twice. A better copy might do something like
ImageView oldGraphic = (ImageView) oldLabel.getGraphic();
Label newLabel = new Label(oldLabel.getText(), new ImageView(oldGraphic.getImage());

This still isn't a true deep copy, but there are no rules against adding the same Image to the scene as many times as you wish, so you're safe there. This sort of approach is fine for Labels, it's only two lines (it could be collapsed down to one even, but I went for more readability), but for more complex types of nodes could get really cumbersome. If it's just labels, here's an okay solution, but otherwise it would make sense to encapsulate all the needed copying into a new clone method.


text:
Q: In apple mail, with contact photos enabled next to mail subjects, one person in my contact doesn't have his picture show up In Apple mail for OSX, I have pictures enabled for both the mail list view as well as in the message itself. This works fairly well, grabbing pictures from my contacts except for one person. Their picture doesn't show up and I don't know what makes them unique.
When I click on their name and select "Show Contact Card" it shows their picture. I can't understand what conditions would cause that picture to not show up in the mail itself.

A: This happens when you have the contact's email address duplicated in another contact.


text:
Q: Filtering data in controller I am trying to filter my data inside of my controller:
MyApp.controller( 'MyCtrl', [ '$scope', '$filter', function( $scope, $filter )
{
    $scope.elements = // array data;

    $scope.filterByUserSetting = function( element )
    {
        // return true/false depending on whether filter criterion matches
        // this part is fine
    }

     $scope.elementsFiltered = $filter("filterByUserSetting")($scope.elements);
    // this part doesn't work
}]);

The error message I get is:
Error: [$injector:unpr] http://errors.angularjs.org/1.2.12/$injector/unpr?p0=filterByUserSettingFilterProvider%20%3C-NaNilterByUserSettingFilter at Error (native)...

How can I fix this?

A: You  need to define the filter provider, like
angular.module('MyApp', []).
    filter('filterByUserSetting', function() {
      return function(input) {
        // your return, based on your filter logic
      };
    });

And then use it in your controller
$scope.elementsFiltered = $filter( "filterByUserSetting" )( $scope.elements )