text:
Q: XAMPP not starting (not a port issue) I'm running XAMPP v3.2.1 on Windows 8 and after it was installed it was working fine but then the next day the apache and MySQL are not starting.
I have changed the default port 80 to 8081 in httpd.conf and changed the port 443 to 444 in httpd-ssl.conf but still nothing,
Here's what I am getting in the logs:
Apache error.log:
[Thu Jul 30 13:08:06.006405 2015] [ssl:warn] [pid 1892:tid 400] AH01909: www.example.com:444:0 server certificate does NOT include an ID which matches the server name
[Thu Jul 30 13:08:06.084534 2015] [core:warn] [pid 1892:tid 400] AH00098: pid file D:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Thu Jul 30 13:08:06.084534 2015] [core:error] [pid 1892:tid 400] (OS 5)Access is denied.  : AH00099: could not create D:/xampp/apache/logs/httpd.pid
[Thu Jul 30 13:08:06.084534 2015] [core:error] [pid 1892:tid 400] AH00100: httpd.exe: could not log pid to file D:/xampp/apache/logs/httpd.pid

MySql mysql_error:
2015-07-30 13:08:05 8408 [Note] Plugin 'FEDERATED' is disabled.
2015-07-30 13:08:05 17f4 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
2015-07-30 13:08:05 8408 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-07-30 13:08:05 8408 [Note] InnoDB: The InnoDB memory heap is disabled
2015-07-30 13:08:05 8408 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2015-07-30 13:08:05 8408 [Note] InnoDB: Memory barrier is not used
2015-07-30 13:08:05 8408 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-07-30 13:08:05 8408 [Note] InnoDB: Not using CPU crc32 instructions
2015-07-30 13:08:05 8408 [Note] InnoDB: Initializing buffer pool, size = 16.0M
2015-07-30 13:08:05 8408 [Note] InnoDB: Completed initialization of buffer pool
2015-07-30 13:08:05 8408 [Note] InnoDB: Highest supported file format is Barracuda.
2015-07-30 13:08:05 8408 [Note] InnoDB: The log sequence numbers 1665234 and 1665234 in ibdata files do not match the log sequence number 2075306 in the ib_logfiles!
2015-07-30 13:08:05 8408 [Note] InnoDB: Database was not shutdown normally!
2015-07-30 13:08:05 8408 [Note] InnoDB: Starting crash recovery.
2015-07-30 13:08:05 8408 [Note] InnoDB: Reading tablespace information from the .ibd files...
2015-07-30 13:08:05 8408 [Note] InnoDB: Restoring possible half-written data pages
2015-07-30 13:08:05 8408 [Note] InnoDB: from the doublewrite buffer...
2015-07-30 13:08:06 8408 [Note] InnoDB: 128 rollback segment(s) are active.
2015-07-30 13:08:06 8408 [Note] InnoDB: Waiting for purge to start
2015-07-30 13:08:06 8408 [Note] InnoDB: 5.6.25 started; log sequence number 2075306
2015-07-30 13:08:06 8408 [Note] Server hostname (bind-address): '*'; port: 3306
2015-07-30 13:08:06 8408 [Note] IPv6 is available.
2015-07-30 13:08:06 8408 [Note]   - '::' resolves to '::';
2015-07-30 13:08:06 8408 [Note] Server socket created on IP: '::'.

I am still trying to google to find answers but so far all of the answers I  can find suggest that the port is the issue while in this case it isnt


text:
Q: Remove HTML TAG Inputs from input Form Ok basically when I type , it won't allow it.
I want to add more like < > / \ etc how do I do it?
$("#in1").keypress(function (evt) {
    if (String.fromCharCode(evt.which) == ",")
        return false;
});

<input type="text" id="in1">

Can see the demo here. http://jsfiddle.net/QshDd/38/

A: If you have a list of disallowed characters, you can forbid them in this fashion:
$("#in1").keypress(function (evt) {
    return [',', '<', '>', ].indexOf(String.fromCharCode(evt.which)) === -1;
});

A: its working , you Required to give more conditions:
$("#in1").keypress(function (evt) {
if (String.fromCharCode(evt.which) == ",")
    return false;
if (String.fromCharCode(evt.which) == "<")
    return false;
if (String.fromCharCode(evt.which) == ">")
    return false;
if (String.fromCharCode(evt.which) == "\\")
    return false;
});

Another Solution , either use regEx or use XMLParser or JSON parser methods.

A: if you want something like this
<input type="text"> ===> input typetext
  $("#in1").keypress(function (evt) {
    if (isValid(String.fromCharCode(evt.which)))
        return false;
    });

    function isValid(str){
      return /[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g.test(str);
    }

http://jsfiddle.net/QshDd/61/

A: Try this, if you need only alphabets
$("#in1").keypress(function (evt) {
    var expr = /^([a-zA-Z\s]+)$/i;
    if (!String.fromCharCode(evt.which).match(expr))
        return false;
});

A: var chars = new Array("<", ">" ,"/" ,"\\");
$("#in1").keypress(function (evt) {
    if(!(chars.indexOf(String.fromCharCode(evt.which)) > -1))
        return false;
});

redpajama_set_name: RedPajamaStackExchange


text:
Q: Sum Approximation Consider $\int_{4}^{9} \frac{1}{\sqrt x} \ dx$
1) Find a value of $n$ where $|L_n - R_n| \leq 0.1$
2) Use that value of $n$ to find $L_n$ and $R_n$
3) If you were to take the average of the Left-hand sum and the Right-hand sum, will your approximation be larger or smaller than the integral? $$\\$$
*$L_n$ is left-hand sum
*$R_n$ is right-hand sum
$$\\$$ I have no clue on how to go about this problem. I was think I might have to use the error formulas but I'm not certain.
Your help would be greatly appreciated. :)

A: Notice that the left hand sum is $\displaystyle \frac{b-a}{n}\sum_{k=0}^{n-1}f\left(a+\displaystyle \frac{k}{n}(b-a)\right)$
Similarly, the right hand sum is $\displaystyle \frac{b-a}{n}\sum_{k=1}^{n}f\left(a+\displaystyle \frac{k}{n}(b-a)\right).$
They're almost the same. The difference is that the rectangle at the beginning of the left hand sum is "replaced" with the rectangle at the end of the right hand sum.
So we have the difference of areas is $\displaystyle L_n-R_n=\frac{b-a}{n}\left(f(a)-f(b)\right)$.
We need that $|L_n-R_n| \leq 0.1$. We have that $\displaystyle f(a)-f(b)=\frac{1}{6}$, and that $b-a=5$.
Plugging right in gives us $\displaystyle \frac{5}{6}\left(\frac{1}{n}\right) \leq \frac{1}{10}$. (We just drop absolute value because $n$ is positive).
Now we isolate $n$ to get $\displaystyle \frac{1}{n} \leq \frac{3}{25}$.
Flipping the inequality gives us $\displaystyle n \geq \frac{25}{3}$.
Because we can't have half a rectangle, we say that $\boxed{n \geq 9}$.

$L_n = \displaystyle \frac{b-a}{n}\sum_{k=0}^{n-1}f\left(a+\displaystyle \frac{k}{n}(b-a)\right)=\displaystyle \frac{b-a}{n}f(a) + \frac{b-a}{n}\sum_{k=1}^{n-1}f\left(a+\displaystyle \frac{k}{n}(b-a)\right)$
$R_n = \displaystyle \frac{b-a}{n}\sum_{k=1}^{n}f\left(a+\displaystyle \frac{k}{n}(b-a)\right)=\displaystyle \frac{b-a}{n}\sum_{k=1}^{n-1}f\left(a+\displaystyle \frac{k}{n}(b-a)\right)+\frac{b-a}{n}f(b)$
That's how $\displaystyle L_n-R_n = \frac{b-a}{n}(f(a)-f(b))$ comes about.


text:
Q: where is repository with spring sources In spring and cantral repo i can find e.g. spring-support-2.0.8.jar but what repo should I add to my pom to make my ide automatically download sources? I don't see any repo with spring-support-2.0.8-sources.jar

A: Unfortunately, not all Spring versions were deployed with sources. In a nutshell, from version 2.5, all Spring JARs come with sources.
If the source is missing, then you'll have to find it elsewhere and either add it manually to your projects or you can install a Maven mirror at your company and deploy the sources there after packaging them in a JAR file.
I suggest to try to upgrade to Spring 2.5. Newer versions of Spring are usually drop in replacements of older ones. Most of the time, the upgrade takes a couple of hours.
spring-support doesn't exist in Spring 2.5 anymore; the classes in there are now in spring-context-support.
You can use the fc: prefix to find the JARs which contain missing classes: http://search.maven.org/#search%7Cga%7C1%7Cfc%3Aorg.springframework.mail

A: As Looking for spring-hibernate3-2.0.8 sources mentions, the source jars were not consistently published back then. The suggestion from that question is to:

get the sources of the old monolithic spring-2.0.8-sources.jar


text:
Q: Calculating day difference between two dates My variable DateBecame looks like this:
19550101

It is of long type and the format is %10.0g. So YMD format.
I also have another variable DateLeft:
19961001

This is also of long type and format %10.0g.
How can I calculate the duration between the two dates?

A: The following works for me:
clear

input long(date1 date2)
19550101 19961001
end

generate diff = daily(string(date1, "%10.0g"), "YMD") - ///
                daily(string(date2, "%10.0g"), "YMD")

list

     +---------------------------------+
     |    date1      date2        diff |
     |---------------------------------|
  1. | 19550101   19961001      -15249 |
     +---------------------------------+

Note that variables of long type are generally not ideal for this kind of calculations.
Type help datetime from Stata's command prompt for more information on working with dates.


text:
Q: Convert NSDate to Unix Time Stamp for use in Dictionary While there are numerous examples on SO and the web of converting the current date to a unix timestamp, I can't seem to find one for any date.
This code produces error shown.
NSDate *date = self.datepicker.date;
time_t start = (time_t) [date timeIntervalSince1970];//collection element of time_t is not an objective-c object

Would appreciate any suggestions.

A: I believe that code will work and the error message relates to a different statement.
If you want to put that time_t into a dictionary then you'll need to wrap it in an NSNumber object. However you may as well keep it as an NSTimeInterval (double) and cast it when using it:
NSDate *date = self.datepicker.date;
NSTimeInterval start = [date timeIntervalSince1970]
dict[@"startTime"] = @(start);

However you can also cast it before adding it to the dictionary if you really want to.


text:
Q: accessing a class from another class I have an idea which requires loading in another class. Let's say I have index.php that includes once (database.php). In a class, is it acceptable to create a new object that is not extended by the class? In otherwords, brining in the content globally instead? Here's what I mean...
index.php:
----------------------
include_once ('./core/dataAccess.php');

....

class home {
    private function getUsers() {
        $dataAccess = new DataAccess();
    }
}

A: It's acceptable and widely used practice, however it is in most cases not the best solution. The advanced way is using dependency injection, which means that any other objects needed by your class will be " injected" from the outside, making them interchangeable. This could happen in the constructor, in a setter method or directly as parameter where they are needed.
The only methods that use the new keyword are then factory methods that do nothing else than creating objects.


text:
Q: Frameworks for optimizing performance with Javascript This is kind of an unusual situation so forgive me for the odd title. I've been looking at optimizing an HTML interface for manipulating server data. All data is passed over a REST service and there are existing jQuery methods for pulling and submitting the data.
The problem is that all this runs very slowly due to the large amount of Javascript code used for animating and manipulating the screen. Obviously I can optimize the javascript code to some extent, but the interface is so slow I'm wondering if there are other frameworks I should look at taking advantage of. I don't have the ability to leverage anything server side like PHP.
If there are no other frameworks, I'm planning to move most of the code to jQuery to improve readability and take advantage of the optimizations others have done there.

A: Please have a look at AngularJS. It is a framework (by Google) specifically designed for data driven websites. It is built on jQuery. It provides a $resource service which can be used to develop your own REST client for your website. The purpose of which is to enhance code readability and performance by abstracting the lower-level HTTP calls.
You can also have a look at Dojo but it has a huge learning curve.


text:
Q: Animate corona SDK enemies I'm try to create a new game on corona SDK i'm new in lua language, my goal is had a set of enemies in a kind of action game.
For this i think the best way is have a array to store all my enemeis in this case i use three.
So my code is :
local enemies = {}

enemy1 = display.newImageRect( "assets/images/sheep_mini.png", 60, 60 )
enemy1.anchorX = 0
enemy1.anchorY = 0
enemy1.name = 'enemy'
enemy1.id = 1
enemy1.x, enemy1.y = 28, display.contentHeight - 260
enemy1.angularVelocity = 0
enemies[1] =enemy1

 enemy2 = display.newImageRect( "assets/images/sheep_mini.png", 60, 60 )
enemy2.anchorX = 0
enemy2.anchorY = 0
enemy1.id = 2
enemy2.name = "enemy"
enemy2.x, enemy2.y = screenW - 120, display.contentHeight - 420
enemy2.angularVelocity = 0
enemies[2] =enemy2

So after that i've a while to iterate to this enemies enemies, but when i try to get the enemies from the array i only getting this :
Mar 31 02:23:36.576: table: 0x600000a66640
Mar 31 02:23:36.577: table: 0x600000a78e00
i'm using this code for doing while :
  local len = #enemies
local i= 1
while i <= len do
    enemy1 = enemies[i]
    print(enemy1)
end

Can you help here? i'm now on corona and also on lua
thanks in advance

A: What you are trying to achieve can be done through
table.print(enemy1)

For more information I suggest you read this: Table Serialization which explains how:

functions to serialize/unserialize a table or object (usually, not
  always, represented as a table), which is to convert it to and from a
  string representation. This is typically used for display (e.g.
  debugging) or storing data in a file (e.g. persistence).


text:
Q: How to keep running when hovering? Continuously I want to create a function that runs a few seconds after I hover my mouse, like 'update' function.
But I did not find a way to run continuously when hovering.
Please let me know if you know how to do it.

A: Jquery makes me want to puke, so, yeah.. native JS;
(Click the blue "run code snippet" button at the bottom of the post and hover the "hover me" button)

var hover;
btn.addEventListener('pointerover', function(evt){
  // We have started hovering the btn, start interval.
    hover = setInterval(function(){
      //every 1000 MS, add another "Hi" to the debug div.
      debug.innerHTML += "Hi  ";
    }, 1000);

});

btn.addEventListener('pointerout', function(evt){
  //Leaving & stopped hovering the btn, stop interval.
  clearInterval( hover );
});
<button id="btn">Hover Me</button>

A: I think you are asking how to trigger a behavior a few seconds after an event has occurred.  You can do this in jquery with the delay function, e.g.
$( "#foo" ).slideUp( 300 ).delay( 800 ).fadeIn( 400 );

To combine this with mouseenter it'd be something like
$( "#foo" ).mouseenter(function(){
   $( "#foo" ).slideUp( 300 ).delay( 800 ).fadeIn( 400 );
});


text:
Q: How do I handle server side validation error if I have a form running inside a jQuery UI dialog? I have the following code in my controller after the user posts the form but if the validation fails (_applicationValidator.Validate), I normally reload the "Edit" view but in this case I want to keep the dialog open and simply show these errors inside the dialog.
Controller Code:
  [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult Update(ApplicationUpdater applicationUpdater_)
    {
        if (_applicationValidator.Validate(applicationUpdater_, ModelState, ValueProvider))
        {
            _repo.UpdateApplication(applicationUpdater_);
            ApplicationsViewModel vm = new ApplicationsViewModel();
            vm.Applications = _repo.GetApplications();
            return View("Index", vm);
        }
        else
        {
            ApplicationViewModel vm = GetApplicationVM();
            return View("Edit", vm);
        }
    }

View Code (jQuery)
 $(".showEditPopup").click(function() {
            $.post("Applications/ShowEdit",
                { recnum: $(this).parents('tr:first').attr("recnum") },
                function(htmlResult) {
                    $("#EditUserControlDiv").remove();
                    $("#container").append(htmlResult);
                    $("#container select[multiple]").asmSelect();
                    $("#EditUserControlDiv").dialog(
                    {
                        height: 675,
                        width: 650,
                        modal: true
                    }
                    );
                }
           );
        });

A: As said

But in this case i want to keep the dialop open and simply show these errors inside the dialog

Ok.
After openning the dialog, you have to

*

*hide previous error message

...
open: function(event, ui) {
    $(".error").css("display", "none");
}

After clicking dialog button, you have to

*

*disable JQuery UI

*Show "loading..." image

*Send form

...
$("#loading").css("display", "block");

panel.dialog("disable");

panel.dialog("option", "disabled", true);

After response is loaded (You can use JSON as response), you have to

*

*Check whether it has errors.

...
// var response plays the role of JSON response

var response = {
    "errors":[
        {
            "property-name":"name",
            "error":"Name is required"
        },
        {
            "property-name":"age",
            "error":""
        }
    ]
};

var hasErrors = false;

for(var i = 0; i < response.errors.length; i++) {
    if(response.errors[i].error != "") {
         hasErrors = true;

         $("#" + response.errors[i]["property-name"] + "-error")
           .text(response.errors[i]["error"])
           .css("display", "block");
    }
}

if(!hasErrors) {
    panel.dialog("close");

    alert("success form!");
} else {
    panel.dialog("enable");

    panel.dialog("option", "disabled", false);
}

Here you can see in Action
Notice you have a default behavior. So you can put it inside a external function

A: Most convenient:

*

*Disable all input elements

*Do an Ajax post to the Update function

*Handle the server response in your UI. E.g. closing the jQuery UI form, or showing validation errors.

Change your Update function to return some wrapper object like:
return new { Succeeded = false, ValidationMessages = new [] { "Incorrect username" } };

$.post(/* postdata */, function(resp) {
     if(resp.Succeeded) //close jQuery UI dialog
     else {
         for(var i = 0; i < resp.ValidationMessages; i++) alert(resp.ValidationMessages[i]));
     }
});

You can build your postdata, by quering all input/textarea etc. elements, and saving them into an array, something like (untested):
var data = [];
$('input').each(function() {
    data.push([ $(this).id, $(this).val() ]);
});

A: You could use the jQuery form plugin to create an Ajax version of the editing form:
$(".showEditPopup").click(function() {
            function popDialog(htmlResult) {
                $("#EditUserControlDiv").remove();
                $("#container").append(htmlResult);
                $("#container form").ajaxForm(function(result) {
                  // There may be an easier way (like testing for a
                  // certain string in the result)
                  // to detect the need to "repop"
                  if ($(result).find('form').length) {
                    popDialog(result);
                  } else {
                    $("#EditUserControlDiv").dialog('close'); // or remove
                  }
                });
                $("#container select[multiple]").asmSelect();
                $("#EditUserControlDiv").dialog(
                {
                    height: 675,
                    width: 650,
                    modal: true
                }
                );
            }

        $.post("Applications/ShowEdit",
            { recnum: $(this).parents('tr:first').attr("recnum") },
            function(result) { popDialog(result); }
       );
    });


text:
Q: memory limit exceeded while using comparator function #include<bits/stdc++.h>
using namespace std;
bool compaa(int i,int j)
{
    if((i%2)!=0)
return true;
else
return false;
}
int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin>>n;
        long long int a[n],i,count=0;
        for(i=0;i<n;i++)
        {
            cin>>a[i];
        }
        sort(a,a+n,compaa);
        for(i=0;i<n;i++)
        {
            cout<<a[i]<<" ";
        }
        cout<<endl;
    }
    return 0;
}

above code is giving memory limit exceeded. it is using more than 262100 KB of memory.
But if I do a slight change the code runs just fine consuming only 3600 KB of memory.
why is this happening??
below is the code which works just fine:
#include<bits/stdc++.h>
using namespace std;
bool compaa(int i,int j)
{
return (i%2)>(j%2);
}
int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin>>n;
        long long int a[n],i,count=0;
        for(i=0;i<n;i++)
        {
            cin>>a[i];
        }
        sort(a,a+n,compaa);
        for(i=0;i<n;i++)
        {
            cout<<a[i]<<" ";
        }
        cout<<endl;
    }
    return 0;
}

what is happening with comparator function?

A: According to the C++ standard, the function used for comparison must be a

comparison function object (i.e. an object that satisfies the requirements of Compare) which returns true if the first argument is less than (i.e. is ordered before) the second.

"requirements of Compare" are these: the comparison function must

Establish strict weak ordering relation with the following properties:
For all a, comp(a,a)==false
If comp(a,b)==true then comp(b,a)==false
if comp(a,b)==true and comp(b,c)==true then comp(a,c)==true

Now, let's check your 1st attempt at comparison function:
bool compaa(int i, int j)
{
    if ((i % 2) != 0)
        return true;
    else
        return false;
}

compaa(2,2) returns false as it should.  But compaa(1,1) returns true
The other 2 conditions are also violated.
You can check that the second version,
bool compaa(int i, int j)
{
  return (i % 2) > (j % 2);
}

satisfies all conditions of  strict weak ordering: the numbers are ordered according to their remainders modulo 2.
Other remarks:

*

*Please don't submit programs with std::cin and without the numbers that need to be entered to reproduce your problem.

Further reading:

*

*https://en.wikipedia.org/wiki/Weak_ordering#Strict_weak_orderings

*https://en.cppreference.com/w/cpp/algorithm/sort

*https://en.cppreference.com/w/cpp/named_req/Compare


text:
Q: How to detect the first access in a WCF project? I have a WCF project which has several services (e.g. .svc files).  The project is hosted in IIS 7.x.
I would like to run some code the first time any user accesses any of the services (because I need to run some code at that time).  I can't seem to find a global.asax kind of construct for this type of project, which would allow me to accomplish this task.
How can I detect the first time any user accesses any of the service?

A:
I can't seem to find a global.asax kind of construct for this type of project, which would allow me to accomplish this task.

Since your WCF service is hosted in IIS 7 you could add a Global.asax and use Application_Start.


text:
Q: How change value of variable in same class? I'm new in python, and I have this code:
class Daemon():
    db = Database()

    def __init__(self):
        final_folder = ''

How I can change the value of the variable final_folder in the same class but in other function?
I try the code like below but isn't work:
class Daemon():
    db = Database()

    def __init__(self):
        final_folder = ''

    def get_mail_body(self, msg):
        Daemon.final_folder = 'someotherstring'

A: You need to refer to it as self.final_folder in __init__, like:
class Daemon():

    db = Database()

    def __init__(self):

        self.final_folder = ''

    def get_mail_body(self, msg):

        self.final_folder = 'someotherstring'

Then you should be able to do something like:
my_daemon = Daemon()
print(my_daemon.final_folder)
# outputs: ''
my_daemon.get_mail_body('fake message')
print(my_daemon.final_folder)
# outputs: 'someotherstring'

A: you need to access the variable with self if you are using inside the class. self holds the current object.
Here is the updated code.
def __init__(self):
   self.final_folder = ''
def get_mail_body(self)
    self.final_folder = 'Hello'

Create the object of the class and access the variable.


text:
Q: PHP: prevent folder hacking - if path has ../ in it? i'm doing a simple thingy in php and i wonder how i can test if the variable $path contains the following structure ../
so i'll simply have a ?path=somepath structure in my url, and if anybody would enter ../ it allows him to go one directory up. I know of course that that's not the best solution, however for my little thingy it's enough if i just test the $path variable for a string of "../" in it. if so die();
i'm not sure what's the best way to test that!
regards matt

A: to answer your question:
if(strpos($path,'../') !== false){
  // looks like someone 's trying to hack here - simply
  // do nothing (or send an email-notification to yourself
  // to be informed and see how often this happens)
}else{
  // here comes the magic

}

but: you really shouldn't do so. if you want an easy solution, use a switch-statement for every possible $path and include the relevant file (or whatever you have to do).

A: Instead of doing that, you could just call realpath() on it and check if the path it's supposed to be in is a prefix of that.
Even better, why not keep a whitelist and reject anything not in it?

A: I's an alternative solution that allow you to customize the url....
<?php
$arr= array(
  "register" => "register.php",
  "login" => "userlogin.php",
  "admin" => "adminlogin.php",
  "etc" => "otherpage.php",
  );
if ( isset ( $_GET['path'] )
    if ( array_key_exists( $_GET['path'] , $arr) ){
      //do some stuff...
      include( $arr[$_GET['path']] );
    }
    else
      echo 'Page Not Found!';
else
  echo 'Required Field Empty!';
?>

So calling index.php?path=admin page adminlogin.php will be included....

A: one of the easier ways is to harden your php.ini config, specifically the open_basedir directive. Keep in mind, some CMS systems do actually use ..\ quite a bit in the code, and when there are includes outside the root folder this can create problems. (i.e. pear modules)
Another method is to use mod_rewrite.
Unless you are using an include file to check each and every URL for injection from $_GET and $_SERVER['request_uri'] variables, you will open doors for this kind of attack. for example, you might protect index.php but not submit.php. This is why hardening php.ini and .htaccess is the preferred method.


text:
Q: DocumentDB protocol support for MongoDB Looked through all the Azure blog pages but couldn't find anything related to my question.
I know that DocumentDB can support MongoDB clients with the help of protocol support but you have to create the database with MongoDB protocol support. I wonder if a DocumentDB database that is created with MongoDB protocol support is still usable by pure DocumentDB clients? Does the database support both types of clients or only MongoDB clients?

A: If you have enabled MongoDB protocol support, recently we enabled support to connect to it via both MongoDB and DocumentDB SDKs.  Please note that MongoDB protocol support is in preview mode and we will update this answer once MongoDB protocol support has GA'ed.


text:
Q: Terminate Scrapy crawl manually When trying to run a spider in Scrapy, after having run it before with other parameters, I get this error message:
crawl: error: running 'scrapy crawl' with more than one spider is no longer supported

I interpret this as the first crawl still running in some sense. I am looking for some way to terminate all running Scrapy processes, in order to start clean with a new crawl.

A: I use an incremented number to break the loop when I'm testing
 def parse(self, response):
     i = 0
     for sel in response.xpath('something'):
         if i > 2:
             break
         #something
         i += 1
         #something

A: I hope you are using multiple command line parameters in wrong way. Simply scrapy crawl <spidername> will work fine. You may missed any specifiers if you are trying to use multiple command line arguments.
For terminating all running Scrapy processes, in Linux OS you can simply find out and kill all Scrapy processes by using the following command in Linux terminal
pkill scrapy

Please use Windows PsKill for Windows OS.


text:
Q: Are these two events independent? Let n ≥ 3 be an integer, consider a uniformly random permutation of the set
{1, 2, . . . , n}, and define the events
A = "in this permutation, 2 is to the left of 3"
and
B = "in this permutation, 1 is to the left of 2 and 1 is to the left of 3".
Are these two events independent? Justify your answer.
Hint: Use the Product Rule to count the number of permutations that define A and B
Not really sure how do justify this. Looking at it logically it seems to be that they are not independent because B is basically saying 1 & 2 are always to the left of 3, and if B is an event, then 2 is guaranteed to be to the left of 3, which is what A is. Any help would be appreciated.

A: No, they're independent. By some symmetry principles you only need to count the permutations of the set $\{1,2,3\}$; these 6 permutations are:
                 2 then 3 |  3 then 2
1 before both      123    |    132
--------------------------+------------
1 not before       213    |    312
                   231    |    321

As you can see from the nice split in the graph, the independence is manifest.

A: Sometimes intuition about independence is clear. But sometimes it is not, so let us calculate.
By symmetry $\Pr(A)=\frac{1}{2}$.
For $\Pr(B)$, note that there are $3!$ equally likely permutations of $1,2,3$ (since all permutations are equally likely, the location of the other numbers is irrelevant.)  We count the ones that satisfy $B$. They are $123$ and $132$. So $\Pr(B)=\frac{2}{6}$.
Finally, we calculate $\Pr(A\cap B)$. Only the permutation $123$ satisfies this.
Now we can check whether $\Pr(A\cap B)=\Pr(A)\Pr(B)$.


text:
Q: Fix the ability to dispute flags The way disputing flags is handled is rather confusing for anyone not familiar with the arcane details of the SE platform in this area. In some parts the feedback users get is only confusing, in others it is plain wrong. The main problems of the whole mechanism are

*

*The "disputed" status of a flag only means that a single 10k+ user disagreed with the flag, it completely ignores what happened with the flagged post, what other 10k+ users think and what a moderator thought about the flag. This is very confusing for users checking their flag feedback, especially when a valid flag that was acted upon is disputed by one user.

*The user that disputed the flag gets the same mod feedback as the user that flagged. As those two users obviously disagreed, one user will always get the wrong feedback. (Am I using the "Invalid Flag" flag wrongly?)

*The terminology is confusing, it is not immediately obvious to users what the difference between a declined flag and a disputed flag is.
Some ideas to fix these problems:

*

*The user that cast the flag that was disputed by another user should never see the dispution in his flag feedback. The important feedback is what a moderator did (acting on the flag or invalidating it), or what the community did with the flagged post.

*Dispution should not affect the flag weight of the target flag, it should only be a way to indicate to 10k+ users and mods that the flag might be wrong, it should not have any actual affect on anything else

A: We implemented the ability for moderators to handle flags on an individual basis instead of only being able to handle flags on a post-by-post basis.
In the case of disputed flags, this thus allows a moderator to directly mark the appropriate flags as "helpful" or "declined" in the case of conflicting flags. So for example, if a flag is incorrect and someone disputes it as invalid, the bad flag can be declined with explanation while the invalid flag is marked as helpful. Counter to that, if the flag was spot-on and the disputer was in the wrong, the correct flag can be marked helpful, while the disputer can be given guidance as to why the flag should not have been marked invalid. In whatever case it plays out, with the flags being handled individually, this will also not result in any reports of flags being "disputed" - only "helpful" and "declined".
This should solve all three of the problems as proposed - not with the ideas of solutions you provided but hopefully I think this solution is actually nicer than additional mechanical krutz and overhead that otherwise might've addressed the issue.


text:
Q: How to create a GridLayout.LayoutParams to specify the position of a text view? To place a Text View dynamically onto a GridLayout I tried the following code:
GridLayout.Spec spec = new GridLayout.Spec(1,1);
GridLayout.LayoutParams params = new GridLayout.LayoutParams(spec);

yielding in an error:
Error:(129, 36) error: constructor Spec in class Spec cannot be applied to given types;
required: no arguments
found: int,int
reason: actual and formal argument lists differ in length

Ok then, I tried the following code, following the documentation here, in which it says to use the following methods to create a spec:
GridLayout.Spec spec = new GridLayout.Spec();
spec.spec(1);

but this also is incorrect.
Now I am utterly confused. I do not understand what the documentation is telling me. Maybe the docs are outdated/incorrect? They do not even tall me what the int values signify!
I want to be able to set parameters for a TextView, like to column and/or the row where to place them, the height of the row the text size...
Maybe someone can show a simple example?

A: Here's how you should use it:
View view; // the view that you wanna insert

GridLayout.LayoutParams params =
   new GridLayout.LayoutParams(view.getLayoutParams());

params.rowSpec = GridLayout.spec(0, 1);    // First cell in first row uses rowSpan 1.
params.columnSpec = GridLayout.spec(0, 2); // First cell in first column uses columnSpan 2.
view.setLayoutParams(params);


text:
Q: React.js - React Router content not changing I'm trying to set up my react.js environment to build a UI Toolkit. I'm using react-router, but for some reason the URL changes when I click on the links rendered from Index.js, but the content stays the same. It just continues displaying the content from the index.js page instead of changing to the content of the link I clicked. I'm not getting any error messages on the console.
main.js
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, browserHistory } from 'react-router';
import routes from './routes';

function run(){
const reactMount = document.getElementById('app');

ReactDOM.render(<Router onUpdate={() => window.scrollTo(0, 0)} history=    {browserHistory} routes={routes}/>, reactMount );
}

new Promise((resolve) => {
if (window.addEventListener) {
  window.addEventListener('DOMContentLoaded', resolve);
} else {
  window.attachEvent('onload', resolve);
}
}).then(run)

routes.js
import React from 'react';
import { IndexRoute, Route } from 'react-router';

import Index from './pages/Index';
import Text from './pages/Text';
import Icon from './pages/Icon';

var routes = (
  <Route  path="/" component={Index}>
      <Route path="/Text" component={Text} />
      <Route path="/Icon" component={Icon} />
  </Route>
);

export default routes;

pages/Index.js
import React from 'react';
import {Link} from 'react-router';

class Index extends React.Component {
render() {

return (

<Link to="/Text">Text</Link>

<Link to="/Icon">Icon</Link>

)
}
}

export default Index;

pages/Text.js
import React from 'react';

class Text extends React.Component {
render() {
return (

Text

)
}
}

export default Text;

A: Two things here:

*

*The nested routes Text and Icon in your route configuration shouldn't have / before them. It should be like this: <Route path="Text" component={Text} />.

*In your container component (Index) you need to access this.props.children so that the component knows to render it's children (the nested routes).
// Index.js

return (

<Link to="/Text">Text</Link>

<Link to="/Icon">Icon</Link>

    { this.props.children }

)


text:
Q: Populating a select element with comma-separated values using for loop I have a bunch of comma-separated values stored as strings in a JSON file. My aim is to split these values to populate a select element which is based on Selectize.js. Code (excerpt) looks as follows:
var options = {};

var attr_split = data.attributes['Attribute1'].split(",");

var options_key;

for (var i = 0; i < attr_split.length; i++) {
    options_key = attr_split[i]
    }

var options_values = {
    value: options_key,
    text: options_key,
    }

    if (options_key in options)
        options_values = options[options_key];
    options[options_key] = options_values;

$('#input').selectize({
    options: options,
});

Although this seems to work, the output in the select element only shows the last iterations done by the for loop. As per here
and here, I've tried
for (var i = 0; i < attr_split.length; i++) {
    var options_key += attr_split[i]
    }

but this throws me undefined plus all concatenated strings without the separator as per the following example:
undefinedAttr1Attr2Attr3

When I simply test the loop using manual input of the array elements everything appears fine:
for (var i = 0; i < attr_split.length; i++) {
    var options_key = attr_split[0] || attr_split[1] || attr_split[2]
    }

But this is not the way to go, since the number of elements differs per string.
Any idea on what I'm doing wrong here? I have the feeling it's something quite straightforward :)

A: when you declare 'options_key' ,you are not initializing it.so its value is undefined .when you concatenate options_key += attr_split[i] .in first iteration options_key holds undefined.so only you are getting undefinedAttr1Attr2Attr3.
so declare and initialize options_key like.
var options_key="";

and in your loop
for (var i = 0; i < attr_split.length; i++)
{
     options_key = attr_split[i]
}

Everytime  you replace options_key with value of attr_split[i].so after the loop it will contain last element value.corrected code is
for (var i = 0; i < attr_split.length; i++)
{
    options_key += attr_split[i]
}

A: Just change var options_key; to var options_key="";
The reason you are getting undefined is because you have not defined the variable properly.
Here is a working example
 var attr_split = "1,2,3,4".split(",");

var options_key="";

for (var i = 0; i < attr_split.length; i++) {
    options_key += attr_split[i]
    }

    alert(options_key);
var options_values = {
    value: options_key,
    text: options_key
}
alert(options_values);


text:
Q: How to keep the social links on the navigation bar when the page shrinks, and also how to place social icons on same line when hamburger menu is open I am trying to create a responsive web page navigation bar. I want the logo on the left, the navigation links center, and social media links on the right. When the page width gets too small, it is supposed to hide the navigation links and social media links. This is effectively working correctly however the social media links are jumping below the navigation bar when the page is too narrow but before it reaches full "mobile" width. Also, I am having trouble placing the social links in one line when the hamburger menu is open. I am not a web developer, just a tutorial watcher and any help would be greatly appreciated.
I have tried changing the class type for the .social class but this seems to only make matters worse.
EDIT: I solved the overflow problem by adding "overflow: hidden;" under ".navbar ul{"

const navbarToggler = document.querySelector(".navbar-toggler");
const navbarMenu = document.querySelector(".navbar ul");
const navbarLinks = document.querySelectorAll(".navbar a");

navbarToggler.addEventListener("click", navbarTogglerClick);

function navbarTogglerClick() {
  navbarToggler.classList.toggle("open-navbar-toggler");
  navbarMenu.classList.toggle("open");
}

navbarLinks.forEach(elem => elem.addEventListener("click", navbarLinkClick));

function navbarLinkClick() {
  if(navbarMenu.classList.contains("open")) {
    navbarToggler.click();
  }
}
* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
  }
  body {
    font-family: 'Righteous', cursive;
    background-color: #fff;
    color: #333;
  }
  .navbar {
    background-color: #000;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    width: 100%;
    height: 80px;
    line-height: 80px;
    font-size: 18px;
    padding: 0 30px;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
  }
  .navbar a {
    text-decoration: none;
    color: #fff;
  }
  .navbar a.navbar-brand {
    float: left;
    height: inherit;
    line-height: inherit;
    padding: 0 30px;
    font-size: 22px;
    text-transform: uppercase;
    font-weight: 400;
    letter-spacing: 2px;
  }
  .navbar a.navbar-brand span {
    font-size: 28px;
    font-weight: 700;
  }
  .navbar ul {
    float: center;
    list-style: none;
    height: inherit;
    line-height: inherit;
    padding: 0 50px;
    overflow: hidden;
  }
  /*Social Stuff*/
  .social{
    float: right;
    background-color: coral;
    font-size: 35px;
    display: inline-block;
  }

  /*Social Stuff*/
  .navbar ul li {
    display: inline-block;
  }
  .navbar ul li a {
    display: block;
    text-align: center;
    min-width: 120px;
    padding: 0 30px;
  }
  .navbar ul li a:hover {
    background-color: transparent;
    color:#00e713;
    transition:0.2s all;
    transform:scale(1.2) rotate(10deg);
  }
  .navbar .navbar-toggler {
    display: none;
  }
  .intro {
    width: 100%;
    height: 100vh;
    background: url("https://source.unsplash.com/GYQBryEWh0Y/") no-repeat center center;
    background-size: cover;
    background-color: #000;
  }
  .container {
    position: relative;
    height: 100vh;
    color: #fff;
  }
  .container h2 {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20vh;
  }
  #html { background-color: #e34f26; }
  #css { background-color: #002561; }
  #javascript { background-color: #333; }

  @media (max-width: 991px) {
    .navbar ul {
      padding: 0 10px;
    }
    .navbar ul li a {
      min-width: 100px;
      padding: 0 20px;
    }
  @media (max-width: 767px) {
    .navbar a.navbar-brand {
      transform: translateX(-50%);
      left: 50%;
      position: absolute;
    }
    .navbar {
      padding: 0;
    }
    .navbar ul {
      width: 100%;
      padding: 0;
      background-color: rgba(0,0,0,0.9);
      /*height: auto; */
      height: 100vh;
      max-height: 0;
      overflow: hidden;
      transition: all ease-in-out 0.3s;
    }
    .navbar ul.open {
      max-height: 100vh;
      /*this next line prevents the navbar overlap on mobile */
      padding-block-start: 9vh;
    }
    /*Social Stuff*/
    .social{
      width: 100%;
      float: left;
      text-align: center;
    }
    .social ul li{
      display: inline;
      float: left;
    }
    /*Social Stuff*/
    .navbar ul li {
      width: 100%;
      /*border-bottom: 1px solid rgba(255,255,255,0.3); */
    }
    .navbar ul li a {
      padding: 0px;
    }
    .navbar .navbar-toggler {
      display: block;
      position: absolute;
      height: 40px;
      top: 20px;
      left: 20px;
      background-color: transparent;
      color: #fff;
      /* border: 3px solid #fff;*/
      border: none;
      /* border-radius: 4px; */
      outline: none;
      padding: 0 5px;
      cursor: pointer;
    }
    .navbar .navbar-toggler span,
    .navbar .navbar-toggler span::before,
    .navbar .navbar-toggler span::after {
      display: block;
      content: '';
      background-color: #fff;
      height: 3px;
      width: 28px;
      border-radius: 4px;
      transition: all ease-in-out 0.3s;
    }
    .navbar .navbar-toggler span::before {
      transform: translateY(-8px);
    }
    .navbar .navbar-toggler span::after {
      transform: translateY(5px);
    }
    .navbar .navbar-toggler.open-navbar-toggler span {
      /* transform: rotate(90deg); */
      background-color: transparent;
      /* transform: scale(0.85) rotate(270deg); */
    }
    .navbar .navbar-toggler.open-navbar-toggler span::before {
      transform: translateY(0px) rotate(45deg);
      /* transform: translateY(0px) scale(0.75) rotate(45deg); */
    }
    .navbar .navbar-toggler.open-navbar-toggler span::after {
      transform: translateY(-3px) rotate(-45deg);
      /* transform: translateY(-3px) scale(0.75) rotate(-45deg); */
    }
  }
}
<!DOCTYPE html>

    <title>Responsive Navbar</title>
    <meta charset="UTF-8">
    <link href="https://fonts.googleapis.com/css?family=Knewave&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="assets/css/style.css">
    <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">

            <button class="navbar-toggler">

            </button>

            TemP

HTML

CSS

JavaScript

Python

A: First, you should decide your layout at what breakpoint you want to change the layout of navigation based on that we can write your styles within those media queries. Those things which you don't need on the mobile layout such as social links you can simply make display: none; to the social section but only in the mobile media query.

A: Actually your HTML structure is messy but anyhow, update this style in media query @media (max-width: 767px)
.social li {
    width: auto;
    margin-right: -18px;
    float: none
}


text:
Q: tabView: event.getTab() always null with Mojarra 2.3 - Alternatives? I've been stuck with this issues for past three years (since WildFly 16.x ~).
tabView: event.getTab() null in Mojarra 2.3 #3800
https://github.com/primefaces/primefaces/issues/3800
My own code:
<p:tabView switchType="ajax" id="tabViewHome" headerPosition="top" headerLocation="center" style="width:100%">
    <p:ajax process="@parent" event="tabChange" listener="#{tabsChangesController.onTabChange}" update=":formNOTiFY:msgs"/>
    <p:ajax process="@parent" event="tabClose" listener="#{tabsChangesController.onTabClose}" update=":formNOTiFY:msgs"/>

    <p:tab title="Motorcycles" id="motorcycles">
        <ui:include src="SelectMotorcycles.xhtml"/>
    </p:tab>

    <p:tab title="Display Selected Motorcycle" id="selectedMotorcycles" closable="true">
        <ui:include src="DisplaySelectedMotorcycle.xhtml"/>
    </p:tab>
</p:tabView>

Calls:
public void onTabChange(TabChangeEvent event) {
   LOGGER.info(">>>>> TabChangeEvent event = {}", event);
}

Results in 'null':
SEVERE [javax.enterprise.resource.webcontainer.jsf.context] (default task-1) javax.el.PropertyNotFoundException: /index.xhtml @38,136 listener="#{tabsChangesController.onTabChange}": Target Unreachable, identifier 'tabsChangesController' resolved to null

PrimeFace Showcase 10.0.0 & 11.0.0-RC1 'TabView' works on Mojarra 2.3 & MyFaces with Jetty:
mvn clean jetty:run -Pnon-ee,mojarra-2.3

https://github.com/primefaces/primefaces/tree/master/primefaces-showcase
Is Mojarra & WildFly likely to be fixed? Or how easy is it to switch to Jetty or similar on WildFly 25.0.0.Final?
I use:
PrimeFace (Elite) 10.0.7/11.0.0-RC1
Mojarra JSF 2.3.14.SP04 & OmniFaces 3.11.2
WildFly 25.0.0.Final (EE 8/9), Weld 4.0.2 (Final) & CDI 3.0
Java OpenJDK 17, Kotlin 1.5.31, Gradle 7.2, MongoDB 5.0.3
IntelliJ IDEA 2021.2.3, macOS Big Sur 11.6


text:
Q: Is it possible to have sidenav start open in W3.CSS? W3.CSS is a very new web technology and I cannot find any information about it other than w3schools.com. I was wondering if anyone here knows how to have their sidenav start out open?
Here is a working example that shows one in action:
https://jsfiddle.net/8orgp5xv/

@import 'http://www.w3schools.com/w3css/w3full.css';

  Close ×
  Link 1
  Link 2
  Link 3
  Link 4
  Link 5

    ☰

My Header

      A car is a wheeled, self-powered motor vehicle used for transportation.
      Most definitions of the term specify that cars are designed to run primarily on roads,
      to have seating for one to eight people,
      to typically have four wheels. (Wikipedia)

Footer

Footer information goes here

I just need to know how to make it start open when the page loads.
I tried messing with w3-sidenav and w3-closenav with no luck. Anyone know?

A: The relevant bit of code appears to be:
.w3-sidenav:target {
  width: 25%;
  display: block;
}
.w3-sidenav:target + .w3-content {
  margin-left: 25%;
}
.w3-sidenav:target + .w3-content .w3-opennav {
  display: none !important;
}
.w3-sidenav:target + .w3-content .w3-closenav {
  display: block !important;
}

This means that the navigation show/hide and the surrounding layout changes are driven by CSS :target and hash fragments. Which means unless you rewrite or duplicate these rules and use .w3-sidenav:not(:target) and change the a element triggering the sidenav, or something similar, it's going to be difficult to tell the layout to load with the sidenav open in pure CSS.
Needless to say, this is made trivial by either setting the appropriate hash on page load, or better yet, rewriting the entire component to use JavaScript instead of hash fragments and :target.

A: First, W3.CSS is not a "very new web technology". It's just a stylesheet.
If you want to know how to use it, see the documentation of the authors, or learn CSS to understand it directly.
In this case, the code that opens the sidenav is
.w3-sidenav:target {
    width: 25%;
    display: block;
}

The :target is a pseudo-class that matches the element whose ID (or name) equals the fragment identifier (the part of the URI after #).
Therefore, you should use some JS to set the fragment identifier to the id of the element when the page loads. This can be done using hash:
document.location.hash = 'id01';

document.location.hash = 'id01';
@import 'http://www.w3schools.com/w3css/w3full.css';

  Close ×
  Link 1
  Link 2
  Link 3
  Link 4
  Link 5

    ☰

My Header

      A car is a wheeled, self-powered motor vehicle used for transportation.
      Most definitions of the term specify that cars are designed to run primarily on roads,
      to have seating for one to eight people,
      to typically have four wheels. (Wikipedia)

Footer

Footer information goes here


text:
Q: Seeking web service that returns elevation profile between two points and can process 5000 requests per second I need a web service that provides elevation profile data between two coordinates with request rates at a minimum of 2000 requests per second but preferably at 5000 per second. The distance between the coordinates is on average 50 kilometers, and I need perhaps 10 or 20 elevation sample points between the two coordinates. What are the logistical and financial means to make this possible?

A: Let's start with some assumptions:

*

*You really need 5000 web requests per second, and

*It would be possible to service those requests in only 5 seconds, and

*The queries could be serviced by exactly one CPU core, and

*Each core only needs 4GB of RAM, and

*The optimal core to CPU chassis distribution is 32, and

*Each CPU chasis has enough SSD disk to service all the RAM, and

*Each network switch contains a backplane which will support 48 network drops, and

*A perfect hashing algorithm exists to match perfectly distributed spatial queries to cores that become available a microsecond before they're needed, and

*A networking protocol exists that would permit each core with unfettered network access in the exact duration necessary to transmit a 1k packet containing the responses

Then, we'll need 25,000 cores utilizing 100,000 Gb of RAM (and 100,000 Gb of disk), distributed across 781 blade chasis (128Gb RAM each), connected to 17 network switches.
If we further assume 6.5 weeks and $1000 is your budget, and that these servers and network switches are equivalently priced, then you'll need to spend no more than $1.25 per hardware device, and will be able to configure each with software (which will need to be written -- you can budget the remaining $2.50) in only 1092 hours (1 hour 23 minutes per device).
Computing devices exist today that could handle this load, but I think you under-bid by about $50M and 8 years.

A: I've recently setup an elevation lookup service using https://github.com/perliedman/elevation-service. My use case is significantly different than yours, a few requests for lots of points vs lots of requests for a few points: the incoming requests a GeoJSON LineString features with a few thousand points. I currently have it deployed on a single t2.micro ec2 instance that is able to handle approximately 3000 lookups per second, reading 1arc second DEMs off an GP-SSD EBS volume. This setup costs $60/month, and $50 of that is for the data storage.
I would guess that it would take 1 day to modify https://github.com/perliedman/elevation-service to handle the type of requests you describe. After that it's a DevOps problem.
Given that this is dramatically different use case than your's it's hard to say exactly how much compute resources it would take. I'm all in on AWS, so the rest of my answer is based on that.
I use the elevation service with all the DEMs pre-loaded, but in an environment with multiple servers i would probably write a loader that downloads DEMs as needed from an S3 bucket, and stores them on local storage. That should only take a few hours.
I would setup a a load balancer, and an autoscaling group to provision EC2 instances as needed. It would be best to use one of the instance types with an instance store large enough to hold all of the DEMs, 450GB if your using 1arc second, I would start with i2.xlarge, those cost $614/month, my guess is that 2 of those would be able to handle 5000/requests per second. The Load balancer is $18/month plus data transfer. So thats $1246 + data transfer.
Summary:

*

*1 weeks work to set it up

*$1246/month for servers + data transfer


text:
Q: How to find out in which div the last and current image has been placed ( draggable, jQuery UI ) I am trying to make my own version of Rapid Sorting from the BrainWars game with javascript/jQuery/jQuery UI (currently available on Android and iOS ).
The game:
images appear one after another.
for example: A square symbol shows up , you have to drag it to the left or right side. ( one div container left and one the right ).
Lets say you throw it in the left container.
if the next image that appears is also a square symbol you have to throw it in the same container as you threw the last same image in.
My problem(s):

*

*how to find out in which the last image was in, and how to check if the player has throwed the image in the same container as the last one ( IF last and current image matched ).

*If the above function case is true, player score should increase with 10 (integer) points.
See example of the game:
https://www.youtube.com/watch?v=V_LXGjIbuSY
So far I have this :  http://lastdimension.nl/rapidsorting/
( click rocket to start game )
( images of random animals will appear)
( you can drag them and throw them on the left - or the right side of screen, indicated with borders for test purposes )
I would love to know / see a fiddle for my case on how to accomplish the check for current and last image and to do a score increment if its correct.
my HTML:

<!DOCTYPE html>

  <meta charset="utf-8" />
  <title>Demo</title>

  <link href="http://code.jquery.com/ui/1.8.24/themes/blitzer/jquery-ui.css" rel="stylesheet" type="text/css" />

  <link rel="stylesheet" type="text/css" href="css/style.css">

  <audio id="bubblePlay" src="audio/bubble.mp3"></audio>
  <audio preload="auto">
    <source src="audio/bubble.mp3" type="audio/mpeg">
      Your browser does not support the audio tag.
  </audio>

  <audio id="correctPlay" src="audio/correct.mp3"></audio>
  <audio preload="auto">
    <source src="audio/correct.mp3" type="audio/mpeg">
      Your browser does not support the audio tag.
  </audio>

  <audio preload="auto" loop autplay>
    <source src="audio/background.mp3" type="audio/mpeg">
      Your browser does not support the audio tag.
  </audio>
  <audio loop id="backgroundPlay" src="audio/background.mp3"></audio>

  <input type="image" width="350px" id="start_button" src="gif/rocket/play2.gif" title="START">

My javascript:

/*
if (last image && current image are the same AND put in same container){
 score =0;
 score = score+10;
 document.getElementById('scoreboard').innerHTML = score;
}
*/

// drag function
$(function() {
  var score = "";
  $("#dvSource img").draggable({
    revert: "invalid",
    refreshPositions: false,
    drag: function(event, ui) {
      ui.helper.addClass("draggable");
    },
    stop: function(event, ui) {

      ui.helper.removeClass("draggable");
      var image = this.src.split("/")[this.src.split("/").length - 1];
      if ($.ui.ddmanager.drop(ui.helper.data("draggable"), event)) {
        //if dropped in container
        correctPlay()
      } else {
        // if not dropped in container
      }
    }
  });

  // container left
  $("#dvDest").droppable({
    drop: function(event, ui) {
      if ($("#dvDest img").length == 0) {
        $("#dvDest").html("");
      }
      ui.draggable.addClass("dropped");
      $("#dvDest").append(ui.draggable);
      $("img1").dropped
    }
  });

  // container right
  $("#dvDest2").droppable({
    drop: function(event, ui) {
      if ($("#dvDest2 img").length == 0) {
        $("#dvDest2").html("");
      }
      ui.draggable.addClass("dropped");
      $("#dvDest2").append(ui.draggable);
      console.log("dropped in right");
    }
  });
});

$(document).ready(function() {
  $("#dvSource, #dvDest, #dvDest2").hide();
  $("#bird").show();
  $('#bird').animate({
    right: '100%'
  }, 4500, 'swing');
  $('#start_button').hover(function() {
    $("#start_button").addClass('transition');

  }, function() {
    $("#start_button").removeClass('transition');
  });
});

$(document).ready(function() {
  $('#start_button').mouseover(function() {
    bubblePlay()
    $('#start_button').attr('src', 'gif/rocket/play2.gif');
  })
  $('#start_button').mouseout(function() {
    $('#start_button').attr('src', 'gif/rocket/play2.gif');
  });

  $('#start_button').click(function() {
    $('#start_scherm').fadeOut(1500);
    $("#dvSource, #dvDest, #dvDest2").show();

    setTimeout(function() {

      // show images one after another with timeout
      $(document).ready(function() {
        backgroundPlay()

        var one = setTimeout(function() {
          $('#img1').show(350).animate({
            top: '190%'
          }, 2500, 'linear'); //.hide(350);
        }, 1500)

        var two = setTimeout(function() {
          $('#img2').show(350).animate({
            top: '190%'
          }, 2500, 'linear'); //.hide(350);
        }, 4500)

        var three = setTimeout(function() {
          $('#img3').show(350).animate({
            top: '190%'
          }, 2500, 'linear'); //.hide(350);
        }, 7500)

        var four = setTimeout(function() {
          $('#img4').show(350).animate({
            top: '190%'
          }, 2500, 'linear'); //.hide(350);
        }, 10500)

      });

    }, 3000);
  })
});

A: The solution could be creating kind of a history stack for activities happening in your game. The array that will contain all the state changes one by one so that you can always check what action was back.
Say following way:
//declaring
var history = [];

//in each droppable containters
$("#dvDest2").droppable({
  drop: function(event, ui) {
  //other code
  console.log("dropped in right");
  history.push({'type': 'drop', 'destination': 'dvDest2', item: ui.draggable.prop('id')});
  }
});

so now after each drop you can see history growing by one, and can check what was 1 step back:
var previousStep = history[history.length-1];
//previousStep - should be then {'type': 'drop', 'destination': 'dvDest2', item: 'img1'}

then you can do comparing previous step with current
if(previousStep.destination == WHATEVER) { /*allow on not allow smth */}
//or
if(previousStep.item != WHATEVER) { /*allow on not allow smth */}


text:
Q: Insert trigger updating certain columns So, I have a table, described via the SQL given below
CREATE TABLE IF NOT EXISTS `employees` (
`e_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`e_username` varchar(100) NOT NULL,
`left_id` int(10) unsigned NOT NULL,
`right_id` int(10) unsigned NOT NULL,
`e_ssn` int(5) unsigned NOT NULL DEFAULT '0',
`e_first_name` varchar(100) NOT NULL,
`e_last_name` varchar(100) NOT NULL,
`e_address` text NOT NULL,
`e_location` int(10) unsigned DEFAULT NULL,
UNIQUE KEY `e_id` (`e_id`),
UNIQUE KEY `e_username` (`e_username`)
)

And it has the given data
INSERT INTO `employees` (`e_id`, `e_username`, `left_id`, `right_id`, `e_ssn`, `e_first_name`, `e_last_name`, `e_address`, `e_location`) VALUES
(1, '100884', 1, 8, 444444444, 'James', 'Burnbridge', '1123 fdkjfjdkfjdfkjd', 76),
(2, '100885', 2, 7, 0, 'Frank', 'Grimsley', '123 Fayke St', 76),
(5, '100886', 3, 4, 0, 'Mark', 'Hill', 'kfjdkfjdf\r\nkofjdkfjdkfdj', 76),
(6, '100887', 5, 6, 0, 'fdfdfd', 'fdfdfd', 'fdfdfdf', 76);

I want to create a trigger that makes it so that when I input a new row, like so
INSERT INTO employees(e_username,left_id,right_id,e_ssn, e_first_name, e_last_name, e_address, e_location)
VALUES('100888', 0, 0, 0, 'New','User', '100 NotReal st city, state zip', 76)

I want for the left_id and right_id columns to be updated based on the right_id of the first user in their location that has it's right_id differ from it's left_id by 1.
Here is what I have so far, but it gives me an error
DROP TRIGGER IF EXISTS  `after_insert_employees` ;

CREATE DEFINER =  `root`@`localhost` TRIGGER `after_insert_employees` AFTER INSERT ON  `employees`
FOR EACH
ROW BEGIN
DECLARE r_id INT;
SELECT max(right_id) INTO r_id FROM employees WHERE e_location=new.e_location AND right_id = left_id+1;
UPDATE employees SET left_id = r_id+1 AND right_id = r_id+2 WHERE e_id = new.e_id;
END

I get this error when I try to insert something
 #1442 - Can't update table 'employees' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.

I'm lost on this one. Any help?

A: Your trigger will trying to update same table that you are inserting. MySQL will lock table when insertion is happening.
This link may help you
MySql Error: Can't update table in stored function/trigger because it is already used by statement which invoked this stored function/trigger


text:
Q: Creating XSD schema for messages validation Problem I 'am developing an interface between my system and other system based on XML messages that will be sent over the internet (by web services).
I've created an XSD schema files to define the message structure.
I 'am using Microsoft Biztalk to create the sachems and new in this field.
I've build an validation process for the incoming and outgoing messages using the .Net built in functionality (link).
The problem is: sometimes the validation expect to a namespace before xml node name and sometimes no.
In addition - sometimes for the validation to be succeeded I have to add an attribute to nodes: xmlns="" and sometimes not.
Can you explain to me the rules about specifying the node father namespace or link to a material?
Thank you in advance.

A: It could be the XML Schema targetNamespace (ref http://dev.ektron.com/kb_article.aspx?id=426). If the targetNamespace is given, then you need the prefix. When defining a schema, references to defined types, elements and attributes within the schema need a prefix. Of course, references to Schema types need xs: or xsd: prefix, depending on which prefix you are using. I've seen both in common practice.


text:
Q: In anything Star Trek, what does it mean to be in or out of phase? In many Star Trek episodes term/concept in phase, out of phase, phase variance, etc. are used many times.
What does phase mean exactly?
Please give as detailed and technical an answer as you can come up with, including Chemistry, Physics, Biology, etc. If you have sources please cite them.
Please keep in mind the three episodes "TNG: The Next Phase", "TNG: Time's Arrow", "VOY:Deadlock", and the issues/answers that may arise from those episodes when answering the question.

A: Out of phase, from a physics perspective, means you have two waves that are not in sync:

In audio this causes a weird effect, because the sound coming out of the right speaker reaches you at a slightly different time than the sound coming out of the left speaker. Then when you consider the fact that sound is a wave, the pressure can interfere with each other causing all kinds of other phenomenon.
In Donald.McLean's answer, he quoted this:

Geordi: Well, whatever or whoever is there, we're out of phase with it. But we're only talking by a fraction of a second.
Warf: A fraction of a second would make them invisible?
Geordi: A millisecond, a year -- it wouldn't make any difference. If what we're reading is true, then we're occupying the same space but in a different time.

Applying this idea of being out of phase, it appears then that in Star Trek time is a waveform. And, in this particular case, the Enterprise and her crew were out of phase with these other folks. If you treat the Y-axis of the above graph as a coordinate in 3-d space, and the X-axis as time, if the blue line is the Enterprise and the red line is the other party you can see that aside from the two intersection points, they would always be occupying a different time when they are at the same space.
This actually reminds me of an interesting episode where the Enterprise and her crew were being sucked into this wormhole thing, and Deanna Troy was having problems.
As it turned out

 They were actually trapped by 2-dimensional beings that were trying to get "home". Turned out that all they had to do was either dive or raise and they were able to escape. They just happened to be on the same 2-d plane as the beings.

A: TL;DR - Out of phase is technobabble that allows something to be hidden from normal human senses as a plot device.
To the best of my knowledge, no such phenomenon exists in the real world, and so we can only understand it by examining what actually took place in the episode.
From "Time's Arrow Part 1", starting at approximately 14:23:

Data: Captain, the results of my temporal analysis may be pertinent.
Picard: Go ahead.
Data: Geordi, it indicates a synchronic distortion in the areas emanating triolic waves.
Geordi: Well, that explains a few things. How much, Data?
Data: A positive displacement of .004%.
Geordi: Well, whatever or whoever is there, we're out of phase with it. But we're only talking by a fraction of a second.
Worf: A fraction of a second would make them invisible?
Geordi: A millisecond, a year -- it wouldn't make any difference. If what we're reading is true, then we're occupying the same space but in a different time.

So, there is some group of beings and objects that are "out of phase", in that they are a fraction of a second in the landing party's future. As time passes for the landing party, it is also passing for that which is out of phase so that the landing party can never catch up. It's sort of like two cars that are on the same road, traveling the exact same speed and separated by a small distance. As long as the two cars continue to maintain the same speed, the following car will never catch up.


text:
Q: Lie algebra of normal subgroup is an ideal I want to prove that if $G$ is a connected Lie group, $H$ is a normal Lie subgroup of $G$, $\mathfrak{g}$ and $\mathfrak{h}$ their respective lie algebras, then $\mathfrak{h}$ is an ideal of $\mathfrak{g}$.
I try to proceed as follows:
Let $X\in\mathfrak{g}$, $Y\in\mathfrak{h}$, we want to compute $[X,Y]$ and show it is in $\mathfrak{h}$. Let $g:(-\varepsilon,\varepsilon)\rightarrow G$ and $h:(-\varepsilon,\varepsilon)\rightarrow H$ with $g(0) = h(0) = e$ be such that
$$\left.\frac{d}{dt}\right|_{t=0}g(t) = X$$
and
$$\left.\frac{d}{ds}\right|_{s=0}h(s) = Y$$
Then
$$[X,Y]=\left.\frac{d}{dt}\right|_{t=0}Ad_{g(t)}Y = \left.\frac{d}{dt}\right|_{t=0}\left.\frac{d}{ds}\right|_{s=0}g(t)h(s)g(t)^{-1}$$
Since $H$ is normal in $G$, we have that $g(t)h(s)g(t)^{-1}=\tilde{h}(s,t)\in H$ for all $t,s$. This means that differentiating $\tilde{h}$ once at the origin gives us an element of $\mathfrak{h}$, but here we have to differentiate it twice!
Am I doing something wrong or there is simply a detail I'm not getting?

A: Another quick way to see that this is true is to note that if $N \hookrightarrow G$ is a normal Lie subgroup, then it is the kernel of a Lie group homomorphism $f : G \to H$. Then all you need to do is check that $\frak{n}$ is the kernel of $f_* : \frak{g} \to \frak{h}$.

A: Hopefully everything is going well.
If $\mathfrak g$ is the Lie algebra of $G$ and $Ad:G\rightarrow GL(\mathfrak g)$ the adjoint representation then $ad:\mathfrak g\rightarrow End(\mathfrak g)$ is its derivative.
So, $[X,Y]=ad_XY=\underbrace{\left(\left.\dfrac{d}{dt}\right|_{t=0} Ad_{e^{tX}} \right)}_{\in End(\mathfrak h)} \quad \underbrace{Y}_{\in \mathfrak h} =\underbrace{\left(\left.\dfrac{d}{dt}\right|_{t=0} Ad_{e^{tX}} \right)}_{\in End(\mathfrak h)} \ \underbrace{(\left.\dfrac{d}{du}\right|_{u=0}e^{uY})}_{\in \mathfrak h} \in \mathfrak h$
The last equality appears to be the same as $\left.\dfrac{d}{dt} \dfrac{d}{du}\right|_{t=u=0}e^{tX}e^{uY}e^{-tX}$ in the special case of $G=GL_n$. Moreover, you can see that we are still working in $\mathfrak h$ and this is how it works for general Lie groups.
By the way, you are computing a Lie bracket of vector fields, and you know that the Lie bracket of two vector fields acting on functions as a derivation involves second derivatives that can cancel out. It is the same here.
For general Lie groups, we can do as follows:
Let $c_g:G\rightarrow G, x\mapsto gxg^{-1}$ be the conjugation map. Then $c_g(H)\subset H$ since $H$ is normal in $G$ and one can consider the restriction of $c_g$ on $H$ into $H$.
Thus $(d c_g)_1(\mathfrak h)=Ad_g(\mathfrak h)\subset \mathfrak h$ and $\forall X\in \mathfrak g, Y\in \mathfrak h$ : $$\forall t, \qquad Ad_{e^{tX}}(Y)\in \mathfrak h\Longrightarrow [X,Y] = ad_XY = \left. \dfrac{d}{dt}\right|_{t=0}Ad_{e^{tX}}(Y) \in \mathfrak h.$$


text:
Q: How to manipulate this result in Ansible I have a problem for manipulating data in Ansible.
My main goal is to purge ADRCI log.
In a first time, i'm listing the databases that are launched with users Oracle and Grid with the shell module
- name: Generate List of databases started with user oracle
  shell: "ps -ef | grep smon | grep -v grep | grep oracle | awk '{print $NF}' | awk -F '_' '{print $NF}'"
  register: list_oracle_bases

Then i want to get the homes to purge with an other shell command :
- name: Get databases homes
      register: get_homes
      environment:
        ORACLE_SID: "{{ item }}"
        ORAENV_ASK: "NO"
      become: true
      become_user: oracle
      become_method: su
      shell: ". oraenv 1>/dev/null 2>&- && adrci exec='show homes' | grep -v 'ADR Homes:'"
      with_items:
        - "{{ list_oracle_bases.stdout_lines }}"

And here comes my problem i've got this result for {{ get_homes }}
ok: [host1] => {
    "msg": {
        "changed": true,
        "msg": "All items completed",
        "results": [
            {
                "_ansible_ignore_errors": null,
                "_ansible_item_label": "ANSIBLE1",
                "_ansible_item_result": true,
                "_ansible_no_log": false,
                "_ansible_parsed": true,
                "changed": true,
                "cmd": ". oraenv 1>/dev/null 2>&- && adrci exec='show homes' | grep -v 'ADR Homes:'",
                "delta": "0:00:00.028970",
                "end": "2019-03-18 11:29:29.708709",
                "failed": false,
                "invocation": {
                    "module_args": {
                        "_raw_params": ". oraenv 1>/dev/null 2>&- && adrci exec='show homes' | grep -v 'ADR Homes:'",
                        "_uses_shell": true,
                        "argv": null,
                        "chdir": null,
                        "creates": null,
                        "executable": null,
                        "removes": null,
                        "stdin": null,
                        "warn": true
                    }
                },
                "item": "ANSIBLE1",
                "rc": 0,
                "start": "2019-03-18 11:29:29.679739",
                "stderr": "",
                "stderr_lines": [],
                "stdout": "diag/rdbms/ansible1/ANSIBLE1",
                "stdout_lines": [
                    "diag/rdbms/ansible1/ANSIBLE1"
                ]
            }
        ]
    }
}

I tried to get get_homes.results.stdout_lines but i've got the following error when i want to display it in a debug statement.
FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'list object' has no attribute 'stdout_lines'\n\nThe error appears to have been in '/tmp/sylvain/roles/test/tasks/query.yml': line 59, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - debug:\n      ^ here\n"}

What is the correct way to get that stdout_lines ("diag/rdbms/ansible1/ANSIBLE1")  in a variable.
Regards
Sylvain

A: results is an array, because you have created it in a loop (with_items). The correct syntax is:
get_homes.results[0].stdout_lines

for the first and so on for the rest.
In order to get the list of home directories you have to filter the results array by the attribute you need. And in the end you have to flatten the array of arrays. Here is a mcve:
---
- name: filter
  hosts: localhost
  connection: local
  tasks:

    - shell: |-
        echo ~{{ item }}
      with_items:
        - man
        - lp
        - mail
      register: get_homes
      ignore_errors: true
      changed_when: false

    - debug: var=get_homes

    - set_fact:
        homes: >-
          {{ get_homes.results | map(attribute='stdout_lines') | list | flatten }}

    - debug: var=homes


text:
Q: Java get specific value from list and add to other list i want to ask some question, how to get specific value from list and add to another list, lets say i have list (this is cust list from hibernate DAO) like:
[["marketplace","001-002-003"],["insurance","142-523-132"],["car purchase","982349824"]]

i just want to get a value of "marketplace","insurance", and "car purchase" from that list and add to new list called "bu"
here is my code
public @ResponseBody String findBU(@RequestBody AllCustomerHist customer){
        BigDecimal id= customer.getId();
        String message;
        List<String> bu= new ArrayList<>();
        int i;

        System.out.println("ID = "+id);
        List<AllCustomerHist> cust = allCustomerHistService.findBU(id);

        for (i=0; i<cust.size(); i++){
            System.out.println("iteration = "+i);

            // stumbled here //
        }

        JSONObject json = new JSONObject();
        json.put("id", id);
        json.put("BU", bu);

        message = json.toString();
        return message;

    }

this is my AllCustomerHistDaoImpl class
//release 1.3
@SuppressWarnings("unchecked")
public List<AllCustomerHist> findBU(BigDecimal adpId) {
    // TODO cek kodingan
    Criteria criteria = getSession().createCriteria(AllCustomerHist.class)
            .setProjection(Projections.projectionList()
                    .add(Projections.property("srctable"), "srctable")
                    .add(Projections.property("customerId"), "customerId"))
    .add(Restrictions.eq("adpId", adpId));

    return (List<AllCustomerHist>)criteria.list();
}

Notice that AllCustomerHist is an entity class to define the table in hibernate
thank you for your helps :D

A: Since you need to make some validation and you need to take off the whole AllCustomerHistobject what I would do is the following code
List<AllCustomerHist> cust = allCustomerHistService.findBU(id);
List<String> bu = new ArrayList<String>(cust.size());

        for (i=0; i<cust.size(); i++){
            System.out.println("iteration = "+i);
            AllCustomerHist aCust = cust.get(i);
            bu.add(aCust.getSrctable());

        }
//here your bu list should be ready to be used.....

I hope it's what you needed

A: If you use JDK1.8+, you can also do it like this:
List<AllCustomerHist> cust = allCustomerHistService.findBU(id);
List<String> bu = cust.stream()
    .map(AllCustomerHist::getSrctable)
    .collect(Collectors.toList());


text:
Q: How do I install media codecs? What is the easiest way to install all the media codec available for Ubuntu? I am having issues with multiple applications prompting me to install codecs before they can play my files.

A: If you are missing Codecs, you can try this command:
sudo apt-get update && sudo apt-get install ubuntu-restricted-extras

That should install the missing packages for multimedia.

A: MP3 is an audio format. Ubuntu can play both out of the box. Use Rhythmbox Music Player for audio and Ubuntu's default video player.
You can also use VLC which plays both.


text:
Q: Method must have a return type on an InitializeComponent() method I have the partial public class
namespace BugNetWPF
{
    public partial class ReportScreen_IdRangeReport : Page
    {
        public GenerateReport(MainWindow mainWindow)
        {

            InitializeComponent();

        }
    }
}

The error is saying that the method must have a return type, any ideas how to fix this?

A: What everyone else is saying about the return type is true, but I'm guessing this is what you actually want:
namespace BugNetWPF
{
    public partial class ReportScreen_IdRangeReport : Page
    {
        public ReportScreen_IdRangeReport(MainWindow mainWindow)
        {
            InitializeComponent();
        }
    }
}

The constructor needs to have the same name as the class.

A: Change:
        public GenerateReport(MainWindow mainWindow)
        {

            InitializeComponent();

        }

on:
    public void GenerateReport(MainWindow mainWindow)
    {

        InitializeComponent();

    }

If your GenerateReport method doesn't return anything the return type should be declared as void.

A: You have provided a constructor called GenerateReport to class ReportScreen_IdRangeReport, constructor must match class
namespace BugNetWPF
{
    public partial class ReportScreen_IdRangeReport : Page
    {
        public ReportScreen_IdRangeReport(MainWindow mainWindow)
        {

            InitializeComponent();

        }
    }
}

or
namespace BugNetWPF
{
    public partial class GenerateReport : Page
    {
        public GenerateReport (MainWindow mainWindow)
        {

            InitializeComponent();

        }
    }
}

A: The problem is that your GenerateReport method doesn't declare a return type. If it doesn't return anything the return type should be declared as void.
    public void GenerateReport(MainWindow mainWindow)
    {

        InitializeComponent();

    }

A: You normally call InitializeComponent in your constructor. Like
 public ReportScreen_IdRangeReport(MainWindow mainWindow)
 {
    InitializeComponent();
 }

Then Your method (if you really need this i doubt that)
public GenerateReport(MainWindow mainWindow)
        {

doesn't have a return type and it isn't allowed.
It should have a return type of void if you don't want to return anything.
public void GenerateReport(MainWindow mainWindow)
        {

A: See void in front of your method name:
namespace BugNetWPF
{
    public partial class ReportScreen_IdRangeReport : Page
    {
        public void GenerateReport(MainWindow mainWindow)
        {

            InitializeComponent();

        }
    }
}


text:
Q: injecting xhtml code from a string in the bean to the xhtml dynamically Hello there i want to ask about injecting xhtml code dynamically from a bean to xhtml page
this is the code i want to inject
code i want to inject
and i put it in a string in the bean like :
private String x="<th> \n <h:outputText value=\"#{msgs.label_insertInSalaryPayroll}\" /> \n </th> \n <td> \n <h:selectOneMenu value=\"#{financialElements.insertInSalaryPayroll}\" styleClass=selectMenu\"> \n <f:selectItem itemValue=\"\" itemLabel=\"#{msgs.label_all}\" /> \n <f:selectItem itemValue=\"true\" itemLabel=\"#{msgs.label_insertInSalaryPayroll}\" /> \n <f:selectItem itemValue=\"false\" itemLabel=\"#{msgs.label_notInsertInSalaryPayroll}\" /> \n </h:selectOneMenu> \n </td> \n <th> \n <h:outputText value=\"#{msgs.label_elementEffect}\" /> \n </th> \n <td> \n <h:selectOneMenu value=\"#{financialElements.elementEffect}\" styleClass=\"selectMenu\"> \n <f:selectItem itemValue=\"-1\" itemLabel=\"#{msgs.label_all}\" /> \n <f:selectItem itemValue=\"#{financialElements.credit}\" itemLabel=\"#{msgs.label_credit}\" /> \n <f:selectItem itemValue=\"#{financialElements.debit}\" itemLabel=\"#{msgs.label_debit}\" /> \n </h:selectOneMenu> \n </td>";

and i get it from the xhtml page like this :
<h:outputText value="#{financialElements.x}" escape="false" />

the result is as below image from the browser inspect view (only "th" and "td" tags are rendered but any h:.. tag is not executed and written in the page as is )
result from browser inspect
so i want to know is there any way to solve this issue or to inject jsf tags  from the bean dynamically to xhtml page .


text:
Q: creating Pointer to class inside its member function to achieve polymorphism Have a look at the below piece of code.
//Base Cls declaration:

class CmdParser_c
{
    public:

    CmdParser_c(){}
    virtual ~CmdParser_c(){}

    BOOLEAN ParseInputCmd(UINT8*);
    virtual BOOLEAN ProcessInputCmd(UINT8* );
    virtual BOOLEAN ProcessInputCmdArgs(UINT8* cmdList_ptr, UINT8 noOfArgs);
}

//One of its member function definition:

BOOLEAN CmdParser_c::ParseInputCmd(UINT8* cmdBuff_ptr)
{
    CmdParser_c *tstObj[MAX_PARSERS]; // <-- creating array of base cls ptr

    RTCcmdParser_c    rtcTstObj;
    UiParser_c        uiP;

    tstObj[0] = &rtcTstObj;          // <-- assigning child1 cls obj
    tstObj[1] = &uiP;                // <-- assigning child2 cls obj

    if (tstObj[0]->ProcessInputCmd(&inputCmd_ptr[0][0]))
    {
        // do something
    }
    else if (tstObj[1]->ProcessInputCmd(&inputCmd_ptr[0][0]))
    {
        // do something
    }
}

The code is working. No issues with that. My question is there any flaw in creating array of ptr to a class inside its own member function to achieve runtime polymorphism? Anything wrong with this logic?

A: I only see one problem: You added specific functionality (ParseInputCmd) to the base class which is not used in the derived classes.
Create a derived class CompositeParser_c : public CmdParser_c { ... }
and then call the other concrete parsers in the CompositeParser_c::ProcessInputCmd() method.


text:
Q: Example of unequal iterated integral but that does not contradict Fubini's Theorem Consider counting measure $\mu_1$ and $\mu_2$ on $X=Y=\mathbb{N}$
Define a function,
$$
f(x,y) = 2-2^{-x} \ \text{if} \ \  x=y \\
\text{and}\\ f(x,y) = -2 + 2^{-x} \ \text{if} \ \ x=y+1
$$
I showed that
$$
\int_X(\int_Y f(x,y)d\mu_2)d\mu_1 =1
$$
and
$$
\int_Y(\int_X f(x,y)d\mu_1)d\mu_2 =-\frac{1}{2}
$$
Therefore two iterated integral does not equal.
But I can to show that why Fubini's theorem does not contradict.
Thanks in advance

A: $\int |f(x,y)| d\mu_1(y) d\mu_2(x) \geq \int |2-2^{x}| d\mu_1(x)=\sum_x |2-2^{x}| =\infty$. Hence $f$ is not integrable on the product. Neither is it non-negative. So Fubini/Tonelli Theorem is not applicable.
[$ \sum |2-2^{x}| \geq \sum 2 -\sum 2^{-x} =
\infty$ since $\sum 2^{-x} <\infty$].


text:
Q: How to resolve error " Error in file : invalid 'description' argument? I have written a Shiny code that has a dashboard with the following elements
1) Side Bar Layout
2) On clicking Tab 'view', the main panel gets populated with tabset panel
3) On clicking 'table', two selectInput should be displayed where the sheet dropdown is dependent on Table dropdown. The Datasets are read from xlsx files
library(shinydashboard)
library(leaflet)
library(ggplot2)
library(DT)
library(openxlsx)

# -----------------------------------------------------------------------------
# Dashboard UI
# -----------------------------------------------------------------------------

dataset <- c("P1-Long-Term-Unemployment-Statistics","P1-OfficeSupplies")
ui <- dashboardPage(
  dashboardHeader(
    title = "Validation Tool"
  ),
  dashboardSidebar(
    sidebarMenu(
      menuItem("View Tables", tabName = "view", icon = icon("database")),
      menuItem("Append Data", tabName = "append", icon = icon("database")),
      menuItem("Update Table", tabName = "update", icon = icon("crosshairs")),
      menuItem("Construct Table", tabName = "construct", icon = icon("fire"))
    ),

    div(style = "padding-left: 15px;padding-right: 5px; padding-top: 40px;",
        p(class = "small", "Note : This validation tools automates the mainstream process involved in creating a Master data for detailed analysis ")
    )
  ),
  dashboardBody(
    tabItems(
      # Current location ------------------------------------------------------
      tabItem(tabName = "view",
              mainPanel(
                titlePanel(h2("Explore Datasets")),fluidRow(
                  column(8,
                         selectInput("table",
                                     "Table:",
                                     dataset)
                  ),
                  column(8,
                         uiOutput("sheets")
                  ),
                  DT::dataTableOutput("table")
                ),
        tabsetPanel(type="tab",
                    tabPanel("Data"

                             ),
                    tabPanel("Summary"),
                    tabPanel("Plot")
      )
    )
  )
)
)
)
# -----------------------------------------------------------------------------
# Dashboard server code
# -----------------------------------------------------------------------------
server <- function(input, output) {

    file <- reactive({paste0("D:/Dataset/",input$table,".xlsx")})
    sheetNames <- reactive({getSheetNames(file)})

    output$sheets <- renderUI({
    selectInput("sheet","Sheet:",choices = sheetNames)
    })

    output$table <- DT::renderDataTable(DT::datatable({
    data <- read.xlsx(file,sheet=as.numeric(input$sheet))
    data
     }))

}

shinyApp(ui, server)

But while implementing the above, I get the error (screenshot attached)
"Error : Invalid 'description' argument"
"Error : cannot coerce type 'closure' to vector of type 'list'
Please help resolving the issue

A: You have to call reactive values with parentheses (file reactive value declared in line 62). But there is a file() function in base R, so change this e.g. for my_file and call it with parentheses, e.g.:
my_file <- reactive({paste0("D:/Dataset/",input$table,".xlsx")})
sheetNames <- reactive({getSheetNames(my_file())})

A: The below code works fine
server <- function(input, output) {

  my_file <- function(){
  my_file <- paste0("D:/Dataset/",input$table,".xlsx")
  }

  sheetNames <- function(){
  sheetNames <- getSheetNames(my_file())
  }

    output$sheets <- renderUI({
    selectInput("sheet","Sheet:",choices = sheetNames())
    })

    output$table <- DT::renderDataTable(DT::datatable({
    data <- read.xlsx(my_file(),sheet=as.character(input$sheet))
    data
    }))

}


text:
Q: Standard form of 2nd order transfer function (Laplace transform)? Say I had a 2nd order system such as:
\begin{equation}
A \dfrac{d^2y(t)}{dt^2} + B \dfrac{dy(t)}{dt} + C y(t) = D \ x(t)
\end{equation}
Dividing both sides by A:
\begin{equation}
\dfrac{d^2y(t)}{dt^2} + 2 \zeta \omega_0 \dfrac{dy(t)}{dt} + \omega_0^2 \ y(t) = \dfrac{D}{A} \ x(t)
\end{equation}
Hence, the transfer function is:
\begin{equation}
H(s) = \dfrac{\dfrac{D}{A}}{s^2 + 2 \zeta \omega_0 s + \omega_0^2}
\end{equation}
But I read some texts and they all list the standard form of the transfer function for a second-order system as:
\begin{equation}
H(s) = \dfrac{\omega_0^2}{s^2 + 2 \zeta \omega_0 s + \omega_0^2}
\end{equation}
Why is this? Thank you.

A: The "standard" form you believe you have is in fact a low-pass 2nd order filter. Here's a picture that might explain things: -

The standard form listed above applies to all types of 2nd order filter i.e. low-pass, high-pass etc..
Note that the numerator changes dependant on what type of filter it is and in your question, the numerator is D/A.
D/A could be made to be whatever you want and this can turn the filter into a low-pass or a high-pass etc..
Information taken from here and my brain

A: The differential equation you provided corresponds to a second order low pass system.
The numerator in your expression can be written as,
$$\frac{D}{A} = \frac{D\times C}{A \times C} = \omega_0^2\times \frac{D}{C} = \omega_0^2 A_0$$
And you can write the transfer function as:
$$H(s) = \dfrac{A_0\omega_0^2}{s^2 + 2 \zeta \omega_0 s + \omega_0^2}\tag1$$
This expression, given in (1) is the standard form of transfer function of 2nd order low pass system. What is given in equation (2) is transfer function of 2nd order low pass system with unity gain at DC.
$$H(s) = \dfrac{\omega_0^2}{s^2 + 2 \zeta \omega_0 s + \omega_0^2}\tag2$$


text:
Q: Why $scope is not defined here in the following code I am working with Angular 1.x and here is the code which was giving errors:-
<!DOCTYPE html>

    <title>Angular JS Controllers</title>

Controllers

{{message}}

It was giving error ReferenceError: $scope is not defined
I thought may be $scope is not getting injected then I addded a dependency of $scope in the array to the 'app' module like this :-
angular.module('app', [$scope])

but to no avail. But what worked was the following code:-
 <!DOCTYPE html>

    <title>Angular JS Controllers</title>

Controllers

{{ctrl.message}}

I am referring the message model in HTML using ctrl.messaage, only then its appearing not otherwise.But why!!
Why can't I use $scope here, if I can how!!
/
Basically what is the difference between this and the earlier code?

A: Try something like this
angular.module('app', [])
     .controller('MainCtrl', ['$scope', function($scope){
       $scope.message = "Hello";
     }]);

A: it shoulde be like this.
angular.module('app', [])
     .controller('MainCtrl', ["$scope", function($scope){
       $scope.message = "Hello";
     }]);

and it's better use controllerAs syntax
angular.module('app', [])
     .controller('MainCtrl', ["$scope", function($scope){
      var vm = this;
       vm.message = "Hello";
     }]);

and in view use

A: When using an array as the second argument of the controller-method you have to use strings as values. This allows you to rename dependency modules.

A: You need to add quotes around $scope when you're injecting it into your controller. AngularJS will look at these string variables to determine what it needs to safely inject into your application.
angular.module('app', [])
    .controller('MainCtrl', ['$scope', function($scope){
        $scope.message = "Hello";
}]);


text:
Q: As my friend already introduced Is it correct to use the following sentence part

As my friend already introduced, ...

when I want to express something like

As my friend has already communicated to you, ...

with ... being some fact my friend has sent in an earlier email.

A: This would depend mainly on the context.
While not incorrect, consider the terms "mentioned," "explained,"
"already mentioned," or "already explained" in the place of "introduced."  If none of these options are preferred, "introduced" should be acceptable.


text:
Q: Looping through post count php echo "<form method='POST' action=''>";
$counter=0;
if( $row=mysql_fetch_array($result)){
mysql_data_seek($result,0);

while( $row=mysql_fetch_array($result))
{
$counter++;
echo "

    ".$row['name']."
     "?><input type="hidden" id="id" name="id[]" value=" <?php echo $row['id']?>"> <input id="txt_port" name="txt_port[]" type="text" class="required" title="Port. This is a required field" value=" <?php echo $row['Destination_port'] ?> ">
    <?php
    echo "<input name='update[]' class='button' type='submit' value='Update'></input>
";

    if(ISSET($_POST["update"]) and $_SERVER['REQUEST_METHOD'] == "POST"){
    $id=$_POST['id'];
    $port=$_POST['txt_port'];
    $menu=$_GET['Menu'];

    echo $id[$counter];
    echo $port[$counter];

    $result=mysql_query("UPDATE protocols SET Destination_port=".$port[$counter]." WHERE id=".$id[$counter].";");

   // header("Location: Overview.php?Menu=".$menu."&Overview=1");
    }
    }
echo "</form>";

I made a simple table which as got 3 columns, the first column is a name, second one has a textbox which contains a number (with a hidden id that I need) and last one is a button to update that specific row.
The big problem is when I echo $id[$counter] and echo $port[counter] this stupid counter never counts up. I always end up with the same data! In total it loops 4 times but it gives me the data of the first record.
Any ideas please help.

A: Can you please show your whole code? I see you have $result variable but I didnt see when you built the sql. In additional, it is highly recommend that you use mysqli or PDO as mysql_ are deprecating.