text:
Q: Java : Thread Programming, Thread Sleep I have a master thread which has its own child threads. Each thread is given a process to be performed and that particular thread must sleep after its work is done until the next frequency of thread awakening.
I have implemented the whole section of code, but not able to make the thread sleep as I'm not aware of is the job of that thread is done or not, in order to make it sleep until the next frequency time.

*

*Create Maste Thread

*Create child threads for each processes from the DB.

*For Each Child Thread Process, it checks its runtime and next runtime to perform the job.

*Make the thread sleep after the work is done until the next runtime.

*Go to Step 3.

I'm stuck at 4, to check if the threads have done its job or not. ( here the child thread doesn't say, if its work is done or not, we have it make it sleep after work is done)
Can anyone help, how it can be done?
private static ScheduledExecutorService stp = Executors.newScheduledThreadPool(11);

@Scheduled(fixedDelayString = "${con.fixedDelay}")
public void processServices() {

    try {

        logger.debug("Entering processServices in MasterProcessThread ");

        // Getting process details and schedule
        List<ProcessDomain> activeProcessList = processDomainDao.getActiveProcessDomainSchedule();

        logger.info("getDomainData for flag is Active :: " + activeProcessList.size());

        // Iterating over active processList to create child threads
        for (ProcessDomain activeProcessDomain : activeProcessList) {

            Timestamp nextRunTS = activeProcessDomain.getProcessSchedule().getProcessNextRunScheduleTime();

            Long nextRunTime = (nextRunTS != null ? nextRunTS.getTime() : null);
            Long startTS = activeProcessDomain.getProcessSchedule().getProcessScheduleTime().getTime();
            Long currentTS = System.currentTimeMillis();
            boolean isPreviousRunSucc = (activeProcessDomain.getProcessRunHistory().getPreviousSuccFlag() != null
                    && activeProcessDomain.getProcessRunHistory().getPreviousSuccFlag().equals("Y")) ? true : false;
            Future future = null;

            // Initializing the child threads and start processing
            if (((nextRunTime == null && currentTS >= startTS) || (nextRunTime != null && currentTS >= nextRunTime))
                    && isPreviousRunSucc) {
                Callable task = beanServiceThreadFactory.getBeanThread(activeProcessDomain.getProcessName(),
                        activeProcessDomain);
                future = stp.submit(task);
                if (future.isDone()){
                    stp.shutdown();
                }
            }
        }


text:
Q: Update tables in sql with strlen or trim So, what i have is a table with a cell that has this value *0000123*
What i need is to pick that cells values and remove the "*" on both sides and paste it in another cell.
To be removed: The ASTERISK symbol from the text.
How can i manage to edit the inside value in sql without using php in the middle? (Direct input would be the thing)

A: It might be the REPLACE() function you're looking for:
DECLARE @Example varchar(max) = '*0000123*'
SELECT REPLACE(@Example, '*', '')

A: You can use REPLACE in SQL-Server and MySql:
SELECT REPLACE(MyVal, '*', '') As NewValue
FROM Table

T-SQL: http://msdn.microsoft.com/en-us/library/ms186862.aspx
MySql: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_replace

redpajama_set_name: RedPajamaStackExchange


text:
Q: what's a good way to implement this data structure in ROR activerecord? I don't want to reinvent the wheel here so would really appreciate some advice!
I get the feeling that there's a 'standard' model for entity->attribute->value system?
Attributes are pre-defined for each entity, so when the instance "Dave's Party" is created, the user needs to be asked specific questions depending on which "services" he requires. Eg. if he requires lighting, he needs to be asked if about the budget and colour, and the values that he gives need to be saved in the correct format, or picked from a set of pre-defined options.
Thanks for any help, and apologies for how I've listed the data below, hopefully how it makes sense!

services = [stage,lighting,sound,tent]

lighting.info_types = [budget,colour]

lighting.size.type = options lighting.size.options = [small,medium,large]

lighting.info_types.colour.type = options lighting.info_types['colour'].options = [red,green,blue]

lighting.info_types.budget.type = currency

tent.info_types = [size,type,capacity]

....

stage.info_types = [size,powered,raised,stage_type]

....

"a specific event "dave's party" requires small stage with a red lighting budget of £300"
@event = Event.create :name => "Dave's Party"
@event.services = [stage,lighting,sound]

What info_types does lighting have and what are the correct format for the responses?
@event.services.lighting.size = large
@event.services.lighting.colour = red
@event.services.lighting.budget = 300.00

....
Which services does Dave's Party require? What are the info_types and values for each of the services?
...

A: I would use a bunch of table and models for the data for light, sound, color, capacity, budget_type, etc. and use ActiveRecord and then you can use standard and familiar queries to manage the data.  If you have values that need to be set up initially for the application use the seeds.rb file.  You can scaffold them up in a few seconds for prototyping.
Others may recommend sti/polymorphism but unless you are already fairly confident in those areas I would recommend KISS and just separate tables.  Tables/models are just so easy to do in rails!


text:
Q: HtmlHelper extension method in grid control I need some help creating this extension method.
My view inherits from
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/NoSideMenu.Master"
Inherits="System.Web.Mvc.ViewPage<List<MyProject.Models.Customer>>" %>

And I have a grid control defined by
<% Html.Telerik().Grid(Model)
    .Name("customer-history-grid").Footer(false).Columns(columns =>
    {
        columns.Bound(o => o.IsValidCustomer).Title(Html.Resource("ValidCustomerTableHeader"));
    }
    ).Pageable(pager => pager.PageSize(25))
    .Footer(true)
    .Render();
    %>

Here I don't want to display the boolean value. Instead I want to display Y or N. For example if o.IsValidCustomer is true then Y else N.
I tried writing the below extension method
public static string ConvertToString<T, TValue>(this HtmlHelper<T> helper, Expression<Func<T, TValue>> expression)
    {
        ......
    }

But my extension method picks up the List<MyProject.Models.Customer> type and not the Customer object. So I cannot select the method o.IsValidCustomer in the lambda expression for example
in View...
columns.Bound(o => o.IsValidCustomer).Format(Html.ConvertToString(o => o.IsValidCustomer)).Title(Html.Resource("ValidCustomerTableHeader"));

A: Would it be possible to edit your domain model?
E.g. add this
public string IsValidCustomerString
{
    get { return IsValidCustomer ? "Y" : "N"; }
}

Then just bind that as a column?
HTHs,
Charles


text:
Q: How to configure DNS records for mail server not also registered as name server I have a single server (server1.host.com single static ip address 12.34.56.78) setup as follows:
1.apache (websites)

*

*client1.com,

*client2.com

*client3.com

2.postfix/dovecot (SMTP and IMAP)

*

*info@client1.com

*info@client2.com

*info@client3.com

I am not using this system as a registered dns server, all domains are obtaining dns from their own registrars.
Clients are complaining about having to use the servers own hostname in their mx records
server1.host.com
A record points to ip address 12.34.56.78
Instead, they want to be able to use
mail.client1.com
mail.client2.com
mail.client3.com
the reason for this change is because mail client apps like outlook grumble profusely when the hostname is different from the client1.com domain. Clients are having problems setting up apps on pc's and mobile phones...its a real nightmare.
Also, lots of SSL errors keep popping up because the SSL certificate belongs to host.com (the servers own domain) instead of client1.com
Is it possible to do this if server1.host.com is not a registered dns server?
They do not want to have to purchase their own ip addresses
IF so, exactly what dns records are needed to do this at client's registrar?


text:
Q: Remove all Instance on stage as3 Im having trouble on removing instances on the stage.
The error I keep getting after I click the button 2 times is
"The supplied DisplayObject must be a child of the caller"
Can somebody help me with this?
package src
{
import flash.display.MovieClip;
import flash.display.Stage;
import flash.events.Event;
import flash.events.MouseEvent;

public class Main extends MovieClip
{
    var positionY:Number = 80;
    var positionX:Number = 0;
    var motion:MovieClip;
    var fCombo:Array = new Array();
    var n:Number;

public function Main()
{
    generate.addEventListener(MouseEvent.MOUSE_UP, loop);
    generate.addEventListener(MouseEvent.MOUSE_DOWN, remove);
    n = Number(inputText.text);
}
function loop(me:MouseEvent):void
{
    var combo:Array = [Punch, Kick, Knee, Elbow];
    n = Number(inputText.text);
    for(var i:Number = 0;i < n;i++ )
        {
        motion = new combo[randomNumber(4)]();
        fCombo.push(motion);
        motion.y = positionY;
        motion.x = positionX;
        positionX += 100;
        addChild(motion);
            if (i == 4 || i == 9 || i == 14)
                {
                    positionY += 40;
                    positionX = 0;
                }
        }
}
function remove(me:MouseEvent):void
{
    for (var j:Number = 0; j < n; j++ )
    {
        removeChild(fCombo[j]);//error
    }
    positionY = 80;
    positionX = 0;
}

function randomNumber(max:Number):Number
    {
    return(Math.floor(Math.random() * max ));
    }
}

}

A: You're adding the new objects you create to the array, and then using that to remove them. But you're forgetting to either create a new list or remove the objects from the old list. So, when time comes to loop over the list you're trying to remove objects that have already been removed.
You can fix this in several ways, one is to remove objects from the stage AND array in your loop:
function remove(me:MouseEvent):void
{
    while(fCombo.length)
    {
        removeChild(fCombo.pop());
    }
    positionY = 80;
    positionX = 0;
}

A: targetDisplayObject.parent.removeChild( targetDisplayObject ); does the trick assuming the parent is not null.


text:
Q: How do I execute a method in a view? I'm trying to find the best way to execute a method in a Rails application.
I have the following in my model:
class Tweet < ActiveRecord::Base
  def self.fetch_all
    # do something
  end
end

I can go to my Rails console and run Tweet.fetch_all and it executes everything inside this method. However, I'd love to create an link in my application to execute this fetch inside the view. Would I need to create a new action inside my controller to get to this?

A: Yes, if you want to create a separate link to execute this function, you will need to first create an action inside the controller for this purpose, and then later, you can create a helper method or simply, use link_to to place the link in your views.
Reason being that, if you add this method inside some other REST action, this fetch will be performed whenever that action is rendered, and this might not be what you intend.
Therefore, you should create another action that specifically executes this code for you, thereby, allowing you to specifically execute this method, whenever the user clicks that link.

A: Actions are executed by controllers, so you need to define an action in tweets_controller.rb:
def fetch_all
 Tweet.fetch_all     #what do you want to do with this?
 redirect_to :back, notice: 'just called fetch_all'
end

and define a way to get to this action in routes.rb
post 'tweets/fetch_all', to: 'tweets#fetch_all'

Then you can use
<%= link_to 'Fetch all!', fetch_all_tweets_path, method: :post %>

anywhere in your views.


text:
Q: Multi Column records keep last version Hello I am trying to use Excel Power Query to do the following.
I have multiple columns
Order / Item / Version / Qty / Price
I have multiple versions of Order Items so want to keep the last version of the record
I'm thinking keep order item where version is max.
snapshot of what I want to keep
I tried using list.max but not sure the syntax.  I played around with grouping columns and conditional column.  I think I am on the right track but just not sure how to generate the functions I need.

A: It is hard to tell if you want the max version of [Order & Item] or [Order] or [Item]
I am going to assume you want to only keep the highest version number of the combination of Order & Item
Load the data into powerquery.  Data .. from table/range....
Click select Order and Item columns, right click, Group By
Set up the group like below image .  Column Count / Operation Max /on Version column, and column Data /  Operation All Rows

use arrows atop the new column to expand all the columns [x] except the ones you used in the initial group; here we just need to [x] version column

Add column .. custom column ...
= if [Count]=[#"CHANGE_VERSION_NUMBER"] then "keep" else "remove"

Then use the drop down in that column to unitick and filter out [x] the remove word

Right click and remove any extra columns
file.. close and load .... your data back into excel


text:
Q: Issue with implementation layer having different signature than abstraction layer I've had this design problem for the third time and I have a feeling there is a solution out there that I simply can't figure out. I am not satisfied with the way I solved it previously, so here is where you come in.
Let's say I'm designing a (C#) library that is agnostic in which system it gets used in. So I have the following classes:
public interface IAction
{
    void Execute();
}

public class Trigger
{
    private List<IAction> actions;

    public void CheckConditions()
    {
        if (AllConditionsMet())
        {
           ExecuteAllActions();
        }
    }

    private void ExecuteAllActions()
    {
        foreach (IAction action in actions)
        {
            action.Execute();
        }
    }

    protected abstract bool AllConditionsMet();
}

public class BigBulkySystem
{
    private List<Trigger> triggers;

    public void CheckAllTriggers()
    {
        foreach (Trigger trigger in triggers)
        {
            trigger.CheckConditions();
        }
    }
}

So far so good. We have a list of triggers in the BigBulkySystem which we check ever so often their conditions. If the conditions are met, the trigger takes care of executing its list of actions.
The issue I'm having now is that I want to implement a layer that is specifically designed for Unity. In Unity, you use coroutines in order to be able to wait a few frames before continuing the execution of a method. This is exactly what I'd want for the Trigger.ExecuteAllActions method. I want to wait for each action to finish executing before moving to the next. In order to do that, I would need to have different signatures for the Trigger and IAction. Here is how this would have been in Unity:
public interface IAction
{
    IEnumerator Execute();
}

public class Trigger
{
    private List<IAction> actions;

    public void CheckConditions()
    {
        if (AllConditionsMet())
        {
            StartCoroutine(ExecuteAllActions());
        }
     }

    public IEnunmerator ExecuteAllActions()
    {
        foreach (IAction action in actions)
        {
            yield return StartCoroutine(action.Execute());
        }
    }
 }

Notice that a couple of methods now return IEnumerator instead of void, which is the way you define a coroutine in Unity.
Here is an example of a Unity action that moves a player object from position (0,0,0) to (1,1,1) in 5 seconds after a 3 second delay:
public class MovePlayerAction : IAction
{
    public GameObject playerObject;

    public IEnumerator Execute()
    {
        yield return StartCoroutine(WaitFor(3)); // Wait 3 secs

        float animDuration = 5.0f;
        Vector3 initialPos = Vector3.zero;
        Vector3 finalPos = Vector3.one;
        float t = 0;
        while (t < animDuration)
        {
            playerObject.transform.position = Vector3.Lerp(initialPos, finalPos, t / animDuration); // Lerp between initial and final
            yield return null; // Wait a frame
            t += Time.deltaTime;
        }
    }

    private IEnumerator WaitFor(float secs)
    {
        float t = 0;
        while (t < secs)
        {
            yield return null; // Wait a single frame
            t += Time.deltaTime;
        }
    }
}

So, my question is: is there a way to design the system in such a way that I can keep the non-Unity layer free from IEnumerator but also have the Unity layer use them?
I have a feeling that there is some sort of middle layer, but even so, I couldn't figure out how IAction can have simultaneously void Execute() and IEnumerator Execute().
Thanks!

A: When you're consuming a class with a different interface to the one you need, you want the adapter pattern. There are a couple of variations on this, but a simple one for your case would look something like this:
public interface IAction
{
    void Execute();
}

public interface IUnityAction
{
    IEnumerator Execute();
}

public class UnityActionAdapter : IUnityAction
{
    private readonly IAction Action;

    public UnityActionAdapter(IAction action)
    {
        Action = action;
    }

    public IEnumerator Execute()
    {
        Action.Execute();
        yield break; //Or whatever you need to yield here
    }
}

UPDATE
In your case it looks like you'd be adapting in the other direction, so:
public class UnityActionAdapter : IAction
{
    private readonly IUnityAction UnityAction;

    public UnityActionAdapter(IAction unityAction)
    {
        UnityAction = action;
    }

    public void Execute()
    {
        StartCoroutine(UnityAction.Execute()); //If I'm correctly understanding how you'd execute an action here
    }
}

Then you'd have MovePlayerAction implement IUnityAction, and instead of directly passing a MovePlayerAction up to your other layer, you'd wrap it in a UnityActionAdapter and pass that along instead.
This is assuming that you actually need to maintain the IEnumerator form in an interface in your Unity layer. You might be able to achieve the same thing without the need for adapters by doing something like:
public class MovePlayerAction : IAction
{
    public GameObject playerObject;

    private IEnumerator Coroutine()
    {
        yield return StartCoroutine(WaitFor(3)); // Wait 3 secs

        float animDuration = 5.0f;
        Vector3 initialPos = Vector3.zero;
        Vector3 finalPos = Vector3.one;
        float t = 0;
        while (t < animDuration)
        {
            playerObject.transform.position = Vector3.Lerp(initialPos, finalPos, t / animDuration); // Lerp between initial and final
            yield return null; // Wait a frame
            t += Time.deltaTime;
        }
    }

    public void Execute()
    {
        StartCoroutine(Coroutine());
    }

    private IEnumerator WaitFor(float secs)
    {
        float t = 0;
        while (t < secs)
        {
            yield return null; // Wait a single frame
            t += Time.deltaTime;
        }
    }
}

A: What if you use Task Parallel Library ?
Sample code of Trigger where I see we can implement this (considering your Non-IEnumerator code):
public class Trigger
    {
        private readonly List<Task> TaskActions = new List<Task>();

        public void AddAction(IAction action)
        {
            TaskActions.Add(new Task(()=>{action.Execute();})
        }

        public void CheckConditions()
        {
            if (AllConditionsMet())
            {
                ExecuteAllActions();
            }
        }

        private void ExecuteAllActions()
        {
            foreach(Task task in TaskActions)
            {
                task.Start();
            }
            Task.WaitAll(TaskActions);
        }

        protected abstract bool AllConditionsMet();
    }

Regards


text:
Q: Block traffic to certain servers In my organization, I'd like to make sure all servers are only accessible from the inside. The only exceptions are the mail and webservers.
What's the best way to do this?
My own suggestion was blocking ALL incoming traffic via 'iptables' except mail and web traffic (and SSH)
Is this the best way to do this or are there any better suggestions?
Thanks!
EDIT:
I found a pretty similar topology as ours:

A: So the machines don't have internet addressable IP addresses and you only have one IP address available to you? Then you're going to have to configure your router/firewall to forward the desired traffic to the machines in question. If you don't do anything to your router/firewall, your first wish is granted: the machines are only available to the inside.


text:
Q: Finding volume of region described in spherical coordinates What is the volume of the following region, described in spherical coordinates?
1 <= ρ <= 9, 0 <= ϴ <= π/2, π/6 <= ϕ <= π/4
Attempt:
Since ρ^2 = x^2 + y^2 + z^2, the first part appears to describe the surface between two concentric spheres, centered at the origin with radii of 1 and 0 respectively.
ϴ=0 is a half xz plane and ϴ=π/2 is a half yz plane.
I know that ϕ has to do with the angular range with respect to the z axis, but I am not sure how to restrict these values and determine an integral of which I can integrate to find the volume.
Thanks!

A: From your description it sounds like $\theta$ is the azimuthal angle (ranges $0$ to $2\pi$) and $\phi$ is the polar angle (ranges $0$ to $\pi$). In that case the spherical volume element is $\rho^2\sin\phi d\rho d\phi d\theta$. The problem statement just gives you the range to integrate over. So you have $$ V = \int_1^9d\rho\int_{\pi/6}^{\pi/4}d\phi\int_{0}^{\pi/2}d\theta \rho^2\sin\phi.$$


text:
Q: Use case of function pointers in c One of the common use cases I've come across when I read about function pointers is  that they can be used to make a function more flexible, as part of the functionality of the function can be taken in as a parameter. An example for this is qsort where I can make a compare function to decide what is meant by greater and lesser (ascending, descending, is a multiple of,etc) and pass the compare funtion pointer to qsort function.
Here, the function repeat has addptr as parameter and therefore performs multiplication.
int add(int a, int b)
{
    return a+b;
}

int (*addptr)(int,int);

int repeat(int a,int b,int (*funcptr)(int,int))
{
    int i,ans=0;
    for(i=0;i<a;i++)
    {
        ans=(*funcptr)(ans,b);
    }
    return ans;
}

int main()
{
    addptr=&add;
    printf("%d\n",repeat(7,5,addptr));

    return 0;

}

But the same exact thing can be done without function pointers at all!
int add(int a, int b)
    {
        return a+b;
    }

    int repeat(int a,int b,int func(int,int))
    {
        int i,ans=0;
        for(i=0;i<a;i++)
        {
            ans=func(ans,b);
        }
        return ans;
    }

    int main()
    {
        printf("%d\n",repeat(7,5,add));

        return 0;

    }

So why is this even one of the uses of function pointers?
What is the advantage of the first code over the second?

A: There is a rule C11 6.7.6.3/8 saying that if you write a function inside a parameter list, it will get adjusted to a pointer to function of that type:

A declaration of a parameter as ''function returning type'' shall be
  adjusted to ''pointer to function returning type'',

This works similar to when you write an array as function parameter, it gets adjusted to a pointer to the first element.
That being said, it is not really meaningful to write a function as a parameter, it is just very confusing to the reader. Use function pointers instead.

EDIT
For maximum readability, I would personally recommend using this style:
typedef int operation_t (int, int);

int repeat (int a, int b, operation_t* operation)
{ ...

Though the most commonly used style is perhaps this one:
typedef int (*operation_t) (int, int);

int repeat (int a, int b, operation_t operation)
{ ...

I prefer the former since hiding pointers behind typedefs is a bad idea, and since that style makes function pointers consistent with regular pointers.

A: As noticed in comment by @user2390668, func in repeat in already a function pointer. And when you call it, add decays to a function pointer.
If your question is what is a possible use case for a variable holding a function pointer, we must try to imagine a use case where a function will not only be passed as a parameter, but will have to be stored. An example for that would be simulating polymorphism of structs in C. Here is an oversimplified example:
#include <stdio.h>

struct Base {
    /* common member variables
    ...
    */
    const char *name;
    void (*display)(void *, FILE *fd);
};

struct S1 {
    struct Base base;
    /* other member variables */
};

void _S1_display(void *this, FILE *fd) {
    struct S1 *s1 = this;
    fprintf(fd, "In S1, name: %s\n", s1->base.name);
}

struct S2 {
    struct Base base;
    /* other member variables */
};

void _S2_display(void *this, FILE *fd) {
    struct S2 *s2 = this;
    fprintf(fd, "In S1, name: %s\n", s2->base.name);
}

void process(void *this, FILE *fd) {
    struct Base *base = this; /* valid because base is first element of both S1 and S2 */
    base->display(this, fd);
}

int main() {
    struct S1 s1 = { "s1", &_S1_display };
    struct S2 s2 = { "s2", &_S2_display };

    process(&s1, stdout);
    process(&s2, stdout);
    return 0;
}

Ok, fur such a simply example, polymorphism would not be necessary, but as I said it is oversimplified...

A: You may use pointers to functions when you need a little more abstraction.
For example, you may want to manage a table of operators that a generic function should use:
int add(int a, int b) {
    return a+b;
}
int sub(int a, int b) {
    return a-b;
}
int mult(int a, int b) {
    return a*b;
}
int div(int a, int b) {
    return a/b;
}

void doit(int a,int b,int (*ptr[2])(int,int)) {
    printf("%d\n",ptr[0](a,b));
    printf("%d\n",ptr[1](a,b));
}

int main() {
    int (*ptr[2])(int,int);
    printf("additives (1) or multiplicatives (2) ?");
    int choice;
    scanf("%d",&choice);

    switch(choice) {
        case 1:
          ptr[0] = &add;
          ptr[1] = ⊂
          break;
        default:
          ptr[0] = &mult;
          ptr[1] = ÷
          break;
    }
    doit(7,5,ptr);
    return 0;
}

Of course you can also design a doit function with two pointers but sometimes a table is more convenient (think about a variable length table of function pointers for example, I know even in this case we may use a variable arguments list...).
At least, passing a function pointer in parameter is defining a function pointer variable...
Another example is also implementing in C object oriented programming, where you may implement methods as function pointers members.


text:
Q: Send input to console applications in Node Webkit is there a way to send input and receive output from console programs using Node Webkit?
I tried searching the net but couldn't find what I was looking for.

A: Basically, if you can do it in node.js, you should be able to do it in node-webkit.  For example, to receive output from the 'ls' command and print it to console.log, you could do this:
exec('ls', function (err, stdout, stderr) {
    console.log(stdout)
});

Of course, you'd want to do some error handling as well in real life.


text:
Q: How to print Binary Search Tree in a specific way First of all I'd like to apologize but I could not come up with a better title.
I have implemented a BST in C++ with 3 properties: left, right and data.
Suppose after some insertions it look like
.
How could I print the BST in the console like ?
The number of X's used should be the minimum possible. I've been looking at this question for quite some time and I'm not able to come up with anything. Any help is appreciated.


text:
Q: Slow importing of CSV into Database I have a CSV file that I use to update data. It takes a really long time (about 10 mins) to update no more than 15.000 records.
This is the code I use:
task csv_updater_so: :environment do
    require 'csv'
    counter = 0
    time = Benchmark.realtime do
        save_folder = Rails.root.join('path_to_file')
        CSV.foreach(save_folder, encoding:'iso-8859-1:utf-8', col_sep: ';', :quote_char => "\x00", headers: true) do |row|
            #If the item is in the db I update its values
            if item = Item.find_by_internal_code(row[4])
                item.update(:price => row[9], :stock_b => row[10])
            end
            counter += 1
            print "updated items => #{counter}" + "\r"
        end
    end
end

I find it strange as to update the same model from an xml file it takes just a bunch of seconds. Am I doing something wrong?
I have also tried
task csv_updater_so: :environment do
    require 'csv'
    counter = 0
    time = Benchmark.realtime do
        save_folder = Rails.root.join('path_to_file')
        updateable_items = CSV.foreach(save_folder, encoding:'iso-8859-1:utf-8', col_sep: ';', :quote_char => "\x00", headers: true).map do |row|
            if item = Item.find_by_internal_code(row[4])
                item.update(:price => row[9], :stock_b => row[10])
            end
            counter += 1
            print "updated items => #{counter}" + "\r"
        end
        Item.import(updateable_items)
    end
end

A: You problem is that the way you are doing you're basically doing a transaction on each insert, so it will be naturally slow.
So my recomendation, to avoid converting your CSV file to SQL COPY commands, would be to use activerecord-import gem.
It will take care of the associations for you and group the inserts by model. Also since it provides the support for databases in a separate gem you can take advantage of some nice features of your database, like Arrays in PostgreSQL.


text:
Q: two person chat room I've been trying for two days to get this to work. It's a two person chat room: user1 and user2 can enter into room1. No one could enter the room1 unless they are either user1 or user2.
as of now, its only showing room1 for user1, but when I use user2 from another browser, it doesn't show room1 unless I do user1. I want both users to see room1. This is my SQL SELECT:
Sorry, I'm a newbie with MySQL, but basically I created a login page where user1 and user2 can enter their user names. Once they're are logged in, it will show the room1 information.
$sql = "SELECT room FROM chat WHERE user1='$user1' AND user2='$user2' and room='$room1'";

$result = $conn->query($sql);
 if ($result->num_rows > 0) {
  while($row = $result->fetch_assoc()) {
  $_SESSION['room'] =$row['room'];
 }
}

Any help will be appreciated.

A: As you are not provided much information about your requirement,I am assuming that you what to create a chat room for two users and these two users can only participate in this room.For this you should not user this schema.

You need to create different tables of different entities and there
  relationship.

Here you have two entities.

*

*User

*room

And one relation between them.

*

*Chat room

room_table(Insert when room is created)
        id          -room id
        name        -room name
        created_at  -time of creation
        status      -is this room is active or not
        etc

user_table(Insert when user created)
        id          -user id
        name        -user name
        password    -password
        created_at  -time of creation
        status      -is this user is active or not
        etc

chat_room(Insert when user is assigned in room)
        id          -user id
        room_id     -room_id//reference of room.id
        user1_id    -user_id//reference of user.id
        user2_id    -user_id//reference of user.id
        created_at  -time of creation
        status      -is this chat room is active or not
        etc

now for any user you to get the chat_room by:
 select id from chat_room where room_id = '$room_id' and user1_id ='$user_id' or user2_id ='$user_id';

Hope this will help you and other. I am wrong any where any one correct   me.
Edit:
messages(Insert when sending message)
        id              -user id
        chat_room_id    -id of chat room//reference of chat_room.id
        user_id         -user_id//reference of user.id
        message_text         -text message
        created_at      -time of creation
        status          -is this chat room is active or not
        etc

Now for any chat room you can get messages by :
select message_text from messages where chat_room_id = 'id_you_got_from_above_query';


text:
Q: Visualize months in map I need to visualize in a map the best month to do something in an area.
I've thought of classifying months in 4 groups: (Dec, Jan, Feb // Mar, Apr, May // Jun, Jul, Aug // Sept, Oct, Nov) and displaying them by colors according the season temperature: Blue - cold, red - warm.
The problem that I find with this approach is that it is a global map, and does not make much sense to show January and February with the same color in Australia and Italy.
Any Idea on how I could display global month/season data in a map having in count this?

A: Based on the statement "visualize in a map the best month to do something" I would start with the following (simple) approach:
Create one map for each month or quarter and start with having two classes in your legend. One is "it's good to do xy" and the other one is "it's bad to do xy". (Of course you can add here more graduated classes and not only the two extreme values) Then color the areas according to their classes, e.g. good with green and bad with red color. So you can see at one glance that activity XY is good/recommended to do in January in Sweden but maybe not in Australia.
If it is mandatory for you to show the temperature on the map, you can do it e.g. by using different colored dots or stripes in the area.

A: You could try to use season names (spring, summer, fall, winter), but you have to reclassify the calendar months given the climate season / hemisphere respectively.
E.g. in Europe, winter could be bound to December, January and February, while in Australia, the winter season is between June and August (or whatever you might choose).
Keep in mind to consider areas near the equator separately, as they have non / minor season variations.


text:
Q: Django: creating number of forms dynamically so I want to create a dynamic number of forms depending on a variable.
Here is my forms.py
class CTestform(forms.Form):
    def __init__(self, c_test_tokens, *args, **kwargs):
        super(CTestform, self).__init__(*args, **kwargs)
        wordsbeforegap = ''
        iteratorforgaps = 0

        for i in (0, len(c_test_tokens)-1):
            if '#GAP#' not in c_test_tokens[i]:
                wordsbeforegap = wordsbeforegap + c_test_tokens[i]

            else:
                self.fields[iteratorforgaps] = forms.CharField(widget=forms.TextInput(attrs={'size': '5'}),
                                                    required=False, label=wordsbeforegap, label_suffix='')
                wordsbeforegap = ''
                iteratorforgaps += 1

Here is my views.py where I call CTestform to render:
def ctest(request):
    # this function is not really important for the question
    # c_test_tokens = list of chars
    c_test_tokens, gaps, tokenindexe = generate_c_test(exampletext())

    form = CTestform(c_test_tokens=c_test_tokens)
    return render(request, 'ctest.html', {'form': form})

I thought that the forms created would be in self.fields, so to print the forms at my website I have in my template this:
<div class="ctest">
    {%  for forms in form.fields %}
        {{ forms }}
        {%  endfor %}
    </div>

But the site is empty and no forms are getting rendered. What could be the problem?

A: Solved:
Problem was in my for loop
Missed "range" lol
for i in range (0, len(c_test_tokens)-1):


text:
Q: Using STS of Java EE app Recently I had the chance to write applications for Java EE and Spring.
Has the support of the STS IDE for Java EE apps/ Core Java?
By your experience is that stable/convenient for that target?
Thanks,
ray.

A: STS is based on "Eclipse for Java EE developers" and you can install every plugin you need. From my experience it is a stable platform.


text:
Q: PHPStorm - Wrong root folder? Full path I have just installed PHPStorm and i'm using MAMP on my mac as local server. I have created a PHP Project and wanted do require_once() to a file which is inside a folder called functions.
But when i want to refer to that file i can't just type "/" infront of it. I have type the full path like: /Applications/MAMP/htdocs/functions
What have i done wrong?
None of these is found:
require_once '/functions/sanitize.php';

require_once 'functions/sanitize.php';

But this one works fine:
require_once '/Applications/MAMP/htdocs/functions/sanitize.php';

Hope you can help me out.


text:
Q: Ember.js with Three.js I have been trying to get my head around a way to intergrate Ember.js with Three.js.  In particular, I want to render a number of elements, controlling the data with Ember.js bindings and general pub/sub handling, but also wont to be able to manipulate the views/elements with three.js using THREE.CSS3DObject.
I'm fairly confident with Ember but new to Three.  I guess what I'm thinking is, can I have an element that exists in both the THREE.Scene and the Ember application namespace?
In the THREE.js periodic table example:
http://mrdoob.github.com/three.js/examples/css3d_periodictable.html
an DOM.element is create and then later decorated with attributes (style, position etc).
var element = document.createElement( 'div' );
    element.className = 'element';
    element.style.backgroundColor = 'rgba(0,127,127,'+(Math.random()* 0.5 + 0.25 ) + ')';

Later, it is added as an element to the THREE.CSS3Object constructor:
var object = new THREE.CSS3DObject( element );

I'm wondering if I can create the elements in perhaps an Ember containerView and then use jQuery to iterate over the childViews, caching the currently iterated element as 'element' and then render this to the THREE.CSS3DObject constructor?
I know it's a bit hacky and I only mention the above as some indication that I have tried to think up a way before asking for help! haha!
Any guidance or even pie in the sky suggestions like mine would be greatly appreciated. Thanks in advance.

A: Three's CSS3D renderer is just a thin abstraction of the browsers' own renderer and therefore should not conflict with the manipulation of DOM elements with Ember or jQ.
Once passed to the CSS3DObject constructor, an element's 3D transforms are updated but beyond that, it's business as usual. You can manipulate its content and style it as needed.


text:
Q: polymer to develop web application I am about to develop a complex web app for business purposes and i was looking into the different technologies available.
Has someone developed a web app based entirely on Polymer?
Do you think Polymer is mature enough to be used for that purpose and could you provide some feedback from your experience?
Many thanks!

A: Definitely.
Have a look here: crowdaboutnow.nl. It's entirely written in Polymer. There are some hurdles to overcome when building entire web applications with WebComponents. But in the end we're quite content with it.

A: Definitely I'll suggest you to use polymer for your project.
With the 1.0 release of its Polymer library, Google is pushing for a method of building Web applications that leverages the development of interoperable custom elements.
So if you are looking for a fast and easy way to get started building a production-ready web application using Polymer? Use the Polymer starter kit. Packed with the latest elements, ready-to-use boilerplate, and an end-to-end toolchain to use from development through production deployment, the starter kit works out of the box so you can focus on adding features right away.
Additionally, check out the many brand-new element product lines built by the Polymer team with the Polymer elements catalog. There you can browse for elements to help create or add features to your web app - whether you need buttons or layouts, Google maps or push notifications. For just about any problem you might need to solve on the web, there's an element for that.
Also you can look at the web applications made with polymer here -

*

*https://builtwithpolymer.org

*https://madewithpolymer.com
To understand more about the state of polymer you can look at the videos of Google Polymer summit 2015


text:
Q: Revert a merge after being pushed Steps I performed:
I have two branches branch1 and branch2,
$git branch --Initial state
$branch1

$git checkout branch2
$git pull origin branch1 --Step1

I resolve the conflicts and did a
$git commit -m "Merge resolved"

then
$git checkout branch1
$git merge branch2
$git push origin branch1

Now I realised that while being at step1, the auto merging removed some code and the change code was pushed. Now I want to go back to my initial state in order to revert any changes. Looking for some immediate help?

A: Try using git reflog <branch> to find out where your branch was before the merge and git reset --hard <commit number> to restore the old revision.
Reflog will show you older states of the branch, so you can return it to any change set you like.
Make sure you are in correct branch when you use git reset
To change remote repository history, you can do git push -f, however this is not recommended because someone can alredy have downloaded changes, pushed by you.

A: The first option is the use of git revert.
git revert -m 1 [sha-commit-before-merge]

The git revert will revert the changes but will keep the history. Therefore you will not be able to continue working in the same branch since you cannot see the actual difference between the merged branch and your feature branch anymore.
Use the following way to remove history as well. Do this very carefully if and only if you are the only one pushing changes to the branch at the moment.
git reset --hard [sha-commit-before-merge]
git push [origin] [branch] --force

A: You can revert the merge following the official guide, however this leaves Git with the erroneous belief that the merged commits are still on the target branch.
Basically you have to :
git revert -m 1 (Commit id of the merge commit)

A: In my case, I merged my branch (say: my-branch) with another feature branch (feature-branch) but not master.
So my branch history was like this:
my-branch (before merge)

---master----m1----m2----m3---m4

After merging it with another feature-branch which had commits f1, f2 on top of master, it became like this:
my-branch (after merge)

---master----m1----m2----f1----f2----m3---m4----mergecommit

This might have happened because while working on my branch I did a merge from master after 2 commits, or one of 2 branches might not have been up to date with master.
So in this case git revert -m 1 was not working as it was leaving those f1 and f2 commits in between.
The solution was simple, which will work in case of normal scenarios, where we don't have in-between commits:
git rebase -i HEAD~6

Instead of 6 use appropriate number based on how many past commits you want to change.
Now Vim editor is opened, just mark undesired commits as drop and same and quit using :wq
verify log:
git log --oneline

force push
git push -f

Now the remote branch should be in previous state.

A: As mentioned in another answer, the primary issue with doing a git revert on a merge is that git still thinks all the previous commits were merged (it only changes the code).  If you attempt to merge that branch later on, you'll find those prior commits are missing.
The better way (obviously after consulting with your team so they don't keep working on a problematic branch) is to git reset to an earlier commit.  It doesn't have to be a hard reset, since that only deals with what to do with your current working changes, so that part is up to you.
You can also create a temporary branch from the previous commit if you would like to make changes there first before doing the reset.  In that case you would reset to a commit on your temporary branch.
You won't be able to push without pulling from your upstream, but obviously you don't want to pull the changes you're trying to revert.  So, you'll need to do a force push (or force push with lease to stop if any changes have been pushed in the interim).
Side Note:  As a fan of VS Code and Git Graph, I find the force push is easy to do by right clicking on the local branch tag name and selecting 'Push Branch...', choosing either Force or Force With Lease, leaving the Set Upstream box checked.

A: More explanation for given answer git revert -m 1 <merge commit id> with a graphical representation and an example, step-by-step.
Reverting a merge commit is not straightforward as with git revert <commit-hash>, since Git gets confused when looking back from the merge commit due to its two parent commits. To specify the desired parent, uses the -m flag. As git cannot determine which parent is the mainline and which is the branch to un-merge automatically, so this must be specified.

The iss53 branch was merged into master, creating a Merge Commit, C6. C6 had two parents, C5 and C4.
Need to revert C6 and return the repository to its state at C4. So it must specify which parent to use for the revert command.

*

*For that check the git log, (here representing actual commit hash with code names from graph)
> git log

commit C6
Merge: C4 C5
Author: Mozz <mozz@example.com>
Date:   Wed Feb 29 23:59:59 2020 +0100

Merge branch 'iss53' to master
...

*From git log output, note down the parent IDs that come with Merge: - -. It will be in the format of Merge: parent1 parent2, here Merge: C4 C5.

*The C4 commit is in master branch and we need to revert to that, that is parent 1 and -m 1 is needed here (use git log C4 to verify the previous commits to confirm parent branch).

*Switch to the branch on which the merge was made ( it is the master branch here and we aim to remove the iss53 branch from it )
Do the git revert with -m 1 flag.
# To revert to C4 in master branch
git revert C6 -m 1

# C6 - is the merge commit hash

For some other cases, if needed revert to C5,
# revert to C5 in iss53 branch
git revert C6 -m 2

# General
git revert <merge commit id> -m 1 (reverts to parent1)
git revert <merge commit id> -m 2 (reverts to parent2)
# remember to check and verify the parent1 and parent2 with git log command.

Practical example
Created a new branch revert-test on an existing project that has only main branch, The commit graph looks like this now.

(For graphical view of commits use —graph with git log  [SO ans ref] OR this more interactive VS code extension - git graph)
Now, I've added some new files, modified existing files, and created separate commits on each branch, then pushed them to the origin. The graph now looks like this:

Then, created a pull request from GitHub and merged revert-test branch to main.

I want to undo the merge commit and go back to the last commit in the main branch - which is 12a7327
Note that the merge commit - 2ec06d9 has two parents now - 12a7327 (in main) and 15bde47 (in revert-test), checking git log now,
> git log

commit 2ec06d9d315a3f7919ffe4ad2c2d7cec8c8f9aa3 (HEAD -> main, origin/main, origin/HEAD)
Merge: 12a7327 15bde47
Author: Akshay <63786863+akshay@users.noreply.github.com>
Date:   Sun Feb 5 00:41:13 2023 +0530

    Merge pull request #1 from Akshay/revert-test

    Revert test

To revert the merge commit and get back to 12a7327 need to do,
# To the First parent
git revert 2ec06d9 -m 1

Now a commit message will show in editor that specifies the details, check and verify.

So that creates a Revert commit that does the inverse changes of the merge commit.

Lastly push the changes, Now the merge commit changes gone and the Log will look like,


text:
Q: How to draw with mouse over webcam in Tkinter? I have an app that displays the webcam using OpenCV then this is converted to Tkinter (for GUI purposes). I can implement a mouse drawing function but the image update loop keeps covering it. I have tried raise/lower on canvas and labels but to no avail. Anyone got any ideas on this please?
Update Loop:
    def update(self):
        isTrue, frame = self.vid.getFrame()

        #Convert frame to TK and put on canvas
        if isTrue:
            self.photo = ImageTk.PhotoImage(image=PIL.Image.fromarray(frame))
            self.image = self.canvas.create_image(0, 0, image=self.photo, anchor=tk.NW)

        self.window.after(10, self.update)

Draw Function:
    def paint(self, event):
        white = (255, 255, 255)
        x1, y1 = (event.x - 2), (event.y - 2)
        x2, y2 = (event.x + 2), (event.y + 2)
        self.canvas.create_oval(x1, y1, x2, y2, fill="white", outline="white")


text:
Q: Nodemailer and ical-generator - to send calendar invite I want to send calendar invite. I'm using Nodemailer and ical-generator to generate ical file. Everything working fine but email doesn't add invite to the calendar automatically instead I get an option to Add to calendar. But I want email to directly add event to the calendar.
This is how email looks like -

My code looks like this.
This code converts to ical file and it is being used with Nodemailer icalEvent to send it.
    const content = ical({
    domain: 'google.com',
    method: 'PUBLISH',
    prodId: '//Google Inc//Google Calendar 70.9054//EN',
    timezone: 'Australia/Brisbane',
    scale: 'GREGORIAN',
    events: [
      {
        start: moment(),
        status: 'CONFIRMED',
        end: moment().add(1, 'hour'),
        summary: 'Calendar invite test',
        transparency: 'OPAQUE',
        organizer: {
          name: 'Organiser name',
          email: 'ttt@gmail.com',
          mailto: 'ttt@gmail.com'
        },
        location: 'Zoom',
        attendees: [
          {
            email: 'my-email-address@gmail.com',
            name: 'Shashank Kumar',
            status: 'NEEDS-ACTION',
            rsvp: true,
            type: 'INDIVIDUAL',
            role: 'REQ-PARTICIPANT'
          },
          {
            email: 'mno@gmail.com',
            name: 'Mike Jack',
            status: 'NEEDS-ACTION',
            type: 'INDIVIDUAL',
            role: 'REQ-PARTICIPANT'
          },
          {
            email: 'xyz@gmail.com',
            name: 'Will Paul',
            status: 'NEEDS-ACTION',
            type: 'INDIVIDUAL',
            role: 'REQ-PARTICIPANT'
          }
        ]
      }
    ]
  }).toString();

and then I'm using Nodmailer to send icalEvent
message: {
  to: toEmail,
  headers: {
    'x-invite': {
      prepared: true,
      value: id
    }
  },
  icalEvent: {
    filename: 'invite.ics',
    method: 'PUBLISH',
    content: content
  }
},

A: You only need use 'REQUEST' as method instead of 'PUBLISH', this will add automatically to your calendar and show confirmation buttons


text:
Q: How do I put the top panel on an external monitor in GNOME3? In Gnome 3, i would like to put the top panel on my external monitor in Ubuntu 11.10.
How do i do this?

A: Run the Displays preferences app (Menu, type "disp", click on "Displays". Right-click on the rectangles representing your monitors, and you can drag them around to your heart's content.


text:
Q: Mobile app in ionic framework I am new to ionic framework. I have SPA build in .net mvc, angularjs & web api which a large web application. But all form are simple data entry forms with input and dropdowns. I want to build simple mobile app for not all but some forms using the same web api. I have googled and found that Ionic framework can do the work, but where should I start from? Need guidance on what type of app (native,web or hybrid) will be best for my purpose. I am looking for these few features.

*

*Should be available for android, iOS and windows download.

*Should have push notification.

*Update the app without uninstalling.

*Performance

A: Basically ionic use basic html components + ionic components + angularjs and that can be installed across iOS, Android, and Windows mobiles.
Also push notification also supported in ionic
updates are available without uninstall
and it gaves best performance for a small and basic functionality
now a days so many application build with hybrid platform like reactjs and ionic.
For your business purpose you can go with it definitely as it is a simple form submission and saves your time.
You can refer that links to see apps build with ionic framework:
http://showcase.ionicframework.com/apps/top


text:
Q: How to resolve PoolableConnectionFactory exception in JMeter when trying to connect AWS postgres db in JMeter? Here is how Database url is given : jdbc:postgresql://Hostname:portnumber/dbname
Kept the following jar file in C:\Program Files\Apache\apache-jmeter-5.0\lib
postgresql-9.1-901-1.jdbc4.jar
I am getting the below error in JMeter when trying to connect AWS postgres db in JMeter.
Cannot create PoolableConnectionFactory (FATAL: no pg_hba.conf entry for host "xxx", user "xxuser", database "xxname", SSL off).

A: Can it be the case you have SSL enabled in your PostgreSQL cluster? Looking at Requiring an SSL/TLS connection to an Aurora PostgreSQL DB cluster chapter

If you enable set rds.force_ssl and restart your DB cluster, non-SSL connections are refused with the following message:
psql: FATAL: no pg_hba.conf entry for host "host.ip", user "someuser", database "postgres", SSL off

So it might be the case you just need to enable SSL in your JDBC URL like:
jdbc:postgresql://Hostname:portnumber/dbname?ssl=true

Otherwise just add the following entry to your pg_hba.conf file:
hostnossl    all          all            0.0.0.0/0  trust

and upon Postgres restart you will be able to connect from anywhere by anyone without SSL
Also according to 9 Easy Solutions for a JMeter Load Test "Out of Memory" Failure and JMeter Best Practices you should always be using the latest version of JMeter so consider upgrading to JMeter 5.4.1 (or whatever is the latest stable version available at JMeter Downloads page)


text:
Q: Many Keycloak quick-starts fail on test phase For example, when running mvn install wildfly:deploy on app-profile-saml-jee-jsp quick-start, I get the error below.
Trying to run the same on app-profile-jee-vanilla quick start fails on tests as well.
Any idea how to solve this? Thanks.
Error:
-------------------------------------------------------  T E S T S
------------------------------------------------------- Running org.keycloak.quickstart.ArquillianProfileSamlJeeJspTest Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.491 sec <<< FAILURE! - in org.keycloak.quickstart.ArquillianProfileSamlJeeJspTest org.keycloak.quickstart.ArquillianProfileSamlJeeJspTest  Time elapsed:
0.49 sec  <<< ERROR! java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor   at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:166)  at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:103)  at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)   at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:114)   at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)     at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)  at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)  at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)     at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)  at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) Caused by: java.lang.reflect.InvocationTargetException: null   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)  at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:162)  at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:103)  at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)   at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:114)   at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)     at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)  at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)  at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)     at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)  at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) Caused by: org.jboss.arquillian.container.impl.ContainerCreationException: Could not create Container jboss    at org.jboss.arquillian.container.impl.LocalContainerRegistry.create(LocalContainerRegistry.java:85)    at org.jboss.arquillian.container.impl.client.container.ContainerRegistryCreator.createRegistry(ContainerRegistryCreator.java:78)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)    at java.lang.reflect.Method.invoke(Method.java:498)     at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)     at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)    at org.jboss.arquillian.core.impl.ManagerImpl.bindAndFire(ManagerImpl.java:265)     at org.jboss.arquillian.core.impl.InstanceImpl.set(InstanceImpl.java:74)    at org.jboss.arquillian.config.impl.extension.ConfigurationRegistrar.loadConfiguration(ConfigurationRegistrar.java:73)  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)    at java.lang.reflect.Method.invoke(Method.java:498)     at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)     at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)    at org.jboss.arquillian.core.impl.ManagerImpl.start(ManagerImpl.java:290)   at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.(EventTestRunnerAdaptor.java:63)     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)  at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:162)  at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:103)  at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)   at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:114)   at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)     at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)  at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)  at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)     at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)  at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) Caused by: java.lang.IllegalArgumentException: DeployableContainer must be specified   at org.jboss.arquillian.core.spi.Validate.notNull(Validate.java:44)     at org.jboss.arquillian.container.impl.ContainerImpl.(ContainerImpl.java:71)  at org.jboss.arquillian.container.impl.LocalContainerRegistry.create(LocalContainerRegistry.java:80)    at org.jboss.arquillian.container.impl.client.container.ContainerRegistryCreator.createRegistry(ContainerRegistryCreator.java:78)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)    at java.lang.reflect.Method.invoke(Method.java:498)     at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)     at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)    at org.jboss.arquillian.core.impl.ManagerImpl.bindAndFire(ManagerImpl.java:265)     at org.jboss.arquillian.core.impl.InstanceImpl.set(InstanceImpl.java:74)    at org.jboss.arquillian.config.impl.extension.ConfigurationRegistrar.loadConfiguration(ConfigurationRegistrar.java:73)  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)    at java.lang.reflect.Method.invoke(Method.java:498)     at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)     at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)    at org.jboss.arquillian.core.impl.ManagerImpl.start(ManagerImpl.java:290)   at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.(EventTestRunnerAdaptor.java:63)     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)  at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:162)  at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:103)  at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)   at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:114)   at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)     at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)  at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)  at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)     at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)  at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

A: Running with mvn clean install -Pwildfly-managed -Denforcer.skip=true should fix your issue, if you don't want to run the integration tests , you can skip them mvn clean install -DskipTests.
I will update the READMEs to make it more explicit.


text:
Q: How to release an update for AppJs desktop app? Is there a way to auto update the node.js script and the html files?

A: Also there is no updating feature inside AppJS, it is easy to program a script for your own app to update html/js files. The procedure is as follows:
1. Manage your folders so html/js files are placed inside a versioned folder say app-v1.0 and create a symlink name it current folder that refers to app-v1.0.
2. Write a nodejs script which checks for updates by calling a web service. If any new update is available, it should download it and place it in another versioned folder say app-v2.0, update current folder symlink to refer to this new update.
3. In app.js where your program starts, call the above script wait for it to finish and open your window.


text:
Q: node-icu-charset-detector error when deploying to node on Azure When I use git command line to push to Azure I keep on getting this error message (this is the first line of maybe 20 in the message dump, full message below).

remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(326):
  error C2995: 'v8::Local Nan::imp::NanEnsureHandleOrPersistent(const
  v8::Local &)': function template has already been defined
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]

I had an issue with async that I fixed by just using ftp to copy the node_modules\async folder from my development environment up to the node_modules folder in Azure.  Credit for that idea came from this article:
https://azure.microsoft.com/en-us/documentation/articles/nodejs-use-node-modules-azure-apps/
So here's the strange thing - I don't have node-icu-charset in my package.json and it doesn't exist in the node_modules folder either (either local or Azure) so I can't just copy this package up to the cloud to fix this issue like I did with async.
I'm developing on Windows 10 with VS Code, local node.js version is 6.1.0 and server node.js version is 6.1.0.  npm on Azure is 3.8.6.
Everything is working fine locally in my development environment and even though this error has been there in pretty much every push I've made the Azure site is also working as expected.
Does anyone know how to get rid of this error?

  "dependencies": {
    "async": "~2.0.0-rc.6",
    "config": "~1.21.0",
    "body-parser": "~1.13.2",
    "cookie-parser": "~1.3.5",
    "auth0": "~2.1.0",
    "express-jwt": "~3.4.0",
    "debug": "~2.2.0",
    "express": "~4.13.1",
    "jade": "~1.11.0",
    "morgan": "~1.6.1",
    "serve-favicon": "~2.3.0",
    "documentdb": "~1.7.0",
    "node-cache": "~3.2.1",
    "winston": "~2.2.0",
    "winston-irc": "~0.3.4"
  }

remote: Updating branch 'master'. remote: Updating submodules. remote:
  Preparing deployment for commit id 'b11dba66e0'. remote: Generating
  deployment script. remote: Running deployment command... remote:
  Handling node.js deployment. remote: KuduSync.NET from:
  'D:\home\site\repository' to: 'D:\home\site\wwwroot' remote: Copying
  file: 'package.json' remote: Copying file: 'config\default.json'
  remote: Copying file: 'node_modules\async\LICENSE' remote: Copying
  file: 'node_modules\async\package.json' remote: Copying file:
  'node_modules\async\README.md' remote: Using start-up script bin/www
  from package.json. remote: Generated web.config. remote: Node.js
  versions available on the platform are: 0.6.20, 0.8.2, 0.8.19, 0.8.26,
  0.8.27, 0.8.28, 0.10.5, 0.10.18, 0.10.21, 0.10.24, 0.10.26, 0.10.28, 0.10.29, 0.10.31, 0.10.32, 0.10.40, 0.12.0, 0.12.2, 0.12.3, 0.12.6, 4.0.0, 4.1.0, 4.1.2, 4.2.1, 4.2.2, 4.2.3, 4.2.4, 4.3.0, 4.3.2, 4.4.0, 4.4.1, 5.0.0, 5.1.1, 5.3.0, 5.4.0, 5.5.0, 5.6.0, 5.7.0, 5.7.1, 5.8.0, 5.9.1, 6.0.0, 6.1.0. remote: Selected node.js version 6.1.0. Use package.json file to choose a different version. remote: Selected npm
  version 3.8.6 remote: Updating iisnode.yml at
  D:\home\site\wwwroot\bin\iisnode.yml remote: ........... remote:
  remote: > node-icu-charset-detector@0.1.0 install
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector remote: >
  node-gyp rebuild remote: remote: remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector>if not
  defined npm_config_node_gyp (node "C:\Program Files
  (x86)\npm\3.8.6\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js"
  rebuild )  else (node "" rebuild ) remote: ....... remote: Building
  the projects in this solution one at a time. To enable parallel build,
  please add the "/m" switch. remote:   node-icu-charset-detector.cpp
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(326):
  error C2995: 'v8::Local Nan::imp::NanEnsureHandleOrPersistent(const
  v8::Local &)': function template has already been defined
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(319):
  note: see declaration of 'Nan::imp::NanEnsureHandleOrPersistent'
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(346):
  error C2995: 'v8::Local Nan::imp::NanEnsureLocal(const v8::Local
  &)': function template has already been defined
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(334):
  note: see declaration of 'Nan::imp::NanEnsureLocal' remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(560):
  error C2039: 'GCEpilogueCallback': is not a member of 'v8::Isolate'
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  d:\local\userprofile.node-gyp\6.1.0\include\node\v8.h(5306): note:
  see declaration of 'v8::Isolate' remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(560):
  error C2065: 'GCEpilogueCallback': undeclared identifier
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(561):
  error C2146: syntax error: missing ')' before identifier 'callback'
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(561):
  error C2143: syntax error: missing ';' before '{'
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(561):
  error C2447: '{': missing function header (old-style formal list?)
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(566):
  error C2039: 'GCEpilogueCallback': is not a member of 'v8::Isolate'
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  d:\local\userprofile.node-gyp\6.1.0\include\node\v8.h(5306): note:
  see declaration of 'v8::Isolate' remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(566):
  error C2065: 'GCEpilogueCallback': undeclared identifier
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(566):
  error C2146: syntax error: missing ')' before identifier 'callback'
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(566):
  error C2143: syntax error: missing ';' before '{'
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(566):
  error C2447: '{': missing function header (old-style formal list?)
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(571):
  error C2039: 'GCPrologueCallback': is not a member of 'v8::Isolate'
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  d:\local\userprofile.node-gyp\6.1.0\include\node\v8.h(5306): note:
  see declaration of 'v8::Isolate' remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(571):
  error C2065: 'GCPrologueCallback': undeclared identifier
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(572):
  error C2146: syntax error: missing ')' before identifier 'callback'
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(572):
  error C2143: syntax error: missing ';' before '{'
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(572):
  error C2447: '{': missing function header (old-style formal list?)
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(577):
  error C2039: 'GCPrologueCallback': is not a member of 'v8::Isolate'
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  d:\local\userprofile.node-gyp\6.1.0\include\node\v8.h(5306): note:
  see declaration of 'v8::Isolate' remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(577):
  error C2065: 'GCPrologueCallback': undeclared identifier
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(577):
  error C2146: syntax error: missing ')' before identifier 'callback'
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(577):
  error C2143: syntax error: missing ';' before '{'
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(577):
  error C2447: '{': missing function header (old-style formal list?)
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(757):
  error C3083: 'smalloc': the symbol to the left of a '::' must be a
  type
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(757):
  error C2039: 'FreeCallback': is not a member of 'node'
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\local\UserProfile.node-gyp\6.1.0\include\node\node_object_wrap.h(8):
  note: see declaration of 'node' remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(757):
  error C2061: syntax error: identifier 'FreeCallback'
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(761):
  error C2065: 'callback': undeclared identifier
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(761):
  error C2065: 'hint': undeclared identifier
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(768):
  error C2665: 'node::Buffer::New': none of the 4 overloads could
  convert all the argument types
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\local\UserProfile.node-gyp\6.1.0\include\node\node_buffer.h(46):
  note: could be 'v8::MaybeLocal
  node::Buffer::New(v8::Isolate *,char *,size_t)' remote:
  D:\local\UserProfile.node-gyp\6.1.0\include\node\node_buffer.h(34):
  note: or       'v8::MaybeLocal
  node::Buffer::New(v8::Isolate *,v8::Local,node::encoding)'
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(768):
  note: while trying to match the argument list '(v8::Isolate *, const
  char *, uint32_t)' remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(772):
  error C2440: 'return': cannot convert from
  'v8::MaybeLocal' to 'v8::Local'
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(772):
  note: No constructor could take the source type, or constructor
  overload resolution was ambiguous remote: gyp ERR! build error remote:
  gyp ERR! stack Error: msbuild failed with exit code: 1 remote: gyp
  ERR! stack     at ChildProcess.onExit (C:\Program Files
  (x86)\npm\3.8.6\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
  remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(779):
  error C2039: 'Use': is not a member of 'node::Buffer'
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote: gyp ERR! stack     at emitTwo (events.js:106:13) remote:
  D:\local\UserProfile.node-gyp\6.1.0\include\node\node_buffer.h(11):
  note: see declaration of 'node::Buffer' remote: gyp ERR! stack     at
  ChildProcess.emit (events.js:191:7) remote:
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector\node_modules\nan\nan.h(779):
  error C3861: 'Use': identifier not found
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote: gyp ERR! stack     at Process.ChildProcess._handle.onexit
  (internal/child_process.js:204:12) remote:
  ..\node-icu-charset-detector.cpp(7): fatal error C1083: Cannot open
  include file: 'unicode/ucsdet.h': No such file or directory
  [D:\home\site\wwwroot\node_modules\node-icu-charset-detector\build\node-icu-charset-detector.vcxproj]
  remote: gyp ERR! System Windows_NT 6.2.9200 remote: gyp ERR! command
  "D:\Program Files (x86)\nodejs\6.1.0\node.exe" "C:\Program Files
  (x86)\npm\3.8.6\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js"
  "rebuild" remote: gyp ERR! cwd
  D:\home\site\wwwroot\node_modules\node-icu-charset-detector remote:
  gyp ERR! node -v v6.1.0 remote: gyp ERR! node-gyp -v v3.3.1 remote:
  gyp ERR! not ok remote: npm WARN
  install:node-icu-charset-detector@0.1.0
  node-icu-charset-detector@0.1.0 install: node-gyp rebuild remote:
  npm WARN install:node-icu-charset-detector@0.1.0 Exit status 1 remote:
  Finished successfully. remote: Running post deployment command(s)...
  remote: Deployment successful.

A: As checked these dependencies one by one, I found that the module winston-irc is the criminal, whose deep dependencies including chain is winston-irc=>irc=>node-irc=>node-icu-charset-detector.
So this maybe the one of Native Modules which is not supported via directly deployment task yet. You can remove this node module from .gitingore file and uploud to Azure Web App with the application project.
Any further concern, please feel free to let me know.


text:
Q: Strongly minimal covering subsets of $\text{Ind}(G)$ Let $G=(V,E)$ be an undirected, simple graph. Let $\text{Ind}(G)$ be the set of independent subsets of $V(G)$. We say that $K\subseteq \text{Ind}(G)$ is a cover (by independent subsets) if $\bigcup K = V(G)$ and denote the collection of all such covers with $\text{CovInd}(G)$.
We call a cover $M\in \text{CovInd}(G)$ strongly minimal if for all $K\in \text{CovInd}(G)$ we have $$|M\setminus K| \leq |K\setminus M|.$$ It is easy to show that strongly minimal covers are minimal elements of $\text{CovInd}(G)$ with respect to set inclusion. It's also easy to see that the cardinality of any strongly minimal cover equals $\text{min}\{|C|: C\in\text{CovInd}(G)\}$. (Both statements are valid for finite as well as infinite graphs.)
Question. Does every graph have a strongly minimal cover by independent subsets? (The answer is trivially positive for finite graphs.)


text:
Q: apache spark2.3.0 when launched with master as yarn, fails with error Could not find or load main class org.apache.spark.deploy.yarn.ApplicationMaster I have installed Apache Hadoop 2.7.5 and Apache Spark 2.3.0.
When I am submitting my job with --master local[*] it runs fine. But when I run --master yarn the error from the web logs says
Error: Could not find or load main class org.apache.spark.deploy.yarn.ApplicationMaster

Here is the command I am firing:
spark-submit --class com.spark.SparkTest --master yarn --deploy-mode cluster /root/Downloads/SimpleSpark-0.0.1-SNAPSHOT.jar

And the console reads:
[root@localhost sbin]# spark-submit --class com.spark.SparkTest --master yarn --deploy-mode cluster /root/Downloads/SimpleSpark-0.0.1-SNAPSHOT.jar
2018-05-12 17:24:37 WARN  NativeCodeLoader:62 - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
2018-05-12 17:24:39 INFO  RMProxy:98 - Connecting to ResourceManager at /0.0.0.0:8032
2018-05-12 17:24:40 INFO  Client:54 - Requesting a new application from cluster with 1 NodeManagers
2018-05-12 17:24:40 INFO  Client:54 - Verifying our application has not requested more than the maximum memory capability of the cluster (8192 MB per container)
2018-05-12 17:24:40 INFO  Client:54 - Will allocate AM container, with 1408 MB memory including 384 MB overhead
2018-05-12 17:24:40 INFO  Client:54 - Setting up container launch context for our AM
2018-05-12 17:24:40 INFO  Client:54 - Setting up the launch environment for our AM container
2018-05-12 17:24:40 INFO  Client:54 - Preparing resources for our AM container
2018-05-12 17:24:43 INFO  Client:54 - Uploading resource file:/opt/spark-2.3.0/yarn/spark-2.3.0-yarn-shuffle.jar -> hdfs://localhost:9000/user/root/.sparkStaging/application_1526143826498_0001/spark-2.3.0-yarn-shuffle.jar
2018-05-12 17:24:45 INFO  Client:54 - Uploading resource file:/root/Downloads/SimpleSpark-0.0.1-SNAPSHOT.jar -> hdfs://localhost:9000/user/root/.sparkStaging/application_1526143826498_0001/SimpleSpark-0.0.1-SNAPSHOT.jar
2018-05-12 17:24:45 WARN  DFSClient:611 - Caught exception
java.lang.InterruptedException
        at java.lang.Object.wait(Native Method)
        at java.lang.Thread.join(Thread.java:1252)
        at java.lang.Thread.join(Thread.java:1326)
        at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.closeResponder(DFSOutputStream.java:609)
        at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.endBlock(DFSOutputStream.java:370)
        at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.run(DFSOutputStream.java:546)
2018-05-12 17:24:45 WARN  Client:66 - Same name resource file:/opt/spark-2.3.0/yarn/spark-2.3.0-yarn-shuffle.jar added multiple times to distributed cache
2018-05-12 17:24:45 INFO  Client:54 - Uploading resource file:/tmp/spark-6db13382-d02d-4e8a-b5bf-5aafd535ba1e/__spark_conf__789951835863303071.zip -> hdfs://localhost:9000/user/root/.sparkStaging/application_1526143826498_0001/__spark_conf__.zip
2018-05-12 17:24:46 WARN  DFSClient:611 - Caught exception
java.lang.InterruptedException
        at java.lang.Object.wait(Native Method)
        at java.lang.Thread.join(Thread.java:1252)
        at java.lang.Thread.join(Thread.java:1326)
        at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.closeResponder(DFSOutputStream.java:609)
        at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.endBlock(DFSOutputStream.java:370)
        at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.run(DFSOutputStream.java:546)
2018-05-12 17:24:46 INFO  SecurityManager:54 - Changing view acls to: root
2018-05-12 17:24:46 INFO  SecurityManager:54 - Changing modify acls to: root
2018-05-12 17:24:46 INFO  SecurityManager:54 - Changing view acls groups to:
2018-05-12 17:24:46 INFO  SecurityManager:54 - Changing modify acls groups to:
2018-05-12 17:24:46 INFO  SecurityManager:54 - SecurityManager: authentication disabled; ui acls disabled; users  with view permissions: Set(root); groups with view permissions: Set(); users  with modify permissions: Set(root); groups with modify permissions: Set()
2018-05-12 17:24:46 INFO  Client:54 - Submitting application application_1526143826498_0001 to ResourceManager
2018-05-12 17:24:46 INFO  YarnClientImpl:273 - Submitted application application_1526143826498_0001
2018-05-12 17:24:47 INFO  Client:54 - Application report for application_1526143826498_0001 (state: ACCEPTED)
2018-05-12 17:24:47 INFO  Client:54 -
         client token: N/A
         diagnostics: N/A
         ApplicationMaster host: N/A
         ApplicationMaster RPC port: -1
         queue: default
         start time: 1526145886541
         final status: UNDEFINED
         tracking URL: http://localhost.localdomain:8088/proxy/application_1526143826498_0001/
         user: root
2018-05-12 17:24:48 INFO  Client:54 - Application report for application_1526143826498_0001 (state: ACCEPTED)
2018-05-12 17:24:49 INFO  Client:54 - Application report for application_1526143826498_0001 (state: ACCEPTED)
2018-05-12 17:24:50 INFO  Client:54 - Application report for application_1526143826498_0001 (state: ACCEPTED)
2018-05-12 17:24:51 INFO  Client:54 - Application report for application_1526143826498_0001 (state: ACCEPTED)
2018-05-12 17:24:52 INFO  Client:54 - Application report for application_1526143826498_0001 (state: ACCEPTED)
2018-05-12 17:24:53 INFO  Client:54 - Application report for application_1526143826498_0001 (state: ACCEPTED)
2018-05-12 17:24:54 INFO  Client:54 - Application report for application_1526143826498_0001 (state: FAILED)
2018-05-12 17:24:54 INFO  Client:54 -
         client token: N/A
         diagnostics: Application application_1526143826498_0001 failed 2 times due to AM Container for appattempt_1526143826498_0001_000002 exited with  exitCode: 1
For more detailed output, check application tracking page:http://localhost.localdomain:8088/cluster/app/application_1526143826498_0001Then, click on links to logs of each attempt.
Diagnostics: Exception from container-launch.
Container id: container_1526143826498_0001_02_000001
Exit code: 1
Stack trace: ExitCodeException exitCode=1:
        at org.apache.hadoop.util.Shell.runCommand(Shell.java:585)
        at org.apache.hadoop.util.Shell.run(Shell.java:482)
        at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:776)
        at org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor.launchContainer(DefaultContainerExecutor.java:212)
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:302)
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:82)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

Container exited with a non-zero exit code 1
Failing this attempt. Failing the application.
         ApplicationMaster host: N/A
         ApplicationMaster RPC port: -1
         queue: default
         start time: 1526145886541
         final status: FAILED
         tracking URL: http://localhost.localdomain:8088/cluster/app/application_1526143826498_0001
         user: root
2018-05-12 17:24:54 INFO  Client:54 - Deleted staging directory hdfs://localhost:9000/user/root/.sparkStaging/application_1526143826498_0001
Exception in thread "main" org.apache.spark.SparkException: Application application_1526143826498_0001 finished with failed status
        at org.apache.spark.deploy.yarn.Client.run(Client.scala:1159)
        at org.apache.spark.deploy.yarn.YarnClusterApplication.start(Client.scala:1518)
        at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:879)
        at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:197)
        at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:227)
        at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:136)
        at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
2018-05-12 17:24:55 INFO  ShutdownHookManager:54 - Shutdown hook called
2018-05-12 17:24:55 INFO  ShutdownHookManager:54 - Deleting directory /tmp/spark-6db13382-d02d-4e8a-b5bf-5aafd535ba1e
2018-05-12 17:24:55 INFO  ShutdownHookManager:54 - Deleting directory /tmp/spark-1218ca67-7fae-4c0b-b678-002963a1cf08

The Diagnostics reads:
Application application_1526143826498_0001 failed 2 times due to AM Container for appattempt_1526143826498_0001_000002 exited with exitCode: 1
For more detailed output, check application tracking page:http://localhost.localdomain:8088/cluster/app/application_1526143826498_0001Then, click on links to logs of each attempt.
Diagnostics: Exception from container-launch.
Container id: container_1526143826498_0001_02_000001
Exit code: 1
Stack trace: ExitCodeException exitCode=1:
at org.apache.hadoop.util.Shell.runCommand(Shell.java:585)
at org.apache.hadoop.util.Shell.run(Shell.java:482)
at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:776)
at org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor.launchContainer(DefaultContainerExecutor.java:212)
at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:302)
at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:82)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Container exited with a non-zero exit code 1
Failing this attempt. Failing the application.

When I click the logs for details:
Error: Could not find or load main class org.apache.spark.deploy.yarn.ApplicationMaster

Here is my spark-defaults.conf:
spark.master                     spark://localhost.localdomain:7077
spark.eventLog.enabled           true
spark.eventLog.dir               hdfs://localhost.localdomain:8021/user/spark/logs
spark.serializer                 org.apache.spark.serializer.KryoSerializer
spark.driver.memory              1g
spark.executor.memory            1g
spark.yarn.dist.jars             /opt/spark-2.3.0/yarn/spark-2.3.0-yarn-shuffle.jar
spark.yarn.jars                  /opt/spark-2.3.0/yarn/spark-2.3.0-yarn-shuffle.jar
# spark.executor.extraJavaOptions  -XX:+PrintGCDetails -Dkey=value -Dnumbers="one two three"

My spark-env.sh:
SPARK_MASTER_HOST=localhost.localdomain
SPARK_MASTER_PORT=7077
SPARK_LOCAL_IP=localhost.localdomain
SPARK_CONF_DIR=${SPARK_HOME}/conf
HADOOP_CONF_DIR=/opt/hadoop-2.7.5/etc/hadoop
YARN_CONF_DIR=/opt/hadoop-2.7.5/etc/hadoop
SPARK_EXECUTOR_CORES=2
SPARK_EXECUTOR_MEMORY=500M
SPARK_DRIVER_MEMORY=500M

And my yarn-site.xml:
<configuration>
        <property>
                <name>yarn.nodemanager.aux-services</name>
                <value>mapreduce_shuffle</value>
        </property>
        <property>
                <name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
                <value>org.apache.hadoop.mapred.ShuffleHandler</value>
        </property>
        <property>
                <name>yarn.nodemanager.vmem-check-enabled</name>
                <value>false</value>
        </property>
        <property>
                <name>yarn.application.classpath</name>
                <value>
                /opt/hadoop-2.7.5/etc/hadoop,
                /opt/hadoop-2.7.5/*,
                /opt/hadoop-2.7.5/lib/*,
                /opt/hadoop-2.7.5/share/hadoop/common/*,
                /opt/hadoop-2.7.5/share/hadoop/common/lib/*
                /opt/hadoop-2.7.5/share/hadoop/hdfs/*,
                /opt/hadoop-2.7.5/share/hadoop/hdfs/lib/*,
                /opt/hadoop-2.7.5/share/hadoop/mapreduce/*,
                /opt/hadoop-2.7.5/share/hadoop/mapreduce/lib/*,
                /opt/hadoop-2.7.5/share/hadoop/tools/lib/*,
                /opt/hadoop-2.7.5/share/hadoop/yarn/*,
                /opt/hadoop-2.7.5/share/hadoop/yarn/lib/*
                </value>
        </property>
</configuration>

I have copied spark-yarn_2.11-2.3.0.jar to /opt/hadoop-2.7.5/share/hadoop/yarn/*.
I went thorugh several stackoverflow solutions where the mentioned about passing --conf "spark.driver.extraJavaOptions=-Diop.version=4.1.0.0" but it didn't work for my case.
Some solution said about missing logging jars, but I am not sure about which jar.
Am I missing any configuration ??

A: Try running the command by adding the jars using --jars
spark-submit --class com.spark.SparkTest --master yarn  --jars /fullpath/first.jar,/fullpath/second.jar --deploy-mode cluster /root/Downloads/SimpleSpark-0.0.1-SNAPSHOT.jar

Or add jars in conf/spark-defaults.conf by adding lines like:
spark.driver.extraClassPath /fullpath/yarn-jar.jar:/fullpath/second.jar
spark.executor.extraClassPath /fullpath/yarn-jar.jar:/fullpath/second.jar


text:
Q: VS2013 Is Not Compatible With VS2015 Project Type (ASP.NET Projects) I am using Visual Studio 2013.
But when i open the MVC project code in Github: https://github.com/aspnet/Mvc
I found that the solution was built on the new type (project contains: xxx.xproj + xxx.json) (I think they are VS 2015 types)
Is there any way to let my VS 2013 compatible with the new project type?

A: This repo is a fork of next version of ASP.NET MVC. It's  built to run on VS 2015, C#6 and the next runtime. Even if you could open it, you couldn't compile or run it.
Visual Studio 2015 can create both vNext (5) and ASP.NET 4.5/4.6 projects. ASP.NET 5 projects can't open with older Visual Studio versions - the different project structure is one of the main features of ASP.NET vNext.
ASP.NET 4.5 projects though have no problem opening in 2013. ASP.NET 4.6 projects have the same project structure but I haven't tested if they can open in 2013. I would expect tooling differences to make this difficult.


text:
Q: Email with image via external path C# Here is a situation.
I am sending an email that has image as html body

After receiving email image src is changed to

Hence does not render image. Following is the code used to send email
SmtpClient sc = new SmtpClient("smtp.live.com");
            sc.Port = 587;
            sc.UseDefaultCredentials = false;
            sc.Credentials = new NetworkCredential("someemail@hotmail.com", "password");
            sc.EnableSsl = true;
            MailMessage m = new MailMessage();
            m.From = new MailAddress("someemail@hotmail.com");
            m.Subject = "test subject";
            m.IsBodyHtml = true;
            m.Body = "";
            m.To.Add(new MailAddress("someemail@hotmail.com"));
            sc.Send(m);

First image url gets changed and second image's url remains same. So whats the science?
I don't want to embed image.

A: Once you send the e-mail you have yielded control to the receiving system. Most MTAs are going to do some kind of reformatting either due to anti-virus, phishing, etc. scans. Many will rework the img source to use their own proxies. You have no way to stop them. You just get to work with them.