text:
Q: Monitor Tomcat Webapp I have a Tomcat webapp running on Amazon EC2. I am expecting heavy usage of the webapp in the future and is therefore trying to understand how to monitor webapp and ensure it is   working well.
The Amazon EC2 shows the following Cloudwatch Metrics for each EC2 instance

*

*Avg CPU Utilization

*Avg Disk Reads

*Sum Disk Read Ops (Count)

*Avg Disk Writes

*Sum Disk Writes Ops (Count)

*Max Network Ins

*Max Network Outs

*Sum Status (Any)

*Sum Status Instance
10.Sum Status System

I have also found a library Metrics, which can be used for monitoring JVM but I have not be able to understand the idea complete of what should I be monitoring and why?
My Question
What and why should be I monitoring to ensure my Tomcat Webapp works fine when sudden increase in user load on server?

A: I would recommend VisualVM.  It's a way of measuring the JVM that Tomcat runs on (you can analyse multiple Tomcat instances this way) using a web front end.  As well as the ability to see which classes are taking the most strain.
Of course as you've mentioned, you still get all the analysis provided by Amazon for your instances.
What you should be looking for is any classes which are taking a particularly large amount of usage and trying to optimize these processes.  VisualVM will give you statistics around this.

A: What you have described in your Cloudwatch Metrics is hardware monitoring.
Monitoring Tomcat is what we call software monitoring. This involves (but is not limited to):

*

*user session count

*thread count

*various memory statistics (heap used/max, permgen used/max, old gen, eden sizes etc.)

*garbage collection (promotions between zones, frequency, full stop-the-world events, etc.)

*uptime

*your app-specific monitors (e.g. if you require database access, ability to do simple selects like SELECT * FROM DUAL which have negligible cost)

Why all these things? Each of them helps to better understand your apps bottlenecks and possible outages or slow response periods. Each of these metrics can explain why your app has suddenly stopped responding or response times have ballooned.
I also suggest you to look at JMX which is the standard interface for monitoring. You probably want to expose all these monitors via JMX.

A: We use Nagios + JMXProxy to instrument the JVM itself as well as a wealth of information exposed by Tomcat.
You can read some recommendations of what things to monitor on Tomcat's Monitoring FAQ.
It's amazing what you can find if you read documentation and FAQs.


text:
Q: Equivalent Spring data mongo template query for this containing $each and $position I have this query and want to use Spring mongo template to fire this query. But Not sure how should I handle $each and $position of mongo with Spring Data.
db.data.update(
    //Query
    {"where":"condition"},
    //Update
    {
        //Set some values
        $set:{"aaa":402.7,"bbbb":6523297.00},
        //Push some value into an inside array at the first place
        $push: {
            YYYYYY: { $each: [{
                    "time" : 1234,
                    "data" : [
                        396,
                        403.35,
                        386.5,
                        401.15,
                        8370865,
                        3320159538.15
                    ]
                    } ],
            //
            $position: 0 }
        }
     },
     {
        //Update or insert
        upsert: true
     }
     )

Currently I have it like this which updates it in the last postiion
Update update = new Update();
              update.set("aaa", 402.7);
              update.set("bbbb", 6523297.00);
              update.push("YYYYYY", data.getYYYYYY().get(0));

              Query query = new Query(Criteria.where("where").is(condition));
              mongoOperations.findAndModify(query, update, FindAndModifyOptions.options().upsert(true),DailyData.class);

I understand there is an way to use push using push builder.
PushOperatorBuilder pushBuilder = update.push("YYYYYY");
              pushBuilder.each(data.getYYYYYY().get(0));
but it doesnt have a position property to mention

A: This is available since 1.7 of spring data from the source.

*

*Forces values to be added at the given {@literal position}.
     *
     * @param position needs to be greater than or equal to zero.
     * @return
     * @since 1.7
     */
    public PushOperatorBuilder atPosition(int position) {
    if (position < 0) {
        throw new IllegalArgumentException("Position must be greater than or equal to zero.");
    }

    this.modifiers.addModifier(new PositionModifier(position));

    return this;
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Form submit using jQuery I have written a function on submit of a form like this:
$("#form").submit(function(){
    // do something
});

And form is submitted like this:
document.formName.submit();

It doesn't trigger my function. If I wrap form in jQuery and then submit it, it works fine:
$(document.formName).submit();

I was thinking binding events to jQuery DOM object will trigger the events on raw DOM object as well, but it doesn't happen in this case.
Example:
http://jsfiddle.net/aZasZ/1/

A: document.formName.submit();

does not trigger the event as it is the actual DOM Element and does not fire off any events,
while
$(document.formName).submit();

is a trigger function for firing of events within JQuery.
i would suggest you use the
$('form').submit();

to submit the form or
$('form').triggerHandler('submit')

in the case of you wanting to fire only that function handler.

A: Have you tried
$("form#myForm").submit();

and this is the whole code:
    <form id="MyForm" method="POST" action="">
        Field1:<input type="text" id="field1" value="" />
        Field2:<input type="text" id="field2" value="" />
        <input type="submit" value="send" />
    </form>

    <button id="ShowLink">Vai</button>
    <script type="text/javascript">
        $(document).ready(function () {
            $("form#MyForm").submit( function () {
              alert("Hello!");
              return(true);
            } );
        })
    </script>

UPDATE:
To achieve what you're trying to do you can overwrite the submit function. See this fiddle.
Credits to this answer.

A: You probably just have gotten your IDs wrong.
Here's a fiddle demonstrating the behavior, feel free to use that.
http://jsfiddle.net/aZasZ/
(I just added $("#form").submit() )


text:
Q: How do I simplify and calculate this inequality? $\log(x^3) > |x-1|$
I can't figure out how to go about solving this inequality, besides this one step:
$3\log(x) > |x-1|$

A: As said in the comments, you have two situations buit you can notice that for $x=1$, the lhs and rhs are equal.
So consider the case where $x=1-\epsilon$ and use Taylor expansion for the lhs at $x=1$. Yous will easily see that the inequality is not satisfied. Since you noticed that for $x=1$, $lhs=rhs$, the inequality will be satisfied for $x>1$. So, you can now forget the absolute value in the rhs.
Now, compute the derivative of $lhs-rhs$; it is equal to $3/x-1$ and so canceled for $x=3$; the second derivative being negative, then this point corresponds to a maximum. For $x=3$, $lhs=3 log(3)$ and $rhs=2$; so, at this point, $lhs > rhs$. On the other side, you know that $x$ moves faster then $log(x)$; so there is a point which will corresponds to an $x$ intercept. You will then need to solve the equation $$\log(x^3) = x-1$$ which does not any simple analytical solution. If you plot the function, you will see that the solution is close to $x=6.71$.
So, the inequality is satisfied for $1 < x < 6.71$


text: Q: php, как установить и запустить на Ubuntu 16.04? Не могу установить и настроить сервер для php, до этого учил django. Там все просто установил Python , запустил venvironment и работаешь спокойно. Может кто подскажет как ПОЭТАПНО установить и настроить Apache , php И все что нужно будет??


text:
Q: How do you prevent CodeRunner from prefixing its console output with [00m[00m[00m[00m[00m? There seems to be a connection between CodeRunner's console output and your actual terminal prompt script, that is, if such prompt code is sourced from e.g. ~/.bash_profile (which CodeRunner reads by default).
I have a pretty fancy (read: great) terminal prompt (screenshot|code) that seems to mess up CodeRunner's console output, leading to garbled [00m[00m[00m[00m[00m characters at the start everytime I run some code, even though it's error-free and regardless of language). I'm reluctant to change my prompt for the sake of getting rid of these annoying characters.
If I turn off Invoke bash in login mode when running code in CodeRunner's Advanced prefs, I'm seeing bash: source: No such file or directory instead…
So I'm stuck between a rock and a hard place, trying to get a clean console in CodeRunner…
How can this be fixed? (I've tried contacting the developer about this but I'm receiving no answer.)

A: The culprit probably is line 88 in your prompt.sh:
trap 'echo -ne "\033[00m"' DEBUG

This will output an ANSI escape code to reset the colors and style before the output of every command.
From examining your bash script, this line seems to be unnecessary, because you are resetting the formatting at the end of your prompt here on line 76:
PS1="$status_style"'$fill \t\n'"$BY\$(__name_and_server)$Y\w$G\$(__git_prompt)$RESET$ "

I suggest you just remove line 88 and try it like that.
Somewhat unrelated to this problem, but I also suggest editing line 73 to the following:
local RESET="\[\033[0m\]"

This way you are truly resetting the ANSI styling, whereas before you were setting it to white.


text:
Q: Can't get the propper Xpath to pass to Selenium with python I'm stuck with a selenium scrape using jupyter. I'm trying to get the "download page data" from the bottom right corner of this page: https://polkadot.subscan.io/account?role=all&page=1
enter image description here
Also, here's the html code:
Download page data
I've tried copying the xpath and full xpath from the Google Chrome "inspect" tab, but it doesn't work.
Here's the code I used, but feel free to suggest anything else.
#Initiating Webdriver
s=Service('CHROMEDRIVER LOCATION')
op = webdriver.ChromeOptions()
driver = webdriver.Chrome(service=s, options=op)

link = "https://polkadot.subscan.io/account?role=all&page=1"

driver.get(link)

Ingresar = driver.find_element(By.XPATH,"//*[@id='app']/main/div/div/div[5]/div/div[3]/div[1]/div/div")

Here's the error I get:
ElementClickInterceptedException: Message: element click intercepted: Element
...
 is not clickable at point (125, 721). Other element would receive the click:
...

Either fixing my code, or getting a new one that works with jupyer and selenium

A: Try this code:
url = "https://polkadot.subscan.io/account?role=all&page=1"
driver.get(url)

driver.find_element(By.XPATH, ".//*[text()='I accept']").click()
time.sleep(5)
download_btn = driver.find_element(By.XPATH, ".//*[text()='Download page data']")
driver.execute_script("arguments[0].scrollIntoView(true);", download_btn)
download_btn.click()


text:
Q: Mapping CName to Windows Azure I am running a site on Windows Azure:
mysite.azurewebsites.net
where my site is the name I was given. I mapped a cname to my site.azurewebsites.net. When I enter my CNAME in the browser, I get a 404. Are there any additional steps to map a CNAME to my site?
I know for an IIS site, I need to set-up a host name. Do I need to do this? I see no CNAME textbox in the preview portal.
Here is an image of my Websites > Configuration area:

A: "I see no CNAME textbox in the preview portal." Look harder? It's there somewhere, and you do need to tell Windows Azure about the host name(s) you're doing to use.
(Sorry, I can't log in right now and look for exactly where it is.)


text:
Q: Does the document directory is removed automatically in iOS apps? I've a simple question to the document directory. I build the folder by the following Swift statement:
open static let DOC_FOLDER : String = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false).path

I store some files and create subfolders there.
And now I'm not sure whether the whole folder structure is deleted automatically if I uninstall the app or does the directory still exists and is only not accessible?

A: When the user uninstalls the app, the entire sandbox is wiped clean. If the user installs the app again, your app will need to recreate the folder structure again.

A: Put user data in Documents/. User data generally includes any files you might want to expose to the user—anything you might want the user to create, import, delete or edit. For a drawing app, user data includes any graphic files the user might create. For a text editor, it includes the text files. Video and audio apps may even include files that the user has downloaded to watch or listen to later.
=> If you uninstall the app, the folder will be removed
Reference: https://developer.apple.com/library/content/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html
https://developer.apple.com/library/content/technotes/tn2406/_index.html


text:
Q: Leakage current to heat sink I am working to lower the leakage current in an isolated power supply.
The power supply uses an isolation transformer to step down from 120V/240V to 6.5V.  The voltage is then rectified and run through five TO-220 LM2941 regulators to generate individual supplies for the different parts of the final circuit.  The LM2941's are attached to an aluminum heatsink with Thermafilm insulators in between the regulator and heatsink and thermal compound on top and bottom of the mica.  The screws used to attach the LM2941's have shoulder washers.  The heat sink is attached to the enclosure of the power supply which is connected to earth ground.
If I lift all of the regulators off of the heat sink, I see a drop in the leakage current of about 10uA, indicating that the contribution of the regulator-heat sink interface to overall leakage current of the power supply is 10uA.  I would like to reduce or eliminate the 10uA of current if possible.  Is this amount of leakage current normal for this configuration, or should I be able to reduce it by using a different insulator or mounting configuration?
Background:
I am measuring the leakage using a Dale 601 Electrical Safety Analyzer.  The specific test is the mains on applied part test where mains voltage (120/240V) is applied to the isolated side of the power supply and the leakage current to the protective earth ground conductor is measured.

A: 240V AC at 50 Hz and 10 uA means an impedance of 24 Mohms. But almost certainly this is due to capacitance so, at 50 Hz this is a capacitance of 133 pF and probably not anything to do with real resistive leakage.
So, estimate how much capacitance 5x T0220 bodies have when bolted down to a large large heatsink via insulators.
Is this a problem? No.


text:
Q: Websockets with Snap won't bind in production please help me with something:
I want to implement websockets-snap in production but they seem that won't take the address. I have the following code:
the js inside index.html file
function createChatSocket() {
    if(window.location.host == '') {
        /* Running on localhost */
        return new WebSocket('ws://35.197.208.147/ws/console/');
    } else {
        /* Running in "production" */
        return new WebSocket('wss://jaspervdj.be/websockets/example/chat/');
    }
}

the window.location.host is not empty, it is the ip
the server.hs file
app :: Snap ()
app = Snap.route
    [ ("",               Snap.ifTop $ Snap.serveFile "./shorts/index.html")
    , ("console", console)
    ]
....
....
....
--------------------------------------------------------------------------------
console :: Snap ()
console = do
    state <- liftIO $ newMVar newServerState
    WS.runWebSocketsSnap $ application state

No matter what i do, it will always return the websockets found on wss://jaspervdj.be/websockets/example/chat/ and not my server. What can i do?
Thanks

A: That's a JavaScript issue, not a Haskell one. The window.location.host will never be empty. Therefore, you always end up with the websocket to jaspervdj.be.


text:
Q: Activating menu in Xfce panel via command-line What is the command for activating the app menu in the Xfce panel? It would be the equivalent of pressing Ctrl+Esc on Windows. I know that there is a command for LXPanel, is there a way to do the same in Xfce panel?

A: Run the following command in a terminal:
xfce4-popup-applicationsmenu


text:
Q: JavaFX Transition animation memory overflow I have a problem with creating JavaFX applications.
My computer was installed Fedora 21 64bit 8G RAM .
When you create JavaFX TranslateTransition to move labels from one to the other side comes up loads of RAM to 100 % and CPU up to 60 %
When checking jconsole heap memory does not exceed 80MB .
Here's the code
...
translateTransition = new TranslateTransition();
translateTransition.setNode(label);
translateTransition.setFromX(position);
translateTransition.setToX(-position);
translateTransition.setDuration(Duration.seconds(120));
translateTransition.setCycleCount(Timeline.INDEFINITE);
translateTransition.play();

...


text:
Q: Algorithm to minimize number of reads in 2D array Given a 2D array of size x*y with numbers from 1 to x*y or null with the following condition -
m[x,y] == null ||
m[x,y] > m[x',y'] where (x > x' && y = y') || (y > y')
For example:
2X2 array:
4 0
0 0

2X2 array:
3 0
0 4

Write an algorithm to output the list of numbers that are missing between 1 and x*y with minimum number of reads.

A: allocate an array of booleans inited to false of size (x*y)
go over all of the cells in the matrix and set array(M(x,y)) to true
go over the array and print all indexes where array(i)=false
if you are looking for a trick the sum of the missing numbers (sum of 1to(x*y) -sum of matrix) and amount of the missing numbers might be enough to determine what they are

A: Here you have a solution in C# but can be translated to Java very easy. The main idea is that under the definition of the problem the minimum value in a row is the maximum value that you can expect to find in a previous row. (The same idea is that the maximum value that you found in a row is the minimum value that you can expect in a following row). If you found the maximum value (or minimum) expected for a row you don't have to continue accessing to the matrix because don't have any sense and then you save a lot of steps becoming optimum solution.
static List<int> Missing(int[,] matrix, int x, int y)
{
    bool[] numbers = new bool[x * y + 1]; //All values found in the matrix
    int max = x * y; //Max possible value in a row
    int min = max; //Min possible value in a row
    int row = y - 1; //Starting from the last row in the matrix until the first one
    while ((row >= 0) && (min > 1)) //Stop accessing in case that the global possible minimum (value 1) is found in a row greater than first one
    {
        int col = -1;
        do
        {
            col++;
            if (matrix[row, col] > 0) //Assuming that value 0 means null
            {
                numbers[matrix[row, col]] = true; //Mark as found the value in the cell
                min = Math.Min(min, matrix[row, col]); //Update the minimun value of the row (first non zero value in the row)
            }
        }
        while ((col < x - 1) && (matrix[row, col] < max) && (min > 1)); //Inside the matrix range? Stop condition to do not access more elements in that row
        max = min - 1; //Update the possible maximum value for the following row (row - 1)
        row--;
    }
    var result = new List<int>();
    for (var index = 1; index <= x * y; index++)
        if (!numbers[index]) //Return only those values that were NOT found in the matrix
            result.Add(index);
    return result;
}

Example of usage:
int[,] matrix =
{
    { 0,  2,  0, 11, 0 },
    { 0,  0,  0,  0, 0 },
    { 0, 12,  0, 15, 0 },
    { 0, 16,  0,  0, 0 },
    { 0,  0, 21, 25, 0 }
};
List<int> numbers = Missing(matrix, matrix.GetLength(0), matrix.GetLength(1));
for (int index = 0; index < numbers.Count - 1; index++)
    Console.Write(numbers[index].ToString() + " ");
Console.WriteLine(numbers.Count > 0 ? numbers[numbers.Count - 1].ToString() : string.Empty);

Hopefully it'll solve your problem.


text:
Q: Options for Database Managers for SQL Server and MDS I am looking at ways to visualize my database for non-technical end users. I want them to only have access to views (triggers can be put on views to enable updating) and let them add, delete and modify data. It should be a simple software (hopefully look and feel wise it will be a lot like Excel).
If anyone has used the Excel with MDS tool I do like that but its largest drawback is it cannot be used to edit views but only the normalized tables. This means a ot of tabs the users will have to go through.
The users wont have admin level access. All of our databases use SQL Server or MDS. Anyone have any thoughts?


text:
Q: C# Store functions in a Dictionary How do I create a Dictionary where I can store functions?
Thanks.
I have about 30+ functions which can be executed from the user. I want to be able to execute the function this way:
   private void functionName(arg1, arg2, arg3)
   {
       // code
   }

   dictionaryName.add("doSomething", functionName);

    private void interceptCommand(string command)
    {
        foreach ( var cmd in dictionaryName )
        {
            if ( cmd.Key.Equals(command) )
            {
                cmd.Value.Invoke();
            }
        }
    }

However, the function signature is not always the same, thus having different amount of arguments.

A: Define the dictionary and add the function reference as the value, using System.Action as the type:
using System.Collections;
using System.Collections.Generic;

public class Actions {

    public Dictionary<string, System.Action> myActions = new Dictionary<string, System.Action>();

    public Actions() {
        myActions ["myKey"] = TheFunction;
    }

    public void TheFunction() {
        // your logic here
    }
}

Then invoke it with:
Actions.myActions["myKey"]();

A: Hey, I hope this helps.  What language are you coming from?
internal class ForExample
{
    void DoItLikeThis()
    {
        var provider = new StringMethodProvider();
        provider.Register("doSomethingAndGetGuid", args => DoSomeActionWithStringToGetGuid((string)args[0]));
        provider.Register("thenUseItForSomething", args => DoSomeActionWithAGuid((Guid)args[0],(bool)args[1]));

        Guid guid = provider.Intercept<Guid>("doSomethingAndGetGuid", "I don't matter except if I am null");
        bool isEmpty = guid == default(Guid);
        provider.Intercept("thenUseItForSomething", guid, isEmpty);
    }

    private void DoSomeActionWithAGuid(Guid id, bool isEmpty)
    {
        // code
    }

    private Guid DoSomeActionWithStringToGetGuid(string arg1)
    {
        if(arg1 == null)
        {
            return default(Guid);
        }
        return Guid.NewGuid();
    }

}
public class StringMethodProvider
{
    private readonly Dictionary<string, Func<object[], object>> _dictionary = new Dictionary<string, Func<object[], object>>();
    public void Register<T>(string command, Func<object[],T> function)
    {
        _dictionary.Add(command, args => function(args));
    }
    public void Register(string command, Action<object[]> function)
    {
        _dictionary.Add(command, args =>
                                     {
                                         function.Invoke(args);
                                         return null;
                                     } );
    }
    public T Intercept<T>(string command, params object[] args)
    {
        return (T)_dictionary[command].Invoke(args);
    }
    public void Intercept(string command, params object[] args)
    {
        _dictionary[command].Invoke(args);
    }
}

A: The following scenario would allow you to use a dictionary of elements to send in as input parameters and get the same as the output parameters.
First add the following line at the top:
using TFunc = System.Func<System.Collections.Generic.IDictionary<string, object>, System.Collections.Generic.IDictionary<string, object>>;

Then inside your class, define the dictionary as follows:
     private Dictionary<String, TFunc> actions = new Dictionary<String, TFunc>(){

                        {"getmultipledata", (input) =>
                            {
                                //DO WORKING HERE
                                return null;
                            }
                         },
                         {"runproc", (input) =>
                            {
                                //DO WORKING HERE
                                return null;
                            }
                         }
 };

This would allow you to run these anonymous functions with a syntax similar to this:
var output = actions["runproc"](inputparam);

A: Like this:
Dictionary<int, Func<string, bool>>

This allows you to store functions that take a string parameter and return boolean.
dico[5] = foo => foo == "Bar";

Or if the function is not anonymous:
dico[5] = Foo;

where Foo is defined like this:
public bool Foo(string bar)
{
    ...
}

UPDATE:
After seeing your update it seems that you don't know in advance the signature of the function you would like to invoke. In .NET in order to invoke a function you need to pass all the arguments and if you don't know what the arguments are going to be the only way to achieve this is through reflection.
And here's another alternative:
class Program
{
    static void Main()
    {
        // store
        var dico = new Dictionary<int, Delegate>();
        dico[1] = new Func<int, int, int>(Func1);
        dico[2] = new Func<int, int, int, int>(Func2);

        // and later invoke
        var res = dico[1].DynamicInvoke(1, 2);
        Console.WriteLine(res);
        var res2 = dico[2].DynamicInvoke(1, 2, 3);
        Console.WriteLine(res2);
    }

    public static int Func1(int arg1, int arg2)
    {
        return arg1 + arg2;
    }

    public static int Func2(int arg1, int arg2, int arg3)
    {
        return arg1 + arg2 + arg3;
    }
}

With this approach you still need to know the number and type of parameters that need to be passed to each function at the corresponding index of the dictionary or you will get runtime error. And if your functions doesn't have return values use System.Action<> instead of System.Func<>.

A:
However, the function signature is not
  always the same, thus having different
  amount of arguments.

Let's start with a few functions defined like this:
private object Function1() { return null; }
private object Function2(object arg1) { return null; }
private object Function3(object arg1, object arg3) { return null; }

You really have 2 viable options at your disposal:
1) Maintain type-safety by having clients call your function directly.
This is probably the best solution, unless you have very good reasons for breaking from this model.
When you talk about wanting to intercept function calls, it sounds to me like you're trying to re-invent virtual functions. There's a boat load of ways to get this sort of functionality out of the box, such as inheriting from a base class an overriding its functions.
It sounds to me like you want a class that's more of a wrapper than a derived instance of a base class, so do something like this:
public interface IMyObject
{
    object Function1();
    object Function2(object arg1);
    object Function3(object arg1, object arg2);
}

class MyObject : IMyObject
{
    public object Function1() { return null; }
    public object Function2(object arg1) { return null; }
    public object Function3(object arg1, object arg2) { return null; }
}

class MyObjectInterceptor : IMyObject
{
    readonly IMyObject MyObject;

    public MyObjectInterceptor()
        : this(new MyObject())
    {
    }

    public MyObjectInterceptor(IMyObject myObject)
    {
        MyObject = myObject;
    }

    public object Function1()
    {
        Console.WriteLine("Intercepted Function1");
        return MyObject.Function1();
    }
    public object Function2(object arg1)
    {
        Console.WriteLine("Intercepted Function2");
        return MyObject.Function2(arg1);
    }

    public object Function3(object arg1, object arg2)
    {
        Console.WriteLine("Intercepted Function3");
        return MyObject.Function3(arg1, arg2);
    }
}

2) OR map the input of your functions to a common interface.
This might work if all of your functions are related. For example, if you're writing a game, and all the functions do something to some part of the player or player's inventory. You'd end up with something like this:
class Interceptor
{
    private object function1() { return null; }
    private object function2(object arg1) { return null; }
    private object function3(object arg1, object arg3) { return null; }

    Dictionary<string, Func<State, object>> functions;

    public Interceptor()
    {
        functions = new Dictionary<string, Func<State, object>>();
        functions.Add("function1", state => function1());
        functions.Add("function2", state => function2(state.arg1, state.arg2));
        functions.Add("function3", state => function3(state.arg1, state.are2, state.arg3));
    }

    public object Invoke(string key, object state)
    {
        Func<object, object> func = functions[key];
        return func(state);
    }
}

A: Why not use params object[] list for method parameters and do some validation inside either your methods (or calling logic), It will allow for a variable number of parameters.


text:
Q: Compile Error: Illegal assignment from List to List I am trying to find how to go about resolving this error.
Error: Compile Error: Illegal assignment from List to List at line 4 column 21
trigger productupdate on Opportunity (after insert,after update)
     {
      List<Opportunity> opp=[select id,Production_date__c,(select id,ServiceDate from OpportunityLineItems)from Opportunity];
                for(Opportunity op:opp)
                {
                    date olddate=oldMap.get(op.id).Production_date__c;
                    date newdate=newMap.get(op.Production_date__c);
                    integer diffdays=olddate.daysbetween(newdate);
                    for(OpportunityLineItem opl:op.OpportunityLineItem)
                    {
                        opl.ServiceDate =(op.diffdays+opl.ServiceDate);
                    }
                 }
                 update opp;
                 }

A: Looks like you might have a class in the system with the name opportunity.
Either rename that class to something or instead of Opportunity use System.Opportunity


text:
Q: Prove that there is no perfect square that is congruent to 2 mod 10 and 3 mod 10. Prove that there is no perfect square that is congruent to 2 mod 10 and 3 mod 10. Can someone tell me how to solve this question. I really can't figure out.

A: For any integer $a,a^2\equiv2,3\pmod{10}\implies a^2\equiv2,3\pmod5$
$a\equiv0,\pm1,\pm2\pmod5\implies a^2\equiv0,1,4$
But $2,3\not\equiv0,1,4\pmod5$

A: Hint $\ {\rm mod}\ 5\!:\,\  x^2\equiv \pm2\, \overset{\rm square}\Rightarrow\,x^4\equiv -1,\,$ contra little Fermat.

A: See.. basically, the perfect square can possibly have last digits 0,1,4,6,5,9 only as its last digit cannot yield in the  units place the digits 3,7 or 2,8 therefore it is never congruent to 2mod10 or 3mod10.

A: If you don't understand the other answers, remember this: if $x$ and $y$ are integers,
$$(10x + y)^2 = 100x^2 + 20xy + y^2 \equiv y^2 \pmod{10}.$$
So if you just look at remainder when any number is divided by $10$, and square it,
you can easily see what the remainder will be when the square of the original number
is divided by $10$.
Since there are only ten possible values of the remainder after division by $10$,
you can check each one to see whether its square is congruent to $2 \pmod{10}$,
and whether it is congruent to $3 \pmod{10}$.


text:
Q: Calling library method inside .a file I'm on Android Studio 2.1.3.
I've static library binary in .a file:
libconfig.a
I've the method signature that I need to invoke on the library:
CLIENT_ConfigIPCWifi(szDeviceSN,  szSSID,  szSSIDPassword,  nWaitTime);
Question: How am I going to call the method?

A: You need an Android.mk file in your app/src/main/jni folder. It should look like this
LOCAL_PATH := $(call my-dir)

# This block is to make the NDK aware of your static library
include $(CLEAR_VARS)
LOCAL_MODULE := libconfig
LOCAL_SRC_FILES := path/to/libconfig/libconfig.a
include $(PREBUILT_STATIC_LIBRARY)

# This block is to build your C++ code that will call the method in the static library
include $(CLEAR_VARS)
LOCAL_MODULE := ThatWillCallTheMethod
LOCAL_SRC_FILES := cppFileThatWillCallTheMethod.cpp
LOCAL_STATIC_LIBRARIES := libconfig.a
include $(BUILD_SHARED_LIBRARY)

In your jni folder, you will have: cppFileThatWillCallTheMethod.cpp. And in that file you will call CLIENT_ConfigIPCWifi(szDeviceSN, szSSID, szSSIDPassword, nWaitTime); Somehow you will have to know which header files from libconfig.a that you need to include.
Hope this helps!


text:
Q: How to add appendTo option to jQuery-UI autocomplete widget I'm working on an old project that uses the following code as a base for an autocomplete text field: https://jqueryui.com/autocomplete/#categories
 $( function() {
    $.widget( "custom.catcomplete", $.ui.autocomplete, {
      _create: function() {
        this._super();
        this.widget().menu( "option", "items", "> :not(.ui-autocomplete-category)" );
      },
      _renderMenu: function( ul, items ) {

I would like to add the "appendTo" option to this widget but can't work out the correct syntax from the API documentation:

Initialize the autocomplete with the appendTo option specified:
$( ".selector" ).autocomplete({
  appendTo: "#someElem"
});

Get or set the appendTo option, after initialization:
// Getter
var appendTo = $( ".selector" ).autocomplete( "option", "appendTo" );

// Setter
$( ".selector" ).autocomplete( "option", "appendTo", "#someElem" );

How do I add this option to a jQuery UI autocomplete widget?

A: You seemed to miss the end of the example source script (in your documentation link).  It activates the autocomplete with:
$( "#search" ).catcomplete({
  delay: 0,
  source: data
});

To use the appendTo, then is as simple as:
$( "#search" ).catcomplete({
  delay: 0,
  source: data,
  appendTo: '#someElem'
});

where you are appending to a selection $('#someElem')


text:
Q: Using connected wallet to authenticate endpoint for dApp? I have a pure Typescript dApp that has no server behind it. The user connects their MetaMask wallet and mints an NFT from the site. I want to provide an affiliate program so partners can give out their affiliate link and anyone who purchases an NFT they will get a percentage fee.
If the affiliate identifier is in the query string parameters, I will write it to the user's cookie. Then I can call an endpoint with the user's public wallet address and transaction identifier when they complete the mint. Or if they leave and come back, the affiliate id is in the cookie to pick up from there.
My challenge is how can I authenticate that endpoint if the dApp is pure javascript with no server behind it? What can stop anyone from just calling this endpoint with a bunch of wallets and affiliate codes?
Could there be a way to use the user's connected wallet to sign a message and authenticate with the endpoint that way? It would almost be like OAuth but for crypto. I want to keep this simple though.
Any suggestions or ideas on how to achieve this?

A:
My challenge is how can I authenticate that endpoint if the dApp is pure javascript with no server behind it? What can stop anyone from just calling this endpoint with a bunch of wallets and affiliate codes?

Usually you don't. You can pass the information in the mint transaction.

My challenge is how can I authenticate that endpoint if the dApp is pure javascript with no server behind it? What can stop anyone from just calling this endpoint with a bunch of wallets and affiliate codes?

You can make users to sign in to your service using Ethereum Sign In. This needs a backend, though. You are not going to get more information than in the mint transaction (the user address).


text:
Q: Manga where the main character kills the Demon Lord (as well as his own friends) The main character kills the Demon Lord at last but is forced to do it again as his evaluation comes to be F.
He killed his own friends because they were really slow. And he is evaluated by the God or someone who tells him that he is not Ideal Hero, so he should start again, sending him back in time.

A: I believe you are looking for FFF-Class Trashero.
The first chapter has the hero slaying the demon king, then a goddess come to him with a report card.  He has an F rank in personality, so he is sent back in time so he can improve his score.  The report card also has the remark "WHY DID YOU KILL YOUR PERFECTLY SANE COMRADES?"


text:
Q: Is it possible and feasable to extend websharper to support decimal datatype? I am looking for a framework that will generate Javascript for the client side, and i am willing to learn more F# to do this.
It is mandatory to have a decimal fully compatible datatype in Javascript
Can it be done?
Are there any guides for extending Websharper?
I noticed that on websharper website there is no link to forums and the websharper google group has latest post from 2011.
Is the project still active, maintained and developed?


text:
Q: Proving adjoint of exponential is exponential of adjoint My background is the Spectral Theorem and its corollaries.
Let $A$ a $n \times n$ matrix with complex entries that satisfies $A^* = -A$.
Define $B = e^A$. Show $B^* = e^{-A}$
Since $A$ is normal there exist $U$ unitary such that
$$A = U^*DU$$
where $D$ is a diagonal matrix. Then, using $f(x) = e^x$ we have
$$B = f(A) = U^*f(D)U$$
Now, I sense I should be able to prove the result from there, but I am stuck. Any hint would be appreciated. I can't see how $f(A)^* = f(A^*)$

A: You've almost got it, you have
$$B = U^* e^D U$$ so
$$B^* = (U^* e^D U)^*= U (e^D)^* U^*.$$
Also, $$(e^D)^*= \left(\sum_{n=0}^\infty \frac{1}{n!} D^n \right)^*$$ which is easily seen to be equal to
$$\sum_{n=0}^\infty \frac{1}{n!} (D^*)^n.$$ So
$$B^*= U e^{(D^*)} U^*= e^{U D^* U^*} = e^{-A}.$$


text:
Q: Question about the "wave function" on Relativistic Quantum Mechanics (RQM) and Quantum Field Theory (QFT) I'm enrolled on a short and conceptual couse on RQM and QFT and the professor made a distinction about the Klein-Gordon (K-G) equation on RQM and the K-G equation on QFT. Roughly speaking, he said that RQM is about particles and QFT in about fields, and the object which captures that distinction is in fact the wave function. Then he said that the wave function on K-G of RQM is the common wave function from non-relativistic quantum mechanics, and the "wave function" from QFT is, also, a scalar field.
He said that in RQM the wave function $\psi$ is for one electron and in QFT in for the field $\Psi$ of electrons, but since the wave function $\psi$ is already an scalar field, in the sense of pure mathematics, how can describe one electron and not a field?

A: Relativistic quantum mechanics (RQM) constructs single-particle wave equations that are consistent with special relativity (SR). However SR allows to create particles out of energy, while quantum mechanics is based on the conservation of probability. Nevertheless at energies low compared to the masses involved a single-particle description is a good approximation to nature.
Quantum field theory (QFT) enables the creation and annihilation of particles. The classical fields are promoted to operators that create and destroy particles. These operators commute with each other if they have integer spin, or anticommute for half-integer spin. A scalar field has spin zero, it commutes. Relativistic covariance is built in. This approach is known as second quantization.
Therefore there is a conceptual difference between the wave function in RQM and the wave function in QFT.


text:
Q: Regex (JS) read data between two symbols My changelog.md data looks like below.
## 11.2.3
* xxx
* xxxx

## 11.2.2
* ttt
* ttt

I need a regex that can return only the first versions list ie.
* xxx
* xxxx

I tried multiple solutions but, didn't reach the final result.
I tried matching, and replacing it, didn't work.

const changelog = `
## Hello World
* This is a bold text
* This is a bold text

## Hello World
* This is a bold text

## Hello World
* This is a bold text
`;

const final = changelog.match( /([^(##)])(.*)[^(##)]/g );
console.log(final);

A: You don't need to put ^## inside []. Square brackets are for making character sets, () is for grouping. There's no need to group it if you're not interested in that part.
Use the m modifier to make ^ match the beginning of a line instead of the the beginning of the string. Then .*\n will match the rest of that line. [^#]* will match everything after that until the next #.

const changelog = `
## Hello World
* This is a bold text
* This is a bold text

## Hello World
* This is a bold text

## Hello World
* This is a bold text
`;

const final = changelog.match(/^##.*\n([^#]*)/m);
console.log(final[1]);


text:
Q: Watir open javascript onclick link I want to follow a link specified on the target page, the problem is that the link is embeeded on a detail_open onclick javascript function like this:

...

I have tried browser1.table(:class => 'head_to_head h2h_mutual').trs[3].fire_event :click but without success
Also tried simply browser1.table(:class => 'head_to_head h2h_mutual').trs[3].clickbut nothing happens
EDIT:
This is the actual URL:
link = "http://www.flashscore.com/match/2TYx9kph/#h2h;overall"
I want to click on the links in rows of table with class head_to_head h2h_mutual

A: Dumb me..
Just needed to change to the new opened tab:
browser1.windows.last.use


text:
Q: Consuming JSONP in Google Apps Script I'd like to consume the following URL in my Google Apps Script:
http://a0.awsstatic.com/pricing/1/emr/pricing-mapr.min.js
Using the typical response = UrlFetchApp.fetch(url).getContentText() doesn't really work, it just returns the JSON surrounded by callback(). Is there a way to consume JSONP with Google Apps Script?
Code:
function myFunction() {
  getEmrPricingData_();

}

/*
 * Get EMR Prices
 *
 */
function getEmrPricingData_() {
  var emr_url = "http://a0.awsstatic.com/pricing/1/emr/pricing-mapr.min.js"
  var response = UrlFetchApp.fetch(emr_url).getContentText();
  Logger.log(response);
}

A: You need to define the function callback() in your code, and eval() your JSONP response to execute that function.  For example to handle JSONP responses on a project of mine I created this function:
function callback(data){
    return data;
}

and in my request function:
var result = eval(UrlFetchApp.fetch(url + uri, options).getContentText());


text:
Q: Efficient Approach: Retrieve CLOB object from oracle database Please suggest which is efficient way to retrieve CLOB data from Oracle 10g database where the data is XML and will both provide same complete content in case the data is in GB's,
        Clob myclob = null;
        myClob= resultSet.getClob("XML_DATA");
        InputStream inputstream = myClob.getAsciiStream();
        StringWriter writer = new StringWriter();
        IOUtils.copy(inputstream, writer);
        myXmlData = writer.toString().trim();

(or)
        String myXml= resultSet.getString("XML_DATA");


text:
Q: Setting a UIimage view equal to another UIimage View I am making a little animation type of app for a project. I have a space to draw images on an imageView. Then when you click the new page button I need the image in that imageview to move into another imageview I have on the timeline. Hopefully you understand my problem if not let me know what other information you need.

A: hai Check This code This will allow you to draw any image and then you can access your image using method getimage in nsdata format. and then you can convert it into image from nsdata
.h File
//
//  SignatureCaptureImageView.h
//  TEST_DRAW_APP
//

 1. List item

//  Created by Talat Masud on 8/23/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface SignatureCaptureImageView : UIImageView {

    CGPoint lastPoint;

    BOOL mouseSwiped;
    int mouseMoved;
}
-(NSData *)getImage;

@end

Implementation File

#import "SignatureCaptureImageView.h"

@implementation SignatureCaptureImageView

- (id)initWithFrame:(CGRect)frame {
    if ((self = [super initWithFrame:frame])) {
        // Initialization code
        self.userInteractionEnabled = YES;
        mouseMoved = 0;
    }
    return self;
}

- (id)initWithImage:(UIImage*)image {
    if ((self = [super initWithImage:image])) {
        // Initialization code
        self.userInteractionEnabled = YES;
        mouseMoved = 0;
    }
    return self;
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    mouseSwiped = NO;
    UITouch *touch = [touches anyObject];

    if ([touch tapCount] == 2)
    {
        //self.image = nil;
        return;
    }

    lastPoint = [touch locationInView:self];
    lastPoint.y -= 5;

}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    mouseSwiped = YES;

    UITouch *touch = [touches anyObject];
    CGPoint currentPoint = [touch locationInView:self];
    currentPoint.y -= 5;

    UIGraphicsBeginImageContext(self.frame.size);
    [self.image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
    CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5.0);
    CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 1.0, 0.0, 0.0, 1.0);
    CGContextBeginPath(UIGraphicsGetCurrentContext());
    CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
    CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
    CGContextStrokePath(UIGraphicsGetCurrentContext());
    self.image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    lastPoint = currentPoint;

    mouseMoved++;

    if (mouseMoved == 10) {
        mouseMoved = 0;
    }

}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {

    UITouch *touch = [touches anyObject];

    if ([touch tapCount] == 2) {
        //self.image = nil;
        return;
    }

    if(!mouseSwiped) {
        UIGraphicsBeginImageContext(self.frame.size);
        [self.image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
        CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
        CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5.0);
        CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 1.0, 0.0, 0.0, 1.0);
        CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
        CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
        CGContextStrokePath(UIGraphicsGetCurrentContext());
        CGContextFlush(UIGraphicsGetCurrentContext());
        self.image = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
    }
}

-(NSData *)getImage{
    return  UIImagePNGRepresentation(self.image);
}

- (void)dealloc {
    [super dealloc];
}

@end

A: declare 2 UIImageViews , first with the image and second without any image, ie., empty UIImageView, but having an origin and size.
Then, when u want to animate, do the following,
[UIView animateWithDuration:3.0
                 animations:^{
                     CGRect sframe = mSecondImgView.frame;
                     mFirstImgView.frame = sframe;
                 }
                 completion:^(BOOL finished){

                 }];


text:
Q: Django tests apis model object does not exist I have created 2 Django models, a User model and a Account model. In the User model, I have all info and in Account, I have account details of that user.
I have designed Views that when I create a user, respective account object also created.
URLs: /user/ will create new user and account object.
But when I am writing tests to check APIs, I created a new user. User object is accessible but when I access account detail it throws models.object doesn't exist.
class User(models.Model):
    user_name = models.CharField(max_length=35)
    first_name = models.CharField(max_length=35)
    last_name = models.CharField(max_length=35)
    email = models.EmailField(max_length=255)

class Account(models.Model):
    user = models.ForeignKey(User, on_delete = models.CASCADE)
    balance = models.IntegerField(default = 0)

def post(self, request):
    received_json_data = json.loads(request.body.decode("utf-8"))
    user = User(user_name=received_json_data['user_name'], first_name=received_json_data['first_name'],
                last_name=received_json_data['last_name'], email=received_json_data['email'])
    user.save()
    account = Account(user=user);
    account.save();

class TestUser(TestCase):
    def setUp(self):
        self.c = Client()
        user1 = {"email": "ram@gmail.com", "user_name": "ramu", "first_name": "ramesh", "last_name": "yadav"}
        data1 = json.dumps(user1)
        self.response = self.c.post('/user/', data1, content_type="application/json")
        self.assertEqual(self.response.status_code, 200)
        account = Account.objects.get(pk =1)

A: You are trying to get the account with primary key which might not exist.
You can try to get the account the following way:
account = Account.objects.filter(user__email="ram@gmail.com")

This will return all accounts for that user. get method will throw an error if one user has multiple account.


text:
Q: Using execvp with parameters I want to know how can I run a program with parameters using fork() and execvp().
I want to run the program test and passed the parameter flag.
I am using the variable args to capture the string start /test flag. This code snippet below is contained inside a conditional statement that checks for the parsed string start /test -flag.
arguments[0] = "/test"
arguments[1] = "-flag"

                    char * arguments[3];
                    arguments[0] = (char*)args[1].c_str();
                    arguments[1] = (char*)args[2].c_str();
                    arguments[2] = NULL;
                    cout << "Arguments[1] = " << arguments[1] << endl;
                    pid_t pid = fork();
                    // ERROR
                    if (pid == -1)
                        perror("ERROR: Failed to fork");
                    // Child
                    if (pid == 0)
                    {
                        cout << "child: " << pid << endl;

                        if (execvp (arguments[0], arguments) == -1)
                        {
                            perror("exec");
                        }
                    }
                    // Parent
                    if (pid > 0)
                    {
                        wait(0);
                        cout << "parent: " << pid << endl;
                    }

Does this mean that my program test is getting passed the parameter flag as an argument? In other words, ARGV[0]: flag?
int main (int argc, char **argv)
{
    cout << "YOU ENTERED: " << argc << "ARGUMENTS" << endl;
    cout << "ARGV[0]: " << argv[0] << endl;

    return 0;
}


text:
Q: Having issues with nginx and docker mapping the correct folder For whatever reason, I keep getting the default html
My docker files are here /Users/xxx/_sites/_blah:
Dockerfile
site.conf
docker-compose.yml

My app with the code is here /Users/xxx/_sites/_blah/app
Here are my files:
Dockerfile
FROM nginx

# Change Nginx config here...
RUN rm /etc/nginx/conf.d/default.conf
ADD ./site.conf /etc/nginx/conf.d/

COPY content /var/www/html/site

COPY conf /etc/nginx

VOLUME /var/www/html/site

VOLUME /etc/nginx/conf.d/

docker-compose.yml
version: '3.3'
services:
  php:
    container_name: pam-php
    image: php:fpm
    volumes:
      - ./app:/var/www/html/site
  nginx:
    container_name: pam-nginx
    image: nginx:latest
    volumes:
      - ./app:/var/www/html/site:rw
      - ./site.conf:/etc/nginx/conf.d/site.conf:rw
    ports:
      - 7777:80

site.conf
    server {
    listen  80;

    server_name localhost;
    root /var/www/html/site;

    error_log /var/log/nginx/localhost.error.log;
    access_log /var/log/nginx/localhost.access.log;

    location / {
        # try to serve file directly, fallback to app.php
        try_files $uri /index.php$is_args$args;
    }

    location ~ ^/.+\.php(/|$) {
        fastcgi_pass 192.168.59.103:9000;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTPS off;
    }
}

Every tutorial or block of code just doesn't work or is old.


text:
Q: How to calculate months with arrayformula in google script I am able to calculate the monthly difference using dateif but not arrayformula
Example : Start Date: 5-Oct-2020
End date: 9-Jun-2021 month difference: using formula (DATEDIF(D3,E3 , "M")).
But I'm unable to use array formula to calculate as I wanted each row to be auto-calculated with dates.
Appreciate some help from Google experts!

A: Try
=ArrayFormula(IF(LEN(D3:D), DATEDIF(D3:D,E3:E, "M"),))

and see if that works?

References

*

*Arrayformula()

*How do arrayformulas work?


text:
Q: MPI Python input function ,I have a problem with my code I am not able to enter the input after each process. The output I am getting when I execute mpiexec -n 4 python 1.py:
rank 0 hi
Enter
rank 1 hi
Enter
rank 2 hi
Enter
rank 3 hi
Enter

I am able to enter the input only once, that is in the last process, how do I enter input after each rank or process is executed?
from mpi4py import MPI

comm = MPI.COMM_WORLD
rank = comm.rank
p=comm.Get_size()

if rank == 0:
    data = "hi
else:
    data = None

data = comm.bcast(data, root=0)

print('rank',rank,data)

x=input("Enter:")


text:
Q: Form not working as it should Question:
 1. Why is the "required" function not working in my contact form?
 2. Why can I not make use of the full width of the input-field. See img.
 I can only write on the left half of the input field.

HTML:

        <fieldset class="name group">
            Name
            <input id="name" name="name" required pattern="[A-Za-z-0-9]+\s[A-Za-z]+"  title="firstname lastname"/>
        </fieldset>
        <fieldset class="email group">
            Email
            <input type="email" id="email" name="email" required title="Submit a valid Email">
        </fieldset>
        <fieldset class="phone group">
            Telephone
            <input type="tel" id="phone" name="phone" pattern="(\+?\d[- .]*){7,17}" required title="Submit an international, national or local phone number"/>
        </fieldset>
        <fieldset class="message group">
            Message
            <input type="text" id="message" required/>
        </fieldset>
        <fieldset class="send group">
            <input type="submit" value="Send" class="sendButton">
        </fieldset>

CSS:
#content
{
 max-width: 50.694%;
 position: absolute;
 bottom: 0;
 background: none repeat scroll 0 0 rgba(0, 0, 0, .55);
 border-radius: 13px;
 width: 730px;
 margin: 0 0 6.6% 25.9167%;
 box-shadow: 0 0 0 2px #000000, 2px 2px 30px 1px rgba(199, 255, 100, 0.73);
 }

 .contact{
 width: 100%;
 margin: 10px;
 }

 fieldset{
 border: 0;
 margin: 0;
 width: 100%;
 padding: 1%;
 }

.name, .email, .message{
padding-right: 29px;
}

label{
color: #d8d9de;
font-family:'apple_chancerychancery';
font-size: 1.2em;
padding-left: 10px;
}

input{
margin-right: 70px;
padding: 6px;
text-align: left;
border-radius: 10px;
background: none repeat scroll 0 0 rgba(255, 240, 260, 0.5);
}

#name, #email, #phone, #message{
padding-right: 50%;
float: right;
color: #253c93;
text-decoration: none;
border: 1px dotted #29FF00;
font-family: 'Calibri', Arial, sans-serif;
font-size: 1em;
width: 23%;
}

div#inner-editor{
padding: 30px;
}

#message{
padding-top: 10%;
}

.sendButton{
background: rgba(0, 0, 0, 0);
color: #d8d9de;
font-size: 1.2em;
font-family: 'apple_chancerychancery';
padding: 0.8% 4%;
border: none;
margin-left: 42%;
box-shadow: inset 2px 2px 9px rgba(199, 255, 100, 0.73), inset -2px -2px 9px rgba(199,
255, 100, 0.73);
}

::-webkit-input-placeholder { /* WebKit browsers */
color:    #d8d9de;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color:    #d8d9de;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
color:    #d8d9de;
}
:-ms-input-placeholder { /* Internet Explorer 10+ */
color:    #d8d9de;
}

A: Here is the fiddle where your second issue has been resolved.
Just removed the padding-right from the name, email, phone and message id input fields and increased their width percentage.

A: You are missing your form tag. It works for me once I add your form tag in:

                <form>
                <fieldset class="name group">
                    Name
                    <input id="name" name="name" required pattern="[A-Za-z-0-9]+\s[A-Za-z]+"  title="firstname lastname"/>
                </fieldset>
                <fieldset class="email group">
                    Email
                    <input type="email" id="email" name="email" required title="Submit a valid Email">
                </fieldset>
                <fieldset class="phone group">
                    Telephone
                    <input type="tel" id="phone" name="phone" pattern="(\+?\d[- .]*){7,17}" required title="Submit an international, national or local phone number"/>
                </fieldset>
                <fieldset class="message group">
                    Message
                    <input type="text" id="message" required/>
                </fieldset>
                <fieldset class="send group">
                    <input type="submit" value="Send" class="sendButton">
                </fieldset>
                    </form>

http://jsfiddle.net/GEs34/


text:
Q: How to create a master html file above the output directory from rmarkdown::render_site When using rmarkdown::render_site, it render all the HTMLs into the same directory.
Is it possible to create a master html file? When opening, it will directly link to the index.html in the output directory?
The reason to do this is because the output directory contains too much HTMLs and css files that are too messy to find the index file for regular user.
_Master.html # try to create this file
├──(output directory)
├── Index.html
├── Data1.html
└── Data2.html

Update
Found a way to do it in other answer. Create a html file that will redirect to the desired html once loaded.
<META http-equiv="refresh" content="0;URL=your_url">


text:
Q: Java implementation power function With Recursion Efficiently We should try long for this sort of methods
 long genericPow(int base,int exp){

    if(exp==0)return 1;
    if(exp==1)return base;
    if(exp==2)return base*base;
    if(exp==3)return base*base*base;

    return genericPow(base, 3)*genericPow(base, exp-3);

}

For instance, if you want to compute x^15, the method of exponentiation by squaring will give you:
x^14 = (x^3)*(x^11)
x^11 = (x^3)*(x^8)
x^8 = (x^3)*(x^5)
x^5 = (x^3)*(x^2)
x^3 = x*x*x

thus it will turn down the loop complexity by 3.

A: I am not quite sure what is your question here.
This doesn't reduce complexity as pointed out by Boris the Spider.
If you are trying to create an efficient algorithm to compute the power of x^n you can use a simple divide and conquer strategy. Note that x^n=(x^(n/2))^2 if n is even and x^n=x(x(n-1)/2)^2 if odd. Thus you can use this to build a recursive algorithm which can compute powers of a number efficiently.

A: static int pow(int a, int b) {
    return powInner(a, b, 1);
}

static int powInner(int a, int b, int c) {
    return b > 0 ? powInner(a, b - 1, a * c) : c;
}

I guess this wasn't the point?

A:  long pow(long x,int n){
    if(n<=0)return 1;
    if(n==1)return x;
    if(n==2)return (x * x);

    if(n%2==0){
        return pow(pow(x, n/2),2);
    }else{

        return x*pow(x, n-1);
    }

}

Complexity O(logn)


text:
Q: Finding a tag way up the hierarchy using jQuery Given the following html:

1. What is one plus one?

<input type="radio" value="a" name="1" required /> 4

<input type="radio" value="b" name="1" required /> 7

<input type="radio" value="c" name="1" required /> 2

<input type="radio" value="d" name="1" required /> 8

2. What is two plus two?

<input type="radio" value="a" name="2" required /> 4

<input type="radio" value="b" name="2" required /> 7

<input type="radio" value="c" name="2" required /> 2

<input type="radio" value="d" name="2" required /> 8

3. What is three plus three?

<input type="radio" value="a" name="3" required /> 4

<input type="radio" value="b" name="3" required /> 7

<input type="radio" value="c" name="3" required /> 2

<input type="radio" value="d" name="3" required /> 6

I want to alert() the value of the nearest previous span[class='q-num'] when any input[type='radio'] is clicked. I've tried closest() but all I get is a blank alert..

A: prevUntil is your friend:
$(this).parent().prevUntil('dt').last().prev().find('span[class="q-num"]').text();

Here's the fiddle: http://jsfiddle.net/UPRBT/

If your posted markup is your real code, you can just use the name property of the clicked radio button:
$('input[type="radio"]').click(function () {
    alert(this.name);
});

Here's the fiddle: http://jsfiddle.net/b4Sj8/

A more efficient way would be to use this custom traversal method:
$.each({
    'prevFind' : 'previousSibling',
    'nextFind' : 'nextSibling'
}, function(method, dir) {

    $.fn[method] = function (selector) {

        var elems = [];

        this.each(function(i, item) {
            while (item = item[dir]) {
                if (item.nodeType == 1) {
                    if ( $.find.matches(selector, [item]).length ) {
                        elems.push(item);
                        break;
                    }
                }
            }
        });

        return this.pushStack(elems, method, selector);
    };
});

which you can then use like this:
$(this.parentNode).prevFind('dt').find('.q-num').text()

Here's the fiddle: http://jsfiddle.net/b4Sj8/1/

A: Try
alert($(this).parent().prevAll('dt:first').find('span[class="q-num"]').text());

http://jsfiddle.net/mowglisanu/PkMGN/


text:
Q: Error while creating trigger delimiter #

create trigger update_recharge_due_onrenewal after insert on recharge
for each row set
begin
update due_amount SET due_amount.amount=due_amount.amount-(select rate from
internet_package where recharge.package_id = internet_package.package_id)
where
due_advance.user_id = recharge.user_id;
end;#

Why is this showing error - unknown system variable 'begin'

A: Change for each row set by for each row.


text:
Q: Split plot with RBCD in R: Are inferences valid when output reports some effects are not estimable? Data are from an agricultural experiment and are the proportion of turnips damaged by cabbage maggot in different insecticide treatments (note preliminary investigation suggested data were approximately normal and homoskedastic). There were three whole-plot treatments applied at planting time ("atplant") arranged in 5 randomized complete blocks ("block"). Each whole plot was split into three subplots assigned one of three postplant treatments ("postplant"). "Wholeplot" indicates the wholeplot number.
I ran an analysis of variance using the below R code:
block = factor(c('I','I','I','I','I','I','I','I','I','II','II','II','II','II','II','II','II','II','III','III','III','III','III','III','III','III','III','IV','IV','IV','IV','IV','IV','IV','IV','IV','V','V','V','V','V','V','V','V','V'))
wholeplot= factor(c('1','1','1','2','2','2','3','3','3','4','4','4','5','5','5','6','6','6','7','7','7','8','8','8','9','9','9','10','10','10','11','11','11','12','12','12','13','13','13','14','14','14','15','15','15'))
atplant=factor(c('lorsban','lorsban','lorsban','sepresto','sepresto','sepresto','untreated','untreated','untreated','untreated','untreated','untreated','sepresto','sepresto','sepresto','lorsban','lorsban','lorsban','sepresto','sepresto','sepresto','untreated','untreated','untreated','lorsban','lorsban','lorsban','lorsban','lorsban','lorsban','untreated','untreated','untreated','sepresto','sepresto','sepresto','untreated','untreated','untreated','lorsban','lorsban','lorsban','sepresto','sepresto','sepresto'))
postplant=factor(c('untreated','mlo','mhi','untreated','mlo','mhi','untreated','mhi','mlo','mhi','mlo','untreated','mlo','untreated','mhi','mhi','mlo','untreated','mlo','untreated','mhi','untreated','mhi','mlo','mhi','mlo','untreated','mhi','untreated','mlo','mlo','mhi','untreated','untreated','mlo','mhi','mhi','mlo','untreated','mlo','untreated','mhi','mlo','untreated','mhi'))
numdam = c(25,15,13,23,17,16,24,9,26,12,17,27,22,19,7,5,9,13,18,23,19,38,30,22,16,14,30,24,26,34,38,34,32,37,18,7,12,27,25,13,22,5,32,25,2)
numundam = c(20,30,32,22,28,29,21,36,19,33,28,18,23,26,38,40,36,32,22,22,26,7,15,23,29,31,15,19,19,11,7,11,11,8,27,38,33,18,20,32,23,40,13,20,43)
propdam = round(numdam/(numdam+numundam),2)
vz19 = data.frame(block,wholeplot,atplant,postplant,propdam)
fit.aov = aov(propdam~atplant*postplant + block + Error(wholeplot), data=vz19)
summary(fit.aov)
fit.aov

The ANOVA results seem reasonable, but the output warns that "4 out of 10 effects not estimable, Estimated effects may be unbalanced" for the wholeplot stratum.
I averaged the response variable across subplots and did a simple RBCD ANOVA on the response at the whole-plot level, and the P-values are identical. Given this, I suspect the error is not critical but before publishing results I want to make sure inferences are sound.

Call: aov(formula = propdam ~ atplant * postplant + block +
  Error(wholeplot),
      data = vz19)
Grand Mean: 0.4584444
Stratum 1: wholeplot
Terms:
                    atplant     block Residuals Sum of Squares  0.2188978 0.4927022 0.1578578 Deg. of Freedom         2         4         8
Residual standard error: 0.1404714 4 out of 10 effects not estimable
  Estimated effects may be unbalanced
Stratum 2: Within
Terms:
                  postplant atplant:postplant Residuals Sum of Squares  0.5285644         0.0420089 0.4825600 Deg. of Freedom         2                 4        24
Residual standard error: 0.141798 Estimated effects may be unbalanced


text:
Q: Wireless connection not figuring in VMware Workstation 10(Kali-Linux) I just installed kali-linux on my VMware workstation 10. I had to check for the wireless connection in the kali-linux. I tried to check for the wireless-network connection(WiFi);but,it was incorrectly identifying the wireless-network as an Ethernet-connection(eth 0).
How can this be resolved? I just googled for it and came to know that one can't evaluate the wireless network connection in Virtual Machines.
I might sound like nerd, but, I really want to know why exactly is this so; and,if this is a short-coming of Virtual Machines; why don't the bigger giants like VMware/Oracle,etc. figure this out and correct it?
Please list the reasons along with some useful resources,if possible. Thanks for giving the time to study the whole question with patience.

A: That's typically not a problem. The WiFi on the host is not actually directly accessible to the VMware guests, or any VM guests using other technologies such as KVM, VirtualBox, etc.
The hardware that's present in the physical host is interacted through virtual hardware that's presented to the guest VMs through the software BIOS that the various virtualization technologies provide.
To my knowledge I've never seen any virtualization technologies that have directly exposed the WiFi included in a laptop, into the guests. I would assume this is a limitation with the BIOS'.
The other approach that you could try would be to utilize a USB based WiFi Adapter that may allow for access to the WiFi directly within the VM guest.
But why?
I too have searched in vain and never found a compelling reason behind why WiFi is unable to be virtualized. I suspect there is some technical reason as to why but I've never been able to find it either.
References

*

*Wireless bridged networking in KVM. Why is it so complicated?

A: This is something i faced when I was new to BackTrack.
I believe the Wireless Interface will run only when the OS is being booted either from a USB or from the hard drive on the system - not from any Virtual platform.
There could be a solution by now - one never knows.


text:
Q: Unity Line Renderer Not Straight I am messing around with unity's Line Renderer and I can not seem to see why the following issue is occurring.

As you can see its not straight for some reason.

Here are all my settings for the line renderer.
Another very strange thing I am seeing is if I set Element 2's X to 10 so that its in the same X position as Element 1 the entire line just disappears. If anyone has any ideas on that as well it would be much appreciated.

A: This is due to how Line Renderers work.
Lines are a dynamically created mesh that uses quads to display the "line." As such, its susceptible to all sorts of problems that comes with generating meshes at runtime.

Notice how the vertical stroke's two triangles (in cyan) properly render two triangles to make a rectangle, but the two in green do not. This is because at that corner, the mesh got turned up side down.
This was likely due to either the cube changing direction (e.g. is started facing left but the first move was to the right) or flipping upside down entirely, causing a twist in the mesh. The top "edge" in green is equivalent to the diagonal edge in the cyan quad.
The only way to "fix" this is to use smaller chunks. Rather than adding a new point every time the cube changes direction, add new points every frame, every ten frames, or every 0.5 units or similar.


text:
Q: Upgrading from Ionic 3 to 5 - .map no longer works on observables How would I go about changing this code in Ionic 3 to Ionic 5 upgrade when the error states: Property 'map' does not exist on type 'Observable'.
return XApi.addTransaction('clicksActive', parameters,
   { timeout: AppConfig.OTP_REQUEST_TIMEOUT, queue: false })
.map(res => {
        let response = res.data;
        let clicksActive: ClicksActive = this.parseActiveResponse(response);
        return clicksActive;
    }).catch(error => {
        let errorMessage = getLambdaErrorMessage(error);
        let clicksActive: ClicksActive = {
            success: false,
            active: false,
            errorMessage: errorMessage
        }
        return Observable.of(clicksActive);
    });

I tried changing it to:
return XApi.addTransaction('clicksActive', parameters,
{ timeout: AppConfig.OTP_REQUEST_TIMEOUT, queue: false })
.pipe(map(res => {
        let response = res.data;
        let clicksActive: ClicksActive = this.parseActiveResponse(response);
        return clicksActive;
    })).catch(error => {
        let errorMessage = getLambdaErrorMessage(error);
        let clicksActive: ClicksActive = {
            success: false,
            active: false,
            errorMessage: errorMessage
        }

        return Observable.of(clicksActive);
    });

But then I get error:
Argument of type 'OperatorFunction<any, ClicksActive>' is not assignable to parameter of type 'UnaryFunction<Observable, Observable>'.
Types of parameters 'source' and 'source' are incompatible.
Type 'Observable' is missing the following properties from type 'Observable': buffer, bufferCount, bufferTime, bufferToggle, and 104
UPDATED:
Here is my updated code for the entire service.ts:
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Rx'
import { AppConfig } from '../config/app-config';
import { XApi  } from 'x-lib';

import { ClicksActive, ClicksBalance } from '../models/user.model';
import { getLambdaErrorMessage } from "../helpers/lambda-error.helper";
import { map } from 'rxjs/operators';
import { catchError } from 'rxjs/operators';

@Injectable()
export class ClicksService {

    constructor() {
    }

    requestActive(
        idNumber: String
    ): Observable<ClicksActive> {

        let parameters =
        {
            apiUsername: this.getApiUsername(),
            apiPassword: this.getApiPassword(),
            apiBaseUrl: this.getApiBaseUrl(),
            idNumber: idNumber
        }

        return XApi.addTransaction('clicksActive', parameters, { timeout: AppConfig.OTP_REQUEST_TIMEOUT, queue: false })
        .pipe(
            map((res) => {
            let response = res.data;
            let clicksActive: ClicksActive = this.parseActiveResponse(response);
            return clicksActive;
        }), catchError((error) => {
            let errorMessage = getLambdaErrorMessage(error);
            let clicksActive: ClicksActive = {
                success: false,
                active: false,
                errorMessage: errorMessage
            }

            return Observable.of(clicksActive);
        })
        );
    }

    parseActiveResponse(response): ClicksActive {
        let clicksActive: ClicksActive = {
            success: response.success,
            active: response.active,
            errorMessage: response.errorMessage
        }
        return clicksActive;
    }

    requestBalance(
        idNumber: String
    ): Observable<ClicksBalance> {

        let parameters =
        {
            apiUsername: this.getApiUsername(),
            apiPassword: this.getApiPassword(),
            apiBaseUrl: this.getApiBaseUrl(),
            idNumber: idNumber
        }

        /*let clicksBalance: ClicksBalance = {
            success: true,
            balance :{
              cardNumber: '123456789',
              amount: 110,
              limit: 220,
              timestamp: Date()
            },
            errorMessage: ""
        };

        return Observable.of(clicksBalance);*/
        return XApi.addTransaction('clicksBalance', parameters, { timeout: AppConfig.OTP_REQUEST_TIMEOUT, queue: false }).map(res => {
            let response = res.data;
            let clicksBalance: ClicksBalance = this.parseBalanceResponse(response);
            return clicksBalance;
        }).catch(error => {
            let errorMessage = getLambdaErrorMessage(error);
            let clicksBalance: ClicksBalance = {
                success: false,
                balance :{
                  cardNumber: '',
                  amount: 0,
                  limit: 0,
                  timestamp: null
                },
                errorMessage: errorMessage
            };

            return Observable.of(clicksBalance);
        });
    }

    /* GENERIC SERVICES */
    getApiUsername(): String {
        if (AppConfig.ENVIRONMENT == 'dev') {
            return AppConfig.DEV_API_USERNAME;
        }
        else if (AppConfig.ENVIRONMENT == 'qas') {
            return AppConfig.QAS_API_USERNAME;
        }
        else if (AppConfig.ENVIRONMENT == 'prd') {
            return AppConfig.PRD_API_USERNAME;
        }
    }

    getApiPassword(): String {
        if (AppConfig.ENVIRONMENT == 'dev') {
            return AppConfig.DEV_API_PASSWORD;
        }
        else if (AppConfig.ENVIRONMENT == 'qas') {
            return AppConfig.QAS_API_PASSWORD;
        }
        else if (AppConfig.ENVIRONMENT == 'prd') {
            return AppConfig.PRD_API_PASSWORD;
        }
    }

    getApiBaseUrl(): String {
        if (AppConfig.ENVIRONMENT == 'dev') {
            return AppConfig.DEV_API_BASE_URL;
        }
        else if (AppConfig.ENVIRONMENT == 'qas') {
            return AppConfig.QAS_API_BASE_URL;
        }
        else if (AppConfig.ENVIRONMENT == 'prd') {
            return AppConfig.PRD_API_BASE_URL;
        }
    }

    parseBalanceResponse(response): ClicksBalance {
        if(response.success){
            let clicksBalance: ClicksBalance = {
                success: response.success,
                balance :{
                  cardNumber: response.balance.cardNumber,
                  amount: response.balance.amount,
                  limit: response.balance.limit,
                  timestamp: response.balance.timestamp
                },
                errorMessage: response.errorMessage
            }
            return clicksBalance;
        }
        else{
            let clicksBalance: ClicksBalance = {
                success: response.success,
                balance : response.balance,
                errorMessage: response.errorMessage
            }
            return clicksBalance;
        }

    }
}

A: You're using the new Rxjs along with Ionic 5 so you need to use the pipe function and the new operators. Here a guide to this migration: https://ionicframework.com/docs/reference/migration
However, in order to fix your problem you need to call map and catchError operators this way:
  call(): Observable<{}>{
    return this.addTransaction() // <- simulate the observable which add a transaction
      .pipe(
        map((res) => {
          // your logic here on success
          // ...

          return {};  // I am using {} but you need to apply your payload
        }),
        catchError((error) => {
          // your logic here on error
          // ...

          return of({}); // I am using {} but you need to apply your payload
        })
      );
  }

  addTransaction(): Observable<{}>{
    return of({}); // I am using {} but you need to apply your payload
  }


text:
Q: How to append [Op.or] to an object in NodeJS to build up where condition for Sequelize? In my NodeJS model, I have the following query.
Ad.adList = function(where_condition, lang_code='EN') {
    return this.findAll({
          attributes:['id','name'],
          where: where_condition,
          include:[
            {
                association : 'ad_user',
                where       : {status:'a', is_ban:'n', deleted_at:null},
                required    : true
            },
            { association: 'translation', where: {lang_code:lang_code} ,required: false},
            { association: 'ad_title', where: {status:'a', deleted_at:null} ,required: false}
          ],
          order: [
            ['translation', 'name', 'asc']
          ]
    });
};

In the controller file, I build up the where_condition object like this:-
let where_condition_Obj =   {};

if(typeof formData.show_active !== 'undefined' && userIdformData.show_active !== null && formData.show_active !== '')
{
    where_condition_Obj.status = 'a';
}
if(typeof formData.category_id !== 'undefined' && userIdformData.category_id !== null && formData.category_id !== '')
{
    where_condition_Obj.category = formData.category_id;
}

As such, the where_condition_Obj object in the controller becomes like this:-
where_condition_Obj =   {
                    status      : 'a',
                    category    : 1,
                }

Now I need to run an OR query with like operation. For such case, my where_condition_Obj should be like this
where_condition_Obj =   {
                        status      : 'a',
                        category    : 1,
                        [Op.or]     : [
                                    {
                                        name:
                                        {
                                            [Op.like] : '%' + searchText + '%'
                                        }
                                    },
                                    {
                                        description:
                                        {
                                            [Op.like] : '%' + searchText + '%'
                                        }
                                    }
                                ]
                }

But how can I append [Op.or] in an object like this where_condition_Obj.category = formData.category_id;
I tried something like
where_condition_Obj.[Op.or] = [
                                    {
                                        name:
                                        {
                                            [Op.like] : '%' + searchText + '%'
                                        }
                                    },
                                    {
                                        description:
                                        {
                                            [Op.like] : '%' + searchText + '%'
                                        }
                                    }
                                ]

But it gives me error. Is there any way by which this can be achieved?
Note: I could have initialize the object like this from beginning,
where_condition_Obj =   {
                        [Op.or]     : [
                                    {
                                        name:
                                        {
                                            [Op.like] : '%' + searchText + '%'
                                        }
                                    },
                                    {
                                        description:
                                        {
                                            [Op.like] : '%' + searchText + '%'
                                        }
                                    }
                                ]
                }

but I don't want to do this because this condition would be appended only based on a particular parameter which may or may not be sent.

A: You can set where_condition as Op.and with an array of conditions like:
[Op.and]: [{
 status: 'a'
}, {
  category: 1,
}]

And afterwards on some condition you can just push a new condition into this array:
where_condition[Op.and].push = {
  [Op.or]: [
     {
       name:
        {
          [Op.like] : '%' + searchText + '%'
        }
     },
     {
       description:
        {
          [Op.like] : '%' + searchText + '%'
        }
      }
    ]
}

A: I faced this condition today, after researching for a few minutes I got some basic idea of how to make this thing work.
Below is my approach which worked for me.
Declare another object for the OR condition.
let where_condition_Obj = {};
let or_condition_Obj = {};

For the normal where condition, do it like the way you have done.
Eg:
if (typeof formData.show_active !== 'undefined' && userIdformData.show_active !== null && formData.show_active !== '') {
      where_condition_Obj.status = 'a';
}

if (typeof formData.category_id !== 'undefined' && userIdformData.category_id !== null && formData.category_id !== '') {
      where_condition_Obj.category = 1;
}

For the OR condition follow below approach
if (typeof formData.name !== 'undefined' && userIdformData.name !== null && formData.name !== '') {
     or_condition_Obj.name = { [Op.substring]: 'name' }
}

if (typeof formData.description !== 'undefined' && userIdformData.description !== null && formData.description !== '') {
     or_condition_Obj.description = { [Op.substring]: 'description' }
}

And finally in your where condition get both those objects and assign it like below.
where: {
    [Op.or]: or_condition_Obj,
    [Op.and]: where_condition_Obj
}


text:
Q: Force page to zoom to 135% in Javascript using Bootstrap I'm writing a web page on high resolution screens that appear very small using bootstrap (especially IE, chrome appears to take up more of the whitespace). However when I zoom to 135% its perfect. Is there a way programmatically to set the zoom level to 135% for my web page? IE11 is the standard browser but cross compability would be nice.
Thank you

A: If you try in the console what Keith suggested - document.body.style.zoom = 1.35 it seems to be working but it feels hacky and intrusive causing noticeable fling of the page. Besides, you find 1.35 to be perfect, but it might be different for other people - that's why all the browsers have that zoom in/out feature to let users decide what best fits their needs.
The same effect can be achieved by css zoom property applied for high resolution screens via @media query upon page rendering:
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body {
        zoom: 1.35;
    }
}

But again it is commonly considered not to be the best practice.

A: Units like dpi, dpcm, and dppx all scale directly with resolution which would be an alternative to zoom.
This shows the different media queries for resolution in CSS.


text:
Q: roll a die an infinity of times and probability that the maximum among all the numbers obtained is 5 I'm a little beat confused about the next problem:
Suppose we roll a die an infinity of times. Calculate (and
justify) the probability that the maximum among all the numbers obtained is 5. Here we assume the coin is fair.
I'm confused; I was thinking in defining the event $A_{n}$ as the event that from $1$ to $n$ dice rolled we have as maximum the number $5.$ So we have $A_{n}\subset A_{n+1}$ for all $n\in\mathbb{N}.$ Therefore $P(\bigcup_{n\in\mathbb{N}}A_{n})=\lim_{n\rightarrow\infty}P(A_{n})=0,$ but I'm not sure if my argument is good or wrong.
Any kind of help is thanked in advanced.

A: If $A_n$ is the event that the maximum in the first $n$ die-rolls is $5$, then it is not true that $A_n \subset A_{n+1}$.  For example, if the maximum in the first four rolls is $5$ but the fifth roll is a $6$, your outcome is in $A_4$ but not in $A_5$.
Suggestion: Consider instead the event $B_n$ that there are no $6$'s in the first $n$ rolls.  This has $B_{n+1} \subset B_n$, and $A_n \subset B_n$.

A: The probability that the maximum is 5 is $\le$ the probability that a 6 never comes up.  This is 0 probability for an infinite number of rolls.


text:
Q: how can I change the name of many files in a folder I have a folder with 1000 files.
Their name is like below
...P1_A1 _R2....
...P1_A2 _R2....
...P1_A3_R2....
which only the middle is important as highlighted
and I have a key .txt file in the same folder with this info
Sample  P   R   Col
    1   1   A   1
    2   1   A   2
    3   1   A   3

I want to check the .txt file and change the name of the file accordingly or save with with a name in another folder. for example
.._P1_A1_..
should be sample1 because when I look at the .txt file , it is
Sample  P   R   Col
    1   1   A   1

for the
.._P1_A2_..
should be sample2 because when I look at the .txt file , it is
Sample  P   R   Col
    2   1   A   2

A: If we can safely assume that all your names are unique, I mean that there is only one file whose name contains _P1_A1, only one with _P1_A2 etc, you can do this:
$ awk 'NR>1{print "mv *_P"$2"_"$3$4"* sample"$1}' key.txt
mv *_P1_A1* sample1
mv *_P1_A2* sample2
mv *_P1_A3* sample3

Awk reads its input line by line and splits it into fields on whitespace. So the first field is $1, the second $2 etc. Here, we're processing the keys file and printing the correct mv command by building it from the file's fields.
If you are sure the mv commands printed are correct, you can run them with:
awk 'NR>1{system("mv *_P"$2"_"$3$4"* sample"$1)}' key.txt


text:
Q: What is the Dunford Integral and why is it useful? Wikipedia http://en.wikipedia.org/wiki/Pettis_integral defines the Pettis Integral for Banach space valued functions wrt to some measure space by duality.
It calls the Pettis & Bochner integral the weak & strong integral respectively, which implies some kind of relationship; also, apparently there is a Dunford integral which specialises to the Pettis integral.
My question is: Why are these weak integrals useful, what is the definition of the Dunford Integral and how does it specialise to the Pettis one, and what is the relationship between the Pettis Integral & the Bochner Integral?.
I've just noted: Weak and Strong Integration of vector-valued functions, which answers the part of my question about the Pettis Integral.

A: The Dunford integral is a version of the weak integral, still weaker than the more widely used Pettis integral; for a $X$-valued function, it takes value in $X^{**}$. See the paper http://www.ams.org/journals/proc/1986-096-03/S0002-9939-1986-0822428-0/S0002-9939-1986-0822428-0.pdf
for a detailed study of relations between the Dunford and Pettis integrals.
This notion should not be confused with the Riesz-Dunford integral, a Cauchy type integral in the complex domain defining a holomorphic functional calculus for some classes of operators.

A: Since you've answered part of the question, let me elaborate on the Dunford integral. If $f:\Omega\to E$ is weakly measurable and satisfies $\langle x^* ,f\rangle\in L^1(\Omega)$ for all $x^*\in E^*$ then it's possible to define $\int_X f\in E^{**}$. This acts on $E^{*}$ via the prescription
$$x^*\mapsto \int_X\langle x^{*},f(\omega)\rangle d\omega.$$
I first learnt this in Talagrand's AMS memoir:
http://books.google.co.uk/books?id=YqJ3t2oT5WgC&lpg=PP1&dq=pettis%20integral%20and%20measure%20theory&pg=PP1#v=onepage&q=pettis%20integral%20and%20measure%20theory&f=false
but a good text on infinite dimensional analysis will probably mention it. $f$ is Pettis integrable precisely when the Dunford integral $\int_Xf$ lies in the canonical image of $E$ in $E^{**}$ and then the two agree (modulo the spaces they live in).
Let's cook up an example. Take the function $f:[0,1]\to c_0$ defined by $f(x)=2^ne_n$ whenever $x\in [2^{-n},2^{-n+1})$. Define $f_n$ to be the obvious simple approximation: let it be $0$ on $[0,2^{-{n+1}})$ and agreeing with $f$ elsewhere.
The problem with these step functions: we compute
$$\int_0^1{\| f(s)-f_n(s)\|ds}=\sum_{k=n}^\infty{2^k(2^{-k+1}-2^{-k})}=\infty$$
and note that our dumb approximation doesn't work in the strong sense.
But pick any $g\in\ell^1$ and note that
$$\int_0^1{\langle f(s)-f_n(s) , g\rangle ds} =\sum_{k=n}^\infty g(k) \to 0$$
as $n\to\infty$. So our function can be weakly approximated by step functions - in fact you can easily see $s\mapsto \langle f(s),g\rangle$ is $L^1$ with $\int\langle f(s),g\rangle=\lim_{n\to\infty}\int\langle f_n(s),g\rangle$. So $f$ is Dunford integrable.
Note that the integrals
$F_n=\int_0^1{f_n(s)ds}=\sum_{k=1}^{n-1}{e_k}$
do not converge to anything in $c_0$. We can think of them as members of $\ell^\infty$ and of course here they converge (in weak* topology) to the identity. In fact, $\int_0^1{\langle f(s), g\rangle ds}=\sum_{k=1}^\infty g(k)$ - so by definition $\int_0^1{f(s)ds}=1 \in \ell^\infty$. This is an example of the Dunford integral, when the Petis/Bochner integrals won't do.
Another example: modify the function $f$ in our example of Dunford integrability, so that $f(x)=2^ne_n/n$ instead of $2^ne_n$. The obvious step function approximation still can't be strong, as $\int_0^1{\|f(s)-f_n(s)\|}=\sum_{k=n}^\infty{1/k}$. Now the sequence of approximations $F_n$ converges in norm to $(1/k)_{k=1}^\infty$. Thought of as an element of $\ell^\infty$ this is the Dunford integral, but as an element of $c_0$ it's just the Pettis integral. (Note, I'm not even saying this function is not Bochner integrable, but the weak approximations make the Pettis integral very natural in this context).

A: Let $f \colon \Omega \to E$ be your function.  $\mu$ is a measure on $\Omega$.  Assume, for every $x^* \in E^*$, the composition $x^* \circ f$ is $\mu$-integrable.  The Dunford integral in general lies in $E^{**}$, namely $\int_A f d\mu$ is the element $u^{**} \in E^{**}$ defined by $u^{**}(x^*) = \int_A x^{*}\circ f\,d\mu$ for all $x^* \in E^*$.  And then, of course, if $\int_A f\,d\mu \in E$ for all $A$, we say $f$ is Pettis integrable.
If $f$ is Bochner integrable, then it is also Pettis integrable, and the two integrals agree.
If $f$ has almost all its values in a separable space, then $f$ is Bochner integrable if and only if it is Pettis integrable, and the scalar integral $\int \|f\| d\mu$ converges.


text:
Q: Display multiple images at the same time using picasso into gridview in android Please help me with this.I tried this code but it diplaying the images at different times.I need to display all images at the same time.thank you for your help
Picasso.with(getContext()).load(result.thumListUrl).fetch();
                Picasso
                        .with(getContext())
                        .load(result.thumListUrl)
                        .networkPolicy(NetworkPolicy.OFFLINE)
                        .fit()
                        .into(img, new Callback() {
                            @Override
                            public void onSuccess() {
                                Log.d("Picasso", "Image loaded from cache>>>" + result.thumListUrl);
                            }

                            @Override
                            public void onError() {
                                Log.d("Picasso", "Try again in ONLINE mode if load from cache is failed");
                                Picasso.with(getContext()).load(result.thumListUrl).fit().into(img, new Callback() {
                                    @Override
                                    public void onSuccess() {
                                        Log.d("Picasso", "Image loaded from web>>>" + result.thumListUrl);
                                    }

                                    @Override
                                    public void onError() {
                                        Log.d("Picasso", "Failed to load image online and offline, make sure you enabled INTERNET permission for your app and the url is correct>>>>>>>" + result.thumListUrl);
                                    }
                                });
                            }
                        });

A: Load images from URL and let it load when it fetches the data at different times, instead hide the imageview or cover it with place holder imageview on top of it untill all the images are loaded.
In Fragment
 private int loadedImages = 0;
    private int numberOfImagesToBeLoaded = 2;
    ArrayList<ImageView> images = new ArrayList<>();
    addImageUsingPicasso(url1,img1);
    addImageUsingPicasso(url2,img2);

  public void addImageUsingPicasso(String url,ImageView img){
     images.add(img);
    private Target target = new Target() {
          @Override
          public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
               img.setImageBitmap(bitmap);
               loadedImages++;
               if(loadedImages == numberOfImagesToBeLoaded) { //<--- All images are loaded
                  showImages();
               }
          }

          @Override
          public void onBitmapFailed(Drawable errorDrawable) {
              loadedImages++;
          }

          @Override
          public void onPrepareLoad(Drawable placeHolderDrawable) {
          }
       }
     Picasso.with(getContext()).load(url).into(target);
   }

  private void showImages(){
     for(ImageView image : images){
         image.setVisibility(View.VISIBLE);
      }
   }


text:
Q: Can I specify the auto-generated property name when using the [ObservableProperty] attribute with CommunityToolkit.MVVM? Is it possible to specify the name of the auto-generated property for a private field that is decorated with the [ObservableProperty] attribute?  For example, if I have a field, string address, that has this attribute, the toolkit will generate a string property, Address.  Is there a way to force the toolkit to produce a property name other than Address while keeping the field name as address?

A: Sergio Pedri responded to my question on Twitter. Short answer: No, not until we get partial properties.


text:
Q: How to get Date from TimeStamp in java I am trying to read a timestamp I have in my database mysql and save it to a Date variable in java.
I want it with this format: YYYY-MM-DD HH:MM:SS (24 hour format)
In my database I have a timestamp with that format but each time I try to get as timestamp I read 2014 and if I read it as Date with getDate()... I get "ago 16, 2014"

A: I'm not sure what you really want. Do you want to get a java.sql.Timestamp instance or do you want to get the timestamp as string with the mentioned pattern?
Maybe that helps:
ResultSet rs = ...
Timestamp t = rs.getTimestamp(...);

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String str = sdf.format(t);

A: // get the timestamp from the DB
java.sql.Timestamp yourTimestamp = youNameItGetTimestamp();

// Create the corresponding Date object
java.util.Date date = new java.util.Date(yourTimestamp.getTime());

// show in a string
java.text.SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
java.lang.String printableDate = formatter.format(date);
System.out.println("here you have it: <" + printableDate + ">");

A: The other Answers are correct but use troublesome old legacy date-time classes. Instead use java.time classes.
Conversion
New methods have been added to the old classes to facilitate conversion such as java.sql.Timestamp::toInstant().
java.sql.Timestamp ts = myResultSet.getTimestamp( … ) ;
Instant instant = ts.toInstant();

Instant
The Instant class represents a moment on the timeline in UTC with a resolution of nanoseconds. Its toString method generates a String in one of the standard ISO 8601 formats.
String output = instant.toString();

2011-12-03T10:15:30Z

You could replace the T with a SPACE and delete the Z to get your format.
output = output.replace( "T" , " ").replace( "Z" , "" ) ;

2011-12-03 10:15:30

ZonedDateTime
If you want to see the same moment but through the lens of a particular time zone, generate a ZonedDateTime.
ZoneId zoneId = ZonedId.of( "America/Montreal" );
ZonedDateTime zdt = instant.atZone( zoneId );

Define a custom DateTimeFormatter object. Or use DateTimeFormatter.ISO_LOCAL_DATE_TIME and replace the T with a SPACE.
String output = zdt.format( DateTimeFormatter.ISO_LOCAL_DATE_TIME ).replace( "T" , " " );

2011-12-03 05:15:30

About java.time
The java.time framework is built into Java 8 and later. These classes supplant the troublesome old date-time classes such as java.util.Date, .Calendar, & java.text.SimpleDateFormat.
The Joda-Time project, now in maintenance mode, advises migration to java.time.
To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations.
Much of the java.time functionality is back-ported to Java 6 & 7 in ThreeTen-Backport and further adapted to Android in ThreeTenABP (see How to use…).
The ThreeTen-Extra project extends java.time with additional classes. This project is a proving ground for possible future additions to java.time. You may find some useful classes here such as Interval, YearWeek, YearQuarter, and more.

A: What's the type of your field? Is it a string/varchar? How about using SimpleDateFormat?
i.e.
final Date myDate = new SimpleDateFormat(FORMAT_STRING).parse(value);

See SimpleDateFormat documentation for more details.
BTW: A litte code and database definition would have been nice...

A: have you tried some thing like this :
java.sql.Date timeStamp = new java.sql.Timestamp( object.getDate() );
also this link may help you :
http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html