text:
Q: change colour of title bar in jquery pop up Messing about trying to change the background colour of the title bar in a jquery pop to to green (seen as blue in the jsfiddle)...cant seem to get it...any suggestions welcome?
    $("#dia").dialog({
    autoOpen: true,
    title:"Access Point",
    height: 200,
    width: 300,
    modal: false,
    draggable: true,
    position: [900, 150],
    dialogClass: "foo",
    //show: {effect: 'bounce', duration: 350, times: 3}
    show: {effect: 'fade', duration: 2000}
});

$(".ui-dialog-titlebar").css("background-color", "green");
$(".ui-dialog").css("background-color", "green");
$(".ui-dialog-title").css("background-color", "green");
$(".ui-dialog-content").css("background-color", "green");

please see http://jsfiddle.net/dEvKb/3254/

A: A gradient is apply in the title bar, it's like a background image, you must reset it.
$(".ui-dialog-titlebar").css("background", "green");

Or
$(".ui-dialog-titlebar").css({'background-color': 'green', 'background-image': 'none'});

A: It's because the default dialog header has a background image. Try changing it to the following code:
$(".ui-dialog-title").css("background", "green");
$(".ui-dialog-titlebar").css({"background": "green", "border": "none"});

See this fiddle:
http://jsfiddle.net/dEvKb/3258/

A: You not need to use JS to change background color.
CSS WAY (raccomanded)
.ui-widget-header,.ui-dialog-titlebar,.ui-dialog,.ui-dialog-title,.ui-dialog-content{
    background: none green;
}

Example: http://jsfiddle.net/dEvKb/3257/
JS WAY
$(".ui-widget-header,.ui-dialog-titlebar,.ui-dialog,.ui-dialog-title,.ui-dialog-content").css("background", "green");

Example: http://jsfiddle.net/dEvKb/3259/


text:
Q: How do i modify TakeProfit of all current open position using OrderModify()? I have opened up to five buy trades with their individual take profit. I want to change the take profit of the first four buy trades to the take profit of number five buy trade. modifyAllBuyOrdTP() is the function created to modify the take profit while findTpL_BuyOrd() function will get the take profit of the last trade that just finished opened. It is not working in strategy tester. I will be grateful to anyone that can help me on this problem. Thank you in advance.
void modifyAllBuyOrdTP(){

       if(CountTradesBuy()>=2){
          for(int l_pos_4 = OrdersTotal() - 1; l_pos_4 >= 0; l_pos_4--)
          {
             OrderSelect(l_pos_4, SELECT_BY_TICKET);
             if(OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber)
                continue;
             if(OrderTakeProfit() == findTpL_BuyOrd())
                continue;
             if(OrderStopLoss() == 0 && OrderTakeProfit() != findTpL_BuyOrd() && OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber){
               if(OrderType() == OP_BUY){
                   ModifyStopsByPrice(OrderTicket(),0,findTpL_BuyOrd());//Print(" b tp ",findTpL_BuyOrd());
               }
             }
          }
      }
   }

double findTpL_BuyOrd(){
   double l_ord_TP = 0;
      for(int l_pos_4 = OrdersTotal() - 1; l_pos_4 >= 0; l_pos_4--)
      {
         OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES);
         if(OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber)
            continue;
         if(OrderTakeProfit() == 0)
            continue;
         if(OrderTakeProfit()!=0 && OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber){
           if(OrderType() == OP_BUY){
               l_ord_TP = OrderTakeProfit();
               break;
           }
         }
      }
  return l_ord_TP;
}

A: In modifyAllBuyOrdTP() function you should select orders by SELECT_BY_POS if you iterating over them.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How do I make my MAX II CPLD stable after disconnecting it from USB ByteBlaster and PC? I just designed and programmed firmware into my CPLD which has a state machine for a project. It works fine when connected to the USB ByteBlaster and PC.
However, when I disconnect the ByteBlaster, the Schmitt trigger and the pull up/down resistors stop working somehow. This makes the outputs of my state machine noisy.
I'm currently using the 5 VDC from an outlet (mains adaptor) to power my CPLD currently. I want to make it mobile and power it from a battery to do further testing.
How do I go about making the output of my CPLD stable after disconnecting the ByteBlaster from the JTAG pins?


text:
Q: How to take credit card payments from user in iPhone applications? I am new to credit card payment applications, I am developing an iPhone application which requires to take credit card payments from the user. In this application I am just providing a coupon to the user and if the user uses the coupon I just want to collect $1 from the user's credit card.
I have read In App Purchase guide but this doesn't suit for this requirement it seems since my coupons are just builtin-App products.
can anyone provide other method which best suits for my requirement or if IAPP suits for my requirement, how to approach.
some help will be appreciated.

A: I don't know how you are planning to distribute your app.  Apple says it will reject almost any app that takes payments via anything other than in-App purchase.  There may be some narrow exceptions, but you should take a very careful look at part 11 of their approval guidelines (from the link).

A: The easiest way is to implement in App purchase for every coupon and the in app purchase just unlocks the content(which must be stored in the application or downloaded from your server).
super easy.
But I would recommend you to implement a feature like buying credits for the app.
You can create an in App Purchase for let's say one (1$) 3, 3$) and so on. This can be send to your server(of course you need to make the billing management on your own) and the iPhone User can identify himself by an User Name and an Password to get access o their Credits and redeem them instantly in the App. In this Situation you could even extend your service by adding PayPal Payment(in an WebView inside the Application).
I Hope this helps. Good Luck.


text:
Q: visual studio's intellisense not working for ajax script i am learning AJAX. i have visual studio 2010 and in that intellisense feature is not showing the open() and send() methods of XMLHttpRequest class.
i have added jquery library files to my page and jquery is working fine but AJAX is not working.
please guide me.
here is a code snippet
var xmlhttp;

function loadevent()
{

    xmlhttp = new XMLHttpRequest();
    xmlhttp.

}

when i press the "." it only shows 7 standard attributes like propertyof, constructor, tostring etc.

A: You need to add vsdoc files for intellisense. Have a look at the following links...

*

*NuGet 1.6.0- Here they have mentioned vsdoc files for Visual Studio IntelliSense are now included in the core jquery NuGet package. As a result, this pacakge is obsolete and will not be updated past version 1.6

*NuGet latest jQuery Package

*Independently you can download it from here
Hope it helps...


text:
Q: Searching and getting results based on word frequency So I have an index that has multiple documents, each document being sentences of text. For example:
Doc 1: "the cat in the hat"
Doc 2: "feed your cat lots of fish"
So I indexed them with term vectors, so I can search and see the word frequency for each document (with stopwords included):
Doc 1: "cat": 1
       "hat": 1
Doc 2: "feed": 1
       "cat":  1
       "lots": 1
       "fish": 1
So I want to be able to search this index so that if I say:
"What do I feed my cat"
This should return Doc 2, by adding up the word frequency for each document based on the query and returning the one with the highest number.
Doc 1: 1 (cat)
Doc 2: 2 (feed,cat).
Is there a way to do this in Elasticsearch? Thanks!


text:
Q: How to elevate privileges only when required? This question applies to Windows Vista!
I have an application which normally works without administrative privileges. There is one activity which does need administrative privilege but I don't want to start the application itself with higher privileges when I know most of time user wont even be using that feature.
I am thinking about certain method by which I can elevate the privileges of application on some event (such as press of a button). Example:

If user clicks this button then he is prompted with UAC dialog or consent. How can I do this?

A: I don't believe that it is possible to elevate the currently running process. It is built into Windows Vista that administrator privileges are given to a process upon startup, as I understand. If you look at various programs that utilise UAC, you should see that they actually launch a separate process each time an administrative action needs to be performed (Task Manager is one, Paint.NET is another, the latter being a .NET application in fact).
The typical solution to this problem is to specify command line arguments when launching an elevated process (abatishchev's suggestion is one way to do this), so that the launched process knows only to display a certain dialog box, and then quit after this action has been completed. Thus it should hardly be noticeable to the user that a new process has been launched and then exited, and would rather appear as if a new dialog box within the same app has been opened (especially if you some hackery to make the main window of the elevated process a child of the parent process). If you don't need UI for the elevated access, even better.
For a full discussion of UAC on Vista, I recommend you see this very through article on the subject (code examples are in C++, but I suspect you'll need to use the WinAPI and P/Invoke to do most of the things in C# anyway). Hopefully you now at least see the right approach to take, though designing a UAC compliant program is far from trivial...

A: You need a UAC moniker and the code to run elevated as a COM object.
See this question.
Documentation on MSDN.

A: Perhaps someone comes in handy this simple example:
using System;
using System.Linq;
using System.Reflection;
using System.Diagnostics;
using System.Security.Principal;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    internal static class Program
    {
        private class Form1 : Form
        {
            internal Form1()
            {
                var button = new Button{ Dock = DockStyle.Fill };
                button.Click += (sender, args) => RunAsAdmin();
                Controls.Add(button);

                ElevatedAction();
            }
        }

        [STAThread]
        internal static void Main(string[] arguments)
        {
            if (arguments?.Contains("/run_elevated_action") == true)
            {
                ElevatedAction();
                return;
            }

            Application.Run(new Form1());
        }

        private static void RunAsAdmin()
        {
            var path = Assembly.GetExecutingAssembly().Location;
            using (var process = Process.Start(new ProcessStartInfo(path, "/run_elevated_action")
            {
                Verb = "runas"
            }))
            {
                process?.WaitForExit();
            }
        }

        private static void ElevatedAction()
        {
            MessageBox.Show($@"IsElevated: {IsElevated()}");
        }

        private static bool IsElevated()
        {
            using (var identity = WindowsIdentity.GetCurrent())
            {
                var principal = new WindowsPrincipal(identity);

                return principal.IsInRole(WindowsBuiltInRole.Administrator);
            }
        }

    }
}

A: As it was said there:
Process.StartInfo.UseShellExecute = true;
Process.StartInfo.Verb = "runas";

will run the process as admin to do whatever you need with the registry, but return to your app with the normal privileges.

A: The following MSDN KB article 981778 describes how to 'self-elevate' an application:
http://support.microsoft.com/kb/981778
It contains downloadable samples in Visual C++, Visual C#, Visual Basic.NET.
This approach gets around the need to start a separate process, but in fact it is the original application that is restarted, running as an elevated user. Nevertheless this may still be very useful in some contexts where it is not practical to duplicate code in a separate executable.
To remove the elevation, you need to quit the application.

A: I know this is an old post, but this is in response to anyone else who comes across MarcP's suggestion. The msdn post he referenced indeed does restart the applications in all of the code examples. The code samples use the runas verb proposed already in other suggestions.
I downloaded the code to make sure, but this is from the original msdn article:

4. Click Yes to approve the elevation. Then, the original application
      restarts, running as an elevated administrator.
   5. Close the application.


text:
Q: Timestamp comparison in awk Considering below file, how can I compare two timestamps, noting that the time part is negligible.
foo,boo,2038-01-18T12:00:00+02:00
foo,boo,2015-09-12T01:31:24+03:00
foo,boo,2015-08-04T03:15:38+03:00

I tried to make it by substring the date using below code and compare it with other dates i.e: 2015-08-12
awk -F, '{$3=substr($3,1,10)}{if($3<2015-08-12){print $0}}'

But it did not work.
Desired output:
foo,boo,2015-08-04T03:15:38+03:00

OR:
foo,boo,2015-08-04

A: You need to double quote the date, to force string comparison:
$ awk -F, '$3 < "2015-08-12"' <file
foo,boo,2015-08-04T03:15:38+03:00


text:
Q: How can I capture wait stats for a previous Actual Plan in SQL Server? I have some SQL Server stored procedures that sometimes take too much time to run.
If I run them manually, I'm able to catch the Wait Stats. However, I would like to automatically capture all plans with wait stats reported.
I've dug into the plan cache, but it seems like it only stores the estimated plans, so, there are no executions metrics included.
Is there a way to capture all actual plans containing Wait Stats?


text:
Q: GoLang: Losing scope in database New to Go, come from .Net-land so bear with me... Would love some guidance on architecting my Go app specifically with regard to managing and reusing DB connections.
I have split up my db code into a package to allow for db-lookups into package that handles sql lookups like a repository layer. I want to have flexibility to decouple my db layer from my app services, so I can easily replace my database if necessary.
Basically I am looking for some guidance on how and when to handle sql connect and holding a sql.DB pointer in the app. Do I need to hold onto a global pointer in main.go or can I manage the connection in my mysql package?
Here's my code:
package mysqlstorage

import (
    "database/sql"
    "fmt"
    "log"
    "types"
)

var db *sql.DB

func Connect() {
    db, dberr := sql.Open("<CONNECTION_STRING>")

    if dberr != nil {
        fmt.Println(dberr)
    }
}

func SaveUser(u types.User) {
    // use db here!
    ....
}

func GetUser(id string) types.User {
    // use db here!
    ....
}

On running my main.go and using my userservices package to attempt to save a user, I hit a problem where I appear to lose scope of my pointer:-
2015/05/03 17:49:08 http: panic serving [::1]:50106: runtime error: invalid memory address or nil pointer dereference goroutine 7 [running]: net/http.func·011()
/usr/local/Cellar/go/1.4.2/libexec/src/net/http/server.go:1130 +0xbb database/sql.(*DB).conn(0x0, 0x10, 0x0, 0x0)
/usr/local/Cellar/go/1.4.2/libexec/src/database/sql/sql.go:634 +0x7ae database/sql.(*DB).Ping(0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.4.2/libexec/src/database/sql/sql.go:462 +0x3a mysqlstorage.SaveUser(0x0, 0xc20805425a, 0x7, 0xc208054280, 0x11, 0xc208054268, 0x6, 0xc208054274, 0x5)
/Users/<USERNAME>/Desktop/go/<APPNAME>/api/src/mysqlstorage/mysqlstorage.go:24
    +0x35 services.CreateUser(0x57c148, 0xc2080563c0, 0xc2080329c0)
/Users/<USERNAME>/Desktop/go/<APPNAME>/api/src/services/userservices.go:30
    +0x398 net/http.HandlerFunc.ServeHTTP(0x3d02a0, 0x57c148, 0xc2080563c0, 0xc2080329c0)
/usr/local/Cellar/go/1.4.2/libexec/src/net/http/server.go:1265 +0x41 github.com/gorilla/mux.(*Router).ServeHTTP(0xc20803c140, 0x57c148, 0xc2080563c0, 0xc2080329c0)
/Users/<USERNAME>/Desktop/go/<APPNAME>/api/src/github.com/gorilla/mux/mux.go:98
    +0x297 net/http.(*ServeMux).ServeHTTP(0xc20803a720, 0x57c148, 0xc2080563c0, 0xc2080329c0)
/usr/local/Cellar/go/1.4.2/libexec/src/net/http/server.go:1541 +0x17d net/http.serverHandler.ServeHTTP(0xc2080543c0, 0x57c148, 0xc2080563c0, 0xc2080329c0)
/usr/local/Cellar/go/1.4.2/libexec/src/net/http/server.go:1703 +0x19a net/http.(*conn).serve(0xc208056320)
/usr/local/Cellar/go/1.4.2/libexec/src/net/http/server.go:1204 +0xb57 created by net/http.(*Server).Serve
/usr/local/Cellar/go/1.4.2/libexec/src/net/http/server.go:1751 +0x35e

Any guidance would appreciated! Thanks guys!

A: I think that your problem is that db in the Connect() scope is shadowed due to your use of the := operator. If you change your method to declare a dberr var:
func Connect() {
    var dberr error
    db, dberr = sql.Open("<CONNECTION_STRING>")

    if dberr != nil {
        fmt.Println(dberr)
    }
}

Your code will work as intended

A: As noted by @Lander your out-of-scope happens because you are creating a local variable db through the db, err := assignment which then goes out of scope when the Connect func returns.
Generally on the use of sql.DB
From the database/sql package:

DB is a database handle representing a pool of zero or more underlying connections. It's safe for concurrent use by multiple goroutines.
The sql package creates and frees connections automatically; it also maintains a free pool of idle connections.

and

The returned DB is safe for concurrent use by multiple goroutines and maintains its own pool of idle connections. Thus, the Open function should be called just once. It is rarely necessary to close a DB.

That said you want to open the connection once and then keep it open for the duration of the process. With that the only reliable way to actually close it when you are done (or run into a fatal or panic) would be to do the idiomatic go defer db.Close() right after opening it which would need to be done in the main function.
You could still keep your Connect function in your package and also use it to initialize the global package variable db, but call it from main once and return *sql.DB to main so you can defer db.Close().


text:
Q: Zend autoloader not working from PHP config Is the PHP config file (php.ini) supposed to have something in it that will enable Zend Autoloader support? Cause I am using it in my application and on one server and it's not working (it says it can't find the file in require_once()) and on another server it's working perfectly.
Any help on this? Thanks.


text:
Q: Is it possible to print a webpage (ipython notebook) to a PDF with a single infinitely long page? I have an ipython notebook with a great deal of graphs and comments in markdown cells.  I'd like to export this notebook to a pdf file, and so far I've managed to do so by selecting print to file from chromium's print dialogue.
This works fine except that page breaks routinely split my graphs in two.  Since this notebook will likely not be printed out, is it possible to create a PDF file with a single, sufficiently-long page?
Thanks in advance!

A: You use the chrome browser to access the web-based user interface of ipython, right?

*

*install the extension Awesome Screenshot for chrome

*click the new icon in the upper left and choose Capture Entire Page

*the software begins to scroll down the page and takes one big screenshot
click for example

*after that you can save it as .png (image) file

*or you can print it directly as a .pdf if you have installed a pdf printer like pdf creator

A: The Save to Google Drive extension will do that.
In addition to adding to the context menu to quickly save images directly to your Google Drive, clicking the extension icon in your toolbar will (depending on your settings) save the entirety of the web page you are looking at as a PDF in your Google Drive.
(Save to Google Drive support page)


text:
Q: How to put text in a circular div? I need to have a div (Pink Color Area) with  some text in it. See the image Below

A: here is ARCTEXT.JS plugin, you can use this plugin from here :
http://tympanus.net/Development/Arctext/

A: Try this :
http://csswarp.eleqtriq.com/
You just enter your text, set the curbe, and copy the CSS :)
But, it's not really optimized...


text:
Q: Misplaced bar in grouped bar charts The first column, which corresponds to the leftmost bar in each group is shifted heavily to the left. Why?

(The tikzpicture has to be in a beamer environment.)
   \documentclass{beamer}
    \usepackage{siunitx, pgfplotstable,booktabs, pgfplots, filecontents}
    \beamertemplatenavigationsymbolsempty
    \pgfplotsset{compat=1.15}
    \begin{filecontents*}{data.csv}
    1,11,35,1,1
    2,9,5,1,1
    3,0,3,5,5
    \end{filecontents*}

\sisetup{range-units=single}
\begin{frame}{Doses and Reported Effects}
\noindent
\begin{tikzpicture}
    \begin{axis}[ybar=3.2em,
            ymin=0,
            ymax=40,
            bar width=1em,
            ylabel={No. of comments},
            xtick={1,2,3},
            width=8cm,
            axis y line* = left,
            axis x line* = bottom,
            ylabel near ticks,
            table/x index={0},
            xticklabels = {
                \strut \SIrange{0}{250}{\mg},
                \strut \SIrange{300}{500}{\mg},
                \strut $>$500
            },
            enlarge x limits =0.25,
            %xticklabel style={yshift=-10ex},
            minor x tick num = 1,
            minor tick length=1em,
            every node near coord/.append style={anchor=north,yshift=1.2em},
            legend entries={sweating,feel hot, diaphoresis, no side effects},
            legend columns=1,
            legend style={draw=none,nodes={inner sep=3pt},at={(1.2,0.8)}}]
    \addplot[draw=black,fill=red!20, nodes near coords] table[y index=1, col sep =comma]{data.csv};
    \addplot[draw=black,fill=red!40, nodes near coords] table[y index=4,col sep =comma]{data.csv};
    \addplot[draw=black,fill=red!60, nodes near coords] table[y index=3,col sep =comma]{data.csv};
    \addplot[draw=black,fill=white, nodes near coords] table[y index=2,col sep =comma]{data.csv};
    \end{axis}
\end{tikzpicture}
\end{frame}

A: The main issue disappeared after I removed =3.2em after ybar. The length after ybar is the bar shift, which, when turned on, unsurprisingly shifts bars.
\documentclass{beamer}
\usepackage{siunitx, pgfplotstable,booktabs, pgfplots, filecontents}
\beamertemplatenavigationsymbolsempty
\pgfplotsset{compat=1.15}
\begin{filecontents*}{data.csv}
1,11,35,1,1
2,9,5,1,1
3,0,3,5,5
\end{filecontents*}

\begin{document}
\sisetup{range-units=single}
\begin{frame}{Doses and Reported Effects}
\noindent
\begin{tikzpicture}
    \begin{axis}[ybar,
            ymin=0,
            ymax=40,
            bar width=1em,
            ylabel={No.\ of comments},
            xtick={1,2,3},
            width=8cm,
            axis y line* = left,
            axis x line* = bottom,
            ylabel near ticks,
            table/x index={0},%xtick={1,2,3},
            xticklabels = {
                {\strut \SIrange{0}{250}{\mg}},
                {\strut \SIrange{300}{500}{\mg}},
                {\strut $>$500}
            },
            enlarge x limits =0.25,
            %xticklabel style={yshift=-10ex},
            minor x tick num = 1,
            minor tick length=1em,
            every node near coord/.append style={anchor=north,yshift=1.2em},
            legend entries={sweating,feel hot, diaphoresis, no side effects},
            legend columns=1,
            legend style={draw=none,nodes={inner sep=3pt},at={(1.2,0.8)}}]
    \addplot[draw=black,fill=red!20, nodes near coords] table[x
    expr=\coordindex+1,y index=1,col sep =comma,header=false]{data.csv};
    \addplot[draw=black,fill=red!40, nodes near coords] table[y index=4,col sep =comma,header=false]{data.csv};
    \addplot[draw=black,fill=red!60, nodes near coords] table[y index=3,col sep =comma,header=false]{data.csv};
    \addplot[draw=black,fill=white, nodes near coords] table[y index=2,col sep =comma,header=false]{data.csv};
    \end{axis}
\end{tikzpicture}
\end{frame}
\end{document}

There were also curious effects from siunitx that went away after I put the \SIRange commands into groups. (You also forgot to add \begin{document} and \end{document}. This is not too important but represents an unnecessary threshold for other users to look at the question.)


text:
Q: Bluetooth and webcam stop working I'm using ASUS Vivobook laptop with Ubuntu 22.04 (5.15.0-58-generic)
Sometimes bluetooth and webcam suddenly stop working until the reboot. Sometimes they don't work right after reboot/turning on. Here is what I see in the log right after they stop working:
Jan 12 21:49:24 vivobook kernel: xhci_hcd 0000:03:00.4: xHCI host not responding to stop endpoint command.
Jan 12 21:49:24 vivobook kernel: xhci_hcd 0000:03:00.4: USBSTS: 0x00000000
Jan 12 21:49:24 vivobook kernel: xhci_hcd 0000:03:00.4: xHCI host controller not responding, assume dead
Jan 12 21:49:24 vivobook kernel: xhci_hcd 0000:03:00.4: HC died; cleaning up
Jan 12 21:49:24 vivobook kernel: usb 3-2: USB disconnect, device number 2
Jan 12 21:49:24 vivobook gsd-media-keys[1767]: Unable to get default sink
Jan 12 21:49:24 vivobook acpid[601]: input device has been disconnected, fd 13
Jan 12 21:49:25 vivobook dbus-daemon[1411]: [session uid=1000 pid=1411] Successfully activated service 'org.freedesktop.Tracker3.Miner.Extract'
Jan 12 21:49:25 vivobook systemd[1390]: Started Tracker metadata extractor.
Jan 12 21:49:25 vivobook bluetoothd[604]: src/profile.c:ext_io_disconnected() Unable to get io data for Hands-Free Voice gateway: getpeername: Transport endpoint is not connected (107)
Jan 12 21:49:25 vivobook bluetoothd[604]: Endpoint unregistered: sender=:1.78 path=/MediaEndpoint/A2DPSink/sbc
Jan 12 21:49:25 vivobook bluetoothd[604]: Endpoint unregistered: sender=:1.78 path=/MediaEndpoint/A2DPSource/sbc
Jan 12 21:49:25 vivobook bluetoothd[604]: Endpoint unregistered: sender=:1.78 path=/MediaEndpoint/A2DPSink/sbc_xq_453
Jan 12 21:49:25 vivobook bluetoothd[604]: Endpoint unregistered: sender=:1.78 path=/MediaEndpoint/A2DPSource/sbc_xq_453
Jan 12 21:49:25 vivobook bluetoothd[604]: Endpoint unregistered: sender=:1.78 path=/MediaEndpoint/A2DPSink/sbc_xq_512
Jan 12 21:49:25 vivobook bluetoothd[604]: Endpoint unregistered: sender=:1.78 path=/MediaEndpoint/A2DPSource/sbc_xq_512
Jan 12 21:49:25 vivobook bluetoothd[604]: Endpoint unregistered: sender=:1.78 path=/MediaEndpoint/A2DPSink/sbc_xq_552
Jan 12 21:49:25 vivobook bluetoothd[604]: Endpoint unregistered: sender=:1.78 path=/MediaEndpoint/A2DPSource/sbc_xq_552
Jan 12 21:49:25 vivobook systemd[1]: Starting Load/Save RF Kill Switch Status...
Jan 12 21:49:25 vivobook kernel: usb 3-3: USB disconnect, device number 8
Jan 12 21:49:25 vivobook systemd[1]: Started Load/Save RF Kill Switch Status.
Jan 12 21:49:25 vivobook systemd[1390]: Stopped target Bluetooth.
Jan 12 21:49:25 vivobook systemd[1]: Stopped target Bluetooth Support.

Can it be fixed?


text:
Q: How to use a user-defined command in glossary file? I've a user-defined symbol like this:
\newcommand{\myexclam}{\mathrel{\stackinset{c}{}{t}{}{\rotatebox{-45}{\scalebox{.5}{$/$}}}{$!$}}}

This symbol should be used in one of my glossary's entries as below (gloss.tex):
\newglossaryentry{mykey}{name={\ensuremath{\delta_{\text{act}}(a,\tau)\myexclam}}, description={Activity automaton}}

and here is main.tex:
\documentclass[doublespaced,12pt]{article}

\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[english]{babel}
\usepackage[symbols]{glossaries}
\usepackage{stackengine}
\usepackage{hyperref}

\newcommand{\myexclam}{\mathrel{\stackinset{c}{}{t}{}{\rotatebox{-45}{\scalebox{.5}{$/$}}}{$!$}}}

\makenoidxglossaries
\loadglsentries{gloss}

\begin{document}

    Here is my formula \gls{mykey}

    \printnoidxglossary[sort=standard,title={List of Symbols}]

\end{document}

But the compilation throws an undefined control sequence corresponding to \myexclam.
How can I properly use this command in my glossary?

A: In this case, \myexclam must be \protected in the \newglossaryentry.
EDITED to add a sort= key to \newglossaryentry, since the name is non-alphabetic, per Nicola's instruction.  Also, loaded hyperref prior to glossaries.
\documentclass[doublespaced,12pt]{article}
\usepackage{filecontents}
\begin{filecontents*}{gloss.tex}
\newglossaryentry{mykey}{name={\ensuremath{\delta_{\text{act}}(a,\tau)\protect\myexclam}},
  description={Activity automaton},sort={delta activity}}
\end{filecontents*}

\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[english]{babel}
\usepackage{hyperref}
\usepackage[symbols]{glossaries}
\usepackage{stackengine}

\newcommand{\myexclam}{\mathrel{\stackinset{c}{}{t}{}{\rotatebox{-45}{%
  \scalebox{.5}{$/$}}}{$!$}}}

\makenoidxglossaries
\loadglsentries{gloss}

\begin{document}

    Here is my formula \gls{mykey}

    \printnoidxglossary[sort=standard,title={List of Symbols}]

\end{document}

In the event that there were multiple macros needing protection (for example, if \myexclam were used more than once), it might just be easier to define it this way, so that only a single \protect is required:
\begin{filecontents*}{gloss.tex}
\newcommand\newname{\ensuremath{\myexclam\delta_{\text{act}}(a,\tau)\myexclam}}
\newglossaryentry{mykey}{name={\protect\newname}, description={Activity automaton},
  sort={delta activity}}
\end{filecontents*}


text:
Q: Android generate signed bundle or APK dialog shows unwanted project After upgrading to Android Studio 2021.2.1 Patch 1 (from 2020.3.1 Patch 4) when generating bundles (or APK) the list of modules has quadrupled, showing modules I don't have as seen on screenshot.
Every original module now comes with 3 extras, *.androidTest, *.main and *.unitTest !
Anyone know how to get rid of those ?


text:
Q: Ruby On Rails data migration from sqlite3 to mysql regarding to many to many relations I have a sqlite3 database in my rails app which has a development.sqlite3 file. I want to convert the database to mysql.Here are the steps I take but still I have problems :
1.First I add and install gem 'seed_dump' to add the data into my seed.rb (By running rake db:seed:dump) because I really need to migrate my data .
2.Change the database.yml configuration to mysql setting.
development:
  adapter: mysql2
  encoding: utf8
  database: MyDB
  username: root
  password: ****
production:
  adapter: mysql2
  encoding: utf8
  database: MyDB
  username: root
  password: ****

3.Run rails db:create then rails db:schema:load.
4.Then loading the data from seed by running rake db:seed:dump
The problem is my many to many relations data (which has a table in db schema ) can't be imported in mysql from my seed.rb.
The thing I wanna know is that is there any other safe way to migrate my data from sqlite3 to mysql instead of writing them into seed.rb and then read them ?

A: As I was looking for another way to resolve the issue I've found what is declared here. I followed the steps facing to another error of mysql : Data is too long for column summary . To skip this error I turned off mysql strict mode like this in database.yml:
config/database.yml
development:
  adapter: mysql2
  encoding: utf8
  database: myDB
  username: root
  password: ****
  host: localhost
  strict: false

production:
  adapter: mysql2
  encoding: utf8
  database: myDB
  username: root
  password: ****
  host: localhost
  strict: false

This solution is more clear than using gem 'seed_dump' which has problems with has and belongs to many relations!


text:
Q: Get the first live record on each quarter we have a pricing table and I need to get the first live record on each quarter, the table structure is like this:
record_id (int)
start_date (date)
price (decimal)
live (boolean)

I need to be able to get the first "live" record on each quarter.
So far, I've been able to do this:
SELECT DISTINCT EXTRACT(QUARTER FROM start_date::TIMESTAMP) as quarter,
EXTRACT(YEAR FROM start_date::TIMESTAMP) as year,
distinct start_date,
live
FROM record_pricing rp
group by year, quarter,record_instance_uid
order by year,quarter;

I get this:

As you can see there are live and not live records there in the results, I just need the first live record on each Q, as highlighted in the picture above as an example.

A: you can use:

SELECT *, ROW_NUMBER() OVER(PARTITION BY  year,quarter order by start_date asc) as Rank,
FROM (
SELECT  EXTRACT(QUARTER FROM start_date::TIMESTAMP) as quarter,
EXTRACT(YEAR FROM start_date::TIMESTAMP) as year,
record_instance_uid,live,start_date

FROM record_pricing rp
)Tab
where tab.Rank=1


text:
Q: FillPath with LinearGradientBrush I found a similar problem from this topic GDI+ .NET: LinearGradientBrush wider than 202 pixels causes color wrap-around
But the solution didn't work for me. I cannot ask in that topic as well. Please take a look. Here is my code:
public partial class Form1 : Form {

    int ShadowThick = 10;
    Color ShadowColor = Color.Gray;
    int width;
    int height;

    public Form1() {
        InitializeComponent();
        width = this.Width - 100;
        height = this.Height - 100;
    }

    private void Form1_Paint(object sender, PaintEventArgs e) {
        //e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
        GraphicsPath shadowPath = new GraphicsPath();
        LinearGradientBrush shadowBrush = null;
        // draw vertical shadow
        shadowPath.AddArc(this.width - this.ShadowThick, this.ShadowThick, this.ShadowThick,
            this.ShadowThick, 180, 180);
        shadowPath.AddLine(this.width, this.ShadowThick * 2, this.width,
            this.height - this.ShadowThick);
        shadowPath.AddLine(this.width, this.height - this.ShadowThick,
            this.width - this.ShadowThick, this.height - this.ShadowThick);
        shadowPath.CloseFigure();
        // declare the brush
        shadowBrush = new LinearGradientBrush(PointF.Empty,
            new PointF(this.ShadowThick + 1, 0), this.ShadowColor, Color.Transparent);
        //shadowBrush = new LinearGradientBrush(PointF.Empty,
        //    new PointF(this.ShadowThick + 1, 0), this.ShadowColor, Color.Transparent);

        //e.Graphics.DrawPath(Pens.Black, shadowPath);

        e.Graphics.PixelOffsetMode = PixelOffsetMode.Half;
        e.Graphics.FillPath(shadowBrush, shadowPath);
    }

}

I want it dark to light from left to right, but see:

I am trying to draw a shadow and I stuck at this.

A: As Hans commented below, the brush coordinates need to match the path, so instead of this:
shadowBrush = new LinearGradientBrush(PointF.Empty,
    new PointF(this.ShadowThick + 1, 0), this.ShadowColor, Color.Transparent);

it should be:
new LinearGradientBrush(new Point(this.width - this.ShadowThick, 0),
                        new Point(this.width, 0),
                        this.ShadowColor, Color.Transparent);

Also, you should dispose of the graphic objects you create.  I also changed your brush to just use Point instead of PointF since you aren't dealing with floating numbers.
Here is your code re-written:
  e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
  e.Graphics.PixelOffsetMode = PixelOffsetMode.Half;
  using (GraphicsPath shadowPath = new GraphicsPath()) {
    shadowPath.StartFigure();
    shadowPath.AddArc(this.width - this.ShadowThick, this.ShadowThick,
        this.ShadowThick, this.ShadowThick, 180, 180);
    shadowPath.AddLine(this.width, this.ShadowThick * 2, this.width,
        this.height - this.ShadowThick);
    shadowPath.AddLine(this.width, this.height - this.ShadowThick,
        this.width - this.ShadowThick, this.height - this.ShadowThick);
    shadowPath.CloseFigure();
    using (var shadowBrush = new LinearGradientBrush(
        new Point(this.width - this.ShadowThick, 0),
        new Point(this.width, 0),
        this.ShadowColor, Color.Transparent)) {
      e.Graphics.FillPath(shadowBrush, shadowPath);
    }
  }


text:
Q: SUM(data) gives different output I have this query:
SELECT finished.first_name, sum(manpower_used.salary) AS 'salary',
       materials_used.qty * materials_used.price AS 'Total'
from finished
INNER JOIN manpower_used ON finished.order_number=manpower_used.order_number
INNER JOIN materials_used ON manpower_used.order_number=materials_used.order_number

and I'm getting this output:

first_name | salary | Total  Aaron Sean | 840    | 32.5

I'm getting the wrong output in my salary column which is the correct output should be 210 (Since I have 3 70's in my salary column) but it gives me 840
Thank you in advance.


text:
Q: Failed to execute goal maven release:prepare I'm having problems when I run mvn release:prepare. I have the following message:
[ERROR] Failed to execute goal org.apache.maven.plugins: maven-release-plugin: 2.5.1: prepare (default-cli) on project marketplace-po
c: Failed to invoke Maven build. Error configuring command-line. Reason: Maven executable not found at: C: \ dev \ apache-maven-3.3.1 \
bin \ mvn.bat -> [Help 1]

A: I just had same problem when running from eclipse, it resolved by making
 copy of mvn.cmd to mvn.bat
And it worked for me.

A: As of version 3.3.X, Maven renamed mvn.bat to mvn.cmd.  This is fixed in the maven-release-plugin version 2.5.2: MRELEASE-902
They suggest adding the following section in case the fixed plugin version is not picked up automatically:
  <build>
    <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.1</version>
          <dependencies>
            <dependency>
              <groupId>org.apache.maven.shared</groupId>
              <artifactId>maven-invoker</artifactId>
              <version>2.2</version>
            </dependency>
          </dependencies>
        </plugin>
    </plugins>
  </build>

A: I had the same problem too at using Maven 3.3.1 in Windows 8.1. I searched on it and found that mvn.bat moved to mvn.cmd. Still, I don't know how to solve it at the version. So, I downloaded Maven 3.2.5 and there was the mvn.bat file. And it worked for me.

A: Fixed, i had same problem with maven 3.5.0 instalation, so just copy mvn.cmd and rename it to mvn.bat at C:\Program Files\apache-maven-3.5.0\bin.


text:
Q: javascript : Assign a method to another object without defining that method in second class body I found this code in mozila developer site:[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this#global_context]
class Car {
  sayHi() {
    console.log('Hello from car');
  }
}

class Bird {

}

const car = new Car();
const bird = new Bird();

bird.sayHi = car.sayHi;
bird.sayHi(); //Why it works?!!!

How and why the last line works without defining method in second class or inherit that method from Car class?

A: Functions are first class objects.
Internally, car is an empty object with a prototype that has its sayHi property defined.
Then, with bird.sayHi = car.sayHi, you are setting the bird.sayHi property.

A: Let's walk through what exactly happens here.

*

*You define the class for Car.  That creates a constructor named Car and creates a prototype for that class.

*You define the sayHi() method in the class definition.  That adds the sayHi method to the Car prototype.

*You define the class for Bird.  That creates a constructor named Bird and creates a prototype for that class.

*You create an instance of each class.  That creates an object, assigns the corresponding prototype and runs the constructor (if there is one).

*You execute bird.sayHi = car.sayHi;.  That has two parts.  First, it reads car.sayHi.  Since there is no own property named sayHi on the car object, the interpreter checks the prototype chain for that object and finds the sayHi method on the prototype.  Then, it takes that method that it found and assigns it to the bird object as an own property (a property directly on the bird object.  Remember, a method is JUST a function that is stored on an object.  You can grab that function off the object and use it like any other function (it may or may not work properly when removed from its original context - that depends upon what it does).

*Then, you execute bird.sayHi().  That causes the interpreter to look on the bird object for an own property named sayHi and it finds the one that you just assigned.  It grabs that method and executes it and you get your output in the console.


text:
Q: Html.fromHtml(); not working on some devices I'm using below code on android nougat and it's working:-
Html.fromHtml(" " + myText + "</strike"));

But on Marshemellow it's not working, i mean the  tag.
Is there any way to get working on all devices ?
myText is a dynamic text received in recyleView:
 public void onBindViewHolder(final DealsAdapter.MyViewHolder holder, final int position) {
    final DataDeals feedItem = feedItemList.get(position);

Usage :-
holder.oldPrice.setText(fromHtml("" + feedItem.getOldPrice() + ""));

A: this method is deprecated.
I should use this code:
@SuppressWarnings("deprecation")
public static Spanned fromHtml(String html){
    Spanned result;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
       result = Html.fromHtml(html,Html.FROM_HTML_MODE_LEGACY);
    } else {
       result = Html.fromHtml(html);
    }
    return result;
}

usage:
fromHtml(" " + myText + "</strike"));
EDIT
Do not forget to close your triangular bracket:
fromHtml(" " + myText + ""));
instead of your: fromHtml(" " + myText + "</strike"));

A: I was having the same problem where StrikethroughSpan was not working (for some devices) on a TextView inside a RecyclerView item layout. It worked fine on my Pixel OS 8.1, but didn't work on a Nexus 6 OS 7.1.1.
In my case I realised that some constraints in my layout were causing the issue. I changed the way I had implemented the layout a little bit and the StrikethroughSpan started working again. Pay attention to TextViews with wrap_content widths and heights and positioned in a Relative layout. Things that might affect the size of the TextView might be causing this issue. Unfortunately I didn't get to the root cause of the problem, but I hope this might help other people with similar problems.
As a note, both solutions to strike through the text work for me:
Html.fromHtml(" " + myText + "</strike"));

or
SpannableStringBuilder spanText = new SpannableStringBuilder("my_awesome_text");
spanText.setSpan(new StrikethroughSpan(), 0, textToBeDisplayed.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
myTextView.setText(spanText);

A: In addition to what Vyacheslav has mentioned, please check that no Font Family is set on your TextView. I spent nearly 4 hours debugging this issue and removing the FontFamily from the TextView solved my issue.


text:
Q: KDE - Is there something wrong in scipy or numpy? Or is it something I am doing? I am simply trying to follow an example: https://medium.com/swlh/how-to-analyze-volume-profiles-with-python-3166bb10ff24
I am only on the second step and I am getting errors. Here is my code:
# Load data
df = botc.ib.data_saver.get_df(SYMBOL.lower())

# Separate for vol prof
volume = np.asarray(df['Volume'])
close = np.asarray(df['Close'])

print("Close:")
print(close)
print("VOLUME:")
print(volume)

# Plot volume profile based on close
px.histogram(df, x="Volume", y="Close", nbins=150, orientation='h').show()

# Kernel Density Estimator
kde_factor = 0.05
num_samples = 500
kde = stats.gaussian_kde(close, weights=volume, bw_method=kde_factor)
xr = np.linspace(close.min(), close.max(), num_samples)
kdy = kde(xr)
ticks_per_sample = (xr.max() - xr.min()) / num_samples

def get_dist_plot(c, v, kx, ky):
    fig = go.Figure()
    fig.add_trace(go.Histogram(name="Vol Profile", x=c, y=v, nbinsx=150,
                               histfunc='sum', histnorm='probability density'))
    fig.add_trace(go.Scatter(name="KDE", x=kx, y=ky, mode='lines'))
    return fig

get_dist_plot(close, volume, xr, kdy).show()

And here are the errors:
Traceback (most recent call last):
  File "C:/Users/Jagel/PycharmProjects/VolumeBotv1-1-1/main.py", line 80, in <module>
    start_bot()
  File "C:/Users/Jagel/PycharmProjects/VolumeBotv1-1-1/main.py", line 64, in start_bot
    kde = stats.gaussian_kde(close, weights=volume, bw_method=kde_factor)
  File "M:\PROGRAMS\Anacondaa\envs\MLStockBot2\lib\site-packages\scipy\stats\_kde.py", line 207, in __init__
    self.set_bandwidth(bw_method=bw_method)
  File "M:\PROGRAMS\Anacondaa\envs\MLStockBot2\lib\site-packages\scipy\stats\_kde.py", line 555, in set_bandwidth
    self._compute_covariance()
  File "M:\PROGRAMS\Anacondaa\envs\MLStockBot2\lib\site-packages\scipy\stats\_kde.py", line 564, in _compute_covariance
    self._data_covariance = atleast_2d(cov(self.dataset, rowvar=1,
  File "<__array_function__ internals>", line 180, in cov
  File "M:\PROGRAMS\Anacondaa\envs\MLStockBot2\lib\site-packages\numpy\lib\function_base.py", line 2680, in cov
    avg, w_sum = average(X, axis=1, weights=w, returned=True)
  File "<__array_function__ internals>", line 180, in average
  File "M:\PROGRAMS\Anacondaa\envs\MLStockBot2\lib\site-packages\numpy\lib\function_base.py", line 550, in average
    avg = np.multiply(a, wgt,
TypeError: can't multiply sequence by non-int of type 'float'

I have looked all over the internet for over an hour and haven't been able to solve this. Sorry if it is simple, but I'm starting to get quite angry, so any help is very much appreciated.
Other things I have tried: using different bw_methods, convert to numpy array first.

A: I don't know about your data, but in your bug, I can reproduce the error as follows:
>>> [5] * 0.1

TypeError                                 Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_18536/2403475853.py in <module>
----> 1 [5] * 0.1

TypeError: can't multiply sequence by non-int of type 'float'

So, you can check about your data, I think in a certain row of the column there is array data


text:
Q: How do I disable notification emails in Magento? How do I disable a particular notification email, for example the welcome email when a user creates an account?

A: There is no buit-in ability to disable particular email notifications in Magento. I suggest you to look at the Mage_Core_Model_Email_Template::sendTransactional method. You can overload this class and add check against allowed/disallowed email notifications (based on template name).
Update: you can use extension for disabling specific email notifications in Magento 1.
Also, there is Disable Emails extension for Magento 2.

A: See:
admin/system_config/edit/section/sales_email/
You can enable/disable all the transaction emails as you want with the exception of the create account email.
I do not suggest that you disable the new account email. This is because it has their login details including password. It is not sent with guest checkout, maybe you need to make your store 'guest checkout only' if that is what you want.

A: This is a feature in the configuration settings as of Magento ver. 1.9.2.1 (maybe earlier)
System >> Configuration >> Sales Emails >> Enable/disable individual emails.

A: We can disable all email communication in Magento by

*

*Login to Magento backend

*Go to the System->Configuration menu.

*On the left hand menu under the Advanced tab (at the bottom) select the System menu item.

*Select 'Mail Sending Settings' from the selection on the right hand side.

*Set Disable email communications to
'Yes', then no email will send
through Magento.

A: Magento 2.3:
Stores > Configuration > Advanced (at the bottom of the left vertical menu) > System
Then Mail sending settings > Disable Email Communications: Yes
Also, make sure you clear the cache from System > Cache management
There's another method, using the command line:
php bin/magento config:set system/smtp/disable 1
php bin/magento cache:flush

*

*1 = Disable email sending

*0 = Enable email sending

A: Inspired by @Mage_user 's question I created extension that allows to disable any email notification in Magento. So, @Bizboss you can use it to disable new order email.

A: In Magento 2.4.2, you can easily navigate to stores > settings > configuration. Then under Sales > Sales emails, you should be able to disable the notifications that you require.


text:
Q: How to generate a set of orthogonal polynomials with a special weight function Regarding to $e^{-ax-bx^2}$ as the weight function , how can I generate a set of orthogonal polynomials? I just know the Orthogonalize command in Mathematica which seems that uses 1 as weight function by Gram-Schmidt method, other commands such as HermiteH and LaguerreL generate special polynomials. But I don't know how to do my case. In fact I try to perform the following step which is a part of one article:

Generate a set of orthogonal polynomials with the square of the
Ground-state wave function as the weight function (WF) adopting any of
the standard algorithms

where Ground-state wave function is $e^{-ax-bx^2}$.

A: If you remove the $x^n$ in your $A$ it will work. The ground state wave-function $\psi(x)=\exp(-ax-bx^2)$ and the weight function is its square $\psi^2(x)=\exp(-2 a x-2 b x^2)$. It helps avoid numerical instability later on if we normalize the weight function first by doing:
$$
\hat{w}(x)=\psi^2(x)*\left(\int_{-\infty}^\infty \psi^2(x)\mathrm{d}x\right)^{-1}
=\frac{\psi^2(x)\sqrt{b}}{\sqrt{\frac{\pi }{2}} e^{\frac{a^2}{2 b}}}
$$
(* ground state wave function *)
ψ = Exp[-a x - b x^2];

(* weight function is the square of ψ *)
w = ψ^2;

(* norm of the weight function *)
normw = Integrate[w, {x, -∞, ∞}];

(* normalized weight function *)
wnormed = w/normw;

(* orthogonalizes the monomials 1,x,x^2,x^3,...,x^n assuming an inner-product convolution with normalized weight fn *)
symbasis[n_?IntegerQ] :=
 Orthogonalize[x^# & /@ Range[0, n],
  Integrate[wnormed * #1 * #2, {x, -∞, ∞}] &]

For example, you can then get a basis (in symbolic $a,b$) for $n=3$ with symbasis[3]. Replace $a,b$ with numerical values if necessary e.g: symbasis[3] /. {a->0.99985, b->0.00015}. This process of getting a symbolic basis then replacing the values is slower than numerical integration but it seems to avoid the problems with precision. With this replacement we get a basis:
basis = symbasis[3] /. {a->0.99985, b->0.00015}
(* results:
{1,
 0.0244949 (3332.83 + x),
 0.000424264 (-1.11094*10^7 + x^2 + 6665.67 (3332.83 + x)),
 6.*10^-6 (3.7037*10^10 + x^3 - 3.33283*10^7 (3332.83 + x) + 9998.5 (-1.11094*10^7 + x^2 + 6665.67 (3332.83 + x)))
}*)

We can verify the basis functions are orthogonal as follows:
(* all six pairs of the 4 basis functions are orthogonal *)
Integrate[#[[1]]*#[[2]]*(wnormed /. {a -> 0.99985, b -> 0.00015}) , {x, -∞, ∞}] & /@ Subsets[basis, {2}]

(* result: {0., 0., 0., 0., 0., 0.} *)


text:
Q: Send notification to specific user based on their location The scenario is like that " i have a system let's say it has 10 users.
And the 10th - i have his location in my database - have made an event in the mobile app.
i want to send a notification to any user in my system within 10km near the 10th user saying "the 10th user have made an event"
What is the best way to implement this scenario ?!
I have read the azure notification hub but couldn't fully understand it.
Note:
I'm have .net core 3.1/ signal-R on the backend
And flutter on the mobile.
And the backend is published on Azure.


text:
Q: MVC pass model from controller to view getting something wrong Hi I am getting something wrong when trying to pass my model from the controller to the view and i m not certain what it is:
Controller (StatsController):
  [AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)]
    public ActionResult InterStats(int manufacturerId, int countryId, DateTime startDate, DateTime endDate)
    {

        //Get all manufacturerwidgets for manufacturer
        var manufacturerWidget = _manufacturerWidgetsRepository.GetManufacturerWidgetByManufacturerAndCountry(manufacturerId, countryId);
        var interReportJson = new InterReportJson();
        var interRecordList = new List<InterRecord>(); // a list of my anonymous type without the relationships
        interReportJson.InterRecordList = new List<InterRecord>();
        var count = 1;
        foreach (var mw in manufacturerWidget)
        {
            var widgetName = mw.Description;

            //Get the product stats data
            var imps = _productStatsRepository.GetSumImpressionsProductStatsForManufacturerCountryDate(
                mw.Id, countryId, startDate, endDate);

            var clicks = _productStatsRepository.GetSumClicksProductStatsForManufacturerCountryDate(
                mw.Id, countryId, startDate, endDate);

            float ctr = 0;
            if (imps != 0 && clicks != 0)
            {
                ctr = ((clicks / (float)imps) * 100);
            }

            //  Create the data for the report
            var interRecord = new InterRecord
            {
                WidgetName = widgetName,
                Impressions = imps,
                Interactions = clicks,
                Ctr = ctr,
                Count = count
            };

           interReportJson.InterRecordList.Add(interRecord);

            count++;
        }

        interReportJson.Counter = count;

        return PartialView(new InterReportJson());
    }

Partial View InterStats.ascx
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dashboard.e_taleiq.com.InterReportJson>" %>

I am getting an error on the  Model.InterRecordList as it thinks it is null - I have checked the controller and the model is being populated properly butby the time its reached the view it has lost all its vallues.
I'm sure I am missing something obvious but any help would be much appreciated!

A: It appears you are accidentally creating a new object:
PartialView(new InterReportJson());

You probably mean to use the existing one: PartialView(interReportJson);


text:
Q: Detect blocked camera react js Hi I need to detect that camera/webcam is blocked. I achieved on doing that, but the problem is that it will detect it after the second open not the first time I click block. I'm using scandit-sdk-react for the camera scanner.
My Scenario and what I'm trying to achieve :

*

*When I open scanner, the browser will ask to allow/block camera

*If I hit the block FROM THE FIRST TIME it will appear custom blocked popup

What I achieved is like below:
I open scanner for first time, and choose block

I close the scanner, then open it again

Here is the code:
const [cameraDenied, setCameraDenied] = useState(false);
const checkCameraDenied = async () => {
  try {
    const PermissionStatus = await navigator.permissions.query({
      name: "camera",
    });

    if (PermissionStatus.state === "denied") {
     setCameraDenied(true);
    }
   } catch (error) {
    console.log(error);
   }
};

useEffect(() => {
   checkCameraDenied();
}, []);

return (
  <>
    {cameraDenied && (
       <Modal type="cameraDenied" setShowModal={closeScanner} />
    )}
   </>
 )


text:
Q: Redirecting one directory to another I am working on a mod script in Python for a legacy game. This game looks for the folder "AI" in its installation directory. Now, everytime before the game runs, a certain folder is chosen (say, AI_1 or AI_2), which should behave as if it is the AI folder (the actual AI folder doesn't exist).
I thought of a few solutions:

*

*Temporary rename AI_1 to AI, run the game and rename back.

*Create a symbolic pointing to AI_1 with the name AI.

Now both options are not looking optimal to me, because 1 is "dirty", and if the script exits unexpectedly it leaves behind trash, and 2 is hard to do on Windows. I have looked at NTFS junctions, but some users of this game run it from a FAT usb-stick and I don't want to leave them in the cold.
What is the best way to do this?

A: Why don't you have the folder(s) zipped & unzip the folder when ever the game loads (into temp folder), from there things would be simpler. since the data is in temp, you can delete the information when the program exits or let windows  clean it up.
this suggestion would work if the folder size is relatively small (a few MB's).

A: I think that option with renaming is fine. To workaround a situation when scrip is terminated unexpectedly put an additional file with original folder name to all of the AI_x folders. Then on startup just check this file in AI folder and rename the folder back to its original name.
Another variant is to add only one file to the game folder where an original name of the folder that is currently renamed to AI will be stored.


text:
Q: Android Checkboxs with ListView This is a tough situation to explain. I have a main activity that has actionbar tabs to cycle through different fragments. The first tabbed fragment that gets loaded has a listview that can scroll with checkboxes. What happens is when you first run the app, if you click on a checkbox, it doesnt check. However if you click on another tab and then click back everything works correctly.
I've looked at a lot of other situations where people havent had checkboxes work with scroll views and i've implemented their solution so i would consider my situation fixed as well due to the fact it works when you after you tab over.
Any thoughts as to why it would work the first time the view gets loaded? I know its a difficult question to ask and i dont think posting code would really help. Thanks guys.
Edit:
Here is the onCheckedChangedListener
public OnCheckedChangeListener checkboxContactsCallback = new OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        if(isChecked) {
            System.out.println("Checkbox checked");
            objects.getContactList().getContactList().get((Integer)buttonView.getTag(R.string.position)).setCheckbox(true);
            if(keyStoreContacts.getPublicKeyStore().size() == 0) {
                LinearLayout layout = (LinearLayout) rootView.findViewById(R.id.contactsWrapperLayout);
                layout.addView(helpers.getInterfaceHelper().createDynamicButton("Delete Contact", checkboxButtonListener));
            }
            keyStoreContacts.addPublicKey((String)buttonView.getTag(R.string.publickey));
        }
        else if(!isChecked) {
            System.out.println("Checkbox unchecked");
            objects.getContactList().getContactList().get((Integer)buttonView.getTag(R.string.position)).setCheckbox(false);
            if(keyStoreContacts.getPublicKeyStore().size() <= 1) {
                LinearLayout layout = (LinearLayout) rootView.findViewById(R.id.contactsWrapperLayout);
                LinearLayout layout2 = (LinearLayout)layout.findViewById(1);
                layout.removeView(layout2);
            }
            keyStoreContacts.removePublicKey((String)buttonView.getTag(R.string.publickey));
        }
    }
};

Here is the getView method in my array adapter
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) act.getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View rowView = inflater.inflate(R.layout.inflatable_contact_view, parent, false);
    TextView textView = (TextView) rowView.findViewById(R.id.inflate_textview);
    CheckBox checkbox = (CheckBox)rowView.findViewById(R.id.checkbox);
    System.out.println("Setting the checkbox " + objects.getContactList().getContactList().get(position).getIsChecked());
    checkbox.setChecked(objects.getContactList().getContactList().get(position).getIsChecked());
    checkbox.setOnCheckedChangeListener(callback.getCheckboxListener());
    checkbox.setTag(R.string.publickey, objects.getContactList().getContactList().get(position).getPublicKey());
    checkbox.setTag(R.string.position, position);
    textView.setText(objects.getContactList().getContactList().get(position).getDisplayName());
    PublicKeyStore keyStore = new PublicKeyStore();
    keyStore.addPublicKey(objects.getContactList().getContactList().get(position).getPublicKey());
    contact.setTag(keyStore);
    return rowView;
}

A: Simply replace you OnCheckedChangeListener with View.OnClickListener to look like this
            checkBox.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {

                    Checkable checkable = (Checkable) v;
                    if (checkable.isChecked()) {
                    } else {
                    }
                }
            });


text:
Q: How to remove decimal points in pandas I have a pandas data frame, df, which looks like this:
Cut-off             <=35   >35
Calcium              0.0   1.0
Copper               1.0   0.0
Helium               0.0   8.0
Hydrogen             0.0   1.0

How can I remove the decimal point so that the data frame looks like this:
Cut-off             <= 35  > 35
Calcium              0     1
Copper               1     0
Helium               0     8
Hydrogen             0     1

I have tried df.round(0) without success.

A: You have a few options...
1) convert everything to integers.
df.astype(int)
          <=35  >35
Cut-off
Calcium      0    1
Copper       1    0
Helium       0    8
Hydrogen     0    1

2) Use round:
>>> df.round()
          <=35  >35
Cut-off
Calcium      0    1
Copper       1    0
Helium       0    8
Hydrogen     0    1

but not always great...
>>> (df - .2).round()
          <=35  >35
Cut-off
Calcium     -0    1
Copper       1   -0
Helium      -0    8
Hydrogen    -0    1

3) Change your display precision option in Pandas.
pd.set_option('precision', 0)

>>> df
          <=35  >35
Cut-off
Calcium      0    1
Copper       1    0
Helium       0    8
Hydrogen     0    1

A: You can alternatively use this code as well if you do not want decimals at all:
df['col'] = df['col'].astype(str).apply(lambda x: x.replace('.0',''))

A: Since pandas 0.17.1 you can set the displayed numerical precision by modifying the style of the particular data frame rather than setting the global option:
import pandas as pd
import numpy as np

np.random.seed(24)
df = pd.DataFrame(np.random.randn(5, 3), columns=list('ABC'))
df

df.style.set_precision(2)

It is also possible to apply column specific styles
df.style.format({
    'A': '{:,.1f}'.format,
    'B': '{:,.3f}'.format,
})


text:
Q: Is there a function to test if objects match other objects? I have an object like this but more complex:
var obj =
{
  a: foo,
  b: bar,
  sub:{
    a: foz
    }
}

and then I have a conditionals based on the keys and values, for example:
{
  a: ^f,
  sub:{
     a: z$
  }
}

Is there a method for checking the conditionals are true for all of the objects properties. I'm also fine with chome-only-features or something like underscore. I can also re-structure the structure of my conditionals.

A: Probably you can use deepEqual() or modify it to your needs

var deepTest = function (x, y) {
  if ((typeof x == "object" && x != null) && (typeof y == "object" && y != null)) {
    if (Object.keys(x).length != Object.keys(y).length)
      return false;

    for (var prop in x) {
      if (y.hasOwnProperty(prop))
      {
        if (! deepEqual(x[prop], y[prop]))
          return false;
      }
      else
        return false;
    }

    return true;
  }
  else if(x && (typeof y != "undefined")) return true; else return false;
}

document.write(deepEqual({a:{b:true}},{a:{c:1}}),'
');
document.write(deepEqual({a:{b:true}},{a:{b:1}}),'
');
document.write(deepEqual({a:{b:false}},{a:{c:1}}),'
');
document.write(deepEqual({a:{b:false}},{a:{b:1}}),'
');
document.write(deepEqual(true,true),'
');
document.write(deepEqual(true,false),'
');
document.write(deepEqual(false,false),'
');
document.write(deepEqual(false,false),'
');
document.write(deepEqual([true],[1]),'
');
document.write(deepEqual([true],[]),'
');
document.write(deepEqual([true],[]),'
');
document.write(deepEqual([true,true],[]),'
');
document.write(deepEqual([true,true],[1,2]),'
');


text:
Q: TOR Network: How to Prevent IP Change on each Website In Tor I am having trouble because each time I change the site address the IP changes as well. It there a way to have it use the same address for like a 10 minute interval?

A: Tor already does this automatically... https://www.torproject.org/about/overview
You can tweak it by using the NewCircuitPeriod and MaxCircuitDirtiness parameters.
Alternatively, you can force it with StrictExitNodes and ExitNodes parameters... but be aware of the security implication of always leaving from the same exit!


text:
Q: Key command to restart google app engine dev server in eclipse? I'm using app engine with java, developing in eclipse. Is there a way to bind restart of the server to a key? Something like ctrl+r will shut down and restart the server? Right now I terminate it manually, then need to restart it via all the context menus, it's eating a few seconds per restart,
Thanks

A: If the command is selectable in Window->Preferences->General->Keys you can assign a keybinding to it.


text:
Q: How can I append Face Encodings of numpy.ndarray into List Object using python I am loading images into all_images variable and later I'm saving it into all_encodings to use it later in my code, check the code below:
all_images = glob.glob('images/*.jpg')

all_encodings = []

for images in all_images:
    image = fr.load_image_file(images)
    face_encode = fr.face_encodings(image)[0]

    print(face_encode)
    all_encodings = list(face_encode)
    all_encodings = list.append(face_encode)

print(all_encodings)

But it is throwing below error

TypeError: descriptor 'append' requires a 'list' object but received a 'numpy.ndarray'..

Please give me the precise answer to my question. Thanks in Advance.

A: You are overwriting all_encodings in each iteration, guess you'd want:
all_images = glob.glob('images/*.jpg')

all_encodings = []

for images in all_images:
    image = fr.load_image_file(images)
    face_encode = fr.face_encodings(image)[0]

    print(face_encode)
    all_encodings.append(list(face_encode))

print(all_encodings)


text:
Q: QGIS - Adding data from a raster into existing different sized polygons I have a raster layer with 100x100 pixel size that contains expected soil subsidence (calculated) and a polygon layer with smaller polygons that contains the measured data. I want to add the calculated data from my raster to each of the road segment polygons. As you can see in the image the polygons don't neatly fall into the raster pixels.
Ideally i would like the raster value that gets added to each polygon to be an average calculated over how much of the polygon area falls into each raster pixel.

A: You should be able to achieve this using the Raster Statistics for Polygons Tool. Found under SAGA > Features - Features-Raster Tools.
Your calculated grid layer will be selected under Grids and your measured polygon layer will be selected for Polygons. For Method I think you will want to select [3] polygon wise (cell area weighted).
This tool will generate a new polygon file which contains your selected statistics. Make sure you tick Mean, along with any other statistics you may be interested in.

A: I ended up using the regular "Zonal Statistics" algorithm. Turns out i made a mistake in the coordinate reference system which is why it didn't work at first.


text:
Q: HTML CSS Drop Down Menu I have a react website that has a custom drop down menu in it that I am doing for a bootcamp.  It is supposed to look like the yelp reviews section.  The menu almost works correctly but when it drops down the items the whole top section resizes itself to display the menu instead of just displaying the drop down menu on top of what is already there.  I tried display, zindex, positioning absolute and relative css but nothing seems to work. Can someone please help me with this?
The github repo for this is https://github.com/hrsf93-welp/welp-review but does not contain the mongo db data.


text:
Q: auto update my database when a entity changes Im using Spring for a web app and using anotations to define columns but when i change a column type that change is not reflected to my database.
Example:
  @Column(name = "detail")
  private String detail;

Changes to:
  @Column(name = "detail")
  private int detail;

My app.propierties:
spring.datasource.url = jdbc:mysql://localhost:3306/exampleapp
spring.datasource.username = root
spring.datasource.password = root
spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1
spring.jpa.show-sql = true
spring.jpa.hibernate.ddl-auto = update
spring.jpa.properties.hibernate.dialect =       org.hibernate.dialect.MySQL5Dialect

A: You need to add the following property. This will update your scheme when you run your application.
spring.jpa.hibernate.ddl-auto = update


text:
Q: Save String and Import at Later Date I'm having a problem with determining how I can save text that users enter into Textboxes and then retrieve that information later on specific dates. For example:
Day 1:
firstNametextbox.text = "John"
lastNametextbox.text = "Smith"

Day 2:
firstNametextbox.text = "Jim"
lastNametextbox.text = "Smith"

Day 3:
firstNametextbox.text = "Jacob"
lastNametextbox.text = "Smith"

On the fourth day I'd like the user to click a button and return just the results from Day 1, on the fifth day return the results from Day 1 and Day 2, etc.
I tried allowing the user to assign a date to the Day using a DateTimePicker and then checking to see if three days had passed. I also tried messing around with the Application Settings so that I could save information but it didn't seem very efficient. Any advice would be greatly appreciated.

A: I would use the AppSettings Container for it. You can just save the date in a key and every time you open the application you can retrieve it easily.
 ApplicationDataContainer AppSettings = ApplicationData.Current.LocalSettings;

            if(date1 == true && AppSettings.Values.ContainsKey("Name1") )
            {
                IsSoundOn = AppSettings.Values["Name1"].ToString();
            }


text:
Q: Uploading enormous amount of data to MySQL server I have to upload about 16 million records to a MySQL 5.1 server on a shared webspace which does not permit LOAD DATA functionality. The table is an Innodb table. I have not assigned any keys yet.
Therefore, I use a Python script to convert my CSV file (of 2.5 GB of size) to an SQL file with individual INSERT statements. I've launched the SQL file, and the process is incredibly slow, it feels like 1000-1500 lines are processed every minute!
In the meantime, I read about bulk inserts, but did not find any reliable source telling how many records one insert statement can have. Do you know?
Is it an advantage to have no keys and add them later?
Would a transaction around all the insert help speed up the process? In fact, there's just a single connection (mine) working with the database at this time.

A: If you use insert ... values ... syntax to insert multiple rows running a single request your query size is limited by max_allowed_packet value rather than by number of rows.
Concerning keys: it's a good practice to define keys before any data manipulations. Actually, when you build a model you must think of keys, relations, indexes etc.
It's better do define indexes before you insert data as well. CREATE INDEX works quite slowly on huge datasets. But postponing indexes creation is not a huge disadvantage.
To make your inserts faster try to turn autocommit mode on and do not run concurrent requests on your tables.


text:
Q: concatenating strings and snprintf in c I'm wondering if this is the proper way to concatenate and NUL terminate strings including width.
#define FOO "foo"
const char *bar = "bar";
int n = 10;
float f = 10.2;

char *s;
int l;

l = snprintf (NULL, 0, "%-6s %-10s %4d %4f",FOO, bar, n, f);
s = malloc (l + 4); // should it be the number of formats tags?
if (s == null) return 1;
sprintf (s, "%-6s %-10s %4d %4f", FOO, bar, n, f);

A: Quite a few systems have a function asprintf in their standard C libraries that does exactly what you do here: allocate and sprintf.

A: You only need to add 1 to the value returned by snprintf(), since there is only one null terminator added.
However, you do need to check for l == -1 (indicating that snprintf() failed).


text:
Q: Measuring Only Page Faults That Reach the Disk I would like to measure "truly" hard page faults, i.e. page faults that result in a disk IO.
It looks as if Memory\Page Reads/sec might do the trick, but as was explained in this answer, the page reads value includes reads that are satisfied from the file system cache, never reaching the disk. That seems to be the reason why the count of Page Reads/sec is consistently higher than the actual disk IOPS as measured by the counter Physical Disk\Disk Reads/sec.
My question is: How can I measure the number of read and write page faults per second reaching the disk?

A: It's been a year and no one's answered this. While I'm not expert on the subject of MS windows by any means, I believe you may want to look at "\Memory\Pages Input/sec" and "\Memory\Pages Output/sec". Microsoft has long descriptions of these values via their PDH library. Some are described here. You can search that page for "hard fault", but you won't find exactly what you're looking for (only hard faults) Here's a paste of their description of "Memory\Pages Input/Sec" which may be of help, YMMV:

Pages Input/sec is the rate at which pages are read from disk to
  resolve hard page faults. Hard page faults occur when a process refers
  to a page in virtual memory that is not in its working set or
  elsewhere in physical memory, and must be retrieved from disk. When a
  page is faulted, the system tries to read multiple contiguous pages
  into memory to maximize the benefit of the read operation. Compare the
  value of Memory\Pages Input/sec to the value of  Memory\Page
  Reads/sec to determine the average number of pages read into memory
  during each read operation.

An I should add, in Windows 8 and up, you can poll these values from the powershell command line with the Get-Counter command, e.g. Get-Counter -Counter "\Memory\Pages Input/sec"


text:
Q: How to make Input.GetAxis("Mouse X") get a value even when the mouse is stopped? I'm controlling a game object using my mouse horizontally. The object moves left or right depending on the mouse position but as soon as the mouse stops moving the object stops too. What I want is if I drag the mouse to the right side of the screen and stop moving the mouse, then I want the object to move to the right as long as the mouse is in the right half of the screen and vice versa. Currently Input.GetAxis("Mouse X"); returns a 0 value when stopped. Here's the code:
float horizontalInput = Input.GetAxis("Mouse X");
I've already tried using this fix but I don't get the desired result as im using mousebuttondown to move my player in the forward direction.
if (Input.GetMouseButton(0) && (horizontalInput == 0f))
{
    if (Input.mousePosition.x < Screen.width / 2)
    {
        horizontalInput = -1f;
    }
    else if (Input.mousePosition.x > Screen.width / 2)
    {
        horizontalInput = 1f;
    }
}

Is there any other way I can achieve this? Thank you so much for your time!
I fixed it by tweaking the above if conditions to this!
if (Input.GetMouseButton(0))
{
    if (Input.mousePosition.x < Screen.width / 2 && (horizontalInput < 0f))
    {
        horizontalInput = -1f;
    }
    if (Input.mousePosition.x > Screen.width / 2 && (horizontalInput > 0f))
    {
        horizontalInput = 1f;
    }
}

A: Just check horizontalInput while is not 0 and store the last position each time (just override it each times).
When it's 0 check the last stored position and if it's on the right side continue to move the object until the horizontalInput is 0 or you reach the screen edge.
Of course in the Update you don't even need to loop with a while, you just need to check if horizontalInput is 0 or is not 0.
something like this:
float horizontalInput = Input.GetAxis("Mouse X");
float lastPos = 0f;
if(horizontalInput  != 0){
  //move object with the mouse the code you currently use
  lastPos = Input.mousePosition.x;
}else if(horizontalInput == 0 && !EndOfScreen(currentObjectPos.x) && RighLeftScreen(lastPos)){
  Move();
}

of course this is just pseudocode. You will need to write a function to know if EndOfScreen right of left, you will need to know if you are on the right or left side of the screen (RighLeftScreen method) and finally you need to move your object Left or Right to the end of the screen.
This is just the basic idea.


text:
Q: Mod Rewrite Optional Parameters I have a fairly complex set of rewrite rules to give my site pages pretty URLs. Right now to deal with paging of search results I'm using 2 rewrite rules:
RewriteRule ^search/([0-9]+)$ /cgi-bin/search.pl?page=$1 [NC,L,QSA]
RewriteRule ^search$ /cgi-bin/search.pl [NC,L,QSA]

These handle URLs such as:
http://example.com/search
http://example.com/search/2
http://example.com/search/1000

I'm wondering how to combine these into 1 rewrite rule so that the search.pl script is called correctly and only passed the page parameter if a page is specified. I know it's a pretty basic question but I can't seem to find the answer anywhere. Thanks for your help!

A: You could do something like this:
RewriteCond page=$2 ^page=.+|
RewriteRule ^search(/([0-9]+))?$ /cgi-bin/search.pl?%0 [NC,L,QSA]

But that's not really nicer, is it?

Edit    Or if you're fine with an empty page value:
RewriteRule ^search(/([0-9]+))?$ /cgi-bin/search.pl?page=$2 [NC,L,QSA]

A: You could use rewritemap with a small external script which maps non-empty to ?page=$1 and empty to empty. I would suggest sticking with what you've got.


text:
Q: why does my C++ morse code translator crash if numbers are entered? Hello I am programming a C++ mores code translator that allows me to translate english text to morse code i have nearly accomplished this the problem I am having is that when a number or special character is entered the program chrashes if anyone can help with this and show me how do it thank you i looked online but many poeple have this problem with no concrete awnser.
The second problom i am having is that  my teacher doesn't want me to use string toMorse (string, string[]); but instead wants me to use string toMorse(char); for the function which doesn't really make sense to me as char would only allow for a single character wouldn't it so the final question is how would i use char instead of string string and still keep it to where i can enter a line of text and it would still out put a line of mores code and if a full line isn't possible how would i do it even with only the single character sorry this is an online class and as you can see im still very new to coding (sorry i am very new and all the help is will be appreciated also i tried using map but as i never used them before i didn't know what i was doing)
also sorry but the enter codeisnt really working from the phone im using
 but this is my code
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
string toMorse (string, string[]);

int main ()
{
string morse[39] = {"--..--", ".-.-.-", "..--..","-----", ".----",  "..---", "...--", "....-", ". ...", "-....", "--...", "---..", "----.", ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--.."};
string text;

    cout << "Please enter a character, word or phrase to translate from english to morse code \n";
    getline(cin,text);
    cout << "Your text \n" << text << endl;
    cout << "Here it is in morse code \n " << toMorse(text, morse) << endl;
return 0;
}

string toMorse (string text, string morse[])
{
int textlength = text.length();
string morseCodeValue;
string sL= " ";
string sW = "  ";
for (int index = 0; index < textlength; index++)
{
    if (text[index]!= ' ')
    {   text[index]=toupper(text[index]);
        morseCodeValue=sL+=morse[text[index]-'A']+" ";
    }
    if (text[index]==' ')
    {
        sL+=sW;
    }
}
return morseCodeValue;
}

Here is the edited version
#include <iostream>
#include <string>

using namespace std;

const int morse_size = 39;
const string morse[morse_size] =
{
".-","-...","-.-.","-..",".","..-.","--.","....","..",".---",
"-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-",
"..-","...-",".--","-..-","-.--","--..","-----",".----",
"..---","...--","....-",".....","-....","--...","---..","----."
};
string toMorse (char);

int main ()
{

string text, coded_text;

cout << "Please enter a character, word or phrase to translate from english to morse code \n";

getline(cin,text);
cout << "Your text \n" << text << endl;

for(int i = 0; i < text.length(); i++ )
{
    coded_text += toMorse(text[i]) + ' ';
}

cout << "Here it is in morse code \n " << coded_text << endl;

return 0;
}

string toMorse (char aCharacter)
{
return  morse[ tolower(aCharacter) - 'a'];;
}


text:
Q: How to control cycle2? friends there is something that I want to do for a week with cycle 2 slideshow plugin but I failed every time let me tell you What I want to do I'm trying to do categorized slideshow.I have filters on my cycle2 carousel (you will see on example)
I have 3 categories (or more than 3)

Sports

Naturel

Animals

and my each li has an id
id#sports,id#naturel,id#animals,id#blabla..

at the same time my image has data-id attribute
data-id="sports",data-id="naturel",data-id="animals",data-id="blabla.."

and at this point I can not do what I want to do.
if I click li#sports than only data-id="sports" img must be appear on slideshow with thumbnail
or if I click li#animals than only data-id="animals" img must be appear on slideshow with thumbnail
I try with jquery but nothing happend
and please click to see my little project on codepen

$(document).ready(function() {

  $(".filter li").on("click", function() {
    var activeId = $(this).attr("id");

    $("img[data-id]").hide();
    $("img[data-id = '" + activeId + "']").show();
  });
});
.single-gallery{
  width:800px;
  overflow:hidden;
  position:relative;
}
.cycle-slideshow img {
  width:100%;
  height:234px;
  max-width:100%;
}

#single-pager a img {
  width: 49.3px !important;
  height:49.3px !important;
  border: 1px solid #fff;
}

#single-pager a.cycle-pager-active img {
  opacity: 0.4;
}

#single-left,
#single-right {
  position: absolute;
  top: 50%;
  z-index: 1000;
  background: rgba(255, 255, 255, .8);
  padding: 12px;
  cursor: pointer;
}

#single-left {
  left: 0;
}

#single-right {
  right: 0;
}

.filter {
  position: absolute;
  z-index: 1000;
  right: 0;
  top:0;
  padding: 0;
  color: #FFF;
  background: rgba(255, 255, 255, 0.6);
  padding: 10px 30px;
}

.filter li {
  list-style-type:none;
  cursor: pointer;
  display: inline-block;
  background: rgba(0, 0, 0, .6);
  padding: 5px;
}

  <div class="cycle-slideshow" data-cycle-pager="#single-pager" data-cycle-pager-template="" data-cycle-prev="#single-left" data-cycle-next="#single-right" data-cycle-pause-on-hover="true">

    Prev
    Next

Sports

Naturel

Animals

A: Even though you are setting display: none on the elements you want hidden (using .hide()) the plugin is still setting them to display: block because when you initialize the slider they are all eligible slides.
There doesn't seem to be a very easy way of dynamically removing/adding slides on the fly.
The approach I took was setting data-hidden="true" on the slides you want hidden, then re-initializing the slider to only use images that match img[data-hidden="false"] as slides.
I added the code below to your css so that the hidden slides don't show up below the slideshow.
img[data-hidden="true"]{
  display: none;
}

I also took all the other data- attributes in the cycle div, and renamed its class to mySlideShow so I could render the cycle when I needed using the $('.mySlideShow').cycle({...}) method.
Here should be a working example: http://codepen.io/anon/pen/dvoLeE


text:
Q: Centinel API endpoint URL is not configured properly. Magento 1.8 exception When I am using the the saved CC payment method im magnento 1.8.1 it's throwing this exception.
exception 'Exception' with message 'Centinel API endpoint URL is not configured properly.' in app/code/core/Mage/Centinel/Model/Api.php:185

Please let me know what is this error and why I am getting this.

A: This may be late to answer, but could be helpful to someone else.
Try disabling the "3D Secure Card Validation" while using test credit card methods in Magento. It should cure the exception and remove any errors on frontend.

A: In my case I had Paypal Payflow Pro enabled in the Test mode in Magento admin with 3D Secure Card Validation set to Yes.
When I set the 3D Secure Card Validation to No the problem solved.


text:
Q: Code to import data from a Stack overflow query into R When I try to answer a question in Stack Overflow about R, a good part of my time is spent trying to rebuild the data given as example (unless the question author has been nice enough to provide them as R code).
So my question is, if somebody just asks a question and gives his sample data frame the following way :
a  b   c
1 11 foo
2 12 bar
3 13 baz
4 14 bar
5 15 foo

Do you have a tip or a function to import this easily into an R session, without having to type the entire data.frame() instruction ?
Thanks in advance for any hint !
PS : sorry if the term "query" is not really nice in my question title, but it seems you can't use the word "question" in a question title in Stack overflow :-)

A: Just want to add this because I now use it regularly and I think it's quite useful.  There is a package overflow (install instructions below) that has a function to read copied data frames. Say I begin with an SO post that contains the data shown as the following, but with no dput output.
  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1          5.1         3.5          1.4         0.2  setosa
2          4.9         3.0          1.4         0.2  setosa
3          4.7         3.2          1.3         0.2  setosa
4          4.6         3.1          1.5         0.2  setosa
5          5.0         3.6          1.4         0.2  setosa
6          5.4         3.9          1.7         0.4  setosa

Now if I copy that data directly, and then run the following
library(overflow)
soread()
# data.frame "mydf" created in your workspace
#   Sepal.Length Sepal.Width Petal.Length Petal.Width Species
# 1          5.1         3.5          1.4         0.2  setosa
# 2          4.9         3.0          1.4         0.2  setosa
# 3          4.7         3.2          1.3         0.2  setosa
# 4          4.6         3.1          1.5         0.2  setosa
# 5          5.0         3.6          1.4         0.2  setosa
# 6          5.4         3.9          1.7         0.4  setosa

I now have a data frame named mydf identical to the one I copied in my global environment, so I don't have to wait for the OP to post a dput of their data frame.  I can change the name of the data frame with the out argument, which (obviously) defaults to mydf.  There are also a few other useful functions for working with SO posts in the package (like sopkgs(), which installs a package temporarily so you can help with a question about a package that you have not previously installed).
If you leave library(overflow) in your .Rprofile, then soread() makes pretty quick work of importing data from SO posts.
overflow is available from GitHub, and can be installed with
library(devtools)
install_github("overflow", "sebastian-c")

A: Maybe textConnection() is what you want here:
R> zz <- read.table(textConnection("a  b   c
1 11 foo
2 12 bar
3 13 baz
4 14 bar
5 15 foo"), header=TRUE)
R> zz
  a  b   c
1 1 11 foo
2 2 12 bar
3 3 13 baz
4 4 14 bar
5 5 15 foo
R>

It allows you to treat the text as a "connection" from which to read.  You can also just copy and paste, but access from the clipboard is more dependent on the operating system and hence less portable.

A: Recent version of R now offer an even lower keystroke option than the textConnection route for entry of columnar data into read.table and friends. faced with this:
zz
  a  b   c
1 1 11 foo
2 2 12 bar
3 3 13 baz
4 4 14 bar
5 5 15 foo

One can simply insert : <- read.table(text=" after the zz, delete the carriage-return and then insert ", header=TRUE) after the last foo and type [enter].
zz<- read.table(text="  a  b   c
1 1 11 foo
2 2 12 bar
3 3 13 baz
4 4 14 bar
5 5 15 foo", header=TRUE)

One can also use scan to efficiently enter long sequences of pure numbers or pure character vector entries. Faced with: 67  75  44  25  99  37   6  96  77  21  31  41   5  52  13  46  14  70 100  18 , one can simply type: zz <- scan() and hit [enter]. Then paste the selected numbers and hit [enter] again and perhaps a second time to cause a double carriage-return and the console should respond "read 20 items".
> zz <- scan()
1: 67  75  44  25  99  37   6  96  77  21  31  41   5  52  13  46  14  70 100  18
21:
Read 20 items

The "character" task. after pasting to console and editing out extraneous line-feeds and adding quotes, then hitting [enter]:
> countries <- scan(what="character")
1:     'republic of congo'
2:     'republic of the congo'
3:     'congo, republic of the'
4:     'congo, republic'
5: 'democratic republic of the congo'
6: 'congo, democratic republic of the'
7: 'dem rep of the congo'
8:
Read 7 items

A: You can also ask the questioner to use the dput function which dumps any data structure in a way that can be just copy-pasted into R. e.g.
> zz
  a  b   c
1 1 11 foo
2 2 12 bar
3 3 13 baz
4 4 14 bar
5 5 15 foo

> dput(zz)
structure(list(a = 1:5, b = 11:15, c = structure(c(3L, 1L, 2L,
1L, 3L), .Label = c("bar", "baz", "foo"), class = "factor")), .Names = c("a",
"b", "c"), class = "data.frame", row.names = c(NA, -5L))

> xx <- structure(list(a = 1:5, b = 11:15, c = structure(c(3L, 1L, 2L,
+ 1L, 3L), .Label = c("bar", "baz", "foo"), class = "factor")), .Names = c("a",
+ "b", "c"), class = "data.frame", row.names = c(NA, -5L))
> xx
  a  b   c
1 1 11 foo
2 2 12 bar
3 3 13 baz
4 4 14 bar
5 5 15 foo


text:
Q: How to take an image from gallery I need to pick an image from the gallery of the phone in order to do some stuff with that.
For this purpose I tried to follow what is inside this android pick images from gallery thread but I think it's too old, probably I need to use the intent anyway but I don't understand how and how to pass the image picked to a bitmap variable.
Precisely I need to take an image and then convert it to bitmap and do other stuff (ml algorithms).
Thanks.


text:
Q: ROC curve: small focused sample vs large sample Background
I'm currently reading the book Data ming: practical machine learning tools and techniques and came across the following ROC curve:

The text corresponding to this figure:

Method  A  excels  if  a  small, focused sample is sought; that is, if
  you are working toward the left-hand side of  the  graph. Clearly, if
  you  aim  to  cover  just  40%  of  the  true  positives  you should
  choose method A, which gives a false positive rate of around 5%,
  rather than method B, which gives more than 20% false positives. But
  method B excels if you are planning a large sample: if you are
  covering 80% of the true positives, method  B  will  give  a  false
  positive  rate  of  60%  as  compared  with  method  A's 80%.

Question
How does a ROC curve relate to sample sizes? (in the context of the text mentioned above)

A: A ROC graph does not relate to sample size directly; small or large samples can have the same ROC graph. The methods (classifiers) used to create the ROCs have different performances and these performance characteristics can relate to the samples size of the results as a proportion of the overall sample examined.
What the author tries to convey is that the performance of method A is "preferable" if we aim detect a subsample of sample with true positives and we want to strongly limit our number of false positive instances (e.g. patients suggested to have an invasive medical procedure). Similarly, if we want to ensure that vast majority the true positive instances is detected (even to the expense of having a substantial number of false positives), method B would be preferable (e.g. patients who are suggested to take a relatively inexpensive screening test).
Different applications may require an exchange between high recall and high precision. As @Frank Harrell correctly notes, if we have a well-defined utility function we can use to maximise our expected utility. If we do not have one (as in the case of this arbitrary ROC graphs) we can pick a methodbased on an overall goal (e.g. medical diagnostics (method A) vs medical screening (method B)).


text:
Q: showings of a movie at different times of the day I know matinee refers to an afternoon showing of a movie.
How about morning, evening, and midnight showings? Any specific terms?

A: French:

*

*Matin = morning

*Midi = noon

*Soiree = evening

*Nuit = night

Apparently, a matinee is a show scheduled for the morning, but actually takes place past noon.
A Soiree would be a show scheduled for the evening but stretches into the night.
Since inebriated/hung-over show masters must have confused themselves as to when morning actually ends, more sober people must have had no other choice but to use the term morning matinee to emphasize that the morning "morning show" would actually take place in the morning rather than after noon.
Therefore, to concoct your own terms, in adherence to traditions

*

*midee for show scheduled at noon but actually shown early evening

*nuitee for show scheduled at bedtime but actually shown at midnight. People tend to use the term midnight matinee, which would actually "oxymoronically" mean midnight morning show.

Hence you now have a complete framework:

*

*morning matinee

*matinee

*midee

*soiree

*nuitee

A: Morning show = before noon or at morning
Matinee = past noon
1st show = evening
2nd show = at night ( Which ends at midnight )
Due to the large number of screens and showings in multiplexes, nowadays the cinemas only refer to the time of a show.


text:
Q: line break setting Question:
My question is in 3rd question second line is starting from left side. I want to move it to slightly right side, exactly below the first line. How can i do this?
MWE:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{parskip}
\usepackage{graphicx}
\usepackage[left=0.60in, right=0.60in, top=0.60in, bottom=0.60in]{geometry}
%\setlength{\parindent}{4em}
%\setlength{\parskip}{1em}
\renewcommand{\baselinestretch}{1.15}
\begin{document}
\textbf{Question:~ Choose the correct alternative (Explanation is not necessary) }

\textbf{(1)}~ Body of first question

\qquad(A)~\hfill(B)~\hfill(C)~\hfill(D)~

\textbf{(2)}~ Body of second question

\qquad(A)~\hfill(B)~\hfill(C)~\hfill(D)~

\textbf{(3)}~ Body of third question Body of third question Body of third question Body of third question Body of third question Body of third question

\qquad(A)~\hfill(B)~\hfill(C)~\hfill(D)~

\end{document}

A: Use a list.
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{parskip}
\usepackage{graphicx}
\usepackage[left=0.60in, right=0.60in, top=0.60in, bottom=0.60in]{geometry}
%\setlength{\parindent}{4em}
%\setlength{\parskip}{1em}
\renewcommand{\baselinestretch}{1.15}
\usepackage{enumitem}
\begin{document}
\textbf{Question:~ Choose the correct alternative (Explanation is not necessary) }

\begin{enumerate}[font=\bfseries]
\item  Body of first question

\qquad(A)~\hfill(B)~\hfill(C)~\hfill(D)~

\item Body of second question

\qquad(A)~\hfill(B)~\hfill(C)~\hfill(D)~

\item Body of third question Body of third question Body of third question Body of third question Body of third question Body of third question

\qquad(A)~\hfill(B)~\hfill(C)~\hfill(D)~

\end{enumerate}

\end{document}

A: It looks like you are writing an exam. This is a case for the exam document class, which can also provide useful features like automatic calculation of total points etc., so I recommend you check it out.
With the exam package, your code becomes:
\documentclass[12pt,a4paper]{exam} %note the new document class
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{parskip}
\usepackage{graphicx}
\usepackage[left=0.60in, right=0.60in, top=0.60in, bottom=0.60in]{geometry}
%\setlength{\parindent}{4em}
%\setlength{\parskip}{1em}
\renewcommand{\baselinestretch}{1.15}
\renewcommand{\choicelabel}{(\thechoice)} % brackets around choices
\renewcommand{\thequestion}{\textbf{\arabic{question}}} % bold question numbers

\begin{document}
Choose the correct alternative (Explanation is not necessary)
\begin{questions}

\question Body of first question

\begin{oneparchoices}
\choice{}
\choice{}
\choice{}
\choice{}
\end{oneparchoices}

\question Body of second question

\begin{oneparchoices}
\choice{}
\choice{}
\choice{}
\choice{}
\end{oneparchoices}

\question Body of third question Body of third question Body of third question Body of third question Body of third question Body of third question

\begin{oneparchoices}
\choice{}
\choice{}
\choice{}
\choice{}
\end{oneparchoices}

\end{questions}
\end{document}

You probably want to actually add text to the choices. Check section 5 of the exam package documentation.

A: I propose this, based on enumitem and tasks(for the horizontal enumeration):
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{parskip}
\usepackage{graphicx}
\usepackage[margin=0.60in]{geometry}
\usepackage{enumitem}
\usepackage{tasks}
\settasks{counter-format =(tsk[A]), label-width=1.5em, item-indent=0pt, column-sep=1em}

%\setlength{\parindent}{4em}
%\setlength{\parskip}{1em}
\renewcommand{\baselinestretch}{1.15}

\begin{document}
\textbf{Question:~ Choose the correct alternative (Explanation is not necessary) }

\begin{enumerate}[label=(\arabic*), font=\bfseries, wide=0pt, widest=(9), labelsep=-2pt, leftmargin=*]
\item Body of first question

\begin{tasks}(4)
  \task
  \task
  \task
  \task
\end{tasks}

\item Body of second question

\begin{tasks}(4)
  \task
  \task
  \task
  \task
\end{tasks}

\item Body of third question Body of third question Body of third question Body of third question Body of third question Body of third question

\begin{tasks}(4)
  \task
  \task
  \task
  \task
\end{tasks}

\end{enumerate}

\end{document}