If a dagger thrown at a monk splits into multiple daggers mid-air, each with their own attack and damage rolls, can Deflect Missiles deflect them all?

Situation:

A dagger is thrown at a monk. On that attack, the dagger multiplies into 2 or 3 daggers in mid-air, each dagger with its own rolls for attack and damage. The daggers move one after another such as a line like:

— — —

As a reaction to that one Attack action, can a monk use Deflect Missiles to deflect all of those projectiles, since all of them were thrown on a single Attack action and will be arriving simultaneously?

If a projectile attack at a monk misses, can the monk use Deflect Missiles to catch the projectiles and throw them back?

Say there are projectiles aimed at a monk that don’t quite beat the AC, leading to a missed attack, but the roll was close to hitting (only falling short by 3-5).

Can monk use Deflect Missiles to catch the projectiles and throw them back at the attacker in a new Attack action?

How do companies store private keys offline but still sign code with them?

I’ve heard that companies store their private keys offline “in a safe that will never be opened” and stuff like that (the context for this is a console developer like Microsoft keeping the Xbox private keys offline in a safe).

How would they still sign code with their private keys if they’re fully locked away? Does someone go and physically get the keys to sign the code? Is this a figure of speech that I don’t understand?

WhatsApp notifications, cannot turn them off

Ik have the Nokia 8.1 with android 9.0 (pie) and I am having troubles with Whatsapp. I want to turn off group app notifications (especially the vibrations and sounds), but I want to keep the notifications for personal messages. I chose these options within Whatsapp but it doesn’t workshop. The vibrations only got less intense.

Hoe can I get the notifications for groups in Whatsapp stop?

I have tried the following:

Here are my settings, in dutch unfortunately. Groepen means groups, and uit equals off. enter image description here

I also tried it via the android setting under apps and notifications -> notifications, but these turn back on automatically. Again, dutch: Groepsberichten is group messages. enter image description here

I found a third optioneel, where I can kill all vibrations for calls and messages (under accessability -> vibrations) but this is too much. I would like to know if someone calls me or sends me a messages via another app.

Is this a known problem? And is the an alternative way to get this to work?

Asking data to a Servlet from jsp and send them back to the jsp

Image that a user have to book a private lesson by compiling this form.

enter image description here

Using MVC pattern I’m building a WebApplication to achieve this goal; I have a jsp wich contains the form and by using Ajax I want to send data to a servlet which is my controller. This servlet comunicate with a DAO and once data are taken from database, they are sent back to jsp.

Here’s the code i wrote: JSP

<!DOCTYPE html> <html>     <head>         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">          <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"               crossorigin="anonymous">          <title>JSP Page</title>     </head>     <body>         <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>         <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/js/bootstrap.min.js"></script>          <form action="BookingController" method="GET">             <input type="hidden" name="command" value="show_courses"/>             <div class="modal-header">                 <h5 class="modal-title">Book your lesson!</h5>                 <button type="button" class="close" data-dismiss="modal" aria-label="Close">                     <span aria-hidden="true">&times;</span>                 </button>             </div>             <div class="modal-body">                 <select id="course">                     <option value="" disabled selected>Select a course</option>                     <c:forEach var="item" items="$  {AVAILABLE_COURSES}">                                               <option data-id='$  {item.id}'>$  {item.courseName}</option>                     </c:forEach>                 </select>                 <br>                 <br>                 <select id="teacher">                     <option value="" disabled selected>Select teacher</option>                 </select>                 <br>                 <br>                 <select id="days">                     <option value="" disabled selected>Select the day</option>                     <option data-id='Lunedi'>Monday</option>                     <option data-id='Martedi'>Friday</option>                 </select>                 <br>                 <br>                 <select id='hour'>                     <option value="" disabled selected>Select time</option>                 </select>             </div>             <div class="modal-footer">                 <button type="button" id="book" class="btn btn-primary">Book</button>                 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>             </div>         </form>          <script type="text/javascript">              $  ("#course").change(function () {                 $  .ajax({                     type: 'GET',                     cache: false,                     url: 'BookingController',                     data: {                         action: "show_teachers",                         course: $  ("#course").val()                     },                     success: function (data) {                         teacher = JSON.parse(data);                         var option;                         $  ("#teacher").empty();                         for (var i in teacher) {                             option = '<option data-id = ' + teacher[i].teacherId + '>' + teacher[i].firstNameLastName + '</option>';                             $  ("#teacher").append(option);                         }                     }                 });             });              $  ("#days").change(function () {                 $  .ajax({                     type: 'GET',                     cache: false,                     url: 'BookingController',                     data: {                         action: "show_available_hours",                         courseId: $  ("#course>option:selected").attr("data-id"),                         teacherId: $  ("#teacher>option:selected").attr("data-id"),                         day: $  ("#days>option:selected").attr("data-id")                     },                     success: function (data) {                         hours = JSON.parse(data);                         var option;                         $  ("#hour").empty();                         for (var i in hours) {                             option = '<option data-id = ' + hours[i] + '>' + hours[i] + '</option>';                             $  ("#hour").append(option);                         }                     }                 });             });       </script>     </body>  </html> 

Servlet:

//@WebServlet(urlPatterns = {"/BookingController"}) public class BookingController extends HttpServlet {      private OperationsDbUtil operationsDbUtil = null; //DAO     private Gson gson = new Gson();      // init for DB connection      /**      * Processes requests for both HTTP <code>GET</code> and <code>POST</code>      * methods.      *      * @param request servlet request      * @param response servlet response      * @throws ServletException if a servlet-specific error occurs      * @throws IOException if an I/O error occurs      */     protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {         response.setContentType("text/html;charset=UTF-8");     }      // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">     /**      * Handles the HTTP <code>GET</code> method.      *      * @param request servlet request      * @param response servlet response      * @throws ServletException if a servlet-specific error occurs      * @throws IOException if an I/O error occurs      */     @Override     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {         try {              // read the command parameter             String requestedAction = request.getParameter("action");              // if action is missing, route to the default page             if (requestedAction == null) {                 requestedAction = "homepage";             }              //route to the appropriate method             switch (requestedAction) {                 case "homepage":                     fillBookingForm(request, response);                     break;                 case "show_courses":                     fillBookingForm(request, response);                     break;                 case "show_teachers":                     showTeachers(request, response);                     break;                 case "show_available_hours":                     showAvailableHours(request, response);                     break;                 default:                     showCatalog(request, response);                     break;             }          } catch (SQLException ex) {             throw new ServletException(ex);         }     }      @Override     protected void doPost(HttpServletRequest request, HttpServletResponse response)             throws ServletException, IOException {         processRequest(request, response);     }      /**      * Returns a short description of the servlet.      *      * @return a String containing servlet description      */     @Override     public String getServletInfo() {         return "Short description";     }// </editor-fold>      private void fillBookingForm(HttpServletRequest request, HttpServletResponse response) throws SQLException, IOException {          // get courses list         List<Course> coursesList = operationsDbUtil.getCourses();          // add list to the request obj         request.setAttribute("AVAILABLE_COURSES", coursesList);         RequestDispatcher dispatcher = request.getRequestDispatcher("/booking-lesson-form.jsp");          try {             dispatcher.forward(request, response);         } catch (ServletException | IOException ex) {             Logger.getLogger(BookingController.class.getName()).log(Level.SEVERE, null, ex);         }     }      private void showTeachers(HttpServletRequest request, HttpServletResponse response) throws SQLException, IOException {         String course = null;         if (request.getParameter("course") != null) {             course = request.getParameter("course");         }          // get teachers list         List<Teacher> teachersList = operationsDbUtil.getTeachers(course);         response.getWriter().write(gson.toJson(teachersList));     }      private void showAvailableHours(HttpServletRequest request, HttpServletResponse response) throws IOException, SQLException {         String courseId = null;         String teacherId = null;         String day = null;          String[] availableHours = {"3-4pm", "4-5pm"};          List<String> hoursList = new ArrayList<>();         hoursList.addAll(Arrays.asList(availableHours));          if (request.getParameter("courseId") != null && request.getParameter("teacherId") != null) {             courseId = request.getParameter("courseId");             teacherId = request.getParameter("teacherId");             day = request.getParameter("day");         }          List<String> notAvailableHoursList = operationsDbUtil.getAvailableHours(courseId, teacherId, day);         hoursList.removeAll(notAvailableHoursList);         response.getWriter().write(gson.toJson(hoursList));     } } 

So this is what happens:

1) When user open the form, the database is queried and all the available courses are sent to the jsp so first field can be filled. 2) Once user has selected the desidered course, another request is sent to the servlet, the database is queried to get all the teachers available for the selected course and the list is sent back to jsp. 3) The user must select a day, there’s not query about this – there are default options. 4) When day is selected, a request is sent to the servlet which queries again the database and based on the previous selection send to the jsp the available time where the lessons can be booked.

Mainly my doubts are in the part related to Ajax, I wonder if I am managing the sending and receiving of data correctly or if there is a better way to do it. I don’t know if this continuous exchange of requests from the jsp could generate problems or if it is not a good practice. Any suggestions?

Is Haskell considered the “One Language to Rule Them All”?

I’ve heard it many times – when someone was trying to introduce Haskell to people with background in other programming languages, statements like these were flowing:

X in Haskell is like Y in other languages, but better

or

Z in Haskell is similar to V in other languages, but more powerful

etc, etc.

One example so that I don’t seem empty worded:

A lot of people coming from OOP get confused by typeclasses because they think they are like classes in object oriented languages. Well, they’re not. You can think of them kind of as Java interfaces, only better.

http://learnyouahaskell.com/types-and-typeclasses#typeclasses-101

Some time ago this kind of attitude used to annoy me and was a surefire way to make me reject on sight whatever was being proposed. Therefore, because of the constant claims of superiority of Haskell over other languages I was not trying to learn Haskell… until now, when I have to, thanks to the Esteemed Academia.

However, recently I seriously started thinking that my approach was arrogant and I was only harming myself. Maybe Haskell is indeed superior, only I’m refusing to accept it?

OK – there are fields where Haskell cannot compete – like it will likely never be faster or provide more control than C or Assembly. But what about C# or Java or the likes?

Another thing is that Haskell has a high entry barrier. But then again, correct patterns and principles in C#, Java, Python etc also have a higher entry barrier than simple, naive cowboy coding. Using dependency injection, for insance, is more complicated than just spamming globals and statics; TDD (another thing I used to reject in my arrogance because it was being pushed so heavily) requires some considerable time to learn. Finally, it would seem, functional programming is making its way into OO languages – but it again, seems less intuitive than modifying state.

Therefore, it would seem that:

  • One can, without much effort, code in typical general-purpose languages, like C#, Java, Python, etc, plaguing the code with anti-patterns – the results will be bad
  • One needs considerable time and effort to learn coding correctly in these languages – the results will be good
  • One needs considerable time and effort to code at all in Haskell; however, once one learns this, the results will be great.

Is Haskell, therefore, only held back by its high entry barrier? (And perhaps a less rich collection of libraries, as compared to more widely adopted languages). However, once one is not held back by the lack of necessary libraries, doesn’t fear the high entry barrier and the project scope doesn’t require the use of low level languages like C or even assembly – is Haskell the unambigously best choice?

SQL query to access a field collection’s data? At them moment, I’m only getting field_collection_item returned

In the below example, I am trying to return the value of a field from all the field collections in the database but only get field_collection_item. This example is just the most basic field collection sql possible.

SELECT field_collection_item.item_id AS item_id, 'field_collection_item' AS field_data_field_grade_decimal_field_collection_item_entity_ FROM  field_collection_item field_collection_item 

What do I need to change in this example? My SQL is terrible unfortunately. I just can’t return any values from field collections using sql. I need to be able to do this for Forena Reports. I’m getting the above code from views which returns the field collection values.

Same server, different Apache virtual hosts, redirection does not work for one of them

On my server there are multiple virtual hosts configured. Two of them should have the following behaviour, so that in the end, it should always be redirected to https://www…..

for example, I put the following into the URL bar: domain1.tld

It redirects to www.domain1.tld -> redirects to -> https://www.domain1.tld

The setup looks like this…

<VirtualHost *:80>         ServerName domain1.tld         Redirect permanent / http://www.domain1.tld </VirtualHost>  <VirtualHost *:80>         ServerName www.domain1.tld      ###### more settings ####  RewriteEngine on RewriteCond %{SERVER_NAME} =www.domain1.tld RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost>   

The other virtual host has exactly the same configuration:

<VirtualHost *:80>         ServerName domain2.tld         Redirect permanent / http://www.domain2.tld </VirtualHost>  <VirtualHost *:80>         ServerName www.domain2.tld      #### more settings ####  RewriteEngine on RewriteCond %{SERVER_NAME} =www.domain2.tld RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost> 

But what happens here is very strange. When I enter www.domain2.tld into the URL bar, it will be redirected to https://www.domain2.tld successfully. But when I enter domain2.tld into the URL bar, it redirects to https://domain2.tld and I get the default “Did Not Connect: Potential Security Issue” page with the error message:

Error code: SSL_ERROR_BAD_CERT_DOMAIN 

If I view the certificate, it show me the certificate from my 3rd domain configuration: subdomain1.domain1.tld. This virtual host can exists with both http and https, so the configuration looks slightly different. It has no redirection:

<VirtualHost *:80>         ServerName subdomain1.domain1.tld      ##### more settings ####  </VirtualHost> 

But this should not be the problem. The problem is:

When I enter domain2.tld into the URL bar, Why does this domain not redirect to HTTPS properly and gets the certificate of the 3rd domain?

What is additionally to say: domain2 is located at another domain provider (which points to my server IP), so the DNS setting looks slightly different (since the option were not the same as on my domain1 provider). Could this maybe a problem (on DNS level)?

Setup of domain1 (working):
domain1

For domain2, I can’t make such settings. Instead the settings look like this:

*.domain2.tld A [IP OF MY SERVER] ftp.domain2.tld A [IP OF MY SERVER] domain2.tld A [IP OF MY SERVER] mail.domain2.tld A [IP OF MY SERVER]