text:
Q: Error in my jquery arrow menu animation I'm working on a project where i try to use a moving arrow navigation.
Now there is something wrong in my jquery.
The original of the arrow is not working but if i resize the window it does work.
So de window.resize function works, but the window.load doesn't.
i also tried to replace the window.load bij document.ready but that doesn't work to.
I hope someone can help me.
The site is online here: http://jesseu.nl/madein030/
JSfiddle: http://jsfiddle.net/dgLthkjy/
The HTML code is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <title>Made in 030</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="style.css" rel="stylesheet" media="all" type="text/css" />
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">

            <menu>

Home

Over

Probeerlijst

Contact

Shop

Blog

            </menu>

The Jquery code is:
$(window).load(function() {

window.setTimeout(function(){
    var bannerHeight = ($(".banner_image").height()+'px')
    $(".banner").css({'height': bannerHeight});
    console.log(bannerHeight);
}, 1);

var $el, leftPos, newWidth,
    $mainNav = $("menu ul");
var $magicLine = $("#magic-line");
var menuLinkWidth = $('menu ul li.active a').width() / (2);

$magicLine
    .width($("menu ul li.active").width())
    .css("left", $("menu ul li.active a").position().left)
    .data("origLeft", $magicLine.position().left)
    .data("origWidth", $magicLine.width());

$("menu ul li a").hover(function() {
    $el = $(this);
    leftPos = $el.position().left;
    newWidth = $el.parent().width();
    $magicLine.stop().animate({
        left: leftPos,
        width: newWidth
    },500);
}, function() {
    $magicLine.stop().animate({
        left: $magicLine.data("origLeft"),
        width: $magicLine.data("origWidth")
    },500);
});

var value = $('body').width() / (11);
$('menu ul li a').css('font-size',$('body').width()/85);
$('#magic-line').css('top',value - 9);

var outerHeight = $('menu ul li').height();
var innerHeight = $('menu ul li a').height();
$('menu ul li a').css('margin-top', (outerHeight - innerHeight)/2);

});

$(window).resize(function(){

var $el, leftPos, newWidth,
    $mainNav = $("menu ul");
var $magicLine = $("#magic-line");
$magicLine
    .width($("menu ul li.active").width())
    .css("left", $("menu ul li.active a").position().left)
    .data("origLeft", $magicLine.position().left)
    .data("origWidth", $magicLine.width());

$("menu ul li a").hover(function() {
    $el = $(this);
    leftPos = $el.position().left;
    newWidth = $el.parent().width();
    $magicLine.stop().animate({
        left: leftPos,
        width: newWidth
    },500);
}, function() {
    $magicLine.stop().animate({
        left: $magicLine.data("origLeft"),
        width: $magicLine.data("origWidth")
    },500);
});

var value = $('body').width() / (11);
$('menu ul li a').css('font-size',$('body').width()/85);
$('#magic-line').css('top',value - 9);

var BannerHeight = ($(".banner_image").height()+'px')
$(".banner").css({'height': BannerHeight});
console.log(BannerHeight);

var outerHeight = $('menu ul li').height();
var innerHeight = $('menu ul li a').height();
$('menu ul li a').css('margin-top', (outerHeight - innerHeight)/2);

});

The CSS code is:
#magic-line {
position: absolute;
left: 0;
height: 10px;
background-image:url(img/active.png);
background-repeat:no-repeat;
background-position:bottom center;
background-size:25px;
}

A: I solved it myself by changing:
$(window).load(function() {

to
onResize = function() {

and closing with
}
$(window).load('resize', onResize);
$(window).bind('resize', onResize);

this way i only had to write the code once, and the problem whas solved to.


text:
Q: Sort data from two delimited strings containing times with different formats I am looking for a way to combine multiple movie showtimes into a single string. The data we get from our source has a couple of instances of a specific movie playing at a specific theater on a specific day, but having two listings in the XML because the theater serves alcohol and is playing the movie in a regular theater and the boozy theater.
Here are two examples of movie showtime strings that we get from our data source:

*

*8:00, 10:30, 11:40 PM

*(11:20 AM), (4:40), 8:00, 11:40 PM

*

*()'s denote a matinee showing.

With those showtime strings, I need it to look like this:

*

*(11:20 AM), (4:40), 8:00, 10:30, 11:40 PM

I have no problem removing duplicates from the strings (8:00, for example), but I am struggling with how to best combine the strings into a single, cohesive unit.
Does anybody have any recommendations on how to do this in PHP? The server this needs to run on has 5.3.something
Edit - Code
I don't think this is going to make a whole bunch of sense, because it is part of a larger script I'm editing
//Make a unique key so we can check if a movie listing already exists for this combo
$showtimesKey = implode('_', array(
    (string)$currentShowTime->theater_id,
    (string)$currentShowTime->movie_id,
    (string)$currentListing['date']
));
if (!isset($justShowtimes[$showtimesKey])) {
    foreach (explode(", ", trim($currentListing->showtimes)) as $time) {
        $justShowtimes[$showtimesKey][$time] = $time;
    }
} else {
    $previousTimes = $justShowtimes[$showtimesKey];
    foreach (explode(", ", trim($currentListing->showtimes)) as $time) {
        $justShowtimes[$showtimesKey][$time] = $time;
    }
    natsort($justShowtimes[$showtimesKey]);
    //sort($justShowtimes[$showtimesKey], SORT_STRING);
    $currentListing->showtimes = $justShowtimes[$showtimesKey];
}

A: Maybe you could try something like this:
$string1 = "8:00, 10:30, 11:40 PM";
$string2 = "(11:20 AM), (4:40), 8:00, 11:40 PM ";

$fullString = $string1.",".$string2;
$splittedString = split(",",$fullString);

$times = array();
foreach($splittedString as $id=>$timeStr) {
        $timeStr = (strpos($timeStr,'('))?str_replace(array("(",")"),"",$timeStr)." -1 DAY":$timeStr;
        $time = strtotime($timeStr);
        $times[$time] = $splittedString[$id];
}

ksort($times);
$orderedString = implode(",",$times);
echo $orderedString ;

A: I ended up solving the issue this way, though it seems a bit cumbersome and over-engineered. But I couldn't come up with a good way to keep AM's, Matinee's, and regular PM showtimes in the correct order.
    $showtimesKey = implode('_', array(
        (string)$currentShowTime->theater_id,
        (string)$currentShowTime->movie_id,
        (string)$currentListing['date']
    ));
    if (!isset($justShowtimes[$showtimesKey])) {
        $justShowtimes[$showtimesKey] = (string) $currentListing->showtimes;
    } else {
        $previousTimes = $currentTimes = array();
        foreach (explode(", ", trim($justShowtimes[$showtimesKey])) as $time) {
            $previousTimes[$time] = $time;
        }
        foreach (explode(", ", trim($currentListing->showtimes)) as $time) {
            $currentTimes[$time] = $time;
        }
        //Just in case we need to get at unedited time arrays
        $original_times = array(
            'previous' => $previousTimes,
            'current' => $currentTimes
        );

        $am = array();
        $pm = array('matinee' => array(), 'full_price' => array());

        //Previous Times
        if ($position = strpos(implode(",", $previousTimes), "AM")) {
            $joined_times = implode(", ", $previousTimes);
            list($tmp_am, $tmp_pm) = explode(" AM)", $joined_times);
            $tmp_am = str_replace(array("(", ")"), '', $tmp_am);
            foreach (explode(", ", $tmp_am) as $time) {
                $am[$time] = $time;
            }

            //Set $previousTimes to only the PM times
            $previousTimes = array();
            foreach (explode(", ", $tmp_pm) as $time) {
                if (empty($time)) continue;
                $previousTimes[$time] = $time;
            }
        }

        foreach ($previousTimes as $time) {
            $time = str_replace(" PM", '', $time);
            if ((strpos($time, "(") !== false) || (strpos($time, ")") !== false)) {
                //We are removing the parentesis from the time so a) we can make sure we aren't duplicating any and b) so the array key is just the time
                $only_time = str_replace(array("(", ")"), '', $time);
                $pm['matinee'][$only_time] = $only_time;
            } else {
                $pm['full_price'][$time] = $time;
            }
        }

        //Current Times
        if ($position = strpos(implode(",", $currentTimes), "AM")) {
            $joined_times = implode(", ", $currentTimes);
            list($tmp_am, $tmp_pm) = explode(" AM)", $joined_times);
            $tmp_am = str_replace(array("(", ")"), '', $tmp_am);
            foreach (explode(", ", $tmp_am) as $time) {
                $am[$time] = $time;
            }

            //Set $currebtTimes to only the PM times
            $currentTimes = array();
            foreach (explode(", ", $tmp_pm) as $time) {
                if (empty($time)) continue;
                $currentTimes[$time] = $time;
            }
        }

        foreach ($currentTimes as $time) {
            $time = str_replace(" PM", '', $time);
            if ((strpos($time, "(") !== false) || (strpos($time, ")") !== false)) {
                //We are removing the parentesis from the time so a) we can make sure we aren't duplicating any and b) so the array key is just the time
                $only_time = str_replace(array("(", ")"), '', $time);
                $pm['matinee'][$only_time] = $only_time;
            } else {
                $pm['full_price'][$time] = $time;
            }
        }

        natsort($am); natsort($pm['matinee']); natsort($pm['full_price']);

        if (!empty($am)) {
            $last = end($am);
            $am[$last] .= " AM";
        }

        if (!empty($pm['full_price'])) {
            $last = end($pm['full_price']);
            $pm['full_price'][$last] .= " PM";
        } else {
            //Only try and tack PM onto the last matinee showing if there actually are matinee showings
            if (!empty($pm['matinee'])) {
                $last = end($pm['matinee']);
                $pm['matinee'][$last] .= " PM";
            }
        }

        foreach ($am as $key => $value) {
            $am[$key] = "(" . $value . ")";
        }
        foreach ($pm['matinee'] as $key => $value) {
            $pm['matinee'][$key] = "(" . $value . ")";
        }

        $justShowtimes[$showtimesKey] = '';
        if (!empty($am)) {
            $justShowtimes[$showtimesKey] = implode(", ", $am);
        }
        if (!empty($pm['matinee'])) {
            if (!empty($justShowtimes[$showtimesKey])) {
                $justShowtimes[$showtimesKey] .= ", ";
            }
            $justShowtimes[$showtimesKey] .= implode(", ", $pm['matinee']);
        }
        if (!empty($pm['full_price'])) {
            if (!empty($justShowtimes[$showtimesKey])) {
                $justShowtimes[$showtimesKey] .= ", ";
            }
            $justShowtimes[$showtimesKey] .= implode(", ", $pm['full_price']);
        }
        $currentListing->showtimes = $justShowtimes[$showtimesKey];
    }

A: *

*Concatenate the two strings with a comma-space as glue.

*Split the consolidated string on comma-spaces and remove duplicates.

*Populate a new array of timestamps (or datetime objects if you prefer) after standardizing the format of the time expression.  I am electing to trim any leading/trailing parentheses then padding the right-side of the string to a length of 8 with " PM" so that any time ambiguity defaults to after noon.

*Sort the times array by the sorting array and it's all done.

Code: (Demo)
$string1 = "8:00, 10:30, 11:40 PM";
$string2 = "(11:20 AM), (4:40), 8:00, 11:40 PM";

$times = array_unique(explode(', ', "$string1, $string2"));
$sorter = [];
foreach ($times as $time) {
    $sorter[] = strtotime(str_pad(trim($time, '()'), 8, " PM"));
}
array_multisort($sorter, $times);
var_export(implode(', ', $times));

Output:
'(11:20 AM), (4:40), 8:00, 10:30, 11:40 PM'

redpajama_set_name: RedPajamaStackExchange


text:
Q: sync android with google biz apps calender A buddy of mine got a new android phone (i use iphone so im a little new to it) but he can sync his gmail calender but not his google biz apps calender that we use for works.
is there any trick to getting it to sync with his phone so he can make edits and have them reflected in his "work" calender

A: Since Android v2.0 you can log into multiple Google accounts on your Android phone. So, if your friend's phone uses Android 2.0+ he can simply add a new account (his Google Apps one) to the calendar application (assuming he currently uses his personal account for the phone).
I myself have my personal and Google Apps calendars synced to my phone and everything works perfectly (I have a HTC Magic running CyanogenMod 6.0/Android 2.2).


text:
Q: Newbie - 1 vs 2 tailed test interpretations seem counter-intuitive How is it that a particular test statistic can
1) fail to reject the null hypothesis when the alternative is that the true value is not equal to the null value (two tailed test), yet
2) the same test statistic is sufficient to reject the null hypothesis in favour of the alternative that the true value is likely greater than the null value (a one tailed test)?
Intuitively, it would seem to me that it should be easier to argue that something is simply not equal  than to specify the direction of inequality, yet significance testing suggests the opposite is true! How do I rationalise this apparent contradiction?
When considering the example of measuring defect rates, in which we want to know simply whether defect rates have exceeded a threshold level or not, if evidence fails to suggest the defect rate has exceeded the threshold (null) value, I can see that the same evidence may  or may not actually suggest the opposite is true (that the true defect rate is actually significantly less than the threshold rate).... but....
I can't understand how of the evidence (test statistic) is sufficient to say with 95% confidence that the threshold has been exceeded (say p=0.04) that we can not also say with 95% confidence that the defect rate is not equal to the threshold value? It is what it is!
Should I think of it as if we are only testing the right half of the distribution, in which case, the critical value termed as "95%" is actually only 90% of the area under consideration? Or perhaps more correctly, that the area of rejection for that tail for a given confidence level is twice as large if one tailed?
Is it simply, fundamentally, a different statement to make a one tailed as opposed to two tailed assertion, and we must understand the confidence levels differently as a result?

A:
Q. How is it that a particular test statistic can 1) fail to reject the null hypothesis when the alternative is that the true value is not equal to the null value (two tailed test), yet 2) the same test statistic is sufficient to reject the null hypothesis in favour of the alternative that the true value is likely greater than the null value (a one tailed test)?

A. Because the P-value for a two-tailed test is larger than the P-value for
a properly framed one-tailed test. Here is an example using $n = 20$ normal
observations.
set.seed(714); x = rnorm(20, 203, 20);  mean(x)
## 208.8698

Two-sided test: We wish to test $H_0: \mu = 200$ vs $H_a: \mu \ne 200.$  The sample mean $\bar X = 208.9$ may seem quite a bit different from $\mu_0 = 200.$ The question is
whether the difference is significant at the 5% level. Results of a one-sample, two-sided t test from R statistical software show P-value $0.98 > .05,$ so the difference is not significant and we do not reject $H_0.$ The P-value is
$P(|T| > 1.7423) = 0.09762,$ where under $H_0$ the test statistic $T \sim
\mathsf{T}(19).$
t.test(x, mu=200)

        One Sample t-test

data:  x
t = 1.7423, df = 19, p-value = 0.09762
alternative hypothesis: true mean is not equal to 200
95 percent confidence interval:
 198.2147 219.5250
sample estimates:
mean of x
 208.8698

One-sided test: Now change the scenario: Suppose the reason for conducting the experiment
was that we suspected the true mean might exceed $200.$ We note that the sample mean is indeed larger than $200.$ So we test $H_0: \mu \le 200$ vs. $H_a: \mu > 200.$ Framing this as a one-tailed test, we are essentially saying that if
we had observed $\bar X < 200,$ then we would have said, "Well, that was pointless. Doesn't look as if $\mu > 200.$ What's the next experiment on our list?"
Using the same data as before, the one-sided t test has P-value about $0.049 < .05$ (just barely), and so we have suggestive evidence that the
true mean exceeds $200.$ Notice that the P-value is half as large as for
the two-sided test. Here, $P(T > 1.7423) = 0.04881,$ where the null distribution of the test statistic is $T \sim \mathsf{T}(19).$
t.test(x, mu=200, alt="greater")

        One Sample t-test

data:  x
t = 1.7423, df = 19, p-value = 0.04881
alternative hypothesis: true mean is greater than 200
95 percent confidence interval:
 200.0671      Inf
sample estimates:
mean of x
 208.8698

Q. Intuitively, it would seem to me that it should be easier to argue that something is simply not equal than to specify the direction of inequality, yet significance testing suggests the opposite is true! How do I rationalise this apparent contradiction?

A. Frequentist statisticians like to imagine that they bring no 'prior knowledge' to the analysis of an experiment. There is indeed prior knowledge affecting
the entire scenario. Someone had to figure out that $n = 20$ was about the right sample size. (This involves guessing the population SD $\sigma$ and deciding how big a difference is of practical importance.) Someone had to figure out how to do the measurements. (If they're
weights, then is measuring to be done on a laboratory balance, a postal scale, or a truck scale?) Also, by doing a t test we're assuming the population is normal. (Only
$n = 20$ observations is hardly enough for a conclusive Shapire-Wilk test.)
But even if you don't recognize these factors as 'prior knowledge', it certainly seems clear that stating ahead of time that we believe $\mu > 200$ (if there is any change) does
bring relevant information to the table. So if we're doing a one-sided test based on prior opinion about the situation, that information makes it easier to
make a decision that we have a significant result. [If we decided to do a one-tailed test only after seeing that $\bar X > 200,$ then we are cheating. It may be easy to rationalize, "I really knew all along: Of course if its
different, $\mu$ really has to be bigger," but this is still cheating.]
Finally, you mentioned confidence intervals in your Question: Notice that the
lower bound 200.5 of the one-sided 95% CI in the one-sided t procedure, is larger than the lower bound in the two-sided 95% CI $(198.2, 219.5).\,$ In the
one-sided procedure we've essentially decided values of $\mu < 200$ aren't of interest. Much of your last paragraph speaks to some of these points.

Addendum based on Comment:
Suppose you have a bent quarter and suspect it may be biased.
Not knowing much about bent coins, you test $H_0; p = 1/2$ vs.
$H_1: p \ne 1/2$ at the 5% level, where $p$ is the true Heads
probability of the quarter. You get $X = 113$ heads in $n = 200$
tosses. The exact P-value of the test is $2P(X \ge 114|p=1/2)=0.077,$ so you cannot reject $H_0$ that the coin is
fair. (If you prefer a normal approximation, the z-score is $1.84 < 1.96.)$
2*sum(dbinom(113:200, 200, .5))
[1] 0.07683763

Also, having seen the data, you cannot legitimately
claim the coin is biased in favor of Heads because you "really
meant" to test $H_0: p \le 1/2$ vs. $H_1: p > 1/2.$ (In this case, you could have rejected: P-value $0.0384 < 0.05$ and $1.84 > 1.645.)$
If you're adamant about bias, you might do another 200 tosses
of the coin to see if fresh data support rejection. It's
simple to do another 200 tosses and no one is stopping you.
By contrast, now suppose the experiment and test are a for a clinical trial whether a new new
drug for treating a virus is effective. If the protocol for
the trial calls for testing a two-sided hypothesis, then you
can't claim the drug is helpful against the virus.
Worse, you
might have trouble getting permission for another clinical
trial. Given what some may consider marginal evidence that the drug is useful, many physicians might be reluctant to allow their
patients to be randomized to the Control group of a new trial.
This is one reason clinical trials in many countries are subject to approval by
supposedly neutral government agencies, that try to make sure
the first trial gets it right. The protocol may specify a
one-sided test at the 1% level. If successful in this trial,
the drug might be subject to additional trials to try to determine
for what kinds of patients with what kinds of diagnoses the drug
may be considered most effective. (There will probably be continued
monitoring of safety and side effects of the drug.)
Comments by people with more extensive recent personal experience
than mine, designing various stages of clinical trials, are welcome.


text:
Q: 4 sql's, need to get each row from each sql where it has the same garage, tried nested loops but just multiplies responses I am working on a page for work and stumped..
I have 4 tables that I need to get a count of each and display them within an element/box based on the  common garage number. Created sql for each table because need counts
Tried for each statement but repeats inners statements over and over again, because 21 garages
Using Visual Basic
Page using bootstrap
*** work added
Originally had all the for each statement nest within each other
Public Shared Function GetStations(ByVal section As String) As String
    'Dim sql As String = "SELECT WOEQ14 AS STATION, COUNT(WONUM) AS TOTAL FROM MAXIMO.WORKORDER WHERE (WOEQ13 LIKE '$RESP1$%' OR WOEQ13 LIKE '$RESP2$%' OR WOEQ13 LIKE '$RESP3$%') AND (CREWID = 'SSO' OR CREWID = 'PST') AND (HISTORYFLAG = 0) AND (ISTASK = 0) AND (WOEQ14 LIKE '$LOC1$' OR WOEQ14 LIKE '$LOC2$' OR WOEQ14 LIKE '$LOC3$') GROUP BY  ORDER BY STATION"
    Dim SQL As String = "SELECT GARAGE, count(VEHICLE) as 'TOTAL' FROM MKTBLVEHINV WHERE (GARAGE LIKE '$GAR1$%' OR GARAGE LIKE '$GAR2$%' OR GARAGE LIKE '$GAR3$%' OR GARAGE LIKE '$GAR4$%' OR GARAGE LIKE '$GAR5$%' OR GARAGE LIKE '$GAR6$%' OR GARAGE LIKE '$GAR7$%' OR GARAGE LIKE '$GAR8$%' OR GARAGE LIKE '$GAR9$%' OR GARAGE LIKE '$GAR10$%' OR GARAGE LIKE '$GAR11$%' OR GARAGE LIKE '$GAR12$%' OR GARAGE LIKE '$GAR13$%' OR GARAGE LIKE '$GAR14$%' OR GARAGE LIKE '$GAR15$%' OR GARAGE LIKE '$GAR16$%' OR GARAGE LIKE '$GAR17$%' OR GARAGE LIKE '$GAR18$%' OR GARAGE LIKE '$GAR19$%' OR GARAGE LIKE '$GAR20$%' OR GARAGE LIKE '$GAR21$%') GROUP BY GARAGE ORDER BY GARAGE"
    Dim SQL2 As String = "SELECT HOME_GARAGE AS 'GARAGE', COUNT(VEHICLE_ID) AS 'OOS' FROM MKTBLOUTSER WHERE (HOME_GARAGE LIKE '$GAR1$%' OR HOME_GARAGE LIKE '$GAR2$%' OR HOME_GARAGE LIKE '$GAR3$%' OR HOME_GARAGE LIKE '$GAR4$%' OR HOME_GARAGE LIKE '$GAR5$%' OR HOME_GARAGE LIKE '$GAR6$%' OR HOME_GARAGE LIKE '$GAR7$%' OR HOME_GARAGE LIKE '$GAR8$%' OR HOME_GARAGE LIKE '$GAR9$%' OR HOME_GARAGE LIKE '$GAR10$%' OR HOME_GARAGE LIKE '$GAR11$%' OR HOME_GARAGE LIKE '$GAR12$%' OR HOME_GARAGE LIKE '$GAR13$%' OR HOME_GARAGE LIKE '$GAR14$%' OR HOME_GARAGE LIKE '$GAR15$%' OR HOME_GARAGE LIKE '$GAR16$%' OR HOME_GARAGE LIKE '$GAR17$%' OR HOME_GARAGE LIKE '$GAR18$%' OR HOME_GARAGE LIKE '$GAR19$%' OR HOME_GARAGE LIKE '$GAR20$%' OR HOME_GARAGE LIKE '$GAR21$%') GROUP BY HOME_GARAGE ORDER BY HOME_GARAGE"
    Dim SQL3 As String = "SELECT GARAGE, COUNT(VEHICLE) AS 'RECALLS' FROM MKTBLRECALL WHERE (GARAGE LIKE '$GAR1$%' OR GARAGE LIKE '$GAR2$%' OR GARAGE LIKE '$GAR3$%' OR GARAGE LIKE '$GAR4$%' OR GARAGE LIKE '$GAR5$%' OR GARAGE LIKE '$GAR6$%' OR GARAGE LIKE '$GAR7$%' OR GARAGE LIKE '$GAR8$%' OR GARAGE LIKE '$GAR9$%' OR GARAGE LIKE '$GAR10$%' OR GARAGE LIKE '$GAR11$%' OR GARAGE LIKE '$GAR12$%' OR GARAGE LIKE '$GAR13$%' OR GARAGE LIKE '$GAR14$%' OR GARAGE LIKE '$GAR15$%' OR GARAGE LIKE '$GAR16$%' OR GARAGE LIKE '$GAR17$%' OR GARAGE LIKE '$GAR18$%' OR GARAGE LIKE '$GAR19$%' OR GARAGE LIKE '$GAR20$%' OR GARAGE LIKE '$GAR21$%') AND RECALL_STATUS IN ('REPORTED','DEFERRED','RAISED','JOBRAISED','JOB RAISED') AND ARCHIVE_STATUS = 'N' GROUP BY GARAGE ORDER BY GARAGE"
    Dim SQL4 As String = "SELECT GARAGE, COUNT(INSPECTION_TYPE) AS 'PM & Inspections' FROM MKTBLPMINSP WHERE (GARAGE LIKE '$GAR1$%' OR GARAGE LIKE '$GAR2$%' OR GARAGE LIKE '$GAR3$%' OR GARAGE LIKE '$GAR4$%' OR GARAGE LIKE '$GAR5$%' OR GARAGE LIKE '$GAR6$%' OR GARAGE LIKE '$GAR7$%' OR GARAGE LIKE '$GAR8$%' OR GARAGE LIKE '$GAR9$%' OR GARAGE LIKE '$GAR10$%' OR GARAGE LIKE '$GAR11$%' OR GARAGE LIKE '$GAR12$%' OR GARAGE LIKE '$GAR13$%' OR GARAGE LIKE '$GAR14$%' OR GARAGE LIKE '$GAR15$%' OR GARAGE LIKE '$GAR16$%' OR GARAGE LIKE '$GAR17$%' OR GARAGE LIKE '$GAR18$%' OR GARAGE LIKE '$GAR19$%' OR GARAGE LIKE '$GAR20$%' OR GARAGE LIKE '$GAR21$%') AND INSPECTION_STATUS = 'overdue' GROUP BY GARAGE ORDER BY GARAGE"

    Dim gar1 As String = ""
    Dim gar2 As String = ""
    Dim gar3 As String = ""
    Dim gar4 As String = ""
    Dim gar5 As String = ""
    Dim gar6 As String = ""
    Dim gar7 As String = ""
    Dim gar8 As String = ""
    Dim gar9 As String = ""
    Dim gar10 As String = ""
    Dim gar11 As String = ""
    Dim gar12 As String = ""
    Dim gar13 As String = ""
    Dim gar14 As String = ""
    Dim gar15 As String = ""
    Dim gar16 As String = ""
    Dim gar17 As String = ""
    Dim gar18 As String = ""
    Dim gar19 As String = ""
    Dim gar20 As String = ""
    Dim gar21 As String = ""
    Dim conn As SqlConnection = ArtCode.InitConn()
    Dim cmd As New SqlCommand
    cmd.Connection = conn

    cmd.CommandText = "SELECT gar1, gar2, gar3, gar4, gar5, gar6, gar7, gar8, gar9, gar10, gar11, gar12, gar13, gar14, gar15, gar16, gar17, gar18, gar19, gar20, gar21 FROM Sections WHERE section = '" & section & "'"
    Using dr As SqlDataReader = cmd.ExecuteReader()
        If dr.HasRows Then
            dr.Read()
            gar1 = dr("gar1").ToString()
            gar2 = dr("gar2").ToString()
            gar3 = dr("gar3").ToString()
            gar4 = dr("gar4").ToString()
            gar5 = dr("gar5").ToString()
            gar6 = dr("gar6").ToString()
            gar7 = dr("gar7").ToString()
            gar8 = dr("gar8").ToString()
            gar9 = dr("gar9").ToString()
            gar10 = dr("gar10").ToString()
            gar11 = dr("gar11").ToString()
            gar12 = dr("gar12").ToString()
            gar13 = dr("gar13").ToString()
            gar14 = dr("gar14").ToString()
            gar15 = dr("gar15").ToString()
            gar16 = dr("gar16").ToString()
            gar17 = dr("gar17").ToString()
            gar18 = dr("gar18").ToString()
            gar19 = dr("gar19").ToString()
            gar20 = dr("gar20").ToString()
            gar21 = dr("gar21").ToString()
        End If
    End Using

    SQL = SQL.Replace("$GAR1$", gar1)
    SQL = SQL.Replace("$GAR2$", gar2)
    SQL = SQL.Replace("$GAR3$", gar3)
    SQL = SQL.Replace("$GAR4$", gar4)
    SQL = SQL.Replace("$GAR5$", gar5)
    SQL = SQL.Replace("$GAR6$", gar6)
    SQL = SQL.Replace("$GAR7$", gar7)
    SQL = SQL.Replace("$GAR8$", gar8)
    SQL = SQL.Replace("$GAR9$", gar9)
    SQL = SQL.Replace("$GAR10$", gar10)
    SQL = SQL.Replace("$GAR11$", gar11)
    SQL = SQL.Replace("$GAR12$", gar12)
    SQL = SQL.Replace("$GAR13$", gar13)
    SQL = SQL.Replace("$GAR14$", gar14)
    SQL = SQL.Replace("$GAR15$", gar15)
    SQL = SQL.Replace("$GAR16$", gar16)
    SQL = SQL.Replace("$GAR17$", gar17)
    SQL = SQL.Replace("$GAR18$", gar18)
    SQL = SQL.Replace("$GAR19$", gar19)
    SQL = SQL.Replace("$GAR20$", gar20)
    SQL = SQL.Replace("$GAR21$", gar21)

    SQL2 = SQL2.Replace("$GAR1$", gar1)
    SQL2 = SQL2.Replace("$GAR2$", gar2)
    SQL2 = SQL2.Replace("$GAR3$", gar3)
    SQL2 = SQL2.Replace("$GAR4$", gar4)
    SQL2 = SQL2.Replace("$GAR5$", gar5)
    SQL2 = SQL2.Replace("$GAR6$", gar6)
    SQL2 = SQL2.Replace("$GAR7$", gar7)
    SQL2 = SQL2.Replace("$GAR8$", gar8)
    SQL2 = SQL2.Replace("$GAR9$", gar9)
    SQL2 = SQL2.Replace("$GAR10$", gar10)
    SQL2 = SQL2.Replace("$GAR11$", gar11)
    SQL2 = SQL2.Replace("$GAR12$", gar12)
    SQL2 = SQL2.Replace("$GAR13$", gar13)
    SQL2 = SQL2.Replace("$GAR14$", gar14)
    SQL2 = SQL2.Replace("$GAR15$", gar15)
    SQL2 = SQL2.Replace("$GAR16$", gar16)
    SQL2 = SQL2.Replace("$GAR17$", gar17)
    SQL2 = SQL2.Replace("$GAR18$", gar18)
    SQL2 = SQL2.Replace("$GAR19$", gar19)
    SQL2 = SQL2.Replace("$GAR20$", gar20)
    SQL2 = SQL2.Replace("$GAR21$", gar21)

    SQL3 = SQL3.Replace("$GAR1$", gar1)
    SQL3 = SQL3.Replace("$GAR2$", gar2)
    SQL3 = SQL3.Replace("$GAR3$", gar3)
    SQL3 = SQL3.Replace("$GAR4$", gar4)
    SQL3 = SQL3.Replace("$GAR5$", gar5)
    SQL3 = SQL3.Replace("$GAR6$", gar6)
    SQL3 = SQL3.Replace("$GAR7$", gar7)
    SQL3 = SQL3.Replace("$GAR8$", gar8)
    SQL3 = SQL3.Replace("$GAR9$", gar9)
    SQL3 = SQL3.Replace("$GAR10$", gar10)
    SQL3 = SQL3.Replace("$GAR11$", gar11)
    SQL3 = SQL3.Replace("$GAR12$", gar12)
    SQL3 = SQL3.Replace("$GAR13$", gar13)
    SQL3 = SQL3.Replace("$GAR14$", gar14)
    SQL3 = SQL3.Replace("$GAR15$", gar15)
    SQL3 = SQL3.Replace("$GAR16$", gar16)
    SQL3 = SQL3.Replace("$GAR17$", gar17)
    SQL3 = SQL3.Replace("$GAR18$", gar18)
    SQL3 = SQL3.Replace("$GAR19$", gar19)
    SQL3 = SQL3.Replace("$GAR20$", gar20)
    SQL3 = SQL3.Replace("$GAR21$", gar21)

    SQL4 = SQL4.Replace("$GAR1$", gar1)
    SQL4 = SQL4.Replace("$GAR2$", gar2)
    SQL4 = SQL4.Replace("$GAR3$", gar3)
    SQL4 = SQL4.Replace("$GAR4$", gar4)
    SQL4 = SQL4.Replace("$GAR5$", gar5)
    SQL4 = SQL4.Replace("$GAR6$", gar6)
    SQL4 = SQL4.Replace("$GAR7$", gar7)
    SQL4 = SQL4.Replace("$GAR8$", gar8)
    SQL4 = SQL4.Replace("$GAR9$", gar9)
    SQL4 = SQL4.Replace("$GAR10$", gar10)
    SQL4 = SQL4.Replace("$GAR11$", gar11)
    SQL4 = SQL4.Replace("$GAR12$", gar12)
    SQL4 = SQL4.Replace("$GAR13$", gar13)
    SQL4 = SQL4.Replace("$GAR14$", gar14)
    SQL4 = SQL4.Replace("$GAR15$", gar15)
    SQL4 = SQL4.Replace("$GAR16$", gar16)
    SQL4 = SQL4.Replace("$GAR17$", gar17)
    SQL4 = SQL4.Replace("$GAR18$", gar18)
    SQL4 = SQL4.Replace("$GAR19$", gar19)
    SQL4 = SQL4.Replace("$GAR20$", gar20)
    SQL4 = SQL4.Replace("$GAR21$", gar21)

    'get station list for this area
    'wrap it in bootstrap divs
    'station name should be hyperlink to report results (hijack)
    Dim result As String = "
"

    Dim dt1 As System.Data.DataTable
    dt1 = ReportingClass.GetEplanDataTable(SQL)
    For Each row As DataRow In dt1.Rows
        result += "
"
        result += "
"
        result += "
"
        result += "
" + row(0).ToString
        result += ""
        result += "
total vehicles= " + row(1).ToString + ""
        result += "

"
    Next
    result += "
"

    result += "
"
    Dim dt2 As System.Data.DataTable
    dt2 = ReportingClass.GetEplanDataTable(SQL2)
    For Each row As DataRow In dt2.Rows
        result += "
"
        result += "
"
        result += "
"
        result += "
" + row(0).ToString
        result += " "
        result += "
OOS vehicles= " + row(1).ToString + ""
        result += "

"
    Next
    result += "
"

    result += "
"
    Dim dt3 As System.Data.DataTable
    dt3 = ReportingClass.GetEplanDataTable(SQL4)
    For Each row As DataRow In dt3.Rows
        result += "
"
        result += "
"
        result += "
"
        result += "
" + row(0).ToString
        result += " "
        result += "
Recalls= " + row(1).ToString + ""
        result += "

"
    Next
    result += "
"

    result += "
"
    Dim dt4 As System.Data.DataTable
    dt4 = ReportingClass.GetEplanDataTable(SQL4)
    For Each row As DataRow In dt4.Rows
        result += "
"
        result += "
"
        result += "
"
        result += "
" + row(0).ToString
        result += " "
        result += "
PM and Inspections= " + row(1).ToString + ""
        result += "

"
    Next
    result += "
"

    Return result

End Function

Can anyone give me an ideas?

A: See if this gets you started.
"Select GARAGE, Count(VEHICLE) As TOTAL From MKTBLVEHINV Group By GARAGE;"

"SELECT HOME_GARAGE AS GARAGE, COUNT(VEHICLE_ID) AS 'OOS' FROM MKTBLOUTSER Group By GARAGE;"

"SELECT GARAGE, COUNT(VEHICLE) AS 'RECALLS' FROM MKTBLRECALL Group By GARAGE;"

"SELECT GARAGE, COUNT(INSPECTION_TYPE) AS 'PM & Inspections' FROM MKTBLPMINSP Group By Garage;"

If you need only certain garages, maybe the Where GARAGE In.... might help.


text:
Q: Calling an ActionResult of Controller in Javascript I am trying to call an ActionResult inside the Controller in javascript.
I have this ActionResult in my AdminController.
[HttpPost]
public ActionResult Logout()
{
    return RedirectToAction("Login", "Login");
}

This is my Logout button in AdminView.
<a class="navbar-link" id="logout" name="logout" href="#">
    ログアウト
</a>

And try to create an event in JAVSCRIPT.
  $("#logout").click(function () {
        swal({
            title: "ログアウト?",
            text: "アカウントからサインアウトしますか?",
            icon: "warning",
            buttons: true,
            dangerMode: true,
        })
            .then((willLogout) => {
                if (willLogout) {
                    //swal("Poof! Your imaginary file has been deleted!", {
                    //    icon: "success",
                    //});
                    $.ajax({
                        url: "/Admin/Logout",
                        type: 'POST',
                        success: function (result) {
                            document.location.reload(true);
                        },
                        error: function (result) {

                        }
                    });
                }
            });
    });

The main purpose of this is to redirect the user to Login Page using the Controller.
I tried setting the swal("Poof")... inside the .then(willLogout) and it works.
but when I use an ajax to call the ActionResult. It did not work.
I saw the console and seems nothing is displayed.
I don't know what am I doing wrong.
How can I call the ActionResult from Controller to the Javascript file with Ajax call?

A: Well, to help my fellow beginners. This is the solution I coped up.
First of all, I learned that each ActionResult should have a View (If I am not mistaken).
So, In my AdminView.cshtml, I create a hidden button.
  <button type="submit" id="submitLogout" name="button" value="logout" hidden>logout</button>

After that, In my JSFILE
I removed the ajax. which is in the first place is wrong.
   $("#logout").click(function () {
        swal({
            title: "ログアウト?",
            text: "アカウントからサインアウトしますか?",
            icon: "warning",
            buttons: true,
            dangerMode: true,
        })
            .then((willLogout) => {
                if (willLogout) {
                    $("#submitLogout").click();
                }
            });
    });

This function in javascript is to trigger the hidden button in .cshtml and trigger the ActionResult in the Controller.
Also, In my Controller. This is what I said that each ActionResult has to have a View.
 public ActionResult AdminView(string button)
    {
        if (button == "logout")
        {
            FormsAuthentication.SignOut();
            Session.RemoveAll();
            Session.Abandon();
            return RedirectToActionPermanent("Login", "Login");
        }
        else
        {
            if (!(Session["UserInfo"] is UserModel))
            {
                return RedirectToActionPermanent("Login", "Login");
            }
            else
            {
                return View();
            }
        }
    }

The parameter string button in the ActionResult is the name of the button which you want to trigger. If the trigger is successful, it will pass the value of the button to the argument string button.


text:
Q: Arrow ending with question mark (tikz) I have the following graphics including an arrow ending with a triangle:
\documentclass[margin=0.5mm]{standalone}

\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{arrows.meta}

\begin{document}
\begin{tikzpicture}
\node[draw=white] (1) at (4,0) {AA};
\node[draw=white] (2) at (0,4) {BB};
\draw[black, arrows={|-Triangle[angle=45:10pt,black,fill=black]}] (1) -- (2);
\end{tikzpicture}
\end{document}

How to change it so as the arrow will end with a question mark instead of the triangle?

A: I suspect you want the question mark to point along the line at the end. You could use the sloped to align the question mark perpendicular to the line and then rotate it 90 degrees to make it parallell. Also you'd need to reposition the question mark as it would have it's anchor point in the middle.
\documentclass[margin=0.5mm]{standalone}
\usepackage{tikz}
\begin{document}
  % Get height of question mark
  \newbox\qbox
  \setbox\qbox\hbox{?}
  \edef\qmarkHeight{\the\ht\qbox}
  \begin{tikzpicture}
    \node[draw=white] (1) at (4,0) {AA};
    \node[draw=white] (2) at (0,4) {};
    \node[above left] at (2) {BB};
    \draw[black, arrows={|-}] (1) -- (2) node[sloped, at end, rotate=90, yshift=\qmarkHeight/2]{?};
  \end{tikzpicture}
\end{document}

Which produces this "tip":
Additionally you can make it a style (\draw[questionmark]...) using decorations, as per this answer:
\documentclass[margin=0.5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}
  % Get height of question mark
  \newbox\qbox
  \setbox\qbox\hbox{?}
  \edef\qmarkHeight{\the\ht\qbox}
  \begin{tikzpicture}
    \tikzset{questionmark/.style={
          postaction={
              decorate,decoration={
                  markings,mark=at position 1 with {
                      \node[at end, rotate=-90, yshift=\qmarkHeight/2]{?};
                    }
                }
            }
        }
    }
    \node[draw=white] (1) at (4,0) {AA};
    \node[draw=white] (2) at (0,4) {};
    \node[above left] at (2) {BB};
    \draw[black, arrows={|-}, questionmark] (1) -- (2);
  \end{tikzpicture}
\end{document}

Which produces an (almost) identical result.

A: My solution is similar to that of ferahfeza. My train of thought was the following:
With the help of \usetikzlibrary{calc} you can exactly calculate a point on a given route. We take advantage of this:
\documentclass[margin=0.5mm]{standalone}

\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}
\node[draw=white] (1) at (4,0) {AA};
\node[draw=white] (2) at (0,4) {BB};
%\draw[black, arrows={|-Triangle[angle=45:10pt,black,fill=black]}] (1) -- (2);

\draw (1) -- (2);
\node[fill=white,draw,circle,inner sep=1pt] at ($(4,0)!.92!(0,4)$) {?}; % You can remove the node options if you want
\end{tikzpicture}
\end{document}


text:
Q: organizing strings before joining them to create a common room I am trying to make a chat app where users chat in rooms. I want to insert both user uid strings into the function and return one concatenated string.
But I want the uids to be organized in a way so that the returned value is always the same.
func (id1, id2) -> id1id2
func (id2, id1) -> id1id2

Is there a higher order function in swift that solves that problem?

A: Assuming id1 and id2 are strings, you can use < operator.
for example:
let id1 = "id1"
let id2 = "id2"

func conString(str1: String, str2: String) -> String {
    if str1 < str2 {
        return str1+str2
    }
    return str2+str1
}


text:
Q: How do I read my Google Location History in R I found my Google Location History at
https://maps.google.co.uk/locationhistory/b/0/?hl=en-GB
I then downloaded the KML file
I installed rgdal correctly but am unable to read the file
I put the file name and layer name as from https://gis.stackexchange.com/questions/58131/how-to-efficiently-read-a-kml-file-into-r
 hist = readOGR(dsn="/home/ajay/Desktop/history-05-04-2015",layer="Location history from 05/05/2015 to 06/04/2015")

this is how file looks like
    <?xml version="1.0" encoding="UTF-8"?>
    <kml xmlns="http://www.opengis.net/kml/2.2"         xmlns:gx="http://www.google.com/kml/ext/2.2"       xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
 <name>Location history from 05/05/2015 to 06/04/2015</name>
<open>1</open>
<description/>
<StyleMap id="multiTrack">

This is the error
>Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv,  :
 Cannot open file

Additional Information
> ogrDrivers()
             name write
1          AVCBin FALSE
2          AVCE00 FALSE
3             BNA  TRUE
4             CSV  TRUE
5             DGN  TRUE
6            DODS FALSE
7             DXF  TRUE
8  ESRI Shapefile  TRUE
9      Geoconcept  TRUE
10        GeoJSON  TRUE
11         GeoRSS  TRUE
12            GML  TRUE
13            GMT  TRUE
14  GPSTrackMaker  TRUE
15            GPX  TRUE
16     Interlis 1  TRUE
17     Interlis 2  TRUE
18            KML  TRUE
19   MapInfo File  TRUE
20         Memory  TRUE
21          MySQL  TRUE
22           ODBC  TRUE
23           OGDI FALSE
24         PCIDSK FALSE
25           PGeo FALSE
26     PostgreSQL  TRUE
27            REC FALSE
28            S57  TRUE
29           SDTS FALSE
30         SQLite  TRUE
31          TIGER  TRUE
32        UK .NTF FALSE
33            VFK FALSE
34            VRT FALSE
35         XPlane FALSE

> sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: i686-pc-linux-gnu (32-bit)
Running under: Ubuntu precise (12.04.5 LTS)

locale:
 [1] LC_CTYPE=en_IN.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_IN.UTF-8        LC_COLLATE=en_IN.UTF-8
 [5] LC_MONETARY=en_IN.UTF-8    LC_MESSAGES=en_IN.UTF-8
 [7] LC_PAPER=en_IN.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
 [11] LC_MEASUREMENT=en_IN.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods
[7] base

other attached packages:
[1] rgdal_0.9-3 sp_1.1-0

loaded via a namespace (and not attached):
[1] tools_3.2.0     grid_3.2.0      lattice_0.20-31

A: I read a file into a trajectories:Track object with:
filename = "history-06-14-2015.kml"

library(XML)
kml <- xmlToList(filename)

tr = kml$Document$Placemark$Track
cc = which(names(tr) == "coord")
coord = t(sapply(kml$Document$Placemark$Track[cc], function(x) scan(text = x, quiet = TRUE)))[,1:2]
when = which(names(tr) == "when")
# convert the "-07:00" into " -0700" with sub:
time = strptime(sub("([+\\-])(\\d\\d):(\\d\\d)$", " \\1\\2\\3",
  unlist(kml$Document$Placemark$Track[when])), "%Y-%m-%dT%H:%M:%OS %z")

library(sp)
library(spacetime)
library(trajectories)
track = Track(STI(SpatialPoints(coord, CRS("+proj=longlat +ellps=WGS84")),
    time))
summary(track)
plot(track, axes = TRUE)

The sub call takes care of different time zones; R's strptime can't read e.g. -07:00, but does understand -0700.
You can convert it into a data.frame by:
as(track, "data.frame")

More recently (since July 2015), google allows you to download a copy of all your data. You can import the json file thus obtained by
library(jsonlite)
system.time(x <- fromJSON("Location History/LocationHistory.json"))
loc = x$locations
loc$time = as.POSIXct(as.numeric(x$locations$timestampMs)/1000,
    origin = "1970-01-01")

loc$lat = loc$latitudeE7 / 1e7
loc$lon = loc$longitudeE7 / 1e7

library(sp)
loc.sp = loc
coordinates(loc.sp) = ~lon+lat
proj4string(loc.sp) = CRS("+proj=longlat +datum=WGS84")

library(spacetime)
library(trajectories)
tr = Track(STIDF(geometry(loc.sp), loc.sp$time, loc.sp@data))
plot(tr)

this data set also has accuracy information, and activity mode classifications.

A: Normally it should work like this:
library(rgdal)
kml_fname <- "path/to/history-05-04-2015.kml"
tracks <- readOGR(kml_fname, ogrListLayers(kml_fname)[1])

But I see:
Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv,  :
  object 'keepGeoms' not found
In addition: Warning message:
In ogrFIDs(dsn = dsn, layer = layer) : no features found

There are possibly issues with the KML driver. A slightly better driver is LIBKML, but it isn't installed for my version of rgdal (and it is difficult to do so).

You could try converting the KML file to a GML using GDAL with LIBKML. For example, from a command prompt, first run ogrinfo to see if you can read the file with LIBKML, then try running ogr2ogr to convert it:
ogrinfo history-05-04-2015.kml
INFO: Open of `history-05-04-2015.kml'
      using driver `LIBKML' successful.
1: history-05-04-2015
ogr2ogr -f GML history-05-04-2015.gml history-05-04-2015.kml

(Note: I also see "Warning 1: Layer name 'history-05-04-2015' adjusted to 'history_05_04_2015' for XML validity.")
Then in R:
gml_fname <- "path/to/history-05-04-2015.gml"
tracks <- readOGR(gml_fname, ogrListLayers(gml_fname)[1])

which shows
OGR data source with driver: GML
Source: "C:\Users\mtoews\Downloads\history-05-04-2015.gml", layer: "history_05_04_2015"
with 1 features
It has 12 fields
Warning message:
In readOGR(gml_fname, ogrListLayers(gml_fname)[1]) : Z-dimension discarded

But the result otherwise works fine with, e.g. plot(tracks)

A: library(jsonlite)
a=fromJSON("/home/rstudio/R/Takeout/Location History/LocationHistory.json")
b=as.data.frame(a)

mygoog=NULL
mygoog$latitude=b$locations.latitudeE7/10000000
mygoog$longitude=b$locations.longitudeE7/10000000
mygoog$time=as.POSIXct(as.numeric(b$locations.timestampMs)/1000 , origin="1970-01-01")

mygoog=as.data.frame(mygoog)

library(ggmap)
Map <- get_googlemap(center = c(lon = median(mygoog$longitude), lat = median(mygoog$latitude)),
                     zoom = 12,
                     size = c(640, 640),
                     scale = 2, maptype = c("terrain"),
                     color = "color")

plot1 <- ggmap(Map) +
  geom_path(data = mygoog, aes(x = longitude, y = latitude
                              ),
            alpha = I(0.5),
            size = 0.8)
suppressWarnings(print(plot1))

mygoog2=mygoog[time>"2015-09-21 12:09:31",,]
plot1 <- ggmap(Map) +

geom_path(data = mygoog2, aes(x = longitude, y = latitude
                              ),
            alpha = I(0.5),
            size = 0.8)
suppressWarnings(print(plot1))


text:
Q: My Javascript doesn't seems work (partially) I am trying to give my welcome texts some animations using delay and show. When i test it locally, everything works fine. However, when I try to run it on live server, the codes in "first load on delay" and "jquery for front page" is not working at all, WHILE the codes in "responsive manipulator" section works???
If the whole script doesn't work then I might figured out something, but strangely some of it is working.
Can anyone tell me what's happening?
Here is the HTML

Welcome to my basement

I hope these will satisfy you

    <button id="welcome-button" class="hvr-grow-rotate" ng-click="about()">Allow me to introduce myself</button>

    Hear my greeting -->

Here is the Javascripts file, and the site url is https://namwin.herokuapp.com/
$(document).ready(function() {
    // first load on delay
    $('#line1').hide().delay(3000).show(2200);
    $('#line2').hide().delay(5000).show(2200);
    $('#welcome-button').hide().delay(10000).show(2200);

    //responsive manipulator
    $('.fa-bars').on('click',function () {
        var x = document.getElementById("nav-bar");
        if (x.className === 'nav-bar')
            x.className += ' responsive';
        else
            x.className = 'nav-bar';
    })

    // jquery for front page
    $('#greet').click(function() {
        var audio = document.getElementById('audio');
        if (audio.paused) {
            audio.play();
        }else{
            audio.pause();
            audio.currentTime = 0
        }
    })
});

A: Since you are using angular place this code in your module.
You are calling the code, while the elements arent there yet.


text:
Q: Groovy - Spock Data Table expected value I have a method for which I am writing unit tests using Spock. This method takes two strings as input and returns an integer value that can be 0, >0 and <0 based on some conditions in the methods (basically a string comparator). Now I want to use data tables to test this method but the problem is we don't know the specific value this method will return but just that it can will be greater or smaller in some scenarios. How to do assert that in Spock using data tables. I have already written individual tests for such cases but was wondering if this can be achieved.

A:
Now I want to use data tables to test this method but the problem is
we don't know the specific value this method will return but just that
it can will be greater or smaller in some scenarios.

If you have a pair of inputs and you have an expectation that the return value of the MUT should be above or below some certain value, include that value in the data table and in your assertions assert that the return value relates to the data table value in the way you expect.

A: You can use Math.signum to compress your result down to (-1,0,1).
Then you can easily write your data table.
import spock.lang.*

class ASpec extends Specification {
  def "compare"() {
    expect:
        Math.signum(comparator(a, b)) == result

    where:
        a | b || result
        1 | 2 || -1
        1 | 9 || -1
        1 | 1 || 0
        5 | 2 || 1
        4 | 2 || -1 // fail intentionally
  }

    int comparator(int a, int b) {
        a - b
    }
}

Groovy Web Console


text:
Q: How to connect apache jean fuseki remote database using JDBC I am new to apache jean fuseki database
Could you please direct me how to connect apache jena fuseki database using JDBC(org.apache.jena.jdbc.remote.RemoteEndpointDriver)
Is there any way to connect using JDBC
Thanks for your help

A: Not using pure JDBC.
From the documentation your options are to use RDFConnection or the SPARQL over JDBC library (linked to on the RDFConnection page). Alternatively you just treat the endpoint as a web service passing the SPARQL as a query parameter etc.


text:
Q: c# installshield wizard changes behavior of program I wrote a program, that monitors a device that is connected to a serial port.
When I use the compiled release version directly, everything works properly. I used Installshield LE to create an installer for this tool and in the installed version some parts of my code are not working or seem to be missing.
For example:
string[] getSerialData(string command, int expectedlength)
{
    string[] Ausgabe = { "" };

    while (Ausgabe.Length != expectedlength && run)
    {
        if (IPS_Port.IsOpen)
            IPS_Port.Write(command);

        try
        {
           Ausgabe = IPS_Port.ReadTo("\t").ToString().Split(splitString, StringSplitOptions.RemoveEmptyEntries);
        }
        catch (TimeoutException)
        {
            j++;

            if (j >= 8)
            {
               notico.ShowBalloonTip(30000,"Error","You lost connection to your IPS \"" + IPSname + "\"!",ToolTipIcon.Error);
               logWriter = new StreamWriter("ErrorLog.log",true);
               logWriter.WriteLine(DateTime.Now.ToString("dd/MM/yyyy - HH:mm:ss tt") + "(" + IPSname + "): Connection Lost!");
               logWriter.Close();
               lostConnection = true;
               reset();
               break;
            }

           continue;
       }
   }

   j = 0;
   return Ausgabe;
}

It proceeds until notico.ShowBallonTip and gets stuck there (shows the balloontip over and over again) but never reaches the logwriter part nor the reset() command.
Why does this happen and how do I solve this?


text:
Q: how to get value of select field in django without any forms.py I want to get value of this select field. But do not have any forms. How to get value of select field in django without any forms.py ?
<label>Portal Language:</label>
<select name="language">
    {% get_available_languages as LANGUAGES %}
    {% for lang in LANGUAGES %}
        <option>
            {{ lang.1 }}
        </option>
    {% end for %}
</select>

A: add these in the views.py
views.py
 class ClientCreateView(View):
     def post(self, request, *args, **kwargs):

          language = request.POST.get('language')

A: Functional implementation with more safer version:
In your view that handles this request, do it like this selected_lang = request.POST.get('language', None)
Assuming your view is:
def get_language(request):
    selected_lang = request.POST.get('language', None)
#do whatever you want to do with this selected_lang


text:
Q: Using pg_routing to connect point to closest point of set of points Imagine we have the location of a person (point) and 100 restaurants (each is a point). My objective is to calculate the path from the person to the nearest restaurant (just one), but I want to avoid calculating 100 shortest paths (which is what pgr_dijkstra one-to-many does), because it is time consuming.
Logically, this should be possible, as Dijkstra's algorithm analyzes cost cumulatively.  Therefore, if the algorithm has already reached the first restaurant and the cost is 50, then all paths whose cost is higher than 50 could be dropped.
How can I implement this in PostgreSQL, preferably using pg_routing?


text:
Q: Y USB Cable with external 5V supply I just got a brand new Nexus 4 phone and am a bit dissappointed that it doesn't support USB OTG. One reason is that is doesn't supply 5 V out of its USB port, as opposed to other Android devices I tested.*
Since I have an extra USB OTG cable lying around, I am thinking about modding it to supply the 5V from somewhere else (e.g. from a USB power supply adapter). How would I do that?

*

*I think I should connect Vcc from the power cable to Vcc from the child, and also  connect all the grounds together (so that host (the Nexus 4) and child have the same 0V potential, relative to which D+ and D- are measured). (Is that sufficient to pull host and power supply to the same potentials? What potential do I end up with anyways? I find that a bit confusing.)

*Do I connect the host Vcc with the power supply+child Vcc, or do I leave it dangling? It seems there is no power on it anyway, so I can regard it as not connected (in USB mode).

*Is there anything special I have to do with the Sense, D+, or D- pins, or can I leave them connected as they are?
Sorry if this is a stupid question!
Here is a schematic of a regular USB (OTG) cables for reference:

From http://tech2.in.com/how-to/accessories/how-to-make-your-own-usb-otg-cable-for-an-android-smartphone/319982

*) There might be other problems related to its Slimport feature, though.

A: What you are looking for is called a "USB Power Injector".
Many commercial (cheap) offerings exist. Here's an example. They are available in all USB connector types: A, B, mini-B, micro-B, etc.


text:
Q: Unable to display items in Listview. Error type 'string' is not a subtype of type 'int' of 'index'
The bottom of the screen reads, A RenderFlex overflowed by 99369 pixels
I am having some problems displaying the list view, I have made integer values to string, what am i doing wrong?
      body: Column(
    children: <Widget>[
      StreamBuilder(
        stream: database.onValue,
        builder: (context, AsyncSnapshot<Event> snapshot) {
          if (snapshot.hasData && !snapshot.hasError &&
              snapshot.data!.snapshot.value != null) {
            print("Error on the way");
            lists.clear();
            DataSnapshot dataValues = snapshot.data!.snapshot;
            Map<dynamic, dynamic> values = dataValues.value;
            values.forEach((key, values) {
              lists.add(values);
            });
            return  ListView.builder(
              shrinkWrap: true,
              itemCount: lists.length,
              itemBuilder: (BuildContext context,int index) {
                return Card(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      Text("Item: " + lists[index]["Item"]),
                      Text("Expiry Date: " + lists[index]["Expiry Date"]),
                      Text("Quantity: " + lists[index]["Quantity"].toString()),
                    ],
                  ),
                );
              },
            );
          }
          return Container(child: Text("Add Items"));
        },
      ),
      ElevatedButton(
        child: const Text('Add Items'),
        onPressed: () {
          Navigator.push(
            context,
            MaterialPageRoute(builder: (context) => const AddItem()),
          );
        },
      ),
    ],

  ),

Any help will be greatly appreciated!

A: It means that there might be some list inside a list for that you have to use two index value for example :
list[index][0]['Item']

i dont know where it will be it can be found easily by looking at its response ,it can be for item,expiry or quantity check for that in the response .


text:
Q: Install ftp Ubuntu 14.04LTS I'm trying to enable the ftp in ubuntu. I write in the terminal the command setup-ftp but the answer is "setup-ftp: command not found". Where am I wrong?

A: Ok, so there is no such program as setup-ftp for Ubuntu. I think you would mean to get vsftpd which can help you set up FTP and SFTP servers. So with that being said, the proper command to install is:
sudo apt-get install vsftpd
If you are looking for a client to connect to FTP/SFTP servers, you will need a program such as FileZilla to do so:
sudo apt-get install filezilla


text:
Q: How to find the kth minimum element in an array I am looking for an efficient algorithm to find the k'th minimum element in an unsorted array of n elements, where 1 <= k <= n. The obvious thing is to sort the array first, then pick the k'th element, which will result in a running time of O(n * log(n))  But I guess it can be done in a more efficient way, since sorting the array seems to do "too much". For example, for k=1 the task is to find the minimum of the array, which can be done in O(n).
Does anyone know  a better algorithm for k>=2?

A: Examine the Quicksort algorithm carefully. Then consider that you want the k-largest element of the sorted array and don't care about any others, so in the Quicksort algorithm drop anything that will not affect the k-th element. In other words, don't sort any subarrays that don't contain the k-th element.
It's not optimal, but better than a complete sort.
You also might consider some tuning of the algorithm, just like Quicksort is usually tuned. What's optimal for Quicksort isn't always optimal for getting the k-th element.

A: Is the Array sorted?
If yes then google for the "Median of Medians" or a "Binarysearch" or an "Interpolation-search" there are way more than these, if it is not sorted,you need to sort it first.


text:
Q: Как сделать такую клавиатуру? Где можно найти исходники этой клавиатуры. Не могу найти ни как.
А самому сделать такую клаву думаю проблематично. Надо в точь точь такую

A: Исходники внутренних приложений Android можешь найти тут:
https://android.googlesource.com/platform/packages/apps/

Касательно вашего вопроса, у вас приложение Phone:
По этой ссылке вы сможете скачать репозиторий приложения Phone:
git clone https://android.googlesource.com/platform/packages/apps/Phone

Находите нужный коммит и используйте исходники.
К примеру:
git clone https://android.googlesource.com/platform/packages/apps/Phone
git checkout 32d4187ddfddde7

В итоге будет проект с исходными файлами.


text:
Q: Add a cursor to each selected block in sublime? I have the letter p on multiple lines, so when I double click it it selects all the the stand-alone p's.  It doesn't select the p's inside other words, exactly how I want it to be.  Now, what is the shortcut to add the cursor to each of those selected blocks?  I've been surfing the web for a solid 30 minutes trying to find one simple shortcut and it's quite frustrating because I feel like I used to know this too, but no one has it listed.
Using CtrlD doesn't work because it simply finds the next letter p, which happens to be inside many words I don't want to edit.  Also I can't use CtrlShiftG because p is only one letter and there is no word for the cursor to be inside of. :( Please help!
Using ubuntu, if it matters.

A: If you select the space before and after the p, then hit AltF3 (Quick Find All) then you'll get what you're looking for.

A: I am not sure I understand your question correctly, but what I think is you want to select all the P's in a specific block of text.
If that, just select the text, press Ctrl-F, type p, and click Find all. It will select all the P's in the selection.


text:
Q: Sum of Squares of Legendre polynomials at 0 I came across an electrostatic problem which deals with $\sum_{l=0}^{\infty} (P_{l}(0))^2$. Does this series converge? If yes, how can we calculate it?
(By completeness theorem, I know that $\sum_{l=0}^{\infty} (2l + 1)(P_{l}(0))^2 = 2$, but I am not able to simplify further.)


text:
Q: Any way to make AR.js camera less sensitive to movement? After testing with default and custom marker/model of various size and distance, I concluded that the reason my AR models are having seizure (jittering/flickering/shaking like mad) is because of my hand movement. When the (phone) camera is at rest, the model is stable when the camera is stable.
Because the intention is to share the end product with the public (or anyone whose phone supports WebRTC), I can't calibrate the AR camera, because that would only fix my (phone) problem, not the other audience's.
Is there a setting in AR.js or ARToolkit that governs the sensitivity of the camera?

A: In case you are facing hard mad movements/hyper-sensitivity shaking of images with Ar.JS, and you are using multiple markers in the same page, the solution is to add a <a-entity camera></entity> inside the <a-scene> that contains the markers.
This avoids the automatic camera(s) created by a-frame, and makes everything more stable.

A: You could use the object position and orientation from AR.js and average that over a few frames to smooth things out.


text:
Q: Problems with customizing buttons of a SweetAlert I am using the older version of SweetAlert (Lower than SweetAlert2). When executing the modal, the main buttons are not working correctly.
The buttons' HTML is generated, but they are not shown.
What is wrong?
Thanks :)
swal("A wild Pikachu appeared! What do you want to do?", {
    showConfirmButton: false,
    buttons: {
    cancel: "Run away!",
    catch: {
      text: "Throw Pokéball!",
      value: "catch",
    },
    defeat: true,
  },
})
.then((value) => {
  switch (value) {

    case "defeat":
      swal("Pikachu fainted! You gained 500 XP!");
      break;

    case "catch":
      swal("Gotcha!", "Pikachu was caught!", "success");
      break;

    default:
      swal("Got away safely!");
  }
});


text:
Q: How can I sign an android app with a value that I want? I'm trying to upload and app to Play Store. I built the app in HTML5 and It was compiled with Cordova, using Intel XDK. When I try to upload the app to Google, I got a message like: "The certificate (digital sign) of past application are different of new".
The older app is an Android WebView, compiled using the IDE: Eclipse.
How can I sign an android app with the same value of older application?

A: You need to sign the app using the same certificate you used the first time you uploaded to Google.
Typically, when you generate the signed APK, you have to select a keystore path (or generate a new one), in your case you need to select the same one you used before. i.e. <your_app>.jks
If you no longer have this keystore then you cannot upload a new .apk, your only solution would be to unpublish your currently uploaded app and create a new one with your new signed .apk
If you do have your old keystore, but cannot remember the information within it, you can Google the commands to retrieve data from the keystore, (based on your OS).


text:
Q: Ruby gem for ADB protocol? A coworker of mine believes that there is a Ruby gem out there that implements an ADB client in Ruby - thus allowing Ruby code to work with ADB in an OO manner rather than just driving the command-line client via shell. He doesn't know what this gem is, but he feels very sure that he's seen it.
After searching search engines every which way I can think of, I'm not so sure he's that sure. :-) I can't find anything like this. Does this sound familiar to anyone? If it's a simple protocol that goes through a TCP port, it seems like it'd be a no-brainer to implement using Net::Telnet or something. I would, but I can't find a specification of this protocol anywhere, and of course I don't want to reinvent the wheel if this has already been done.

A: I just ran into the ruby gem "android-adb".  Will this work for you?
https://rubygems.org/gems/android-adb


text:
Q: How to identify all the cyclic groups within a symmetric group Sn? There might be many cyclic groups within a symmetric group Sn. Is there any explicit result as how to find the total number of them?
Although, it could be shown that any permutation is decomposable into cyclic permutations.
Thanks,


text:
Q: axios map through the api response and make multiple api calls I need to achieve something like below - get response from first api call and get the response - form links and make subsequent api calls while looping through the first response object - the following code works for first call - but not for next calls?
import Request from 'axios';
export function getData() {
  return async function getData(dispatch) {
    const { data } = await getDataFromApi();
    dispatch({ type: GET_DATA, payload: data });
    Object.keys(data).map((keyName, keyIndex) => {
    Request.get(endpoint).then((response) => {
    dispatch({
      type: GET_SUBSEQUENTCALLS + keyIndex,
      payload: response });
  });
});

};
}
async function getDataFromApi() {
  return Request.get(endpoint);
}

A: This is my example
let getTopStories = () => axios.get('https://someapi.com/v0/topstories.json');
let getStory = ( id )  => axios.get(`https://someapi.com/v0/item/${id}.json`);
let getUser = ( user ) => axios.get(`https://someapi.com/v0/user/${user}.json`)
let consolidateData = ( storyID ) => new Promise( ( resolve, reject ) => {

  let consolidated = {};

  getStory( storyID )
  .then( storyData => {
    let user = storyData.data.by;
    Object.assign( consolidated, { story: storyData.data } );
    return getUser( user );
  })
  .then( userData => {
    Object.assign( consolidated, { user: userData.data } );
    resolve( consolidated );
  });

});

getTopStories()
    .then( res => {
    let ids    = res.data;
    let random = _.sampleSize( ids, 10 );
    let proms  = random.map( consolidateData );
    return Promise.all( proms );
    }).then( storyData => {
    console.log( storyData );
  this.setState({ storyData })
    });


text:
Q: Tkinter 'if' statement returning incorrect text When I try a number it gives me invalid but I only want it to say invalid if it's a negative or not a number:
from Tkinter import *
import tkMessageBox

class MyApp(object):
def __init__(self):
    self.root = Tk()
    self.root.wm_title("Question 7")
    self.label = Label(self.root, text="Enter weight in pounds",
                       font=('Calibri', 50))
    self.label.pack(padx=20,pady=10)
    self.labeltext = StringVar()
    self.labeltext.set("")
    Label(self.root, textvariable=self.labeltext).pack()
    self.entrytext = StringVar()
    Entry(self.root, textvariable=self.entrytext).pack()
    self.entrytext.trace('w', self.entry_changed)

    self.root.mainloop()

def entry_changed(self, a, b, c):
    s = self.entrytext.get()
    try:
        a=int(s)*4.3
        self.labeltext.set(a)
    except:
        if s=="":
           self.labeltext.set("")
    else:
        self.labeltext.set("invalid")

MyApp()

A: EDIT: As @BillTheLizard pointed out, much more likely that you forgot to indent your else statement properly. Therefore disregard basically everything below and add four spaces in front of else: and self.labeltext.set("invalid") :)
Your issue is with the usage of try/except. When you use else as part of a try/except block, the else piece will execute if the try clause does not raise an exception. Therefore in your case, anytime the try block completes successfully and executes self.labeltext.set(a), it goes to the else clause and overwrites the same text.
In order to accomplish what I think you're trying to accomplish, try something like this:
def entry_changed(self, a, b, c):
    s = self.entrytext.get()

    try:
        a = int(s)
        if a > 0:
            a *= 4.3 # -> a = a * 4.3
            self.labeltext.set(a)
    except ValueError: # Always specify what kind of exception you are catching
        if s == "":
            self.labeltext.set("")
        else:
            self.labeltext.set("invalid")

I removed the else because it sounded like you wanted anything that wasn't a number or was < 0 to return invalid. Your previous except handled an empty string differently, so this can be adjusted if need be.


text:
Q: Source code for the Android Wi-Fi settings activity? Looking through the massive android source code, anyone on here who know where exactly the above mentioned Activity is located? I would guess some place around

platform_frameworks_base/tree/master/core/java/android/app

but I cannot find anything.

A: It's in the Settings app source code, specifically:
platform_packages_apps_settings/src/com/android/settings/wifi/WifiSettings.java

It can be found on Github here: https://github.com/android/platform_packages_apps_settings/blob/master/src/com/android/settings/wifi/WifiSettings.java


text:
Q: System.Configuration.Provider.ProviderException: The role 'user' was not found I'm a bit out of my depth with this so if anyone can help I would be so grateful. I have a website written using asp.net/VB with SQL for the database. On that server and wanted to duplicate it to be able to change it and turn it into a different site. My developer set me up a new database and copied necessary sql files across. When trying to register a new account I get the error: System.Configuration.Provider.ProviderException: The role 'user' was not found but sometimes the site says the email address I'm trying to register already exists.. The database is empty though so I think I have something wrong in my WebConfig file where it's probably trying to connect to the old database ? I have copied the webconfig from that site too and simply renamed the "application Name=" parts.. Below shows the database and then the webconfig. Thank you so much for any help at all.

<authentication mode="Forms">
  <forms cookieless="UseCookies" loginUrl="~/login.aspx" name="freebeeAuth1" slidingExpiration="true" timeout="259200" defaultUrl="~/default.aspx" domain=".freebeepoints.com" path="/" />
</authentication>
<membership>
  <providers>
    <clear />
    <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="MembershipConnectionString" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" maxInvalidPasswordAttempts="10" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/freebee" />
  </providers>
</membership>
<profile>
  <providers>
    <clear />
    <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="MembershipConnectionString" applicationName="/freebee" />
  </providers>
</profile>
<roleManager enabled="true">
  <providers>
    <clear />
    <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="MembershipConnectionString" applicationName="/freebee" />
    <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/freebee" />
  </providers>
</roleManager>

A: If you copy over your website to a new location to have a copy of the same website, you should not change the ApplicationName in the asp.net membership stuff. Just change the connectionstring to make sure you're connecting to the right db.
Also make sure you're keeping the same machinekey element.
Hope this helps...


text:
Q: Using IE to export webpage contents into Excel I need to pull school names and abbreviations from this page on Wikipedia.
Abbreviations will go in column A and school names in column B.
I am hoping to use the feature in IE but I can't seem to figure out if certain aspects of the page can be exported with exporting the entire page.
I can't seem to figure out what settings need to be changed to get this to work.

A: If this is a one time thing you should be able to get close to what you need.
On a new worksheet, if you select the one choice available

and follow the directions importing it to you worksheet to range A1, you will have extraneous rows, but you can copy just A16:A380 to another worksheet.
While the range is selected on that new worksheet, choose DATA>Text to Columns and make the delimiter be "-" (a minus sign) this will give you basically what you need.
From this, sort A:B on A and remove the empty and [edit] heading rows you don't need.
Because the data is not in a separate table you can't automate this easily, but even that could be done with a macro, if this is not a one time effort.
This example is office 2003 but the same idea can be done with the other versions.

A: If you wanted to use a VBA macro to do this then here's the code you would need. You need to set a reference to "Microsoft XML, v6.0" then create and run this macro:
Option Explicit

Sub main()

Dim domResult As DOMDocument60
Dim ixnlLi As IXMLDOMNodeList
Dim iRow As Integer
Dim sResult As String
Dim iDashPos As Integer

Set domResult = New DOMDocument60
domResult.setProperty "ProhibitDTD", False
domResult.setProperty "SelectionNamespaces", "xmlns:ns='http://www.w3.org/1999/xhtml'"
domResult.resolveExternals = True
domResult.validateOnParse = False
domResult.async = False
domResult.Load "http://en.wikipedia.org/wiki/List_of_colloquial_names_for_universities_and_colleges_in_the_United_States"

Set ixnlLi = domResult.selectNodes("id('bodyContent')/ns:ul/ns:li")

With ThisWorkbook.Worksheets("Sheet1")
    .UsedRange.ClearContents
    For iRow = 1 To ixnlLi.Length
        sResult = ixnlLi(iRow - 1).Text
        iDashPos = InStr(sResult, "-")
        If (iDashPos > 0) Then
            .Cells(iRow, 1).Value = Trim$(Left$(sResult, (iDashPos - 1)))
            .Cells(iRow, 2).Value = Trim$(Mid$(sResult, (iDashPos + 1)))
        Else
            .Cells(iRow, 1).Value = sResult
            .Cells(iRow, 2).Value = ""
        End If
    Next iRow
    .UsedRange.Columns.AutoFit
End With

End Sub

This will be quite a fragile solution though because if someone alters the page structure, the XPath expression used in selectNodes would break. You could use a simpler and less fragile expression //ns:li in selectNodes but this will pull through some other extraneous values from the page which you would have to delete from your list.
That Wikipedia page is not valid XHTML (due to two empty

 tag pairs)


text:
Q: I am a beginner, should I answer? I'm not a professional programmer, but I have some experience, sometimes I see a question but I'm not sure about the answer, or even if I am confident, I'm not an advanced programmer and my answer can be bad, or worse, so should I answer questions or not?
And about asking questions, maybe it's a good idea to open a branch or site for beginners, I don't like bother people with my stupid beginner questions, but there I will be able to ask my questions without being voted down, and professional programmers who want to help beginners in their first steps, will guide them to be professionals.

A: Yes! As long as you are reasonably sure in your answer, there is no reason not to. If you edit it carefully and write it well according to the rules, you might get some upvotes.
Even if you get downvoted, as long as you have posted politely and well, the downvotes will serve as a learning experience to learn what was wrong with your code.
As for questions, as the comments have said, as long as your question meets the requirements and is not a duplicate, not answerable directly from documentation (e.g. "What does the map method do in Ruby?"), and is written well, you should be fine.


text:
Q: How do you use Lucene.Net phonetic search The Lucene.Net documentation is extremely lacking - I've been trying to figure out how to make use of the Lucene.Net phonetic searching functionality.
I've mainly been referencing the lucene.ne git project's test case for the PhoneticFilter: https://github.com/apache/lucenenet/blob/master/src/Lucene.Net.Tests.Analysis.Phonetic/TestPhoneticFilter.cs
How I create my index:
// add new index entry
Document doc = new Document
{
    new TextField("brand", vehicle.Brand ?? string.Empty, Field.Store.YES),
    new TextField("range", vehicle.Range ?? string.Empty, Field.Store.YES),
    new TextField("model", vehicle.Model ?? string.Empty, Field.Store.YES),
    new TextField("year", vehicle.Year ?? string.Empty, Field.Store.YES),
};

// add entry to index
writer.AddDocument(doc);

Next, from the test case, it seems you can add the PhoneticFilter to the Analyzer:
// set up lucene searcher
using DirectoryReader reader = DirectoryReader.Open(Directory);

Analyzer analyzer = Analyzer.NewAnonymous(createComponents: (fieldName, reader) =>
{
    Tokenizer tokenizer = new KeywordTokenizer(reader);
    return new TokenStreamComponents(tokenizer, new PhoneticFilter(tokenizer, new Soundex(), false));
});

IndexSearcher searcher = new IndexSearcher(reader);
int hits_limit = searchModel.Start + searchModel.Qty;
TopDocs topDocs;
Sort sortOrder = null;

BooleanQuery vehicleFilterQuery = new BooleanQuery();

var brandParser = new QueryParser(Lucene.Net.Util.LuceneVersion.LUCENE_48, "brand", analyzer);
var brandQuery = ParseQuery(searchModel.SearchTerm, brandParser);
brandQuery.Boost = 4.0f;
vehicleFilterQuery.Add(brandQuery, Occur.SHOULD);

var rangeParser = new QueryParser(Lucene.Net.Util.LuceneVersion.LUCENE_48, "range", analyzer);
var rangeQuery = ParseQuery(searchModel.SearchTerm, rangeParser);
rangeQuery.Boost = 3.0f;
vehicleFilterQuery.Add(rangeQuery, Occur.SHOULD);

var modelParser = new QueryParser(Lucene.Net.Util.LuceneVersion.LUCENE_48, "model", analyzer);
var modelQuery = ParseQuery(searchModel.SearchTerm, modelParser);
modelQuery.Boost = 2.0f;
vehicleFilterQuery.Add(modelQuery, Occur.SHOULD);

var yearParser = new QueryParser(Lucene.Net.Util.LuceneVersion.LUCENE_48, "year", analyzer);
var yearQuery = ParseQuery(searchModel.SearchTerm, yearParser);
yearQuery.Boost = 1.0f;
vehicleFilterQuery.Add(yearQuery, Occur.SHOULD);

topDocs = searcher.Search(vehicleFilterQuery, null, hits_limit, sortOrder ?? Sort.RELEVANCE);
ScoreDoc[] subset = topDocs.ScoreDocs.Skip(searchModel.Start).Take(searchModel.Qty).ToArray();

return MapToModelList(subset, searcher);

After implementing this in order to test, I search with Audee, expecting to get a bunch of Audi results, but while the regular (correctly spelled) search works, the phonetic search seems to have no impact.
I've tried the Metaphone(), DoubleMetaphone(), Soundex(), RefinedSoundex(), Caverphone1() and Caverphone2() encoders

Metaphone https://lucenenetdocs.azurewebsites.net/api/Lucene.Net.Analysis/Lucene.Net.Analysis.Phonetic.Language.Metaphone.html
DoubleMetaphone https://lucenenetdocs.azurewebsites.net/api/Lucene.Net.Analysis/Lucene.Net.Analysis.Phonetic.Language.DoubleMetaphone.html
Soundex https://lucenenetdocs.azurewebsites.net/api/Lucene.Net.Analysis/Lucene.Net.Analysis.Phonetic.Language.Soundex.html
RefinedSoundex https://lucenenetdocs.azurewebsites.net/api/Lucene.Net.Analysis/Lucene.Net.Analysis.Phonetic.Language.RefinedSoundex.html
Caverphone1 https://lucenenetdocs.azurewebsites.net/api/Lucene.Net.Analysis/Lucene.Net.Analysis.Phonetic.Language.Caverphone1.html
Caverphone2 https://lucenenetdocs.azurewebsites.net/api/Lucene.Net.Analysis/Lucene.Net.Analysis.Phonetic.Language.Caverphone2.html

A: There is a specialized DoubleMetaphoneFilter designed for basic phonetic matches. You only need to use the PhoneticFilter if you need explicit control over the phonetic algorithm being used.
Here is an example (based on this StackOverflow answer):
// Ensures index backward compatibility
const LuceneVersion AppLuceneVersion = LuceneVersion.LUCENE_48;

[Test]
public void DoubleMetaphoneExample()
{
    // Create a directory
    var directory = new RAMDirectory();

    // Create a phonetic analyzer
    var analyzer = Analyzer.NewAnonymous(createComponents: (fieldName, reader) => {
        var tokenizer = new KeywordTokenizer(input: reader);
        var stream = new DoubleMetaphoneFilter(input: tokenizer, maxCodeLength: 8, inject: false);
        return new TokenStreamComponents(tokenizer, stream);
    });

    // Create an index writer
    var indexConfig = new IndexWriterConfig(AppLuceneVersion, analyzer);
    using (var writer = new IndexWriter(directory, indexConfig))
    {
        // Add documents
        foreach (var vehicle in Vehicles)
        {
            // add new index entry
            Document doc = new Document
            {
                new TextField("brand", vehicle.Brand ?? string.Empty, Field.Store.YES),
                new TextField("range", vehicle.Range ?? string.Empty, Field.Store.YES),
                new TextField("model", vehicle.Model ?? string.Empty, Field.Store.YES),
                new TextField("year", vehicle.Year ?? string.Empty, Field.Store.YES),
            };

            // add entry to index
            writer.AddDocument(doc);
        }
    }
    // Done indexing

    // Begin Search

    var searchModel = new { SearchTerm = "audee" };

    // Open an IndexReader
    using var reader = DirectoryReader.Open(directory);

    IndexSearcher searcher = new IndexSearcher(reader);
    int hits_limit = 5;
    TopDocs topDocs;
    Sort sortOrder = null;

    BooleanQuery vehicleFilterQuery = new BooleanQuery();

    var brandParser = new QueryParser(Lucene.Net.Util.LuceneVersion.LUCENE_48, "brand", analyzer);
    var brandQuery = ParseQuery(searchModel.SearchTerm, brandParser);
    brandQuery.Boost = 4.0f;
    vehicleFilterQuery.Add(brandQuery, Occur.SHOULD);

    var rangeParser = new QueryParser(Lucene.Net.Util.LuceneVersion.LUCENE_48, "range", analyzer);
    var rangeQuery = ParseQuery(searchModel.SearchTerm, rangeParser);
    rangeQuery.Boost = 3.0f;
    vehicleFilterQuery.Add(rangeQuery, Occur.SHOULD);

    var modelParser = new QueryParser(Lucene.Net.Util.LuceneVersion.LUCENE_48, "model", analyzer);
    var modelQuery = ParseQuery(searchModel.SearchTerm, modelParser);
    modelQuery.Boost = 2.0f;
    vehicleFilterQuery.Add(modelQuery, Occur.SHOULD);

    var yearParser = new QueryParser(Lucene.Net.Util.LuceneVersion.LUCENE_48, "year", analyzer);
    var yearQuery = ParseQuery(searchModel.SearchTerm, yearParser);
    yearQuery.Boost = 1.0f;
    vehicleFilterQuery.Add(yearQuery, Occur.SHOULD);

    topDocs = searcher.Search(vehicleFilterQuery, null, hits_limit, sortOrder ?? Sort.RELEVANCE);

    // topDocs.ScoreDocs contains

    // doc = 2
    // doc = 3
    // doc = 4
    // doc = 7
}

private static Search.Query ParseQuery(string searchTerm, QueryParser queryParser)
{
    return queryParser.Parse(searchTerm);
}

private static Vehicle[] Vehicles = new Vehicle[] {
    new Vehicle { Brand = "Ford", Model = "Taurus", Year = "1986" },
    new Vehicle { Brand = "Ford", Model = "Fiesta", Year = "1990" },
    new Vehicle { Brand = "Audi", Model = "A4 45", Year = "2021" },
    new Vehicle { Brand = "Audi", Model = "Q3 45 S", Year = "2021" },
    new Vehicle { Brand = "Audie", Model = "Q3 45 S", Year = "2021" },
    new Vehicle { Brand = "Toyota", Model = "Corolla", Year = "2010" },
    new Vehicle { Brand = "Toyota", Model = "Hilux", Year = "2015" },
    new Vehicle { Brand = "Audi", Model = "A4", Year = "2017" },
};

public class Vehicle
{
    public string Brand { get; set; }
    public string Range { get; set; }
    public string Model { get; set; }
    public string Year { get; set; }
}

Alternatively, you can use PhoneticFilter to pick an algorithm. I tried your example with DoubleMetaphone (both with and without setting MaxCodeLen) and it worked fine.
var stream = new PhoneticFilter(
    input: tokenizer,
    encoder: new DoubleMetaphone() { MaxCodeLen = 8 },
    inject: false);

There is some general information about phonetic algorithms on Wikipedia. In most cases, Double Metaphone is the best choice for the English language.


text:
Q: The PWM output of dsPIC chip fail to drive the motor with H-bridge circuit I am simulating a dsPIC33FJ32MC202 in Proteus to control a motor.

I used an H-bridge to let motor rotate, but the motor is not rotating after the simulation started.

You can see the oscilloscope output connected to the IO pins of the dsPIC. The ideal output should be 3.3V to -3.3V, I don't quite understand why it is 2.3V to -2.3V, but it seems OK.

And also the oscilloscope output connected to the lines between Q3-R1 and Q1-R3. The output looks weird, and I don't know the reason causing this phenomenon.

P.S. You can download the Proteus design file and my program files(.c and .hex files) here.

A: You can't solve it by changing resistor values. You need more gain.
Basically, bipolar transistors are current-gain devices. This means that for a certain amount of current that flows into the base, a correspondingly larger current will flow into the collector.
The ratio between these two currents is the gain of the transistor, commonly called \$H_{fe}\$ in most transistor datasheets.
Transistors typically have a \$H_{fe}\$ in the range of 5-500, with big power transistors tending towards the 10-100 range.
Now, if you have a transistor with a \$H_{fe}\$ of 25, and you want to pull an amp through the collector, you need \$\frac{1A}{25} = 40 mA\$ of current flowing into the base. Obviously, your PIC cannot source that. Even if you have a \$H_{fe}\$ of 100: \$\frac{1A}{100} = 10 mA\$, you're still not going to have any luck.
I would say, that since this seems to be more of a learning project then anything else for you, you should look at playing with Darlington transistors. A darlington is two transistors wired in such a way that it has a much higher \$H_{fe}\$. However, the voltage drop across the transistor is doubled (to 1.2V), so they're rarely used in power applications. However, if you replaced the transistors in your circuit with darlington transistors, I think it would probably work, at least in the simulation.
(You would still have to deal with the issue of not turning the PNP transistor off, see the bottom section of this answer)

Another problem you will have with the topology as you have draw it is what is colloquially called "shoot-through". Basically, when your microchip decided to change the state of one half of the H-bridge, it will begin driving the voltage on the IO pin to the other state. Since there is capacitance on the connection, and the MCU IO line cannot source or sink infinite current, the voltage will slew from one extreme to the other. As such, there will be a period of time when the voltage on the IO pin is between 0 and Vcc.
Now, look at your circuit. What will happen when the voltage on the bases of both the top and bottom transistors is somewhere in the middle of 0-Vcc?
Both transistors will be turned on, and a large currents can flow straight through both transistors, completely ignoring the motor.

There is another issue with your design.
To fully turn off the upper transistor (the PNP transistor), you need to drive it's base-voltage to within -0.6V of it's emitter. Since you have the emitter tied to 5V, and your PIC microprocessor can only drive it's IO lines to 3.3V, you can never turn the top transistor off. As such, when you try to turn the bottom transistor on, all you're doing is shunting current through both transistors to ground, completely ignoring the motor.

A: These parts can only reliably source around 2mA of current (absolute maximum 4mA) on their I/O lines. Use a driver IC to buffer the gate drive signals before applying them to the power BJTs. The lower output voltage the simulation shows could be due to the excessive current drawn by the circuit.
\$\dfrac{3.3V-0.6V}{470\Omega}=5.7mA\$
(You'll probably want to drive your H-bridge much more stiffly than with 5.7mA.)


text:
Q: How many bytes are needed for a complete thumbnail of a progressive JPEG? I am trying to build an uploader which uploads progressive files in two steps:

*

*Upload the minimal number of bytes to create a thumbnail (0-10%)

*Upload the rest of the bytes for the thumbnail. (11%-100%)

I want to do this to have thumbnails available earlier without having to upload a seperate thumbnail.
Taking an image (3426398 Byte) which was created with jpegtran -copy all -progressive -outfile progressive.jpg original.jpg and then taking the first 350000 bytes with dd if=progressive.jpg of=thumb.jpg bs=1 count=350000 I got a thumbnail which works.

*

*Original: https://dl.dropbox.com/u/5910/thumbtest/progressive.jpg

*Thumbnail: https://dl.dropbox.com/u/5910/thumbtest/thumb.jpg
Is there a way to find out how many bytes I have to transfer in order to get an image where all lines are available? Thus only losing image quality?

A: A progressive JPEG image is made up of a series of "Scans". Each Scan provides progressively more information for each MCU block (more A/C coefficients). The first scan is usually just the DC values for each MCU. This happens to be the perfect amount of information to get you a 1/8th sized thumbnail image.
In the JPEG file, each scan starts with a SOS (start of scan) marker of FFDA. In order to know how much data is needed to completely hold the first scan, simply search the file data for the start of the second scan (the second FFDA marker) and you have your answer. Because of the marker byte rules, the 2 byte sequence FF DA cannot be anything but the SOS marker. Compressed data which needs to encode the value FF followed by DA would have to be encoded as FF 00 DA.


text:
Q: JS search values in the array using loops? how to search the value in te array using loops.. not able to sort out the value what's wrong in this solutions ...

function arrayCheck(arr, value) {
  var arr = [35, 56, 78, 90, 54];
  for (var i = 0; i < arr.length; i++) {
    // var value = arr.length;

    if (arr[i] === value) {
      return i;
    } else {
      return "Not found";
    }
  }
}

// // arraycheck(value);
console.log(arrayCheck(56));

A: The function expects 2 arguments - arr and value. You pass the value (56) in place of the arr.
In addition, returning in the else means that if the 1st item is not the requested value, the iteration would stop, and return "Not Found".
Pass the array to the function, and return "Not Found" after the loop ends:

function arrayCheck(arr, value) {
  for (var i = 0; i < arr.length; i++) {
    if (arr[i] === value) {
      return i;
    }
  }

  return "Not found";
}

var arr = [35, 56, 78, 90, 54];

console.log(arrayCheck(arr, 56));

A simpler solution would be to use Array.indexOf():

const arrayCheck = (arr, value) => {
  const idx = arr.indexOf(value);

  return idx === -1 ? "Not found" : idx;
};

const arr = [35, 56, 78, 90, 54];

console.log(arrayCheck(arr, 56));


text:
Q: Fortran interop with C function pointer wrong results I have a C program that calls a Fortran subroutine in a static lib. This subroutine takes as argument a function pointer to a callback implemented in C. A minimal example looks like this:
Fortran code:
subroutine fortran_function(input, c_function) bind(c)
    use, intrinsic :: iso_c_binding
    implicit none
    real(c_float), value, intent(IN) :: input
    type(c_funptr), intent(IN), value :: c_function
    abstract interface
        subroutine callback(a, b) bind(c)
            USE iso_c_binding, only: c_float, c_int
            integer(c_int), intent(IN), value :: a
            real(c_float), intent(IN), value :: b
        end subroutine callback
    end interface
    procedure(callback), pointer :: c_proc

    call c_f_procpointer(c_function, c_proc)

    call c_proc(1_c_int, input)
    if (input > 1.0) call c_proc(2_c_int, input)
end subroutine fortran_function

C code:
#include <stdio.h>

typedef void (*c_function)(int, float);
void fortran_function(float, c_function);

void callback(int a, float b)
{
    printf("a=%d, b=%.1f\n", a, b);
}

int main()
{
    fortran_function(0.0, &callback);
    fortran_function(5.0, &callback);
}

If I compile this (Intel and MSVS on Windows) everything works fine and I get the expected output:
a=1, b=0.0
a=1, b=5.0
a=2, b=5.0

However, I ultimatley want to target a powerpc (using gfortran and gcc-variant crosscompiler). The program compiles there without warnings (-Wall) but produces the output:
a=1, b=0.0
a=2, b=0.0
a=1, b=5.0
a=2, b=5.0

This is very strange because for the first call the flow should never enter the if-body. Apparently it does so anyway, but even prints the correct value for the input.
Compiled on Ubuntu with:
powerpc-linux-gnu-gfortran test.f90 -c -Wall -pedantic
ar cr test.lib test.o

What I already checked:

*

*Replacing if (input > 1.0) with if (input > 1.0_c_float) doesn't solve the problem

*Using pass-by-reference instead by-value on the function pointer crashes instantly (on Windows it runs fine)

*Turning of optimization (on both the C and Fortran part) doesn't solve the problem

*All types are 4 byte sizeof(real)=sizeof(real(c_float))=sizeof(integer)=sizeof(integer(c_int)) (same in C)

Does anyone have an idea what could possibly cause this problem?


text:
Q: Why HTTP Error code start from 100 While working on recent REST apis I had a question that why "IANA" decided to have HTTP status code from 100 only and not from 1. I hope there will be a reason behind it but I am curious to know about that.

A: HTTP/1.0 added status codes to HTTP/0.9, the initially released version. The status code range is defined as such:

RFC 1954, 6.1.1 Status Code and Reason Phrase

The Status-Code element is a 3-digit integer result code of the
attempt to understand and satisfy the request[...]. The
Status-Code is intended for use by automata[...].

The first digit of the Status-Code defines the class of response. The last two digits do not have any categorization role. There are 5 values for the first digit:

*

*1xx: Informational - Not used, but reserved for future use

*

*2xx: Success - The action was successfully received, understood, and accepted.

*

*3xx: Redirection - Further action must be taken in order to complete the request

*

*4xx: Client Error - The request contains bad syntax or cannot be fulfilled

*

*5xx: Server Error - The server failed to fulfill an apparently valid request

As for the "why": it allows for five categories, each of which can contain a hundred different codes (x00 - x99), which "ought to be enough for anybody".

A: The status codes are not numbered in a consecutive manner. The first digit indicates the type of status code, e.g. 2xx for success and 4xx for client error. The last to digits are used to specify the status code more. Two digits are needed because more then 9 status codes per type exists.


text:
Q: Reference bold version without using font-weight: bold? I'm using webfonts on a site. For certain headings (h1, h2, etc.) I'm using bold variants (and setting font-weight to normal) because they look much better than using the regular variant and leaving the h-tags with the default bold weight. It's necessary to specify font-weight: normal because otherwise "the bold is bolded", which looks really terrible.
The problem I'm having is, how do I specify standard web fonts as fallback fonts and have the bold setting "restored"?
So for example I might do something like:
@font-face {
    font-family: "My bold webfont";
    src: url("url/of/webfont/bold/variant");
}

h1 {
    font-family: "My bold webfont", Arial, sans-serif;
    font-weight: normal;
}

As long as the webfont is present we have no problem, but if the webfont fails we end up with non-bold Arial.
Is there a way to specify "Arial Bold" in the font-family of the h1 (I know that doesn't work, but it's the desired goal)? Or perhaps in the @font-face definition I can say "this applies only to the bold version of whatever it's assigned to" – so I can omit the font-weight: normal from the h1 style?

A: Try specifying font-weight: bold in both places:
@font-face {
    font-family: "My bold webfont";
    src: url("url/of/webfont/bold/variant");
    font-weight: bold;
}

h1 {
    font-family: "My bold webfont", Arial, sans-serif;
    font-weight: bold;
}
Here's a demo. p#one shows this technique in use; if you look at it in a browser that doesn't support WOFF webfonts, you'll see the default font in bold.


text:
Q: How to trim off Mr. or Ms. or Miss in SQL server How to trim off Mr. or Ms. or Miss in SQL server. Also I need to check only if Mr. or Ms. or Miss is available then only I need to trim.
Mr. Andy J Jones
Ms. Sarah D Lee
Miss Sarah D Lee

A: Please try this
SOLUTION
SELECT a , SUBSTRING(a,CHARINDEX(' ',a,0),LEN(a)) NewformattedColumns FROM
(
    SELECT 'Mr. Andy J Jones' a UNION ALL
    SELECT 'Ms. Sarah D Lee' a UNION ALL
    SELECT 'Miss Sarah D Lee'
)x

OUTPUT
a                NewformattedColumns
---------------- -------------------
Mr. Andy J Jones  Andy J Jones
Ms. Sarah D Lee   Sarah D Lee
Miss Sarah D Lee  Sarah D Lee

(3 rows affected)

You need to use like below
SELECT * , SUBSTRING(yourcolName,CHARINDEX(' ',yourcolName,0),LEN(yourcolName)) NewformattedColumns FROM YourtableName

A: If you know for sure that all of your rows have ONE of the titles (Mr., Ms., or Miss), and you know that all of those also have a space after them, then searching for the space character and selecting the substring after that will work ok. If you have rows that do NOT have a title, then that will not work.
Another possible approach would be to use REPLACE:
SELECT REPLACE(ColName, 'Mr. ', '') FROM myTable

This has problems as well.  If somebody's first name contains the string "miss" at the end, this will give bad results.
Basically without checking every row, you cannot guarantee integrity. I'd agree with Zorkolot's comment, this data model needs to be fixed, if possible.


text:
Q: FCM notification in android. How to show all notification when app is in foreground I build android native app with FCM notification but is seems that default scenario when application is in foreground
Notifications overwrite each other's. how to prevent that and show all notifications when app is in foreground.

A: I found the reason of that issue
when onMessageReceived get fired and create notification I give it static id with 0
notificationManager.notify(0, not)
instead of that I tried to give it unique id, so I used current time instead of zero
notificationManager.notify(System.currentTimeMillis().toInt(), not)