text:
Q: How do all the planets in the Star Wars universe contain breathable atmosphere and Earth gravity? All sorts of different species inhabit the Star Wars universe. How is it that their biological function is compatible with the same atmospheric gases, and that the gravity is the same on all the planets, and the sun is just the right difference from the planet to sustain life?

A: They don't all contain human-breathable atmosphere. The Kel Dor breathe helium and Dorin gas, and are poisoned by oxygen-rich environments (plus carbon dioxide and nitrogen in Legends canon). They wear a filter mask to compensate.
In Legends canon, there are a couple of different atmospheric types. Type I is human-breathable. Type II is potentially toxic, but can be managed without aid in the short term. Type III require a breath mask, and Type IV requires a full environment suit.

A: There's never been any indications that ALL the planets in the Star Wars universe have breathable environments, survivable levels of gravity, etc. We see a lot of those kinds of planets because, well, otherwise our characters wouldn't be on those planets. But we do see gas giants like Yavin and Endor from space.

There's also plenty of indication that there are planets with radically different environments that still support life. The Jedi Plo Koon, for example, wears a rebreather mask since he doesn't breathe oxygen. While I'm not sure it's ever stated in a canon source, his home planet of Dorin is rich in helium.

As for why there are so many habitable planets, it's not that unrealistic. Star Wars takes place in an entire galaxy. The Milky Way has billions of stars and even more planets. Chances are, there are as many potentially habitable planets in our galaxy.

A: This is great question over which i was wondering also. At first let me say that most answers here fail to recognize the real problem pointed out here in part because the answer is clumsily formulated. The better formulation which comes to my mind is:
Why it is that planets which support some life and we get to see them in star wars movies and other media are of such nature that almost all are habitable by human. In other words, how it is that most of aliens we get to see demand same environment as human
At first note that rare exception like Plo-koon does not count to counterpoint the question, as we don't ask for all planets and aliens but most. Even Plo-koon share same need of pressure, heat, gravity and other things. He just cant breathe but don't have problems with other parameters.
I came to some answers, which are itself dubious but make some sense:

*

*Humans may be one of the oldest intelligent species in galaxy and so they were able to colonize more planets than any other species. (But that does not mean more than other species combined.)

*Humans may belong to most probable intelligent life-form to evolve, in other words, earth like conditions may be most probable environment to support life and many of the lifeforms could evolve from the similar planets. (Yet this does not mean most of all, although earth like conditions could be the most probable condition it does not mean it would be more than the others combined) (Also there are species like space-whales, so pretty improbable one)

*It may be that most of habitable planet are product of terraforming from some even older species like Rakatan empire or Sentinels.

*It is possible that humans or other specie which need similar environment just force most of other planets to terraform and than force native to adapt by genetic engineering. Although there is some tendency to human supremacy, it seems improbable. And if the humans were so abusive to change environment of strangers planets, why would they care to modify them and don't let them die? And how would they change gravity?

*Humans or some older species with need of same environment just destroyed most of planets with lifeforms incompatible environment.

*It is the will of force to unite all species together

*It is humans who are modified to survive most conditions. That is improbable because we see most of other species to interact together on Coruscant.

*There is big number of planetary life with environment non-compatible to human yet we don't get to see those planets because we follow human heroes. Well it seems possible but if there is big number of such planets, than they should have some influence in galactic politics and warfare so our heroes would have to go there. Also we don't see much of the species with technical life support in senate.

*It may be that those species are ignored by galactic government. But how it can be, that they are so weak that they do not force the government to count with them. If we say there is more of them, than the ruling one, it is improbable.

*All of the above combined.
So those are my ideas.
Please forgive my English and spelling errors.

A: In my opinion not all planets in the galaxy far far away are habitable, it's just that we are mostly shown planets that are.  There wouldn't be much of a story if everyone on a planet were dead.

Kel Dor's species have to wear masks since they breathe something other than oxygen (helium and Dorin gas).

Gungans are an amphibious species so they are also quite different from humans
Many planets wouldn't be able to evolve intelligent life. For example, Hoth was an ice planet and home to primitive tauntauns and wampas.

Another example is Mustafar, which is a volcanic planet.

As for why all species are pretty much the same humanoids with the same biological functions, it wouldn't make a good story if everyone had to wear space suits all the time when they were on other planets. Regarding gravity, it would be weird if Jedi came to some planet with G15 and couldn't move an inch, wouldn't it?
But that's just my take on the thing :D

A: It's now part of the Legends universe and non-canon, but the video game Knights of the Old Republic establishes that

 an ancient race called the Rakata used powerful technology to terraform many planets to suit their desires.

This is also the explanation for why many of the planets shown in the films are "single-climate" planets (e.g. desert planet, snow planet, forest planet), something that would be incredibly unlikely in real life.
You can read about the Rakata here: http://starwars.wikia.com/wiki/Rakata, but I highly recommend actually playing the game.
Aside from that, the films and other media cover life-sustaining planets because completely uninhabitable planets are not very interesting settings and Hollywood hates putting masks on actors.

A: Not all of the planets are habitable, as many have said before me, however the story only takes place on these planets with breathable oxygen and gravity similar to (or the same as) Earth's.


text:
Q: ISO8601 dates parsed from XML have different Timezones I have an XML segment that contains two dates in format e.g. 2016-03-22 and 2016-03-29. They are parsed from XML to String objects and then converted to ISO8601 compliant date objects. During this process, the 2016-03-22 is interpreted as Tue Mar 22 00:00:00 GMT 2016 while the second date gets interpreted as Tue Mar 29 00:00:00 BST 2016. You will see that one is in GMT TZ and the other in BST timezone. This means that calculating days between those dates results in a day less than I'd expect. The clocks go forward this year on 30th March and I am not sure if there is a correlation since this is happening for ranges of dates close to but no including March 30th. This year is also a leap year, cannot be sure if that also has a bearing on the dates involved.
Have you any thoughts on why this might happen?
Thanks,
Ger.

A: Just FYI, most (if not all) European countries change to Daylight Savings Time on Sunday March 27. This also explains the BST (British Summer Time) time zone that you get when parsing "2016-03-29".
However, if you perform period or duration calculations based on input data that originally does not include time zone information, you should expect results like this.
If you are using Java, I suggest using the excellent java.time API, introduced in Java 8. If Java 8 is not an option, look for Joda Time or its C# (.NET) counterpart, Noda Time.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to get the difference between two dates with php and symfony 4? I am developing a holiday management project. There is an entity called Conge which includes date_departure, date_retrun and period. I made a form and the view. I would like to set the difference between the date of departure and the date of return. For example, if the user chooses dates from '04-05-2019' to '04-08-2019', how can I get and display the difference in days using javascript, php, and symfony4?

A: If you are always going to use the m-d-Y format for your dates you can use just PHP to give you the number of days difference.
$departure ="04-05-2019";
$arrival = "04-08-2019";
$departure = DateTime::createFromFormat('m-d-Y', $departure)->getTimestamp();
$arrival = DateTime::createFromFormat('m-d-Y', $arrival)->getTimestamp();
echo ($arrival - $departure) / (24*60*60);  // 86400 might save some math

A: Use momentjs (https://momentjs.com/docs/#/displaying/difference/)
var departureRaw = $(".departure").val();
var departureDate = moment(departureRaw);

var returnRaw = $(".return").val();
var returnDate = moment(returnRaw);

var difference = departureDate.diff(returnDate, 'days');

A: for php, as mentionned here and here you can use ->diff() function. I don't think than Symfony have any function for that


text:
Q: Flume can't access s3 to write the file java.lang.IllegalArgumentException: Invalid hostname in URI s3://ACCESSKEY:SECRETKEY/@bucket Flume is install on amazon EC2 (Amazon Linux AMI 2018.03.0.20190514 x86_64 HVM gp2) Flume version: 1.9
I try to use a local as a sink the copy works perfectly. But when I use S3 as a sink, I hit the invalid hostname in URI problem.
I doubled check my access key and secret key, they are all correct.
I tried to use s3n:// it did not work
# example.conf: A single-node Flume configuration

# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1

a1.sources.r1.type = org.apache.flume.source.kafka.KafkaSource
a1.sources.r1.kafka.bootstrap.servers = localhost:9092
a1.sources.r1.kafka.topics = testflume
a1.sources.r1.kafka.consumer.group.id = flumeconsumer

a1.sinks.k1.type = hdfs
a1.sinks.k1.hdfs.path = s3://AWSACCESSKEY:AWSSECRETKEY@bucket/path
a1.sinks.k1.hdfs.fileType = DataStream
a1.sinks.k1.hdfs.filePrefix = event
a1.sinks.k1.hdfs.rollInterval = 10

# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 1000

# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

The error
[ERROR - org.apache.flume.sink.hdfs.HDFSEventSink.process(HDFSEventSink.java:459)] process failed
java.lang.IllegalArgumentException: Invalid hostname in URI s3://AWSACCESSKEY:AWSSECRETKEY@bucket/path/event.1558997927667.tmp

I expect flume to authenticate successfully in S3 and write the files

A: Can you try using s3a://?
But it is good practice to assign a role to EC2 instance and give permission to S3 for that role, instead of providing AWS Access and secret keys. Once you setup that you can the path as s3a://bucket_name/path/../


text:
Q: Should I explicitly create a promise when waiting for an event to fire? I am writing a function to get an rss feed and return the date of the last update:
var FeedParser = require('feedparser'),
Promise = require('bluebird'),
request = require('request');

function getDate() {
    var deferred = Promise.defer();
    var feed = new FeedParser();
    request('rss.xml');
    .on('response',function() {
        this.pipe(feed);
    });

    feed.on('meta',function() {
        deferred.resolve(this.meta.date);
    });

    return deferred.promise;
}

Is this an anti-pattern? What is the proper way to do this?

A: You can simplify it a bit.
var FeedParser = require('feedparser'),
Promise = require('bluebird'),
request = require('request');

function getDate() {
  return new Promise(function(resolve, reject){
    var feed = new FeedParser();
    request('rss.xml').on('error', reject).pipe(feed);
    feed.on('meta',function() {
      resolve(this.meta.date);
    }).on('error', reject);
  });
}


text:
Q: How is a flex child's 100% width calculated? When I set the .sidebar width to be 100%, it gets smaller than before.
However, when I remove the body's font-size: 1.3rem and toggle the .sidebar's width: 100%, it gets slightly larger.
I know that when we set the font-size to be 1.3rem, .primary-content's horizontal width (if it didn't wrap) should still be the same ratio as the .sidebar's width (if it didn't wrap).
So I'm not sure how flexbox calculates width: 100%

body {
  font-size: 1.3rem;
}

h1 {
  margin-top: 0;
}

.container {
  width: 80%;
  max-width: 1100px;
  margin: 0 auto;
}

.row {
  display: flex;
}

.primary-content {
  background-color: moccasin;
}

.sidebar {
  /* width: 100%; */
  padding: 1em;
  text-align: center;
  color: #fff;
  background-color: #136c72;
}

Quality designs made custom, on demand, just for you

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
      et dolore magna aliqua. Ut enim ad minim veniam.

Cheap

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.

Here's the codepen.
https://codepen.io/Fullchee/pen/OJMBovq

A: It's all about the initial width here. To understand this let's take another simple example with less code:

.box {
  display: flex;
  width: 50%;
  border: 2px solid red;
  margin: auto;
}

.box>div {
  border: 1px solid green;
}

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris nulla nisi, accumsan vel purus nec, pretium dictum ex. Suspendisse pellentesque velit eget turpis porttitor efficitur

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris nulla nisi, accumsan vel purus nec, pretium dictum ex. Suspendisse pellentesque velit eget turpis porttitor efficitur

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris nulla nisi, accumsan vel purus nec, pretium dictum ex. Suspendisse pellentesque velit eget turpis porttitor efficitur

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris nulla nisi, accumsan vel purus nec, pretium dictum ex. Suspendisse pellentesque velit eget turpis porttitor efficitur

It's trivial, that the second case seems a bit strange because the width is reduced but this is logical.
First, you should notice that both elements have the same content and the content need to wrap inside each one because there is not enough space.
If we reduce the content it will be different:

.box {
  display: flex;
  width: 50%;
  border: 2px solid red;
  margin: auto;
}

.box>div {
  border: 1px solid green;
}

    Lorem ipsum dolor sit amet,

    Lorem ipsum dolor sit amet,

    Lorem ipsum dolor sit amet,

    Lorem ipsum dolor sit amet,

To understand both cases, you need to understand the flexbox algorithm that I will summarize in 3 points:

*

*We first set the initial width of each element

*If the total width is bigger that the container width, we shrink both elements

*The shrink factor consider the negative free space (total width - container width) and the width of each element.

The trick is in the (1).
Without width:100% we will have the following in (1)

$('.box div').each(function() {
  console.log($(this).width());
})
.box {
  display: flex;
  width: 50%;
  border: 2px solid red;
  margin: auto;
}

.box>div {
  border: 1px solid green;
  flex-shrink:0;
}

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris nulla nisi, accumsan vel purus nec, pretium dictum ex. Suspendisse pellentesque velit eget turpis porttitor efficitur

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris nulla nisi, accumsan vel purus nec, pretium dictum ex. Suspendisse pellentesque velit eget turpis porttitor efficitur

Both elements have the same width so both will shrink the same way to get the following:

$('.box div').each(function() {
  console.log($(this).width());
})
.box {
  display: flex;
  width: 50%;
  border: 2px solid red;
  margin: auto;
}

.box>div {
  border: 1px solid green;
  flex-shrink:1;
}

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris nulla nisi, accumsan vel purus nec, pretium dictum ex. Suspendisse pellentesque velit eget turpis porttitor efficitur

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris nulla nisi, accumsan vel purus nec, pretium dictum ex. Suspendisse pellentesque velit eget turpis porttitor efficitur

Now if you make the second element width:100% it will have a smaller initial width

$('.box div').each(function() {
  console.log($(this).width());
})
.box {
  display: flex;
  width: 50%;
  border: 2px solid red;
  margin: auto;
}

.box>div {
  border: 1px solid green;
  flex-shrink:0;
}

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris nulla nisi, accumsan vel purus nec, pretium dictum ex. Suspendisse pellentesque velit eget turpis porttitor efficitur

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris nulla nisi, accumsan vel purus nec, pretium dictum ex. Suspendisse pellentesque velit eget turpis porttitor efficitur

The first one is almost 3 times bigger than the second one thus they will not shrink the same way and at the end the second will remain smaller (it will be kept at almost 3 times smaller)

$('.box div').each(function() {
  console.log($(this).width());
})
.box {
  display: flex;
  width: 50%;
  border: 2px solid red;
  margin: auto;
}

.box>div {
  border: 1px solid green;
  flex-shrink:1;
}

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris nulla nisi, accumsan vel purus nec, pretium dictum ex. Suspendisse pellentesque velit eget turpis porttitor efficitur

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris nulla nisi, accumsan vel purus nec, pretium dictum ex. Suspendisse pellentesque velit eget turpis porttitor efficitur

Same logic apply to your code!
The same logic also apply when smaller content is used but in this case width:100% can make the initial width of the second item bigger so we end having a bigger element (like in the second snippet above)

Some related questions where you will get more details around the calculation and the flexbox algorithm:
How flexbox calculates flex-item's width if no flex-basis or width are set?
Why is a flex item limited to parent size?
The unpredictable wrapping habits of CSS

In case you want to increase the width of your element you can make the first element to shrink more:

body {
  font-size: 1.3rem;
}

h1 {
  margin-top: 0;
}

.container {
  width: 80%;
  max-width: 1100px;
  margin: 0 auto;
}

.row {
  display: flex;
}

.primary-content {
  background-color: moccasin;
}

.sidebar {
  padding: 1em;
  text-align: center;
  color: #fff;
  background-color: #136c72;
}

Quality designs made custom, on demand, just for you

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
      et dolore magna aliqua. Ut enim ad minim veniam.

Cheap

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.

Quality designs made custom, on demand, just for you

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
      et dolore magna aliqua. Ut enim ad minim veniam.

Cheap

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.

You can also define flex-shrink for both and make sure it's bigger for the first element:


text:
Q: How to change the titlebar font-size of a javax.swing.JFrame window I'm figuring out how to change the font-size of the titlebar on the following window:

This is the code of the JFrame container:
public class MyWindow extends JFrame {

  //Constructor of my window
  public MyWindow() {
      this.setSize(600, 300);
      this.setVisible(true);
      this.setLocationRelativeTo(null);
      this.setDefaultCloseOperation(EXIT_ON_CLOSE);
      this.setTitle("I want to change the font-size of this Title");
      this.initComponents();
  }

  //Declaration and deveploment of the components of my window
  private void initComponents() {
      JPanel myPanel = new JPanel();
      this.getContentPane().add(myPanel);
      JLabel myLabel = new JLabel();
      myPanel.add(myLabel);
      myLabel.setText("Hello World!!!");
      myLabel.setFont(new Font("Calibri", Font.BOLD, 32));
      myLabel.setForeground(Color.decode("#1165AA"));
      myPanel.setLayout(null);
      myLabel.setBounds(200, 80, 200, 50);
  }
}

And this is the Main class code that runs the program:
public class Main {
    public static void main(String[] args) {
       MyWindow window = new MyWindow();
    }
}

After reading a lot of posts, I think it is not possible because the titlebar styles would be controlled by the user OS, but I want to explore all the options...
Thanks


text:
Q: How to make an eventlistener in a UI thread to listen to an event from another UI thread started from the first thread? I have tried to look for a solution to this problem for some time, but nothing I've found solves my problem.
I have two UI threads, Window A and Window B, in a single instance application where B is created and started from A. When I try to add an event listener in the A to listen for when B is visible or not, I get an NullReferenceException in System.Threading.Tasks.dll with the note "Object reference not set to an instance of an object.". I have tried to use a Dispatcher without any luck. Here is a mock up of my code (both classes are in the same namespace):
public partial class A : Window
{
    private B _b;
    private Thread _bThread;
    private Dispatcher _bDispatcher;

    public A ()
    {
        InitializeComponent();

        _bThread = new Thread(() =>
        {
            try
            {
                _bDispatcher = Dispatcher.CurrentDispatcher;
                _b = new B();
                Dispatcher.Run();
            }
            catch (Exception ex)
            {
                Logger.Log(ex.message);
            }
        });
        _bThread.SetApartmentState(ApartmentState.STA);
        _bThread.Start();

       _b.VisibleChanged+= _b_VisibleChanged; // <= if this line is removed the program can start, but with this line I get the exception and the program crasches..
    }

    private void _b_VisibleChanged(object sender, EventArgs e)
    {
        // change margin values on A..
    }
}

public partial class B : Window
{

    private static EventHandlerList Events = new EventHandlerList();
    private static readonly object EventVisibleChanged = new object();

    public B ()
    {
        InitializeComponent();
        // other stuff
    }

    private void Window_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
    {
        TriggerOnVisibleChanged();
    }

    #region Triggers

    private void TriggerOnVisibleChanged()
    {
        ((EventHandler<EventArgs>)Events[EventVisibleChanged])?.Invoke(this, null);
    }

    #endregion

    #region Event add/remove handlers

    public event EventHandler<EventArgs> VisibleChanged
    {
        add
        {
            Events.AddHandler(EventVisibleChanged, value);
        }
        remove
        {
            Events.RemoveHandler(EventVisibleChanged, value);
        }
    }

    #endregion
}

I don't know what I am doing wrong and I don't know how to make this work, can someone help me?
PS. this is for wpf, not Forms.. DS.
PS2. I know I did not have to create my own event and trigger and could just have used the IsVisibleChanged event in window B, but I have tried that with the same result..DS.

A: I don't believe what you want is possible as WPF uses an 'apartment' model that adheres to thread affinity, i.e. threads cannot interact with each other.
Furthermore, you may be falling into this trap more tightly... as it says in the article "WPF objects that have thread affinity derive from the Dispatcher object."
See here for more information on threading in WPF
EDIT: Why do it in multiple threads? Perhaps what you are looking for is the RoutedEventHandler (defined in the child window)... see this SO post for an example


text:
Q: Postgresql aggregate and join Уважаемое сообщество, я новичок в postgresql. Объясните мне, пожалуйста. Где пресловутая "крутость" Постгры? Почему она не поддерживает алиасы в селектах и я должен в having дублировать агрегированные функции, которые, скорее всего, выполняются ещё раз? Насколько эта калькуляция увеличивает время выполнения? Похоже, что это вложенный цикл (хоть и лекговесный. А легковесный ли?).
Есть 2 таблицы: пользователи и отзывы (users.id <--- reviews.user_id)
select
    distinct users.id,
    AVG(reviews.vote) as avg,
    count(reviews.id) as cnt
from
    "users"
left join "reviews" on
    "reviews"."user_id" = "users"."id"
group by
    "users"."id"
having
    AVG(reviews.vote) > 2.5 and count(reviews.id) > 2 -- почему здесь я не могу использовать уже просчитанное значение cnt и avg?
order by
    "users"."id" desc
    limit 25
    offset 0


text:
Q: Cards that I created in Bootstrap 4 are not responsive when changing screens I created some Cards using bootstrap, html and css. Unfortunately, when I change the size of the screen the cards do not adjust accordingly.
This is how they look right now before changing the size.

When I go to inspect and switch it to ipad, it looks like this:

I tried using a media query in my css folder to solve this, but no luck. Can someone tell me what I am doing wrong? EDIT: Ideally, I would like to have one card on top of another when changing the screen size. I would also like to have the spacing in between the cards as well.

 @item.ReportName - @item.TitleColor

GrossAmountDue

     if (Flag == 1)
       {

       }

Audited

Packages: Will go here

Transactions will go here

       <p style="font-size:20px;"Icon will go here

Text Here

//CSS

A: You have to wrap your cols in a row like this:

...

...

...

In this way, when you have a screen equal or less of md, contents of cols goes one on top of another, but when screen is lg or higher, you have 3 cols in a row.
INFO
In your media query you are changing the col class, when instead you are using col-md-4


text:
Q: AWS - Not receiving HTTPS requests I usually don't have this problem, but I can't receive any HTTPS request in Elastic Beanstalk environment, but HTTP requests are working.
I hope that the Load Balancer isn't redirecting requests to server, because isn't working the HTTPS with the simple application, and when I use another AWS account my server works good, with the same configurations, using HTTP and HTTPS.
I have tried:

*

*Open security group; (Not work)

*Change the target in the route53; (Not work)

*Kill my instances and deploy again; (Not work)

*Kill Load Balancer; (Not work)

*Deploy with Simple application; (Not work)

*Use redirect HTTP to HTTPS; (Not work)

*Use another account to deploy the same server; (Works good)
I don't receive any HTTPS request. I checked in nodeJS, and in the nginx logs.
I am using Node.js 12.16.1 running on 64bit Amazon Linux/4.14.1 with Elastic Beanstalk using nginx.
Load Balancer config, redirecting all the requests to instance:80
Security group config:
Security group, opened for all inbound in the port 433


text:
Q: Should Domain Model Classes always depend on primitives? Halfway through Architecture Patterns with Python, I have two questions about how should the Domain Model Classes be structured and instantiated. Assume on my Domain Model I have the class DepthMap:
class DepthMap:
    def __init__(self, map: np.ndarray):
        self.map = map

According to what I understood from the book, this class is not correct since it depends on Numpy, and it should depend only on Python primitives, hence the question: Should Domain Model classes rely only on Python primitives, or is there an exception?
Assuming the answer to the previous question is that classes should solely depend on primitives, what would the correct way create a DepthMap from a Numpy array be? Assume now I have more formats from where I can make a DepthMap object.
class DepthMap:
    def __init__(self, map: List):
        self.map = map

    @classmethod
    def from_numpy(cls, map: np.ndarray):
        return cls(map.tolist())

    @classmethod
    def from_str(cls, map: str):
        return cls([float(i) for i in s.split(',')])

or a factory:
class DepthMapFactory:
    @staticmethod
    def from_numpy(map: np.ndarray):
        return DepthMap(map.tolist())

    @staticmethod
    def from_str(map: str):
        return DepthMap([float(i) for i in s.split(',')])

I think even the Repository Pattern, which they go through in the book, could fit in here:
class StrRepository:
    def get(map: str):
        return DepthMap([float(i) for i in s.split(',')])

class NumpyRepository:
    def get(map: np.ndarray):
        return DepthMap(map.tolist())

The second question: When creating a Domain Model Object from different sources, what is the correct approach?
Note: My background is not software; hence some OOP concepts may be incorrect. Instead of downvoting, please comment and let me know how to improve the question.

A: I think it's perfectly fine to depend on librairies that are pure language extensions or else you will just end up with having to define tons of "interface contracts" (Python doesn't have interfaces as a language construct -- but those can be conceptual) to abstract away these data structures and in the end those newly introduced contracts will probably be poor abstractions anyway and just result in additional complexity.
That means your domain objects can generally depend on these pure types. On the other hand I also think these types should be considered as language "primitives" (native may be more accurate) just like datetime and that you'd want to avoid primitive obsession.
In other words, DepthMap which is a domain concept is allowed to depend on Numpy for it's construction (no abstraction necessary here), but Numpy shouldn't necessarily be allowed to flow deep into the domain (unless it's the appropriate abstraction).
Or in pseudo-code, this could be bad:
someOperation(Numpy: depthMap);

Where this may be better:
class DepthMap(Numpy: data);
someOperation(DepthMap depthMap);

And regarding the second question, from a DDD perspective if the
DepthMap class has a Numpy array as it's internal structure but has to
be constructed from other sources (string or list for example) would
the best approach be a repository pattern? Or is this just for
handling databases and a Factory is a better approach?

The Repository pattern is exclusively for storage/retrieval so it wouldn't be appropriate. Now, you may have a factory method directly on DepthMap that accepts a Numpy or you may have a dedicated factory. If you want to decouple DepthMap from Numpy then it could make sense to introduce a dedicated factory, but it seems unnecessary here at first glance.

A:
Should Domain Model classes rely only on Python primitives

Speaking purely from a domain-driven-design perspective, there's absolutely no reason that this should be true

*

*Your domain dynamics are normally going to be described using the language of your domain, ie the manipulation of ENTITIES and VALUE OBJECTS (Evans, 2003) that are facades that place domain semantics on top of your data structures.

*The underlying data structures, behind the facades, are whatever you need to get the job done.
There is nothing in domain driven design requiring that you forsake a well-tested off the shelf implementation of a highly optimized Bazzlefraz and instead write your own from scratch.
Part of the point of domain driven design is that we want to be making our investment into the code that helps the business, not the plumbing.

A: I wrote the book, so I can at least have a go at answering your question.
You can use things other than primitives (str, int, boolean etc) in your domain model. Generally, although we couldn't show it in the book, your model classes will contain whole hierarchies of objects.
What you want to avoid is your technical implementation leaking into your code in a way that makes it hard to express your intent. It would probably be inappropriate to pass instances of Numpy arrays around your codebase, unless your domain is Numpy. We're trying to make code easier to read and test by separating the interesting stuff from the glue.
To that end, it's fine for you to have a DepthMap class that exposes some behaviour, and happens to have a Numpy array as its internal storage. That's not any different to you using any other data structure from a library.
If you've got data as a flat file or something, and there is complex logic involved in creating the Numpy array, then I think a Factory is appropriate. That way you can keep the boring, ugly code for producing a DepthMap at the edge of your system, and out of your model.
If creating a DepthMap from a string is really a one-liner, then a classmethod is probably better because it's easier to find and understand.


text:
Q: Is there a text editor which can display null bytes Not important to the question but I'm working with files output from a php script. These files contain null bytes (\00) which is actually part of the php output and should not be removed.
Up until now, I've been using gedit to view these files. It complains about the encoding but is usueful in that it highlights the null bytes. This only seems to work with small files though. Trying to open a larger file (15kb and that is still small) displays pure gibberish.
Is there another editor which is able to display (pure ASCII) files which contain unprintable characters? I'd much prefer an editor which replaces said bytes with the standard 'illegal character' (question mark set in a diamond glyph).

A: You should consider using Hex Editor for such purposes, as normal editors don't display non-printing characters  unless its some side-effect or glitch.
I suggest Bless :

And in console you can use Midnight Commander's  mcview - F4 switches to hex mode:


text:
Q: Drawing lots of overlapping 2D shadows I'm working on a program that involves drawing lots of very simple overlapping shadows.  There's nothing fancy about the shadows: they have hard edges and there is a single light source at infinity (i.e. all shadows are parallel).  The unique aspect is that the shadows represent areas of partially absorbed light, and so many many shadows can overlap to make progressively darker regions.
Here is an image to illustrate the idea:

My question is this: What would be a good way to take the shadows in my program (stored as convex quadrilaterals) and efficiently draw them to the screen?
I can simply draw them all with the appropriate alpha values and the result looks fine, but doing so can get awfully slow.  I think this is because pixels that are in many shadows are drawn over many times.  I suspect an approach that only draws to each pixel once could be much faster.
My program is in C++ and I'm using Qt to do the UI and drawing.  I'd be happy to make use of a library to do polygon clipping or something (e.g. Clipper or boost), but I'd be reluctant to dive into the world of OpenGL/GPUs (unless there is a particularly painless way of doing so).
Any ideas?  Thanks!

A: Well I think an efficcient way to draw your shadow will be to do something like ray-tracing. It means basically that you iter through every pixel in your image and draw in the right color by checking how many "wall" the reversed ray traverses. something like :
For every pixel in the image
    compute the reversed lightray (from the pixel to your light direction)
    compute the number of walls traversed by your lightray
    (= nb of intersections with all the segments/walls)
    draw the pixel according to the number of intersections
    (the more intersections, the darker)

It should be easy and O(n) in complexity with the number of pixels ^^
By the way I think boost::geometry can manage intersections.


text:
Q: How to check internet available to mobile packdata or not..? Our app support offline and online
So every step we need to check internet available to network or not.
When we using Reachability class then wi-fi off/on check it properly.
And in another we are also use SimplePing it is also work properly with Wi-fi using ping to host.
We are also check ICMP socket programing for this but it is only support to wi-fi.
But when we are using mobile packetdata how can we check internet is available to mobile or not.

A: NSURL *scriptUrl = [NSURL URLWithString:@"http://google.co.in/"];
NSData *data = [NSData dataWithContentsOfURL:scriptUrl];
if (data)
    NSLog(@"Device is connected to the internet");
else
    NSLog(@"Device is not connected to the internet");

A: This is something that a OS detects itself or by the ISP. You can check whether the internet is available through WiFi, or through CellularData or some other medium.
Internet access will automatically disconnected if user has consumed the data.
You can not check this by writing code.


text:
Q: Nginx 404 not found in subdir Okay, i setup a debian install with ispconfig3 ,php5-fpm and nginx, the main site, drupal is working fine, even perfect. But i also have a modded phpbb3 board, in a subdir, named 'forum'.
Now for some reason i get the following error from nginx when accesing the dir:
'ERROR 500 - Internal Server Error!'
This is the content of the nginx directiv field(for vhost):
# search for already compressed files
  gzip_static on;
  gzip on;

  # some images have no mime type
  default_type image/jpeg;

  # 404 generated from php can be rather slow. Uncomment with care
  error_page 404 /index.php;

  # disallow access to version control directory, but return 404, not to disclose information
  location /.git {
    return 404;
  }

  # robots.txt is important for search engines
  location /robots.txt {
    access_log off;
  }

  # This is mostly based on Drupal's stock .htaccess
  location ~* ^.+(\.(txt|engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)|code-style\.pl|/Entries.*|/Repository|/Root|/Tag|/Template)$ {
    return 404;
  }

  # serve imagecache files directly or redirect to drupal if they do not exist
  location ~* imagecache {
    access_log off;
    expires 30d;
    try_files $uri @drupal;
  }

  # Drupal 7 image stylef
  location ~* image/generate {
    access_log off;
    expires 30d;
    try_files $uri @drupal;
  }

  # serve static files directly
  location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|swf|flv)$ {
    access_log off;
    log_not_found off;
    expires 30d;
  }

location @rewrite {
      # Some modules enforce no slash (/) at the end of the URL
      # Else this rewrite block wouldn't be needed (GlobalRedirect)
       rewrite ^/(.*)$ /index.php?q=$1;
break;
    }

  # This rewrites pages to be sent to PHP processing
  location @drupal {
rewrite  ^/(.*)$  /index.php?q=$1  last;

}

location / {
    try_files $uri @cache;
  }

  # This will try to see if we have a boost file in place. no harm done if this is not used
  location @cache {
    # queries, drupal cookies, or not GET methods, all require PHP processing.
    if ($query_string ~ ".+") {
      return 405;
    }
    if ($http_cookie ~ "DRUPAL_UID" ) {
      return 405;
    }
    if ($request_method !~ ^(GET|HEAD)$ ) {
      return 405;
    }
    error_page 405 = @drupal;

    # Drupal uses 1978 - I am 4 years older than Dries :)
    add_header Expires "Tue, 22 Sep 1974 08:00:00 GMT";
    add_header Cache-Control "must-revalidate, post-check=0, pre-check=0";
    try_files /cache/normal/$host/${uri}_.html /cache/mobile/$host/${uri}_.html /cache/perm/$host/${uri}_.css /cache/perm/$host/${uri}_.js /cache/$host/0$uri.html /cache/$host/0${uri}/index.html @drupal;
  }

location /phpmyadmin {
               root /usr/share/;
               index index.php index.html index.htm;
               location ~ ^/phpmyadmin/(.+\.php)$ {
                       try_files $uri =404;
                       root /usr/share/;
                       fastcgi_pass 127.0.0.1:9000;
                       fastcgi_index index.php;
                       fastcgi_param SCRIPT_FILENAME $request_filename;
                       include /etc/nginx/fastcgi_params;
                       fastcgi_param PATH_INFO $fastcgi_script_name;
                       fastcgi_buffer_size 128k;
                       fastcgi_buffers 256 4k;
                       fastcgi_busy_buffers_size 256k;
                       fastcgi_temp_file_write_size 256k;
                       fastcgi_intercept_errors on;
               }
               location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                       root /usr/share/;
               }
        }
        location /phpMyAdmin {
               rewrite ^/* /phpmyadmin last;
        }

location /forum {
               root /var/www/ashladan.net/web;
               index index.php index.html index.htm;
               location ~ ^/forum/(.+\.php)$ {
                       try_files $uri =404;
                       root /var/www/ashladan.net/web;
                       fastcgi_pass 127.0.0.1:9000;
                       fastcgi_index index.php;
                       fastcgi_param SCRIPT_FILENAME $request_filename;
                       include /etc/nginx/fastcgi_params;
                       fastcgi_param PATH_INFO $fastcgi_script_name;
                       fastcgi_buffer_size 128k;
                       fastcgi_buffers 256 4k;
                       fastcgi_busy_buffers_size 256k;
                       fastcgi_temp_file_write_size 256k;
                       fastcgi_intercept_errors on;
               }
               location ~* ^/forum/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                       root /var/www/ashladan.net/web;
               }
        }

A: It may be standard PHP response for uncaught exception / fatal / syntax error with no output.
You can either turn on error logging in php.ini and check your log file, or just at the beginning of your index.php file in this directory add two lines:
<?php
error_reporting(E_ALL);
ini_set('display_errors','on');

So if it is PHP's fault you will get more details on this error.


text:
Q: Express 4.17.1 req.body returns undefined The code is split into 2 files:
the main file: server.js
the router file: user.js
In the user.js file req.body returns undefined and doesn't save the data to database
The data sent to /user/register returns 'Could not save to database'.
I've tried bodyParser.json() and bodyParser.urlencoded({extended: true}), although it isn't required in express 4.17.x, and they do not work.
Other common solutions like app.use(express.json()) also didn't help.
server.js
const express = require('express')
const mongoose = require('mongoose')
const User = require("./models/userSchema");

const userRouter = require('./routes/user')
const placeRouter = require('./routes/place');
const bodyParser = require('body-parser');

const app = express()
const PORT = 5000

app.use(express.json())

mongoose.connect('mongodb://localhost:27017/instaDB', {
    useNewUrlParser: true,
    useUnifiedTopology: true
}, () => {
    console.log('Connected to Database');
})

app.use('/user', userRouter)

app.listen(PORT, ()=>{
    console.log(`Listening on PORT: ${PORT}`);
})

user.js
const express = require('express')
const User = require("../models/userSchema");

userRouter = express.Router()

userRouter.post('/register', (req, res) => {
    const {username, password} = req.body
    console.log(req.body.username);
    console.log(password);
    User.findOne({username}, (err, user) => {
        if(err){
            res.status(500).json({
                err: true,
                msgBody: 'Server Error'
            })
        } if(user){
            res.status(400).json({
                err: true,
                msgBody: 'Username already exists'
            })
        }
        else{
            const newUser = new User({
                username,
                password
            })

            newUser.save((err)=>{
                if(err){
                    res.status(500).json({
                        err: true,
                        msgBody: 'Could not save to database'
                    })
                } else {
                    res.status(200).json({
                        err: false,
                        msgBody: 'Registered Successfully'
                    })
                }
            })
        }
    })
})

module.exports = userRouter;

A: I would guess the initial request lacks the header Content-Type: application/json.
So Express json parser ignores the request body as it is not typed as json.
So the parser does not fill the req.body field.
Try adding this header with this value (Content-Type: application/json) to your request.
How you will do that depends on how you send this request (curl, postman, javascript xhr, react/angular..., lib...)


text:
Q: ubuntu 13.10 radeon.dpm=1 Does radeon power management work out of the box on ubuntu 13.10 by putting radon.dpm=1 on the kernel boot parameters or do I need also to update the firmware files ?

A: I asume that you might have to update the firmware as I have tried it without updating the firmware and it does not work for me out of the box with radeon.dpm=1 as boot parameter. I have the Radeon HD 4225 card and my notebook heats up like mad. Powertop shows a consumption of 20 Watts in idle. I didn't update the firmeware as I could not find appropriate files.


text:
Q: VB How do I end a batchfile/cmd command running with a button? This is the code i'm using:
Public Class Form1
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Process.Start("C:\batchfile.bat")
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub

I'd like to know how to make Button1_Click kill the "batchfile.bat?" The batchfile is opening a CMD prompt, if that helps anyone in anyway.

A: You need to start the Process instance returned by Process.Start() in a field in your form.
You can then call the Kill() method.
For example:
Public Class Form1
    Private mySubTask As Process

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        mySubTask = Process.Start("C:\batchfile.bat")
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        mySubTask.Kill()
    End Sub

You will need to figure out what to do if the user clicks start twice.


text:
Q: android : issue getting file path on Lollipop So, I have following code to pick file:
public void getFile() {
        try {
            Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
            intent.setType("*/*");
            startActivityForResult(Intent.createChooser(intent, "Select a file"), PICKFILE_RESULT_CODE);
        } catch (ActivityNotFoundException exp) {
            Toast.makeText(getBaseContext(), "No File (Manager / Explorer)etc Found In Your Device", Toast.LENGTH_SHORT).show();
        }
}

This is how I implemented onActivityResult():
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    switch (requestCode) {
        case PICKFILE_RESULT_CODE:
            if (resultCode == RESULT_OK) {

                String srcFile = data.getData().getPath();
                Log.i("Path: ", srcFile);
                // rest of the code to upload file to server
            }
            break;
    }
}

Problem is:
I am getting path on Jellybean(Android 4.1.2) as below:

/sdcard/Download/93e8c6b0c589feed4037375aecaf4a1e.txt

But when I try to get path in Lollipop I get something like:

/document/B0EC-6E35:TestWordDoc.doc

Goal is to pick any file and upload it to server. I am able to do my task on Jellybean device but not on Lollipop. Did anyone face issue like this ? If so, Please help me.. It got two days of mine, and I am still no where..


text:
Q: Sequelize nested eager loading does not load both records associated with the same model I am trying to have an api route return a large object with nested eager loading in sequelize. My "Lane" model has two associations to the "Location" model as 'origin_location_id' and 'destination_location_id'. I am trying to return both the 'origin_location_id' and 'destination_location_id' records but I am only getting the 'destination_location_id' record.
I have tried reversing the associations in the model definitions, multiple variations of syntax in the model definitions using "as" and "through" and in the query, and I continue to either get no response from the server, a nondescript (not even an error code or error description) sequelize eager loading error, or I only see one Location record loading in the json results.
Here is the query:
(function(req,res) {
models.Trip.findAll({
  attributes: ['id', 'createdAt'],
  include: [
    { model: models.Customer, attributes: ['id', 'name', 'email', 'address', 'phone'] },
    { model: models.Move, attributes: ['id', 'trip_id'], include: [
      { model: models.Lane,  attributes: ['origin_location_id', 'destination_location_id', 'duration', 'distance'], include: [
        { model: models.Location, attributes: ['id', 'tookan_id', 'name', 'address', 'email', 'phone'] }
      ] }
    ] }
 ],
order:[['createdAt', 'DESC']]}).then(trips => {return res.json(trips)}).catch(err => res.status(422).json(err))})

Here is the Lane model definition:
'use strict';
module.exports = (sequelize, DataTypes) => {
  const Lane = sequelize.define('Lane', {
    active: {
      type: DataTypes.TINYINT,
      defaultValue: true },
    customer_id: DataTypes.INTEGER,
    description: DataTypes.TEXT,
    origin_location_id: DataTypes.INTEGER,
    destination_location_id: DataTypes.INTEGER,
    distance: DataTypes.INTEGER,
    duration: DataTypes.INTEGER,
    driver_base_pay: DataTypes.DECIMAL,
    driver_return_pay: DataTypes.DECIMAL,
    tolls: DataTypes.DECIMAL,
    driver_pay_per_minute: DataTypes.DECIMAL,
    driver_pay_per_kilometer: DataTypes.DECIMAL,
    average_drive_speed: DataTypes.DECIMAL
  }, {});
  Lane.associate = function(models) {
    models.Lane.belongsTo(models.Customer, {foreignKey: 'customer_id'});
    models.Lane.belongsTo(models.Location, {foreignKey: 'origin_location_id'});
    models.Lane.belongsTo(models.Location, {foreignKey: 'destination_location_id'});
    models.Lane.hasMany(models.Move, {foreignKey: 'lane_id'});
  };
  return Lane;
};

Here is the Location model definition:
'use strict';
module.exports = (sequelize, DataTypes) => {
  const Location = sequelize.define('Location', {
    tookan_id : DataTypes.INTEGER,
    active: {
      type: DataTypes.TINYINT,
      defaultValue: true },
    customer_id: DataTypes.INTEGER,
    name: DataTypes.TEXT,
    address: DataTypes.TEXT,
    email: DataTypes.TEXT,
    phone: DataTypes.TEXT
  }, {});
  Location.associate = function(models) {
    models.Location.belongsTo(models.Customer, {foreignKey: 'customer_id'});
    models.Location.hasMany(models.Lane, {foreignKey: 'origin_location_id'});
    models.Location.hasMany(models.Lane, {foreignKey: 'destination_location_id'});
  };
  return Location;
};

Here is the current JSON result structure (only one Location record is returned for each Lane record, despite that it is associated with Locations at two fields):

{
  "id": 27,
  "createdAt": "2018-09-20T12:30:32.000Z",
  "Customer": {
    "id": 1,
    "name": "",
    "email": "",
    "address": "",
    "phone": ""
  },
  "Moves": [{
      "id": 29,
      "trip_id": 27,
      "Lane": {
        "id": 4,
        "origin_location_id": 3,
        "destination_location_id": 1,
        "duration": 1260,
        "distance": 21082,
        "driver_base_pay": "20",
        "driver_return_pay": "3",
        "driver_pay_per_kilometer": "1",
        "average_drive_speed": "18",
        "Location": {
          "id": 1,
          "tookan_id": null,
          "name": "",
          "address": "",
          "email": "",
          "phone": ""
        }
      }
    },
    {
      "id": 26,
      "trip_id": 27,
      "Lane": {
        "id": 3,
        "origin_location_id": 1,
        "destination_location_id": 3,
        "duration": 1260,
        "distance": 21082,
        "driver_base_pay": "20",
        "driver_return_pay": "3",
        "driver_pay_per_kilometer": "1",
        "average_drive_speed": "18",
        "Location": {
          "id": 3,
          "tookan_id": null,
          "name": "",
          "address": "",
          "email": "",
          "phone": ""
        }
      }
    }
  ]
}

and here is the error I get:
       {
        "name": "SequelizeEagerLoadingError"
        }

when I try this:
    (function(req,res) {
        models.Trip.findAll({
          include: [
            { model: models.Customer },
            { model: models.Move, include: [
              { model: models.Lane, include: [
                { model: models.Location, as: 'origin_location_id' },
                { model: models.Location, as: 'destination_location_id'}
              ] }
            ] }
         ],
        order:[['createdAt', 'DESC']]
      }).then(trips => {return res.json(trips)})
      .catch(err => res.status(422).json(err))
    })

A: I did the same thing that I've been doing for the past hour, which is trying to add "as" statements to associations and have them correspond to the query and all of the sudden it works for no apparent reason even though it did not work an hour ago. What I did was change the Lane--Location associations to
models.Lane.belongsTo(models.Location, { as: 'pickup', foreignKey: 'origin_location_id'}); models.Lane.belongsTo(models.Location, { as: 'delivery', foreignKey: 'destination_location_id'});
and then updated the query to match
{ model: models.Location, as: 'pickup', attributes: ['id', 'tookan_id', 'name', 'address', 'email', 'phone'] }, { model: models.Location, as: 'delivery', attributes: ['id', 'tookan_id', 'name', 'address', 'email', 'phone'] }

A: I have had similar problems when eager loading with model associations. My problem was that an inner join was performed, where I really needed an outer join.
Changed this:
Foo.findAll(include: [ Bar ])
To This:
Foo.findAll(include: [ { model: Bar, required: false }])


text:
Q: Gravity Forms and WooCommerce Our team is working on a WooCommerce project for one of our clients.
They are event organizers and work with volunteers who sell tickets on their behalf.
They do not want volunteers to have access to the backend of their site, so we are trying to find a way to create an order form using Gravity Forms that will record the sale as desired and communicate product depletions to the Product database in WooCommerce.
Any thoughts on how this might be accomplished?


text:
Q: How do I install mod_wsgi in Apache for python 3.5 on CentOS 7 if apxs2 is missing? I am currently trying to install mod_wsgi 4.4.21 into Apache 2.4 for a Python 3.5 web server on CentOS 7.
Under "Configuring The Source Code" in the Quick Installation Guide, it says this:

On some Linux distributions, such as SUSE and CentOS, it will be necessary to use the "--with-apxs" option and specify either "/usr/sbin/apxs2-worker" or "/usr/sbin/apxs2-prefork".

As far as I can tell, those are supposed to come with the httpd-devel package. I have that installed already:
# rpm -qa | grep httpd
httpd-tools-2.4.6-40.el7.centos.x86_64
httpd-manual-2.4.6-40.el7.centos.noarch
httpd-2.4.6-40.el7.centos.x86_64
httpd-devel-2.4.6-40.el7.centos.x86_64

However I don't have apxs2-worker or apxs2-prefork in /usr/sbin:
# ls /usr/sbin/apxs*
ls: cannot access /usr/sbin/apxs*: No such file or directory

However, I do have apxs in /usr/bin. Can I just use that, or is there something else I am missing?

A: For posterity, I ended up using /usr/bin/apxs and it seems to work fine.


text:
Q: Recurrence Relation for Divide and Conquer Describe the recurrence running time T(n) on an input of size n?
A divide and conquer algorithm takes an array of n elements and divides into three sub arrays of size n/4 each taking Θ(n) time to do the subdivision. The time taken to combine outputs of each sub-problem is Θ(1).
I came with this recurrence relation, but it's not correct
T(n) = 3T(n/4) + Θ(1)

Can someone knows what I am doing wrong on this?

A: You missed  taking Θ(n) time to do the subdivision part.
So relation should include  subdivision + working on smaller parts + combining
T(n)= Θ(n) + 3T(n/4) + Θ(1) = 3T(n/4) + Θ(n)


text:
Q: Pass user-input number of variables into Matlab function handle I am looking to use the fminsearch function for minimization. According to the documentation, fminsearch requires a function handle and initial parameter estimate.
However, I have been struggling to create a function handle that accepts a variable number of inputs. This is an example of how I would like my code to behave:
for i = 1:M
    fhandle = @(x)(x(i) + @fhandle)
end

In this example, the final fhandle is the sum of all x. Is there any way to implement this and optimize all x values such that fhandle is minimized?

A: Function handles accept varargin. So your exemple can be rewriten to accept a variable number of inputs:
fhandle = @(varargin) sum([varargin{:}])

and then
>> fhandle(1)
ans =
     1

>> fhandle(1,2)
ans =
     3

>> fhandle(1,2,3)
ans =
     6

Best,


text:
Q: Converting fftw library calls to OpenCV calls I am trying to use OpenCV instead of fftw because of the more permissive license of OpenCV. With the help of
FFTW fftwf_plan_r2r_2d() with FFTW_REDFT01 equivalent
I am aware that it is currently wrong, it's just what I have as an initial idea. I need some guidance to get exact functionality of fftw with OpenCV, I am offering bounty for someone who can help me do that.
I only need those particular functions and I am not interested in converting other fftw functions for now.
Thanks!
Anyone?
h:
#pragma once

#define DO_NOT_USE_FFTW

#ifdef DO_NOT_USE_FFTW
enum fftwf_r2r_kind
{
    FFTW_R2HC,    //computes a real-input DFT with output in "halfcomplex" format, i.e. real and imaginary parts for a transform of size n stored as: r0, r1, r2, ..., rn/2, i(n+1)/2-1, ..., i2, i1 (Logical N=n, inverse is FFTW_HC2R.)
    FFTW_HC2R,    //computes the reverse of FFTW_R2HC, above. (Logical N=n, inverse is FFTW_R2HC.)
    FFTW_DHT,     //computes a discrete Hartley transform. (Logical N=n, inverse is FFTW_DHT.)
    FFTW_REDFT00, //computes an REDFT00 transform, i.e. a DCT-I. (Logical N=2*(n-1), inverse is FFTW_REDFT00.)
    FFTW_REDFT10, //computes an REDFT10 transform, i.e. a DCT-II (sometimes called "the" DCT). (Logical N=2*n, inverse is FFTW_REDFT01.)
    FFTW_REDFT01, //computes an REDFT01 transform, i.e. a DCT-III (sometimes called "the" IDCT, being the inverse of DCT-II). (Logical N=2*n, inverse is FFTW_REDFT=10.)
    FFTW_REDFT11, //computes an REDFT11 transform, i.e. a DCT-IV. (Logical N=2*n, inverse is FFTW_REDFT11.)
    FFTW_RODFT00, //computes an RODFT00 transform, i.e. a DST-I. (Logical N=2*(n+1), inverse is FFTW_RODFT00.)
    FFTW_RODFT10, //computes an RODFT10 transform, i.e. a DST-II. (Logical N=2*n, inverse is FFTW_RODFT01.)
    FFTW_RODFT01, //computes an RODFT01 transform, i.e. a DST-III. (Logical N=2*n, inverse is FFTW_RODFT=10.)
    FFTW_RODFT11, //computes an RODFT11 transform, i.e. a DST-IV. (Logical N=2*n, inverse is FFTW_RODFT11.)
};

struct fftwf_plan_imp
{
     int nx;
     int ny;
     float * in;
     float * out;
     fftwf_r2r_kind kindx;
     fftwf_r2r_kind kindy;
     unsigned flags;
};

#define fftwf_plan         fftwf_plan_imp *
#define fftwf_malloc(x)    malloc(x)
#define fftwf_free(x)      free(x)
#define FFTW_DESTROY_INPUT 1
#define FFTW_ESTIMATE      1

fftwf_plan fftwf_plan_r2r_2d(int nx, int ny, float * in, float * out, fftwf_r2r_kind kindx, fftwf_r2r_kind kindy, unsigned flags);
void fftwf_execute(fftwf_plan x);
void fftwf_destroy_plan(fftwf_plan x);
void fftwf_cleanup();
#else
#include <fftw3.h>
#endif

src:
#include "KissInterface.h"
#include "kiss_fftr.h"
#include "kiss_fftndr.h"
#include "opencv.hpp"

//currently cv::dct supports even-size arrays (2, 4, 6 ...). For data analysis and approximation you can pad the array when necessary.

#ifdef DO_NOT_USE_FFTW
fftwf_plan fftwf_plan_r2r_2d(int nx, int ny, float * in, float * out, fftwf_r2r_kind kindx, fftwf_r2r_kind kindy, unsigned flags)
{
    fftwf_plan plan = new fftwf_plan_imp;

    plan->nx    = nx;
    plan->ny    = ny;
    plan->in    = in;
    plan->out   = out;
    plan->kindx = kindx;
    plan->kindy = kindy;
    plan->flags = flags;

    return plan;
}

void fftwf_execute(fftwf_plan x)
{
    int newx = x->nx;
    int newy = x->ny;
    if(newx % 2 != 0)++newx;
    if(newy % 2 != 0)++newy;

    cv::Mat Input (cv::Size(newx, newy), CV_32FC1, x->in); //AUTO_STEP or not?
    cv::Mat Output(cv::Size(newx, newy), CV_32FC1, x->out); //AUTO_STEP or not?

    if(x->kindx == FFTW_REDFT00 && x->kindy == FFTW_REDFT00)
    {
        cv::dct(Input, Output);
    }
    else if(x->kindx == FFTW_REDFT10 && x->kindy == FFTW_REDFT10)
    {
        cv::dct(Input, Output);

        Output *= (4 * sqrt(float(newx / 2)) * sqrt(float(newy / 2)));
        Output.row(0) *= 1.41421356237;
        Output.col(0) *= 1.41421356237;
    }
    else if(x->kindx == FFTW_REDFT01 && x->kindy == FFTW_REDFT01)
    {
        // First re-scale the data for idct():
        Input /= (4 * sqrt(float(newx / 2)) * sqrt(float(newy / 2)));
        Input.row(0) /= 1.41421356237;
        Input.col(0) /= 1.41421356237;

        cv::idct(Input, Output); // this will return the input exactly

        // However, the transforms computed by FFTW are unnormalized, exactly like the corresponding,
        // so computing a transform followed by its inverse yields the original array scaled by N, where N is the logical DFT size.
        // The logical DFT size: Logical N=2*n for each axis, this is th implicit symmetrization
        // of the image: reflect right and then reflect both halves down.
        int logicalSizeN = (2 * newx) * (2 * newy);
        Output *= logicalSizeN; // scale to be like FFTW result
    }

    memcpy(x->out, Output.ptr<float>(0), x->nx * x->ny);
}

void fftwf_destroy_plan(fftwf_plan x)
{
    delete x;
    x = NULL;
}

void fftwf_cleanup()
{

}
#endif

A: OpenCV's FFT/DCT works like Matlab's implementations. Knowing this may help you find better references and answers.
In my question and answer you have several links that may help get you started.
Recently I had to go back to this code and rework it and it turned out that since I wanted to use the transforms and then transform back, I could just avoid all the extra scaling, before and after, and it just worked.
Of course, this means that the intermediate values (between the transforms) are not the same as with fftw, but the results after the inverse-transform were.


text:
Q: How to convert a pandas series into datetime type? I read some of the post related to this topic but nothing worked.
I am trying to convert to column of my dataframe called dem_inclusiondate and sae_hospit_date because I need to do a survival analysis, and need the duration between the inclusion date and the hospitalization
However, the type of these columns are Series and I can't find a way to convert them into date type.
I tried this following your comment
  baseline_all_patients["dem_inclusiondate"]
    .to_datetime(baseline_all_patients["dem_inclusiondate"], format="%Y-%m-%d")

but this error occurs: 'Series' object has no attribute 'to_datetime'
Sorry I am new, I don't know if my question is clear
Thank you for your help.

A: I believer this should help. Lets generate some data.
df = pd.DataFrame({'date_begin':['2020.6.7', '2020.5.3', '2020.1.1'],
                   'date_end':['2020.6.17', '2020.6.1', '2020.1.20']})

Then the syntax to convert stings in pandas is pretty easy. See more in Documentation
df['date_begin'] = pd.to_datetime(df['date_begin'], yearfirst=True)
df['date_end']   = pd.to_datetime(df['date_end'],   yearfirst=True)

Now timeDeltas are might give you some problems. That's because months and years have different lenghts. Depending on the accuracy you require, you might want to use Numpy (np) timedelta or pandas' own timedelta.
(df['date_end'] - df['date_begin']) / pd.Timedelta('1 days')
(df['date_end'] - df['date_begin']) / np.timedelta64(1, 'D')
(df['date_end'] - df['date_begin']) / np.timedelta64(1, 'M')
(df['date_end'] - df['date_begin']) / np.timedelta64(1, 'Y')


text:
Q: Show the series diverges
Show $\sum_{x=1}^{\infty} \frac{1}{x^{\frac{x+1}{x}}}$ diverges.

I tried the integral test, but showing $\int_{1}^{\infty} f(x)dx $ diverges is just as difficult.
I tried comparison but I don't see a proper comparision?

A: We have $\frac{1}{n^{\frac{n+1}{n}}}=\frac{1}{n}*\frac{1}{n^{1/n}}$
Since $n^{1/n} \to 1$ for $ n \to \infty$, we have that $n^{1/n} \le 2$ for large $n$. Thus
$\frac{1}{n^{\frac{n+1}{n}}} \ge \frac{1}{2n}$ for large $n$.

A: Using the AM-GM inequality, we get that for any $n\geq 1$
$$ n^{1/n} = GM\left(1,\frac{2}{1},\frac{3}{2},\ldots,\frac{n}{n-1}\right)\leq AM\left(1,\frac{2}{1},\frac{3}{2},\ldots,\frac{n}{n-1}\right)=1+\frac{H_{n-1}}{n} $$
hence:
$$ \sum_{n=1}^{N}\frac{1}{n\cdot n^{1/n}}\geq \sum_{n=1}^{N}\frac{1}{n+H_{n-1}}=H_N-\sum_{n=1}^{N}\frac{H_{n-1}}{n(n+H_{n-1})}\geq \log(N)-O(1). $$


text:
Q: CSS negative right background position I know I can set a negative left position on a background image like this:
#element {
    background: url(image.png) -20px 0 no-repeat;
}

That'll position the background image 20px to the left of the left edge of #element, regardless of #element's width.
But is there any way to set a negative right position, without giving #element a fixed width (and then just setting a high positive left value)?

A: What you're wanting to do is not possible in the way you want to do it.
A fix might be to create a parent div with a position: relative; attribute and then z-index another div behing a div that holds your content.

A: It's simply not true that this effect is impossible to obtain through simple CSS. There is no need to complicate your mark-up with unnecessary pseudo elements or multiple divs.
You can use the "calc" function in CSS to make the browser calculate 100% of the containers width and then add your negative margin to that like so (remember to add your negative margin to the 100% not subtract it):
background-position: calc(100% + 20px) 0;

Or if you prefer your mark-up in short-hand format:
background: url("image.png") calc(100% + 20px) 0 no-repeat;

This will position your background-image 100% (hereby obtaining the same effect as using background-position: right) from the left side of its container and by adding the 20px to that, you will obtain your negative right margin.
You can see a demo of how the function behaves in this jsFiddle: http://jsfiddle.net/58u665fe/
The "calc" function is supported by most major browsers, though support for IE9< lacks in certain cases. You can read more about which browsers support this function on http://caniuse.com/#feat=calc.

A: There's another way to achieve this without changing your markup:
using the :after pseudo-selector you can add an image to the right of any block although is not the same as an actual css background
so you can do:
#element {
  position: relative;
}
#element:after{
  content: "";
  background: transparent url(image.png) 0 0 no-repeat;
  position: absolute;
  right: -20px;
  top: 0;
  height: 50px /*add height of your image here*/
  width: 50px /*add width of your image here*/
  z-index: 1;
}
#element *{
  position: relative;
  z-index: 2; /*this makes sure all the "background image" doesn't sit above the elements*/
}


text:
Q: Where should I display or store data that is imported from a file? When I do an import of data from a file, such as csv or text file, I would like to display on a summary page (table view) about what is going to be imported to the database, and user can select or deselect what will be imported into the database. I would like to find out what is the best way of temporary storing these data to be displayed onto the summary page?
To give a clearer understanding about what i am talking about, for example:

*

*I have a csv file that holds a list of products.

*I would do an importation to read the csv file and display onto a summary page with
table view and checkboxes to select/deselect some of the data.

*After the selection, I would click the confirm button to store those checked data

So between the process of getting the csv data to the summary page for display, where should I store the data, in the database as a tbl_temp data and clean off when done, or just read directly from the csv file?
Thanks.

A: I would think an array would do the trick unless you think your environment is really unstable or, for user interface reasons, then just store to a temp file.  Temp db table seems a bit much.

A: I would just display it in the browser, and stored? It's already stored, the uploaded CSV file!
Unless you don't run into an actual problem with that approach, why care?

A: Just use HTML to display the data read from the file in a web browser.  Use standard HTML Form and form controls.  Use PHP scripting logic to control what happens when the form is submitted.  You could have the submit button hand off to a service or some other php file that could handle writing it to the db.
Why bother writing to a temp table, to just read back out and display in a form to be then written back to a perm. table.
If this were a process that you would be performing a lot, i might give it a little more consideration.


text:
Q: SQL Commandline login error: sp2-0306 I'm simply trying to logon to a newly installed Oracle Database 11g Express Edition (Windows) using the "Run SQL Command Line" from the start menu.
As specified on Oracle® Database Express Edition Getting Started Guide, I'm using the following commands:
SQL> connect
Enter user-name: system
Enter password: <password-for-system>

But the logon fails with the following error:
SQL> connect
Enter user-name: system
Enter password:
SP2-0306: Invalid option.
Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM}] [edition=value]]
where <logon> ::= <username>[/<password>][@<connect_identifier>]
      <proxy> ::= <proxyuser>[<username>][/<password>][@<connect_identifier>]

Where am I going wrong here?

A: I resoved the error.
It was an authentication problem.
But shouldn't the server be more verbose and say invalid uname/password?


text:
Q: Get active and inactive records from the table I have two tables like :
tbl student :

.................
id  | Name |Age |
.................
1   | A    |15  |
2   | B    |13  |
3   | C    |12  |
.................

Another table like Tbl_student_details :
.......................
id  | stud_id |section |
.......................
1   | 1       |A       |
2   | 1       |B       |
3   | 2       |C       |
.......................

Result Expected:
Active student : count (2) because id 1 and 2 have records in student detail table
Inactive Student :count(1)  dont have any record in student detail table

What i need to get is i want active or inactive students ..
if any student have records in student_details then in need the count of these student and for inactive student
which student have no records in student details tablle i need a count of those student as well as for inactive student
how can i get this active and inactive student can any one have any idea i need a query in laravel DB:: raw if not possible just suggest me query pleae help me related this ..

A: *

*In order to consider all the students from the student table, you will need to use Left Join, so that even if there is no matching row in the Tbl_student_details table, you will still consider all the students.

*Count() function can be used count Inactive/Active students. Count() function does not count NULL values; so we can use Case .. When expression to count Inactive students (NULL because of unmatching row).

*In order to count Unique number of Active students, we will need to use Count(Distinct ..) as you have duplicate rows for a stud_id in the Tbl_student_details table.

Try the following query:
SELECT
  COUNT(CASE WHEN tsd.id IS NULL THEN 1 END) AS Inactive_students,
  COUNT(DISTINCT tsd.stud_id) AS Active_students
FROM
student AS ts
LEFT JOIN
  Tbl_student_details AS tsd ON tsd.stud_id = ts.id

A: You can try using left join and CASE WHEN
select
   s.id,
   s.`Name`,
   s.`Age`, case when sd.stud_id is null then 'In Active' else 'Active' end as `StudentStatus`
from student s left join student_details sd
on s.id=sd.stud_id

A: You can use groupBy id's to get count of each id by left joining the student_details table with student table.
 DB::table('student')
                ->leftJoin('Tbl_student_details ', 'student.id', '=', 'Tbl_student_details .id')
                ->groupBy('student.id')->count();

A: Using laravel you could setup your models for your tables
class Student extends Model
{
    protected $table = 'student';

    public function details()
    {
        return $this->hasMany('App\StudentDetails');
    }
}

class StudentDetails extends Model
{
    protected $table = 'student_details';

    public function student()
    {
        return $this->belongsTo('App\Student');
    }
}

And via query buider you can get count as
$students = App\Student::withCount('details')->get();

Above will return all students along with a property "details_count" which will give you the desired count from related table
Counting Related Models
For Active/Inactive students you could write is as
$activeStudents = App\Student::has('details')->count();
$inActiveStudents = App\Student::doesntHave('details')->count();


text:
Q: what is this sql statement doing? (mysql) SET @row := 0;
SELECT * FROM (
SELECT @row := @row+1 AS rank, account_id, keyword, bid_amount ,timestamp
FROM bids WHERE keyword='programmers'
ORDER BY bid_amount DESC, timestamp ASC
) AS derived_table;

i saw this somewhere and i was wondering what the set does along with the @ sign and the :=
thanks

A: It's creating a row number column.
@row is an integer variable. := sets the variable for each row, taking the previous row's value of @row. So, you get a nicely incrementing column which tells you what number row you're on.


text:
Q: English equivalent for French "la rentrée"? In French we use "la rentrée" to mean the return to work after the slack period of the summer break in France. It is used by students, workers and pretty much anyone else. Is there any English expression to convey a similar meaning?

A: In Australia it is called "Back to school".
The new school year and the cranking up of work again after the summer holidays is from mid to late January.  So many people would wish each other "Happy New Year" for the first couple of weeks - probably haven't seen each other since before Christmas.

A: Not really, in the sense that you use it.  This is because, as StoneyB has mentioned, there is no real equivalent to the French summer break in either the UK or the USA.
A literal translation would be "re-entry", which is indeed the term used when someone is returning to the job market after a leave of absence, but this isn't generally used for coming back from vacation, and isn't used if you are returning to the job you left.  It would be more common after, perhaps, taking a year off after having a child, recovering from a prolonged illness or accident, or coming out of retirement.  For example:

Five years ago, I won $100 million in the lottery.  I find that I have managed to spend it all, so I have to re-enter the job market.

A: Sounds definitively like coming back to work but actually performing at a slower pace until one gets up to speed.
In Spain, many times after say a 3-day holiday, the first day scheduled back to work is taken by many as a day off and called the "resaca".
Resaca in this manner is a "hangover day".  You need that one more extra day of vacation, at home, to get ready to go back to work, whether you have been drinking or not.
It's a simple difference between working and actually doing work.  Don't try to understand the concept nor poke holes in it, just accept it for the laziness it represents.


text:
Q: How to retrieve or display the image (Using Image's URL) from GCP bucket using java? How to view the original image using the URL in the GCP bucket using java.
I used MediaLink. But it works for download not for View the Image/File.
Please, anyone, answer my question.


text:
Q: How to find the `img` tag with class name of `captcha` by combining use getElementsByClassName and getElementsByTagName?

document.getElementsByClassName("captcha");

By the above code line, the class names captcha can be found, but then how to filter the img tag out?

A: Test the tagName of each one to see if it is an image or not:

const elements = document.getElementsByClassName("captcha");
const result = [...elements].filter( element => element.tagName === 'IMG' );
console.log(result[0]);

However, it would be easier to just use querySelectorAll or querySelector in the first place.

const elements = document.querySelectorAll("img.captcha");
console.log(elements[0]);


text:
Q: Is io.spring.dependency-management plugin required when using Spring Boot 2.3+ and Spring Cloud? I'm using Gradle 6.6 to build my Spring Boot app. According to this post, the io.spring.dependency-management plugin is no longer needed since Gradle 5+ supports BOM files.
However, I receive the following error if I remove the plugin:
Could not run phased build action using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-6.6.1-bin.zip'.
Build file 'C:\my-app\build.gradle' line: 14
A problem occurred evaluating root project 'my-app'.
Could not find method dependencyManagement() for arguments [build_6e8ejdhnd2no2m9jw221sctmn3$_run_closure2@432e46e2] on root project 'my-app' of type org.gradle.api.Project.

Line 14 of my build.gradle file is referenced in the above error. Here are lines 14-18:
dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:Hoxton.SR8"
    }
}

Is there another way to specify the required dependencies for Spring Cloud without using io.spring.dependency-management plugin?

A: dependencyManagement() is provided exclusively by the io.spring.dependency-management plugin. Which means you cannot use it if you don't use the plugin.
And in that case you have to use the gradle's platform capability.
In the post you linked there's an example of that.
To fix your build, remove the dependencyManagement part and add
implementation platform("org.springframework.cloud:spring-cloud-dependencies:Hoxton.SR8")

to your dependencies { }
Reference: https://docs.spring.io/dependency-management-plugin/docs/current/reference/html/#dependency-management-configuration-dsl


text:
Q: This script stops while running http://jsbin.com/uyawi/1879/edit
THe html piece is
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

My scrolling text is so freakin' COOL!!!111!

My scrolling text is so freakin' COOL!!!111!</p

My scrolling text is so freakin' COOL!!!111!</p

and here is the javascript
$(function() {

    var marquee = $("#marquee");
    marquee.css({"overflow": "hidden", "height": "100%"});

    // wrap "My Text" with a span (IE doesn't like divs inline-block)
    marquee.wrapInner("");
    marquee.find("span").css({ "height": "100%", "display": "inline-block", "text-align":"center" });
   marquee.append(marquee.find("span").clone()); // now there are two spans with "My Text"
    marquee.wrapInner("
");
    marquee.find("div").css("height", "100%");
    var reset = function() {
        $(this).css("margin-top", "100%");
        $(this).animate({ "margin-top": "-100%" }, 5000, 'linear', reset);
    };
    reset.call(marquee.find("div"));

});

It stops a while while running and then runs again, do you know how to fix it ?

A: var reset = function() {
    $(this).css("margin-top", "100%");
    $(this).animate({ "margin-top": "0%" }, 5000, 'linear', reset);
};


text:
Q: What does dax ipsa refer to? I was listening to a Tripod song, an Australian comedy band, and they used the 'name' dax ipsa (spelled phonetically). It was obviously some sort of joke, but I have no clue what it actually means? Is this something specific to Australia?
Edit:
Adding some context from Russell's answer:

Gatesy: I'm Batman.
     Scod: Really?
     Gatesy: No, I impersonate Batman, for photos and that, you know.
     Scod: I don't really get it. What's your real name?
     Gatesy: I can't tell you that. People used to tease me at school.
     Scod: Oh, come on.
     Gatesy: Okay. It's "Dax Ipsa".
     Scod: Do you mind if I call you "Batman"?
     Gatesy: Yeah, sure.

Edit 2:
Found the song on youtube, and linked to the start of the dialog in question: http://www.youtube.com/watch?v=YrlEWc72LWY&t=2m25s

A: Lyrics at the end - they don't make sense to me -  and I'm an antipodean "just across the pond" in New Zealand. I doubt that this would make much sense to most Australians either.
DAX & IPSA are two stock indexes used in world finacial markets.
If the song had anything to do with capitalism or investment or money or societal issue or ... that could relate
IPSA here
DAX here - Deutsche Borse AG German Stock Index DAX
If there are references to any others in the list:
 DAX IPSA IBEX ATX OBX BEL MIB BSI KLCI KOSPI PSI RTS IBC WIG
 that would be a positive indication.

Here's the Tripod original. It's in a musical.
Surfers Paradise The Musical Part 1
This makes no apparent sense :-) :
Gatesy:  I'm Batman.
Scod:    Really?
Gatesy:  No, I impersonate Batman, for photos and that, you know.
Scod:    I don't really get it. What's your real name?
Gatesy:  I can't tell you that. People used to tease me at school.
Scod:    Oh, come on.
Gatesy:    Okay. It's "Dax Ipsa".
Scod:    Do you mind if I call you "Batman"?
Gatesy:  Yeah, sure.

A: The name means nothing, and it's not intended to mean anything. Just because it happens to use two Latin-sounding words does not make it Latin.
The point is that it is simply a ridiculous name and its wearer prefers something less ridiculous, like "Batman". Even having explained what the real name is, Scod thinks Batman less ridiculous and easier to use.
The rather weak joke is that something which initially appears inappropriate is in fact the better option.

A: L. "the thing speaks for itself"
Res ipsa loquitur  (Wikipedia)
the doctrine of res ipsa loquitur (Latin for "the thing speaks for itself") states that the elements of duty of care and breach can be sometimes inferred from the very nature of an accident or other outcome, even without direct evidence of how any defendant behaved.
In the context,

Gatesy: Okay. It's "Dax Ipsa".

suggests that the speaker says it is self-explanatory. Needs no explanation (or, I can't offer you any) for my calling myself Batman (because my real name made people tease me).


text:
Q: windows phone map auto zoom on double tap I have my map declared in xaml like this:
<my:Map Height="497" CredentialsProvider="key" HorizontalAlignment="Left" Margin="6,104,0,0" Name="map1" VerticalAlignment="Top" Width="450" ZoomBarVisibility="Visible" />

And I can't figure out why on double tap map is zoomed in? How can I disable this behavior?
Thanks in advance, best regards

A: This is the default behavior of the map control. I can only think of two ways to disable this functionality:

*

*Create a custom MapControl and override the map's OnDoubleTap or OnZoomLevelChanged methods

*Listen to the map's MapZoom or DoubleTap event handlers and utilize e.Handled = true in cases that you don't want other handlers to do anything.

Hopefully this helps a little.


text:
Q: What role does the range of an operator play in showing the operator is compact? To show an operator is compact I understand you have to show the operator is the limit of finite rank operators. However the proof I have doesn't do this.
I have an operator $$k:C0[,\pi]) \to C([0, \pi])$$ given by $$(Ku)(x)=\int^\pi _0 (sin x+ cos t)u(t) dt$$ where $u \in C([0, \pi])$
I have the proof to show the operator is compact.
Firstly we show the operator is bounded and it follows that $||Ku|| \leq 2 \pi ||u||$. Hence the operator is bounded.

It says in my notes that $(Ku)(x)=\mathrm{a}\ \mathrm{sin}\ x + b$ for
  some constants a,b. How do we get this?

From this it follows that $\mathrm{Ran} K \subset \ \mathrm{span}\{\sin,1\}$
Which shows that the operator is compact.

Why do we have to look at the range of K?
  What role does this play in showing the operator is compact?

A: For your first question,
$$Ku(x) = \int_0^\pi (\sin(x)+\cos(t)) u(t) dt = \sin(x) \underbrace{\int_0^\pi u(t) dt}_a + \underbrace{\int_0^\pi \cos(t)u(t) dt }_b$$
For your second question, if the range of an operator is a finite dimensional vector space, then it is compact, because the unit ball of a finite vector space is compact

A: This is an integral operator with kernel $K:C([0,\pi])^2\to\mathbb R$ defined by $K(x,t)=\sin x+\cos t$. Since $$\|K\|_2^2=\int_0^\pi\int_0^\pi(\sin x+\cos t)^2\ \mathsf dx\ \mathsf dt =\pi^2<\infty,$$ $K$ is a Hilbert-Schmidt kernel and therefore the operator $k$ is compact.
(The proof of this result does use a sequence of finite-rank operators to approximate the given integral operator.)

A: There is a theorem that so-called finite-rank operators between normed spaces are compact. It goes like this:

Theorem 8.1-4 [Kreyszig: Introductory Functional Analysis with Applications]
Let $X$ and $Y$ be normed spaces and $T:X\to Y$ a linear operator. Then if $T$ is bounded and dim$(T(X))<\infty$ the operator is $T$ is compact.

(Proof given in the text)
In your case $K$ is bounded and its range is spanned by 2 vectors, i.e. it's 2-dimensional, hence it is compact by the theorem.
For your first question, on why you can write $(Ku)(x) = a\sin x + b$, see the answer by @Tryss.


text:
Q: Three.js thicker BoxHelper I created a THREE.BoxHelper like so:
let bbox = new THREE.BoxHelper(object, 0xff0000);
scene.add(bbox);

When I load this up, it looks as expected:

The only thing that I would want to do is make the lines a little thicker. I am aware that this is not directly possible because they are set to 1px, but I am looking for the quickest way I could do this.


text:
Q: Understanding the AStar Algorithm From this link: Link

If an adjacent square is already on the open list, check to see if
this path to that square is a better one. In other words, check to see
if the G score for that square is lower if we use the current square
to get there. If not, don't do anything.

Example:
parent (already traversed): O
branches: A, B, C
parent (working on): A
Branches: B, D
The open list contains, A, B, C and now D.
Now, the bold statements in the above quote are comparing which path with, path A to B?
i.e.
Comparison of A to B && O to B
OR
Comparison of A to B && A to D
Please clarify.

A: Basic A* is:
While we're not close enough to the / a destination
    Take the point that we have now, with the lowest expected total cost (so known cost up to this point plus estimated remaining cost).
    Calculate cost for all surrounding locations & add them back to the priority queue with their expected total cost.

return route that we followed to the closest point

In the official A* terminology, G-score is the cost to get there. H-score is the estimate to get from there to where you want to go.
Extremes are if your H-score always overestimates; the new score (estimate + new cost) will then always be lower than the previous square's estimate + cost, so you'll beeline to the target. If your H-score always underestimates (or is 0, or whatever) you'll always prefer squares closer to your point of departure, as they'll have a lower cost so far, so you'll basically floodfill from that position.
You can use A* from a theoretical point of view or from a practical point of view. Theoretically, you may never overestimate the cost of any link. That means that you will always find the most efficient route, but will take longer finding it as you'll expand a lot more nodes.
Using it from the practical point of view allows slightly-inadmissible heuristics (ones that can overestimate slightly). The route you find will most likely be slightly unoptimal but shouldn't be too bad for game use. The calculations get way faster though, since you don't expand everything anymore. One (slow) implementation I had made took 6 minutes across a 1k*1k map with a regular trig distance heuristic but only a few seconds with that augmented times 3. The routes weren't too different. Making the heuristic times 5 made the routes basically a beeline & much faster still, but unusably so.
WRT your direct question:
It's the second square you evaluate. You have the roads from O to A,B,C planned (with a given cost G for each of those routes). Now, suppose there's a highway from O through A to B, instead of a dirt road from O to B. That means that going through A is faster. When expanding A it looks at all surrounding squares and adds the cost + heuristic to the open list if it wasn't in there already. If it was in there, it sees if the new route is faster (lower G to get to that square) and only if so, does it replace it.
So in your example, it adds O->A->D to the list and then checks if O->A->B is faster than O->B.
-- addendum
Open list: 2 / A (through O), 5 / B (through O), 7 / C (through O)
Closed list: 0 / O (origin / through nothing)
Take A as it's the lowest cost so far. Then, for each neighbor of A calculate the cost to get there.

*

*If there's an entry for it already and the cost is lower than we know so far, replace the entry.

*If there's no current entry, add it.

Working on A, with roads of cost 2 to B and 3 to D. Going to B through A has a cost of 4, where the current entry is 5. So we replace it. D isn't in there, so we add it.
Open list: 4 / B (through A), 5 / D (through A), 7 / C (through O)
Closed list: 0 / O (origin / through nothing), 2 / A (through O)
So we compared A to B versus O to B.

A: Well, if we are working on the node A, we are considering its neighbours. Say we are considering the B node now (which is in the openList).
The definition given tells us to compare the G value of B (previously computed when it was first added to open list when the working node was O) and the sum of the cost of reaching A from the begining (O) and the cost of reaching B from A.


text:
Q: Rebin irregularly gridded data to regular (2D) grid in Python, using mean/median I'm looking for a way to rebin irregularly gridded data onto a regular grid, but without interpolation (so not e.g. matplotlib.mlab.griddata. Preferably, I'd like to average or median the points within one cell, or even apply my own function.
The grid is 2D, but since I foresee future cases with different dimensions, an N-dimensional solution is even better.
As an example, consider the following data, with x and y coordinates:
data = np.arange(6)
x = np.array([0.4, 0.6, 0.8, 1.5, 1.8, 2.2])
y = np.array([0.4, 0.8, 2.3, 2.5, 2.7, 2.9])

which, when binned to a regular 3x3 grid and using average values, should result in:
[[ 0.5  nan  2. ]
 [ nan  nan  3.5]
 [ nan  nan  5. ]]

(NaN's are optional, but clearer than 0's, since the latter value can be an actual average; this is of course also easy to turn into a masked array.)
So far, I've been able to tackle the problem using Pandas:
xindices = np.digitize(x, np.arange(NX))
yindices = np.digitize(y, np.arange(NY))
df = pd.DataFrame({
    'x': xindices,
    'y': yindices,
    'z': data
})
grouped = df.groupby(['y', 'x'])
result = grouped.aggregate(np.mean).reset_index()
grid = np.empty((NX, NY)) * np.NaN
grid[result['x']-1, result['y']-1] = result['z']

which allows me to pick any aggregating function I like.
However, since Pandas is rather general (Pandas doesn't care that x and y are grid indices), I feel that this may not be the optimal solution: having a solution that knows that the input and output are already on a (2D) grid seems more efficient. I have, however, not been able to find one; np.digitize comes closest, but that's only 1 dimensional, and still requires a loop in Python to access the indices and average or median over the data.
Does anyone know a better solution that the above one?

A: You could use scipy.stats.binned_statistic_2d:
import numpy as np
import scipy.stats as stats

data = np.arange(6)
x = np.array([0.4, 0.6, 0.8, 1.5, 1.8, 2.2])
y = np.array([0.4, 0.8, 2.3, 2.5, 2.7, 2.9])

NX, NY = 4, 4
statistic, xedges, yedges, binnumber = stats.binned_statistic_2d(
    x, y, values=data, statistic='mean',
    bins=[np.arange(NX), np.arange(NY)])
print(statistic)

which yields
[[ 0.5  nan  2. ]
 [ nan  nan  3.5]
 [ nan  nan  5. ]]

There is also binned_statistic_dd for higher dimensional binning.
Each of these functions support user-defined statistics by passing a callable to the statistic parameter.


text:
Q: Java Execution Service Sometimes I am getting current exception:
[java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ExecutorCompletionService$QueueingFuture@746c196 rejected from java.util.concurrent.ThreadPoolExecutor@5eeac923[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]]

I am calling runAndAwaitResult() function limiting it to 100ms. If results successfully received and ready I am shutting down a ExecuorService if timeout has been exceeded I am taking available results and shutting down service as well. But sometimes I am getting that exception. How should I handle it or what is the best way terminating service to avoid such exception. Note I cannot wait for gentle shutdown I have just 100 ms for both jobs.
try{
        generalPersonalisationHandler = new GeneralPersonalisationHandler(resourceStack);
        com.company.personalisation.jobs.result.GeneralPersonalisationResult result = timeLimiter.callWithTimeout(new Callable<com.company.personalisation.jobs.result.GeneralPersonalisationResult>() {
            @Override
            public com.company.personalisation.jobs.result.GeneralPersonalisationResult call() throws Exception {
                com.company.personalisation.jobs.result.GeneralPersonalisationResult result = generalPersonalisationHandler.runAndAwaitResults(customerCookie);
                generalPersonalisationHandler.shutdown();
                return result;
            }
        }, timeout, TimeUnit.MILLISECONDS, true);

        PersonalisationData response = transformAvailableResults(result);
        return  response;
    }
    catch (UncheckedTimeoutException e) {
        String errorMsg = String.format("TIMEOUT for RunGeneralPersonalisation() execution time has exceeded maximum limit of: [%s] ms", timeout);
        ErrorLogger.error(errorMsg, e);
        com.company.personalisation.jobs.result.GeneralPersonalisationResult result = generalPersonalisationHandler.returnAvailableResults();
        generalPersonalisationHandler.shutdown();
        return transformAvailableResults(result);
    }

GeneralPersonalisationHandler.java
public class GeneralPersonalisationHandler {

    private GeneralPersonalisationResult generalPersonalisationResult;

    private final int SUBMITTED_JOBS = 2;
    private CompletionService<JobResult> completionService;
    private ResourceStack resourceStack;
    private ExecutorService executor;
    public GeneralPersonalisationHandler(ResourceStack resourceStack){
        this.executor = Executors.newFixedThreadPool(SUBMITTED_JOBS);
        this.completionService = new ExecutorCompletionService<JobResult>(executor);
        this.resourceStack = resourceStack;
    }

    public GeneralPersonalisationResult runAndAwaitResults(String customerCookie) throws Exception {

            Job customerEventsJob = new CustomerEventsJob(customerCookie, resourceStack);
            Job customerInfoJob = new CustomerPersonalInfoJob(customerCookie, resourceStack);

            completionService.submit(customerInfoJob);
            completionService.submit(customerEventsJob);

            generalPersonalisationResult = new GeneralPersonalisationResult();
            for (int handledJobs = 0; handledJobs < SUBMITTED_JOBS; handledJobs++) {
                Future<JobResult> result = completionService.take();

                JobResult jobResult = result.get();
                if (jobResult instanceof CustomerPersonalInfoJobResult) {
                    CustomerPersonalInfoJobResult customerPersonalInfoJobResult = (CustomerPersonalInfoJobResult) jobResult;
                    generalPersonalisationResult.setCustomerPersonalInfoJobResult(customerPersonalInfoJobResult);
                }

                if (jobResult instanceof CustomerEventsJobResult) {
                    CustomerEventsJobResult customerEventsJobResult = (CustomerEventsJobResult) jobResult;
                    generalPersonalisationResult.setCustomerEventsJobResult(customerEventsJobResult);
                }
            }

        }

        return generalPersonalisationResult;
    }

    public GeneralPersonalisationResult returnAvailableResults(){
        return this.generalPersonalisationResult;
    }

    public void shutdown(){
        if(!this.executor.isShutdown()) {
            this.executor.shutdown();
        }
    }
}

Thanks for any help!

A: catch (UncheckedTimeoutException e) {
    String errorMsg = String.format("TIMEOUT for RunGeneralPersonalisation() execution time has exceeded maximum limit of: [%s] ms", timeout);
    ErrorLogger.error(errorMsg, e);
    com.thehutgroup.personalisation.jobs.result.GeneralPersonalisationResult result = generalPersonalisationHandler.returnAvailableResults();
    generalPersonalisationHandler.shutdown();  // possible problem !!!
    return transformAvailableResults(result);
}

Looks like if UncheckedTimeoutException occurs you shutting down executor service, and after that if you try to add some task, you will have RejectedExecutionException.
Call shutdown only when you sure that any task won't be added.