text:
Q: Implementing animation when removing Toast I have a working ToastList that enables me to click a button multiple times and generate a toast each time. On entry, I have an animation, but when I remove the toast, I do not get an animation. I am using Typescript and functional components.
My component is as follows:
import React, { useCallback, useEffect, useState } from 'react';
import * as Styled from './Toast.styled';

export interface ToastItem {
 id: number;
 title: string;
 description: string;
 backgroundColor: string;
}

export interface ToastProps {
 toastList: ToastItem[];
 setList: React.Dispatch<React.SetStateAction<ToastItem[]>>;
}

export default function Toast(props: ToastProps) {
 const deleteToast = useCallback(
  (id: number) => {
   const toastListItem = props.toastList.filter((e) => e.id !== id);
   props.setList(toastListItem);
 },
 [props.toastList, props.setList]
);

useEffect(() => {
  const interval = setInterval(() => {
    if (props.toastList.length) {
      deleteToast(props.toastList[0].id);
    }
  }, 2000);

  return () => {
    clearInterval(interval);
  };
}, [props.toastList, deleteToast]);

return (
  <Styled.BottomRight>
    {props.toastList.map((toast, i) => (
      <Styled.Notification
        key={i}
        style={{ backgroundColor: toast.backgroundColor }}
      >
        <button onClick={() => deleteToast(toast.id)}>X</button>
        <div>
          <Styled.Title>{toast.title}</Styled.Title>
          <Styled.Description>{toast.description}</Styled.Description>
        </div>
      </Styled.Notification>
    ))}
  </Styled.BottomRight>
);

}
And my styling is done using styled-components and is as follows:
import styled, { keyframes } from 'styled-components';

export const Container = styled.div`
  font-size: 14px;
  position: fixed;
  z-index: 10;

  & button {
    float: right;
    background: none;
    border: none;
    color: #fff;
    opacity: 0.8;
    cursor: pointer;
  }
`;

const toastEnter = keyframes`
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0%);
  }
}
`;

export const BottomRight = styled(Container)`
  bottom: 2rem;
  right: 1rem;
`;

export const Notification = styled.div`
  width: 365px;
  color: #fff;
  padding: 15px 15px 10px 10px;
  margin-bottom: 1rem;

  border-radius: 4px;
  box-shadow: 0 0 10px #999;
  opacity: 0.9;
  transition .1s ease;

  animation: ${toastEnter} 0.5s;

  &:hover {
    box-shadow: 0 0 12px #fff;
    opacity: 1;
  }
`;

export const Title = styled.p`
  font-weight: 700;
  font-size: 16px;
  text-align: left;
  margin-bottom: 6px;
`;

export const Description = styled.p`
  text-align: left;
`;

When I click a button, I just add an element to the state list, like:
    toastProps = {
      id: list.length + 1,
      title: 'Success',
      description: 'Sentence copied to clipboard!',
      backgroundColor: '#5cb85c',
    };
    setList([...list, toastProps]);

My component is rendered like:
<Toast toastList={list} setList={setList}></Toast>

I would like to add animation when a toast exits, but do not know how. I have tried changing the style according to an additional prop I would send to the styled components, but this way all the toasts animate at the same time. My intuition is that I should use useRef(), but I am not sure how. Thanks in advance for any help you can provide.


text: Q: Application install event without android.permission.QUERY_ALL_PACKAGES My application installs another application. How can I know that an app has been installed without using android.permission.QUERY_ALL_PACKAGES for Android 11 and up?

redpajama_set_name: RedPajamaStackExchange


text:
Q: На всех страницах footer прижат к низу, а на одной нет. Почему? У кого так было? Всем привет. Сверстал сайт на бутстрап. На всех страницах футер прижат к низу, а на странице регистрации нет.
Стили общие для всех страниц. В стилях указан для html, body {height: 100%; min-width: 100%;}. В чем может быть
проблема? У кого такое было?
Код страницы, на которой footer нормальный:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://fonts.googleapis.com/css2?family=Lora&display=swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Lobster&display=swap" rel="stylesheet">
    <link rel="shortcut icon" href="assets/img/homeflat.png" />

    <title>DIM CLEANING</title>

    <link rel="stylesheet" href="assets/css/bootstrap.min.css">

    <link rel="stylesheet" href="assets/css/owl.carousel.min.css">
    <link rel="stylesheet" href="assets/css/owl.theme.default.min.css">

    <link href="assets/css/style.css" rel="stylesheet">
    <?php
        require_once "functions/functions.php";
    ?>

                                <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-telephone-forward-fill" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
                                <path fill-rule="evenodd" d="M2.267.98a1.636 1.636 0 0 1 2.448.152l1.681 2.162c.309.396.418.913.296 1.4l-.513 2.053a.636.636 0 0 0 .167.604L8.65 9.654a.636.636 0 0 0 .604.167l2.052-.513a1.636 1.636 0 0 1 1.401.296l2.162 1.681c.777.604.849 1.753.153 2.448l-.97.97c-.693.693-1.73.998-2.697.658a17.471 17.471 0 0 1-6.571-4.144A17.47 17.47 0 0 1 .639 4.646c-.34-.967-.035-2.004.658-2.698l.97-.969zM12.646.646a.5.5 0 0 1 .708 0l2.5 2.5a.5.5 0 0 1 0 .708l-2.5 2.5a.5.5 0 0 1-.708-.708L14.293 4H9.5a.5.5 0 0 1 0-1h4.793l-1.647-1.646a.5.5 0 0 1 0-.708z"/>
                                </svg>
                                WhatsApp и тел: +7(910)-419-47-35

                                <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-envelope-fill" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
                                  <path fill-rule="evenodd" d="M.05 3.555A2 2 0 0 1 2 2h12a2 2 0 0 1 1.95 1.555L8 8.414.05 3.555zM0 4.697v7.104l5.803-3.558L0 4.697zM6.761 8.83l-6.57 4.027A2 2 0 0 0 2 14h12a2 2 0 0 0 1.808-1.144l-6.57-4.027L8 9.586l-1.239-.757zm3.436-.586L16 11.801V4.697l-5.803 3.546z"/>
                                </svg>
                                Электронная почта: dimclean@mail.ru

                            <?php
                              if (@$_COOKIE['user'] == ''):
                            ?>
                            <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-check2-circle" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
                              <path fill-rule="evenodd" d="M15.354 2.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3-3a.5.5 0 1 1 .708-.708L8 9.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>
                              <path fill-rule="evenodd" d="M8 2.5A5.5 5.5 0 1 0 13.5 8a.5.5 0 0 1 1 0 6.5 6.5 0 1 1-3.25-5.63.5.5 0 1 1-.5.865A5.472 5.472 0 0 0 8 2.5z"/>
                            </svg>
                            Регистрация |
                            Авторизация
                            <?php else: ?>

Привет <?=$_COOKIE['user']?>.  Выйти

                            <?php endif;?>

                            Отзывы клиентов

                            Сделать заказ

                            Акции

                            Прайс-лист

                                            Уборка квартир
 от 1690 рублей

                                Услуги клининговой компании DIM Cleaning

Повседневная уборка

От 2000 рублей

                                  <button type="button" class="btn btn-info">Подробнее</button>

Генеральная уборка

От 3000 рублей

                                  <button type="button" class="btn btn-info">Подробнее</button>

Уборка после ремонта

От 4000 рублей

                                  <button type="button" class="btn btn-info">Подробнее</button>

                                Наши преимущества

Более 3 лет на рынке

Более 30000 выполненных заказов

Специализированные средства
для уборки

Возможность уборки
в день обращения

Только русские бригады клинеров

Техника Керхер

Накопительная система скидок
 для постоянных клиентов

Есть нарекания к уборке?
 Переделаем бесплатно

                                Акции

                            Previous

                            Next

                                Вопросы и ответы

                                <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
                                  Могу ли я заказывать уборку на еженедельной основе?
                                </button>

                                Да. Вы можете заказать регулярную уборку по графику раз в неделю или раз в 2 недели. Так как поддерживать чистоту проще, чем ее наводить, при еженедельном обслуживании Вы получите хорошую скидку. Обычно, мы закрепляем определенный день недели и время, в которое к Вам будет приходить Домовенок, но можем разработать и индивидуальный график.Для больших любителей чистоты, наша клининговая компания может предоставлять услуги по уборке помещений на ежедневной основе.

                                <button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
                                  Могу ли я единоразово заказать генеральную уборку?
                                </button>

                                Да, Вы можете заказать уборку только один раз, без подписки. "Домовенок" является признанным лидером в сложных уборках. У нас большая база профессиональных клинеров. Поэтому мы легко справимся с любым жилым помещением: квартирой, домом или коттеджем.

                                <button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
                                  Хочу, чтобы ко мне приходил один и тот же исполнитель. Это возможно?
                                </button>

                                Да. В этом преимущество работы с нашим сервисов уборки. При регулярном обслуживании, к Вам будет приходить постоянный исполнитель, который знает где висят рубашки для глажки и как должен лежать коврик в ванной.

                                <button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#collapseFour" aria-expanded="false" aria-controls="collapseFour">
                                  Вы каким-то образом отбираете и обучаете своих исполнителей?
                                </button>

                                Каждый исполнитель проходит трехступенчатый отбор:

                                1.Начинается всё с серии интервью на личные и профессиональные качества

                                2.Затем исполнитель проходит видео-обучение и сдает тесты на знание усвоенного материала. Далее начинается практика в специально построенной модели квартиры, в которой есть все стандартные поверхности. Также после этого этапа необходимо сдать тест.

                                3.После чего, каждый исполнитель около месяца ездит на заказы по уборке в качестве дополнительного стажера и проходит еще один курс обучения.

                                <button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#collapseFive" aria-expanded="false" aria-controls="collapseFive">
                                  Мне нравится как Вы убираетесь у меня дома. Можете ли Вы убраться в офисе?
                                </button>

                                Да, мы также убираемся в коммерческих, производственных и торговых помещениях. Клининговая компания "DIM Cleaning" уникальна в своем роде. Опыт предоставления услуг в офисах помогает нам с легкостью убирать сложные жилые объекты, а опыт уборки в квартирах помогает относится к офису, как к своему дому.

                                Заказать уборку

                            <form class="w-50">

                                Услуга
                                <input type="text" class="form-control" id="subject" name="subject" placeholder="Услуга">

                                Телефон
                                <input type="text" class="form-control" id="message" name="message">

                                Имя
                                <input type="text" class="form-control" id="name" name="name" placeholder="Имя">

                                Email
                                <input type="text" class="form-control" id="email" name="email" placeholder="Email">

                              <button type="button" id="done" name="done" class="btn btn-primary">Заказать</button>
                            </form>

                                Клининговая компания "DIM Cleaning"

                                Все права защищены © <?=Date ('Y')?>

                                +7(910)-419-47-35

Код страницы, где footer не прижат:

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://fonts.googleapis.com/css2?family=Lora&display=swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Lobster&display=swap" rel="stylesheet">
    <link rel="shortcut icon" href="assets/img/homeflat.png" />
    <title>DIM CLEANING</title>

    <link rel="stylesheet" href="assets/css/bootstrap.min.css">

    <link rel="stylesheet" href="assets/css/owl.carousel.min.css">
    <link rel="stylesheet" href="assets/css/owl.theme.default.min.css">

    <link href="assets/css/style.css" rel="stylesheet">
    <?php
        require_once "functions/functions.php";
    ?>

                                <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-telephone-forward-fill" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
                                <path fill-rule="evenodd" d="M2.267.98a1.636 1.636 0 0 1 2.448.152l1.681 2.162c.309.396.418.913.296 1.4l-.513 2.053a.636.636 0 0 0 .167.604L8.65 9.654a.636.636 0 0 0 .604.167l2.052-.513a1.636 1.636 0 0 1 1.401.296l2.162 1.681c.777.604.849 1.753.153 2.448l-.97.97c-.693.693-1.73.998-2.697.658a17.471 17.471 0 0 1-6.571-4.144A17.47 17.47 0 0 1 .639 4.646c-.34-.967-.035-2.004.658-2.698l.97-.969zM12.646.646a.5.5 0 0 1 .708 0l2.5 2.5a.5.5 0 0 1 0 .708l-2.5 2.5a.5.5 0 0 1-.708-.708L14.293 4H9.5a.5.5 0 0 1 0-1h4.793l-1.647-1.646a.5.5 0 0 1 0-.708z"/>
                                </svg>
                                WhatsApp и тел: +7(910)-419-47-35

                                <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-envelope-fill" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
                                  <path fill-rule="evenodd" d="M.05 3.555A2 2 0 0 1 2 2h12a2 2 0 0 1 1.95 1.555L8 8.414.05 3.555zM0 4.697v7.104l5.803-3.558L0 4.697zM6.761 8.83l-6.57 4.027A2 2 0 0 0 2 14h12a2 2 0 0 0 1.808-1.144l-6.57-4.027L8 9.586l-1.239-.757zm3.436-.586L16 11.801V4.697l-5.803 3.546z"/>
                                </svg>
                                Электронная почта: dimclean@mail.ru

                            <?php
                              if (@$_COOKIE['user'] == ''):
                            ?>
                            <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-check2-circle" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
                              <path fill-rule="evenodd" d="M15.354 2.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3-3a.5.5 0 1 1 .708-.708L8 9.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>
                              <path fill-rule="evenodd" d="M8 2.5A5.5 5.5 0 1 0 13.5 8a.5.5 0 0 1 1 0 6.5 6.5 0 1 1-3.25-5.63.5.5 0 1 1-.5.865A5.472 5.472 0 0 0 8 2.5z"/>
                            </svg>
                            Регистрация |
                            Авторизация
                            <?php else: ?>

Привет <?=$_COOKIE['user']?>.  Выйти

                            <?php endif;?>

                            Отзывы клиентов

                            Сделать заказ

                            Акции

                            Прайс-лист

                            <form class="w-50" action="auth.php" method="post">

                                Логин
                                <input type="text" class="form-control" id="login" name="login" placeholder="Логин">

                                Пароль
                                <input type="password" class="form-control" id="pass" name="pass" placeholder="Пароль">

                              <button type="submit" class="btn btn-primary">Войти</button>
                            </form>

                                Клининговая компания "DIM Cleaning"

                                Все права защищены © <?=Date ('Y')?>

                                +7(910)-419-47-35

CSS

html, body {
    height: 100%;
    max-width: 100%;
    /* overflow-x: hidden; */
}

body {
    font-family: 'Lora', serif;
    background-color: #fff;
    position: relative;
}

a:hover {
    text-decoration: none;
}

/* Style for header */

.header {
    background-color: #fff;
    font-size: 18px;
    width: 100%;
}

.header-logo__pic {
    width: 67%;
    height: 80%;
    border-radius: 10px;
    margin: 20px 0;
}

.header-auth__reg {
    color: #00264d;
    margin: 0 5px;
}

.header-auth__reg:hover {
    color: #6666ff;
}

.header-dark {
    background-color: #00b3b3;
}

.header-dark__link {
    color: #fff;
    font-size: 20px;
}

.header-dark__link:hover {
    color: #ffff4d;
}

/* Style for wrapper */

.wrapper {
    background: url(2.jpg) no-repeat center top / cover;
}

.wrapper-img {
    padding-top: 30px;
}

.wrapper-img__title {
    font-family: 'Lobster', cursive;
    font-size: 50px;
    color: #181f32;
    margin-bottom: 60px;
}

/* Style for services */

.service {
    margin-top: 60px;
    margin-bottom: 60px;
}

.service-title__text {
    margin-bottom: 60px;
}

.card:hover {
    -moz-transform: scale(1) translate(10px, -20px);
    -webkit-transform: scale(1) translate(10px, -20px);
    -o-transform: scale(1) translate(10px, -20px);
    -ms-transform: scale(1) translate(10px, -20px);
    transform: scale(1) translate(10px, -20px);
    transition: all 0.8s ease;
    cursor: pointer;
}

/* Style for advantage */

.advantage {
    background-color: #e6faff;
    padding-bottom: 20px;
}

.advantage-item {
    cursor: pointer;
}

.advantage-title__text {
    margin-bottom: 60px;
    margin-top: 30px;
}

.advantage-item__text {
    margin-top: 10px;
}

.owl-carousel .owl-item img {
    width: 40%;
    margin-left: 110px;
}

/* Style for stock */

.stock {
    margin-top: 30px;
    margin-bottom: 30px;
}

.stock-title {
    margin-bottom: 30px;
}

/* Style for answer */

.answer-title__text {
    margin-bottom: 30px;
}

/* Style for order */

.order {
    margin-top: 30px;
    background-color: #e6faff;
    padding: 40px 0;
}

.order-title {
    margin-bottom: 30px;
}

/* Style for footer */

.footer {
    background-color: #17a2b8;
    padding: 10px 0;
}

.footer-info__text {
    color: #fff;
    font-size: 20px;
}

.footer-info__link {
    margin-right: 10px;
}

/* Style for register */

.register {
    margin: 100px 0;
}

/* Style for comment */

.comment-title {
    margin-top: 50px;
}

.comment-form {
    margin-bottom: 50px;
}

.comment-user {
    margin-bottom: 50px;
}

@media screen and (min-width: 320px) and (max-width: 425px) {
    .header-phone__nbr {
        font-size: 80%;
    }

    .header-auth__reg {
        font-size: 95%;
    }

    h1.wrapper-img__title {
        font-size: 200%;
    }

    h1.service-title__text {
        text-align: center;
    }

    .card-deck .card {
    margin-bottom: 0;
    }

    h1.advantage-title__text {
        text-align: center;
    }

    .owl-carousel .owl-item img {
        margin-left: 25%;
        width: 50%;
    }

    h1.answer-title__text {
        text-align: center;
    }

    .order-form {
        margin-bottom: 10%;
    }
}

@media screen and (min-width: 768px) and (max-width: 1024px) {

    .header-phone__nbr {
        font-size: 72%;
    }

    .header-auth__reg {
        font-size: 72%;
    }
}

@media screen and (min-width: 1500px) and (max-width: 2560px) {
    h1.wrapper-img__title {
        font-size: 400%;
    }

    .header-phone__nbr {
        font-size: 150%;
    }

    .header-auth__reg {
        font-size: 150%;
    }
}


text:
Q: Move windows users folder to external drive while keeping junctions I've found and followed these methods* to move my user folder to an external drive, and it works wonderfully, however a side effect of this is that robocopy source dest /xj copies all files BUT junctions, meaning that the user folder it creates on the external drive has no directory junctions anymore, like it does in default Windows 7. I've tried everything I can to move junctions from backups, create new ones with the same properties, copy them, etc, and nothing I've tried has worked to get them back.
I need a way to either fix my junction links in my user folder,
A way to copy / move some from my backups,
Or a way to follow the steps in the link, but keep all junctions intact.
You may ask why I'm so concerned with junctions when the user profile appears to be working fine? The reason is that these junctions are there to keep backward compatibility with previous operating systems, and should be there. I want to copy the EXACT users folder over, not most of it. There is honestly no reason why this should be so hard. :/
Does anyone have any suggestions? Thanks!
Note: I've done extensive Googling for hours, and cannot come up with any solution to the problem. This is my last resort. I don't mind the answers that come, even if it's a reinstall. Just as long as there's a way to do it.
* http://lifehacker.com/5467758/move-the-users-directory-in-windows-7

A: Since I couldn't find any real answers anywhere, I took the time to write and reverse engineer the entire process.
I hope this is of use to anyone else looking to do the same. Please enjoy!
Note: These scripts are designed to only work with one user on the system, other than the default ones. It will not generate anything for additional users you may have created.
WARNING: These scripts come with no warranty, and while I have done my best to make them perfect, I will in no way be liable for any damages you may receive by using them. Use at your own risk!
#
# Restore default Windows 7 symlink and junction points
#
# To run:
# (1) Start CMD as administrator
# (2) cd to directory where script is
# (3) Run: powershell -executionpolicy remotesigned -File restorelinks.ps1
#

# tmp folder for our work
New-Item -ItemType directory -Path .\tmp

$username = [Environment]::UserName
$userObj = New-Object System.Security.Principal.NTAccount("$username")
$userSid = $userObj.Translate([System.Security.Principal.SecurityIdentifier]).Value

# file, target, perms
$symlinks = @(,
    ("C:\Users\All Users", "C:\ProgramData", "D:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICIIO;GA;;;CO)(A;OICI;0x1200a9;;;BU)(A;CI;DCLCRPCR;;;BU)")
)

# file, target, perms
$junctions = @(
    ("C:\Users\Default User",                                     "C:\Users\Default",                                                            "D:PAI(D;;CC;;;WD)(A;;0x1200a9;;;WD)(A;;FA;;;SY)(A;;FA;;;BA)"),
    ("C:\Users\Default\Application Data",                         "C:\Users\Default\AppData\Roaming",                                            "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;ID;0x1200a9;;;BU)(A;OICIIOID;GXGR;;;BU)(A;ID;0x1200a9;;;WD)(A;OICIIOID;GXGR;;;WD)"),
    ("C:\Users\Default\Cookies",                                  "C:\Users\Default\AppData\Roaming\Microsoft\Windows\Cookies",                  "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;ID;0x1200a9;;;BU)(A;OICIIOID;GXGR;;;BU)(A;ID;0x1200a9;;;WD)(A;OICIIOID;GXGR;;;WD)"),
    ("C:\Users\Default\Local Settings",                           "C:\Users\Default\AppData\Local",                                              "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;ID;0x1200a9;;;BU)(A;OICIIOID;GXGR;;;BU)(A;ID;0x1200a9;;;WD)(A;OICIIOID;GXGR;;;WD)"),
    ("C:\Users\Default\My Documents",                             "C:\Users\Default\Documents",                                                  "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;ID;0x1200a9;;;BU)(A;OICIIOID;GXGR;;;BU)(A;ID;0x1200a9;;;WD)(A;OICIIOID;GXGR;;;WD)"),
    ("C:\Users\Default\NetHood",                                  "C:\Users\Default\AppData\Roaming\Microsoft\Windows\Network Shortcuts",        "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;ID;0x1200a9;;;BU)(A;OICIIOID;GXGR;;;BU)(A;ID;0x1200a9;;;WD)(A;OICIIOID;GXGR;;;WD)"),
    ("C:\Users\Default\PrintHood",                                "C:\Users\Default\AppData\Roaming\Microsoft\Windows\Printer Shortcuts",        "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;ID;0x1200a9;;;BU)(A;OICIIOID;GXGR;;;BU)(A;ID;0x1200a9;;;WD)(A;OICIIOID;GXGR;;;WD)"),
    ("C:\Users\Default\Recent",                                   "C:\Users\Default\AppData\Roaming\Microsoft\Windows\Recent",                   "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;ID;0x1200a9;;;BU)(A;OICIIOID;GXGR;;;BU)(A;ID;0x1200a9;;;WD)(A;OICIIOID;GXGR;;;WD)"),
    ("C:\Users\Default\SendTo",                                   "C:\Users\Default\AppData\Roaming\Microsoft\Windows\SendTo",                   "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;ID;0x1200a9;;;BU)(A;OICIIOID;GXGR;;;BU)(A;ID;0x1200a9;;;WD)(A;OICIIOID;GXGR;;;WD)"),
    ("C:\Users\Default\Start Menu",                               "C:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu",               "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;ID;0x1200a9;;;BU)(A;OICIIOID;GXGR;;;BU)(A;ID;0x1200a9;;;WD)(A;OICIIOID;GXGR;;;WD)"),
    ("C:\Users\Default\Templates",                                "C:\Users\Default\AppData\Roaming\Microsoft\Windows\Templates",                "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;ID;0x1200a9;;;BU)(A;OICIIOID;GXGR;;;BU)(A;ID;0x1200a9;;;WD)(A;OICIIOID;GXGR;;;WD)"),
    ("C:\Users\Default\AppData\Local\Application Data",           "C:\Users\Default\AppData\Local",                                              "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;ID;0x1200a9;;;BU)(A;OICIIOID;GXGR;;;BU)(A;ID;0x1200a9;;;WD)(A;OICIIOID;GXGR;;;WD)"),
    ("C:\Users\Default\AppData\Local\History",                    "C:\Users\Default\AppData\Local\Microsoft\Windows\History",                    "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;ID;0x1200a9;;;BU)(A;OICIIOID;GXGR;;;BU)(A;ID;0x1200a9;;;WD)(A;OICIIOID;GXGR;;;WD)"),
    ("C:\Users\Default\AppData\Local\Temporary Internet Files",   "C:\Users\Default\AppData\Local\Microsoft\Windows\Temporary Internet Files",   "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;ID;0x1200a9;;;BU)(A;OICIIOID;GXGR;;;BU)(A;ID;0x1200a9;;;WD)(A;OICIIOID;GXGR;;;WD)"),
    ("C:\Users\Default\Documents\My Music",                       "C:\Users\Default\Music",                                                      "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;ID;0x1200a9;;;BU)(A;OICIIOID;GXGR;;;BU)(A;ID;0x1200a9;;;WD)(A;OICIIOID;GXGR;;;WD)"),
    ("C:\Users\Default\Documents\My Pictures",                    "C:\Users\Default\Pictures",                                                   "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;ID;0x1200a9;;;BU)(A;OICIIOID;GXGR;;;BU)(A;ID;0x1200a9;;;WD)(A;OICIIOID;GXGR;;;WD)"),
    ("C:\Users\Default\Documents\My Videos",                      "C:\Users\Default\Videos",                                                     "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;ID;0x1200a9;;;BU)(A;OICIIOID;GXGR;;;BU)(A;ID;0x1200a9;;;WD)(A;OICIIOID;GXGR;;;WD)"),
    ("C:\Users\Public\Documents\My Music",                        "C:\Users\Public\Music",                                                       "D:PAI(D;;CC;;;WD)(A;;0x1200a9;;;WD)(A;;FA;;;SY)(A;;FA;;;BA)"),
    ("C:\Users\Public\Documents\My Pictures",                     "C:\Users\Public\Pictures",                                                    "D:PAI(D;;CC;;;WD)(A;;0x1200a9;;;WD)(A;;FA;;;SY)(A;;FA;;;BA)"),
    ("C:\Users\Public\Documents\My Videos",                       "C:\Users\Public\Videos",                                                      "D:PAI(D;;CC;;;WD)(A;;0x1200a9;;;WD)(A;;FA;;;SY)(A;;FA;;;BA)"),
    ("C:\Users\$username\Application Data",                       "C:\Users\$username\AppData\Roaming",                                          "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;$userSid)"),
    ("C:\Users\$username\Cookies",                                "C:\Users\$username\AppData\Roaming\Microsoft\Windows\Cookies",                "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;$userSid)"),
    ("C:\Users\$username\Local Settings",                         "C:\Users\$username\AppData\Local",                                            "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;$userSid)"),
    ("C:\Users\$username\My Documents",                           "C:\Users\$username\Documents",                                                "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;$userSid)"),
    ("C:\Users\$username\NetHood",                                "C:\Users\$username\AppData\Roaming\Microsoft\Windows\Network Shortcuts",      "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;$userSid)"),
    ("C:\Users\$username\PrintHood",                              "C:\Users\$username\AppData\Roaming\Microsoft\Windows\Printer Shortcuts",      "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;$userSid)"),
    ("C:\Users\$username\Recent",                                 "C:\Users\$username\AppData\Roaming\Microsoft\Windows\Recent",                 "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;$userSid)"),
    ("C:\Users\$username\SendTo",                                 "C:\Users\$username\AppData\Roaming\Microsoft\Windows\SendTo",                 "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;$userSid)"),
    ("C:\Users\$username\Start Menu",                             "C:\Users\$username\AppData\Roaming\Microsoft\Windows\Start Menu",             "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;$userSid)"),
    ("C:\Users\$username\Templates",                              "C:\Users\$username\AppData\Roaming\Microsoft\Windows\Templates",              "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;$userSid)"),
    ("C:\Users\$username\AppData\Local\Application Data",         "C:\Users\$username\AppData\Local",                                            "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;$userSid)"),
    ("C:\Users\$username\AppData\Local\History",                  "C:\Users\$username\AppData\Local\Microsoft\Windows\History",                  "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;$userSid)"),
    ("C:\Users\$username\AppData\Local\Temporary Internet Files", "C:\Users\$username\AppData\Local\Microsoft\Windows\Temporary Internet Files", "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;$userSid)"),
    ("C:\Users\$username\Documents\My Music",                     "C:\Users\$username\Music",                                                    "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;$userSid)"),
    ("C:\Users\$username\Documents\My Pictures",                  "C:\Users\$username\Pictures",                                                 "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;$userSid)"),
    ("C:\Users\$username\Documents\My Videos",                    "C:\Users\$username\Videos",                                                   "D:AI(D;;CC;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;$userSid)")
)

# dump acl file
Add-Content tmp\acl-tmp.dat "Users`r`nD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;;0x1200a9;;;BU)(A;OICIIO;GXGR;;;BU)(A;;0x1200a9;;;WD)(A;OICIIO;GXGR;;;WD)"
foreach ($symlink in $symlinks) {
    Add-Content tmp\acl-tmp.dat "$($symlink[0].Substring(3))`r`n$($symlink[2])"
}
foreach ($junction in $junctions) {
    Add-Content tmp\acl-tmp.dat "$($junction[0].Substring(3))`r`n$($junction[2])"
}

# generate formatted acl file
$aclTmp = [io.file]::ReadAllBytes("tmp\acl-tmp.dat")
$acl = New-Object Byte[] ($aclTmp.length*2)
$offset = 0
for ($i = 0; $i -lt $aclTmp.length; $i++) {
    $acl[$offset] = $aclTmp[$i]
    $acl[$offset+1] = 0x00
    $offset += 2
}
[io.file]::WriteAllBytes("tmp\acl.dat", $acl)

# create links
foreach ($symlink in $symlinks) {
    cmd /c mklink /D "$($symlink[0])" "$($symlink[1])"
    cmd /c attrib +s +h +i "$($symlink[0])" /L
    cmd /c icacls "$($symlink[0])" /setowner SYSTEM /L
}
foreach ($junction in $junctions) {
    cmd /c mklink /J "$($junction[0])" "$($junction[1])"
    cmd /c attrib +s +h +i "$($junction[0])" /L
    cmd /c icacls "$($junction[0])" /setowner SYSTEM /L
}

# restore link permissions
cmd /c icacls C:\ /restore tmp/acl.dat

# cleanup tmp folder
Remove-Item -Recurse -Force tmp

In case anyone has any strange need to delete all the generated symlink and junction points, you can use this.
@echo off

set FILES=(^
    "C:\Users\All Users"^
    "C:\Users\Default User"^
    "C:\Users\Default\Application Data"^
    "C:\Users\Default\Cookies"^
    "C:\Users\Default\Local Settings"^
    "C:\Users\Default\My Documents"^
    "C:\Users\Default\NetHood"^
    "C:\Users\Default\PrintHood"^
    "C:\Users\Default\Recent"^
    "C:\Users\Default\SendTo"^
    "C:\Users\Default\Start Menu"^
    "C:\Users\Default\Templates"^
    "C:\Users\Default\AppData\Local\Application Data"^
    "C:\Users\Default\AppData\Local\History"^
    "C:\Users\Default\AppData\Local\Temporary Internet Files"^
    "C:\Users\Default\Documents\My Music"^
    "C:\Users\Default\Documents\My Pictures"^
    "C:\Users\Default\Documents\My Videos"^
    "C:\Users\Public\Documents\My Music"^
    "C:\Users\Public\Documents\My Pictures"^
    "C:\Users\Public\Documents\My Videos"^
    "C:\Users\%username%\Application Data"^
    "C:\Users\%username%\Cookies"^
    "C:\Users\%username%\Local Settings"^
    "C:\Users\%username%\My Documents"^
    "C:\Users\%username%\NetHood"^
    "C:\Users\%username%\PrintHood"^
    "C:\Users\%username%\Recent"^
    "C:\Users\%username%\SendTo"^
    "C:\Users\%username%\Start Menu"^
    "C:\Users\%username%\Templates"^
    "C:\Users\%username%\AppData\Local\Application Data"^
    "C:\Users\%username%\AppData\Local\History"^
    "C:\Users\%username%\AppData\Local\Temporary Internet Files"^
    "C:\Users\%username%\Documents\My Music"^
    "C:\Users\%username%\Documents\My Pictures"^
    "C:\Users\%username%\Documents\My Videos"^
)

for %%a in %FILES% do (
    icacls %%a /grant "%username%:(F)" /L
    icacls %%a /setowner %username% /L
    attrib -S -I -H %%a /L
    rmdir %%a
)


text:
Q: Where to host Meteor-Apps? I want to build a Meteor-App to run a little side-project/business. This in mind:

*

*I want a cheap environment (online) to test and share my progress

*I want to have the option to scale it up in terms of production in a few months

*I want to use some standard command line tools to push to this service

*The database options have also to scale up if i need more

I've started looking into Heroku, but are there any "good practices" which anybody can recommend? I never hosted a Meteor-App, and i want to avoid a private server because of administration etc.

A: Meteor apps are immediately ready to deploy to Heroku. Your question is very broad, but Heroku fits the bill for every parameter you specified.
Here's a flow for creating an example meteor app and deploying it:
$ meteor create --example leaderboard
$ cd leaderboard
$ git init . && git add .
$ git commit -m "First commit"
$ heroku create --buildpack https://github.com/jordansissel/heroku-buildpack-meteor
$ git push heroku master

A: There are a few options:

*

*Meteor.Com -- the easiest option, free hosting from Meteor. Super easy deployments, but limited resources until the Galaxy platform is complete. Not suitable for very high load/traffic sites (yet).

*PaaS providers -- cloud hosting where you are responsible for your app, and the provider manages the infrastructure for you. Generally small virtual machines which host node apps, with great deployment tools.

*Own Infrastructure -- info on how to host on your own servers, or via IaaS providers like Amazon AWS, Digital Ocean, Rackspace, etc. Most complicated option.

*Deployment Services - services to manage deployment to your own servers (or IaaS servers). Advantages of the above but with the management taken care of for you (managed deployment, monitoring, etc).
Source: Meteorpedia

A: I have been hosting some meteor apps on Webfactions and it has been working fine so far.
Here is a tutorial :
http://racingtadpole.com/blog/meteor-mongodb-webfaction/


text:
Q: Prove Looped line is Hausdorff Definition of Looped line At each point $x$ of the real line other than the origin, the basic neighborhoods of $x$ will be the usual open intervals centered at $x$. Basic neighborhoods of the origin will be the sets
$(-\epsilon,\epsilon)\cup(-\infty,-n)\cup(n,\infty)$ for all possible  choices $\epsilon >0$ and $n \in \mathbb{N}$. This gives a topology on the line.
Problem. Prove the looped line is Hausdorff.
I know, by definition of Hausdorff space, with different points $x,y$ and differents of zero, we can disjoint open. But when, for example, $x=0$ there's no exists a open of $y$ such that both are disjoints. Could you guide me to solve this problem?


text:
Q: Xamarin - How to send Push Notifications without using another service Hi I'm wanting to send push notifications to devices for both iOS and Android. But I am wanting to do it by not using Azure or other Products and services like that. Is this at all possible and if so how would I achieve this.

A: To send you push notifications, you will need to have some sort of server to communicate with Apple's and Google's push services. And presumably if you're sending push notifications, you have some sort of content you need to deliver to the mobile device, which implies you are running a web service somewhere to deliver the content.
The server that handles push notifications can be anything from a box running in your closet to an IaaS virtual machine from a commercial cloud provider. However, your most inexpensive option will likely be Azure Notification Hubs or something similar from another provider.

A: All push notification architectures require some service, in addition to the platform notification service, to send push notifications. The following diagram (from the Azure docs) shows the basic lifecycle of a notification:

Notice that some backend service has to be there to both keep track of handle assigned to a device by the PNS and also to send the actual notifications. The free tier in Azure Notification Hubs lets you have up to 500 devices and 1 million pushes before you have to move up to a pay tier. Agree with jblair that you should at least take a look at Notification Hubs, and there is a Xamarin quickstart tutorial.
(Full disclosure, I do work at Microsoft on Azure.)


text:
Q: What is the correct way to have multiple grok patterns in a Logstash filter? What is the valid logstash config of these 2 options?
else if [pipeline] == "tomcat_all" {
  grok {
    match => [ "message", "%{MONTH}%{SPACE}%{MONTHDAY},%{SPACE}%{YEAR}%{SPACE}%{HOUR}:?%{MINUTE}(?::?%{SECOND})%{SPACE}(?:AM|PM)%{SPACE}%{NOTSPACE:class}%{SPACE}%{NOTSPACE:type_log}%{SPACE}%{WORD:loglevel}:%{SPACE}%{GREEDYDATA:log_text}" ]
    match => [ "message", "%{TIME:timestamp}%{SPACE}\|-%{WORD:loglevel}%{SPACE}in%{SPACE}%{NOTSPACE:class}%{SPACE}%{GREEDYDATA:log_text}" ]

...

else if [pipeline] == "123" {
  grok {
    match => [ "message", "%{MONTH}%{SPACE}%{MONTHDAY},%{SPACE}%{YEAR}%{SPACE}%{HOUR}:?%{MINUTE}(?::?%{SECOND})%{SPACE}(?:AM|PM)%{SPACE}%{NOTSPACE:class}%{SPACE}%{NOTSPACE:type_log}%{SPACE}%{WORD:loglevel}:%{SPACE}%{GREEDYDATA:log_text}" ]
  }
  grok {
    match => [ "message", "%{TIME:timestamp}%{SPACE}\|-%{WORD:loglevel}%{SPACE}in%{SPACE}%{NOTSPACE:class}%{SPACE}%{GREEDYDATA:log_text}" ]
  }

Logstash seems to start fine with both configurations and report no errors, but the grok parsing isn't working properly with multiple grok patterns yet.

A: In comparison, both will almost perform equally since the default value for break_on_match is true.
break_on_match

*

*Value type is boolean

*Default value is true

Break on first match. The first successful match by grok will result in > the filter being finished. If you want grok to try all patterns (maybe  you are parsing different things), then set this to false.

Your first pattern can be further simplified as follows,
filter {
   grok {
     match => [ "message", "PATTERN1", "PATTERN2" ]
    }
}

Please refer to this answer as well, Multiple patterns in one log


text:
Q: How can i convert get date from database and display without this "java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Date" I am trying to show the details inserted into my database on a weppage
I have tried converting the date to sql date
public static List<Detail> getAllRecords(){
    List<Detail> list = new ArrayList<Detail>();

    try{
        Connection con = getConnection();
        PreparedStatement ps = con.prepareStatement("select * from studentDetails");
        ResultSet rs = ps.executeQuery();
        while(rs.next()){
            Detail u = new Detail();
                        java.sql.Date dbSqlDate = rs.getDate("dob");

                        u.setPassword(rs.getInt("password"));
                        u.setName(rs.getString("name"));
                        u.setLastname(rs.getString("lastname"));
                        u.setUsername(rs.getString("username"));
                        u.setEmail(rs.getString("email"));
                        u.setAddress(rs.getString("address"));
                        System.out.println("dbSqlDate=" + dbSqlDate);
                        u.setAge(rs.getInt("age"));
                        list.add(u);
        }
    }catch(Exception e){System.out.println(e);}
    return list;
}

I expect the output to be 02/03/2000 , but it's not working

A: Quickfix is to add ?zeroDateTimeBehavior=convertToNull to the MySQL JDBC URL when establishing the connection.

The start of a longer answer would point out that...
By default, MySQL allows special "zero" date values to be stored in DATE / DATETIME columns.  When retrieved, those values are strings in format '0000-00-00'. When pulled into Java through JDBC, Java doesn't allow java.util.Date values to have that value.
The "zero" date behavior of MySQL can be disallowed by some settings of sql_mode. We may also want to ensure that column allows for NULL values (i.e. if the column is not defined as NOT NULL), and/or modify the column definition to provide a non-zero default value ...
The "zero" date values already in the column can be replaced with NULL value, e.g.:
UPDATE `studentDetails` SET dob = NULL WHERE dob = '0000-00-00'

zeroDateTimeBehavior is documented here:
https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties.html
MySQL DATE behavior documented here
https://dev.mysql.com/doc/refman/8.0/en/date-and-time-types.html
excerpt:

MySQL permits you to store a "zero" value of '0000-00-00' as a "dummy date." This is in some cases more convenient than using NULL values, and uses less data and index space. To disallow '0000-00-00', enable the NO_ZERO_DATE mode.


text:
Q: I/O issue with AWS server Currently we have a number of Amazon AWS c3.large setups and I'm trying to figure out the bottle neck. The load is very high on most of them during our peak periods.
It looks to be high disk utilization as iostat is at 100 for the majority of the time with respect to %util (last column):
iostat -x 1 Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util xvdap1            0.00
0.00    0.00   68.00     0.00 16712.00   245.76   137.40 1924.29  14.71 100.00

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.51    0.00    6.06   93.43    0.00    0.00

Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util xvdap1            0.00
0.00    0.00   69.00     0.00 16560.00   240.00   136.34 1895.94  14.49 100.00

The thought might be that the IOPS used with the 64 GB General Purpose SSD might not be enough (192 IOPS).
Although watching the tps (IOPS) seems to average about 70-80. So it seems to be enough. But I do notice some occasional high bursts well above that. I believe that shouldn't be a problem either as the bursts are up to 3000.
sar -b 1
Linux 3.14.35-28.38.amzn1.x86_64 (ip-10-167-69-88)      03/04/2016      _x86_64_        (2 CPU)

09:08:35 PM       tps      rtps      wtps   bread/s   bwrtn/s
09:08:36 PM     78.12      1.04     77.08      8.33  16700.00
09:08:37 PM     73.74      0.00     73.74      0.00  16880.81
09:08:38 PM     76.77      1.01     75.76      8.08  16452.53
09:08:39 PM     68.69      0.00     68.69      0.00  16678.79
09:08:40 PM     72.92      0.00     72.92      0.00  17250.00
09:08:41 PM     72.04      0.00     72.04      0.00  17677.42
09:08:42 PM    144.68      0.00    144.68      0.00   9480.85
09:08:43 PM    141.05      0.00    141.05      0.00   9574.74
09:08:44 PM     97.98      0.00     97.98      0.00  13664.65
09:08:45 PM    185.26      0.00    185.26      0.00   4244.21
09:08:46 PM     96.91      0.00     96.91      0.00  14564.95
09:08:47 PM     68.32      0.00     68.32      0.00  16324.75
09:08:48 PM     66.67      0.00     66.67      0.00  16703.03

Do you think the problem is the number of IOPS allocated or should I be looking at something else?

A: Your IO subsystem (aka disks) are your problem here. Your system is spending a huge amount of time waiting for IO requests to be fulfilled. I tend to start looking at upgrades whenever my systems reach ~5% iowait. Needless to say, you're way beyond that.
You'll need to increase the amount of IOPS that are available to your system. Your first option is migrate to a PIOPS (Provisioned IOPS) EBS volume if you're not already using one. After doing that, then increase the IOPS setting until you get the performance you need.


text:
Q: Validar jQuery, envio de datos con submitHandler con sweet alert el sweet alert no se me dispara. Quizá es por el evento. Si comentamos los sweet alert y descomentamos un alert normal sí me dice el mensaje.
En mi index, me logueo, mando datos a un servlet, recupero la respuesta del sevlet y, si sus credenciales son correctas, le mando 1 y redirecciono a menú,..., sino, pues credenciales incorrectas.
  $(document).ready(function(){
    $("#FRM_Login").validate({
        rules : {
            usuario : {
                required : true,
                minlength : 5,
                maxlength : 25
            },
            pass : {
                required : true,
                minlength : 8,
                maxlength : 12
            }
        },
        messages : {
            usuario : {
                required : "El campo usuario es obligatorio",
                minlength : "El usuario debe contener al menos 5 caracteres",
                maxlength : "El usuario debe contener no mas de 25 caracteres"
            },
            pass : {
                required : "El campo password es obligatorio",
                minlength : "La contraseña debe contener al menos 8 caracteres",
                maxlength : "La contraseña debe contener no mas de 12 caracteres"
            }
        },
        submitHandler: function (form){
            var data = $("#FRM_Login").serialize();
            $.post("Login", data, function (respuesta, estado, jqXHR){
                if(respuesta === '1'){
                    $("#BTN_Login").onclick = function(){
                        swal({
                            title: "Credenciales Correctas",
                            text: "Redireccionando...",
                            type: "success",
                            timer: 1000,
                            showConfirmButton: false
                        });
                    };
                    //alert("Credenciales Correctas");
                    var delay = 2000;
                    setTimeout(function(){ window.location = "Menu.jsp"; }, delay);
                }else{
                    $(document).ready(function(){
                        swal("Oops...", "Credenciales Incorrectas!", "error");
                    };
                    //alert("Credenciales Incorrectas");
                }
                $("#usuario").val("");
                $("#pass").val("");
            });
        }
    }); });

A: No veo la necesidad del .onclick cuando respuesta === 1 (ya fueron enviados los datos y solo vas a redireccionar) y cuando esta condición es falsa, normalmente $(document).ready no funciona en solicitudes ajax:
        submitHandler: function (form){
        var data = $("#FRM_Login").serialize();
        $.post("Login", data, function (respuesta, estado, jqXHR){
            if(respuesta === '1'){

                    swal({
                        title: "Credenciales Correctas",
                        text: "Redireccionando...",
                        type: "success",
                        timer: 1000,
                        showConfirmButton: false
                    });

                var delay = 2000;
                setTimeout(function(){ window.location = "Menu.jsp"; }, delay);
            }else{

                    swal("Oops...", "Credenciales Incorrectas!", "error");

            }
            $("#usuario").val("");
            $("#pass").val("");
        });


text:
Q: Spotlight Recursive Search in Finder How do I have a recursive search for filetypes in a Finder folder?

*

*no AppleScript

*no Terminal

*100% Spotlight

Is this possible?  Looking for mp3 and jpg file types.  I am using El Capitan (macOS 10.10)

A: Spotlight Search
Use the kind attribute in your Spotlight search.  For example, in the search dialog, type
kind:mp3
to find all MP3 files.  I have a listing of all the relevant attributes in this answer.
So, for a more relevant example, you would issue a Spotlight search with your search term in double quotes and specify the attribute as follows:
"search term" kind:mp3

Not indexed by Spotlight
If you have a location not indexed by Spotlight, the most efficient tool for doing this is the built in tool find, however, since "Terminal" is off the table, you're options are limited.

*

*Use Finder Search ⌘ CommandF and create a query for that specific location.  Here's an example of a Finder search for images in my "Backgrounds" folder (and below)

*Use a 3rd party tool. Disclaimer:  There are many tools out there, but the good ones will usually have a cost. These are the ones I'm familiar with however, they are not what I use as I prefer to utilize built in tools like find, mdfind and even locate via the command line.

*

*HoudahSpot 5 ($35USD) Allows you to create and save complex search queries on macOS.

*Alfred (Free, but Powerpack is about $40USD).  This is more of a productivity and workflow tool, but it does have excellent search capabilities.  The Powerpak can greatly enhance all of the functions.

*Find Any File ($8USD).  A search utility that goes beyond Spotlight.

*EasyFind ($0). File search utility that helps organize your searching.   Recommended by user Tetsujin

A: It is possible to do a recursive search in Finder using Spotlight.
I just forgot to make sure that Spotlight had indexed the volume I was trying to search.
I removed this volume from the Privacy tab in System Preferences > Spotlight, and now I can search it recursively with Finder.


text:
Q: What is the difference between "apply" and "mapcar" in Lisp (defun describe-paths (location edges)
(apply #'append (mapcar #'describe-path (cdr (assoc location edges)))))

A: The describe-paths function (from the text based adventure game in Land of Lisp!) generates descriptions for the paths going from a given location. Page 74-77 in Land of Lisp explains the roles of mapcar and append in the example.
The (cdr (assoc location edges)) provides a list of all paths going from the location, such as these for the living-room location:
((GARDEN WEST DOOR)
 (ATTIC UPSTAIRS LADDER))

The mapcar calls the function describe-path for each of the paths, collecting the path descriptions into a list where each of the sublists is a path description:
((THERE IS A DOOR GOING WEST FROM HERE.)
 (THERE IS A LADDER GOING UPSTAIRS FROM HERE.))

Next the append function is applied to the list of path descriptions, concatenating it into a flat list:
(THERE IS A DOOR GOING WEST FROM HERE. THERE IS A
  LADDER GOING UPSTAIRS FROM HERE.)

A: What are the similarities? Or, is there another question lurking here?
(Links from elisp, because that is what I know. The quotes are just excerpts and the links contain examples which may or may not be relevant in a particular "Lisp".)
mapcar

mapcar is a function that calls its first argument with each element of its second argument, in turn. The second argument must be a sequence.

apply (in Calling Functions)

apply calls function with arguments, just like funcall but with one difference: the last of arguments is a list of objects, which are passed to function as separate arguments, rather than a single list. We say that apply spreads this list so that each individual element becomes an argument.

Happy coding.


text:
Q: Why does importing pycuda.driver under sudo lead to "libcurand.so.10: cannot open shared object file: No such file or directory" I am trying to import pycuda-2021.1 in a python script. My OS is Ubuntu 18.04. I have cuda toolkit 11.2 installed and my nvidia driver version is 460.27.04. My python interpretor is Python 3.8. When I execute
import pycuda.driver as cuda

I seem to be able to do so without executing the python script under sudo. However, when using sudo, this leads to the following error:

ImportError: libcurand.so.10: cannot open shared object file: No such file or directory

How can I resolve this issue?

A: I've found a solution myself, by refering to this post: 完美解决ImportError: libcudart.so.10.0: cannot open shared object file: No such file or directory (this post is in Chinese). Basically, the solution is to execute the following command:
sudo ldconfig /path/to/your/cuda/lib64
which in my case should be
sudo ldconfig /usr/local/cuda-11.2/lib64


text:
Q: sameformfieldsasarray in Application.cfm I am working on a Legacy Application and they are using Application.cfm, now that file cannot be converted to Application.cfc due to the fact that the site is too big and probably making a change will make it unstable
In one of the Pages, I have defined the form field as: keys[] to return me an array. I have defined the
<cfset this.sameformfieldsasarray = "true">

in Application.cfm under the cfapplication tag
But that does not seems to be working, it just creates the list rather than an array.
So Question is:

*

*How can i use that function?

*If i cannot use that function in Application.cfm, is there any other way to use it in The Page only where I need to the form value as an array

i am using coldfusion Version 11

A: I think you are setting the value to be a string rather than a boolean
<cfset this.sameformfieldsasarray = "true">

Should be
<cfset this.sameformfieldsasarray = true>

Also consider using application.cfc


text:
Q: PHP Script will not insert into mysql I am writing this code and have it working well so far.  Basically, it is the phpacademy OOP Login script that I am modifying for my own uses.  The part I'm having issues with is
$user->update(array(
                    'username' => input::get('username'),
                    'name' => input::get('name'),
                    'address' => input::get('address'),
                    'group' => input::get('group'),
                    'hire_date' => input::get('hire_date'),
                    ), $user->findUser(input::get('username'), 'id'));

It will work great if I remove the group line out of it, but with group in, it just doesn't work.  I do have the group as a column in my mysql database so I'm not sure where to go from here.  Still kind of new to this, but learning a lot.  I would appreciate the help anybody can give me.
The update user page
<?php
require_once 'core/init.php';
$user = new user();
$db = db::getInstance();
if($user->data()->group > 1) {
    session::flash('home', "You do not have permission to view this page");
    redirect::to('home.php');
}
if(!$user->isloggedin()) {
    redirect::to('index.php');
}
if(input::exists()) {
    if(token::check(input::get('token'))){
        $validate = new validate();
        $validation = $validate->check($_POST, array(
            'username' => array(
                'required' => true,
                'min' => 2
            ),
            'name' => array(
                'required' => true,
                'min' => 2,
                'max' => 50
            ),
            'hire_date' => array(
                'required' => true,
            ),
            'address' => array(
                'required' => true,
                'max' => 100
            ),
            'group' => array(
                'required' => true,
            )
        ));
        if($validation->passed()) {
            try {
                $user->update(array(
                    'username' => input::get('username'),
                    'name' => input::get('name'),
                    'address' => input::get('address'),
                    'group' => input::get('group'),
                    'hire_date' => input::get('hire_date'),
                    ), $user->findUser(input::get('username'), 'id'));
                session::flash('home', 'the details have been updated');
                redirect::to('home.php');
            } catch (Exception $e) {
                die($e->getMessage());
            }
        } else {
            foreach($validation->errors() as $error){
                echo $error, '
';
            }
        }
    }
}
?>

    <title>PCTSoft V1.0</title>
    <link rel="stylesheet" type="text/css" href="css/style.css">

    <form action="" method="post" class="register">

            Username
            <input type="text" value="" id="username" name="username">

            Name
            <input type="text" value="<?php echo escape($user->findUser(input::get('username'), 'name'));?>" id="name" name="name">

            Hire Date
            <input type="text" value="<?php echo escape($user->findUser(input::get('username'), 'hire_date'));?>" id="hire_date" name="hire_date" placeholder="2014-01-01">

            Address
            <input type="text" value="<?php echo escape($user->findUser(input::get('username'), 'address'));?>" id="address" name="address" style="width:300px;">

            Group
            <input type="text" id="group" name="group" value="<?php echo escape($user->findUser(input::get('username'), 'group'));?>">

            <input type="submit" value="Update">
            <input type="hidden" name="token" value="<?php echo token::generate();?>">

    </form>

The user class
<?php
class user {
    private $_db,
            $_data,
            $_sessionName,
            $_cookieName,
            $_isloggedin;

    public function __construct($user = null) {
        $this->_db = db::getInstance();
        $this->_sessionName = config::get('session/session_name');
        $this->_cookieName = config::get('remember/cookie_name');
        if(!$user) {
            if(session::exists($this->_sessionName)) {
                $user = session::get($this->_sessionName);
                if($this->find($user)) {
                    $this->_isloggedin = true;
                } else {
                    $this->logout();
                }
            }
        } else {
            $this->find($user);
        }
    }
    public function update($fields, $id = null) {
        if(!$id && $this->isloggedin()) {
            $id = $this->data()->id;
        }
        if(!$this->_db->update('users', $id, $fields)) {
            throw new Exception('there was a problem updating the information');
        }
    }
    public function create($fields = array()) {
        if(!$this->_db->insert('users', $fields)) {
            throw new Exception('There was a problem creating an account');
        }
    }
    public function findUser($user = null, $column) {
        if($user) {
            $field = (is_numeric($user)) ? 'id' : 'username';
            $data = $this->_db->get('users', array($field, '=', $user));
            if($data->count()) {
                $this->_data = $data->first();
                return $this->data()->$column;
            }
        }
    }
    public function find($user = null) {
        if($user) {
            $field = (is_numeric($user)) ? 'id' : 'username';
            $data = $this->_db->get('users', array($field, '=', $user));
            if($data->count()) {
                $this->_data = $data->first();
                return true;
            }
        }
    }
    public function login($username = null, $password = null, $remember = false) {

        if(!$username && !$password && $this->exists()) {
            session::put($this->_sessionName, $this->data()->id);
        } else {
        $user = $this->find($username);
        if($user) {
            if($this->data()->password === hash::make($password, $this->data()->salt)) {
                session::put($this->_sessionName, $this->data()->id);
                if($remember) {
                    $hash = hash::unique();
                    $hashCheck = $this->_db->get('users_session', array('user_id', '=', $this->data()->id));
                    if(!$hashCheck->count()) {
                        $this->_db->insert('users_session', array(
                            'user_id' => $this->data()->id,
                            'hash' => $hash
                        ));
                    } else {
                        $hash = $hashCheck->first()->hash;
                    }
                    cookie::put($this->_cookieName, $hash, config::get('remember/cookie_expiry'));
                }
                return true;
            }
        }
      }
      return false;
    }
    public function exists() {
        return (!empty($this->_data)) ? true : false;
    }
    public function logout() {
        $this->_db->delete('users_session', array('user_id', '=', $this->data()->id));
        session::delete($this->_sessionName);
        cookie::delete($this->_cookieName);
    }
    public function data() {
        return $this->_data;
    }
    public function isloggedin() {
        return $this->_isloggedin;
    }
}

The db class
<?php
class db {
    private static $_instance = null;
    private $_pdo,
            $_query,
            $_error = false,
            $_results,
            $_count = 0;
    private function __construct() {
        try {
            $this->_pdo = new PDO('mysql:host=' . config::get('mysql/host') . ';dbname=' . config::get('mysql/db'),config::get('mysql/username'),config::get('mysql/password'));
        } catch (PDOException $ex) {
            die($ex->getMessage());
        }
    }
    public static function getInstance() {
        if(!isset(self::$_instance)) {
            self::$_instance = new db();
        }
        return self::$_instance;
    }
    public function query($sql, $params = array()) {
        $this->_error = false;
        if($this->_query = $this->_pdo->prepare($sql)) {
            $x = 1;
            if(count($params)) {
                foreach($params as $param) {
                    $this->_query->bindValue($x, $param);
                    $x++;
                }
            }
            if($this->_query->execute()) {
                $this->_results = $this->_query->fetchAll(PDO::FETCH_OBJ);
                $this->_count = $this->_query->rowCount();
            } else {
                $this->_error = true;
            }
        }
        return $this;
    }
    public function action($action, $table, $where = array() ) {
        if(count($where) === 3) {
            $operators = array('=', '>', '<', '>=', '<=');
            $field      = $where[0];
            $operator   = $where[1];
            $value      = $where[2];

            if(in_array($operator, $operators)) {
                $sql = "{$action} FROM {$table} WHERE {$field} {$operator} ?";
                if(!$this->query($sql, array($value))->error()) {
                    return $this;
                }
            }
        }
        return false;
    }
    public function get($table, $where) {
        return $this->action('SELECT *', $table, $where);
    }
    public function delete($table, $where) {
        return $this->action('DELETE', $table, $where);
    }
    public function insert($table, $fields = array()) {
        $keys = array_keys($fields);
        $values = '';
        $x=1;
        foreach($fields as $field) {
            $values .= "?";
            if($x < count($fields)) {
                $values .= ', ';
            }
            $x++;
        }
        $sql = "INSERT INTO $table (`" . implode('`, `', $keys) . "`) VALUES ({$values})";
        if(!$this->query($sql, $fields)->error()) {
            return true;
        }
        return false;
    }
    public function update($table, $id, $fields = array()) {
        $set = '';
        $x = 1;
        foreach($fields as $name => $value) {
            $set .= "{$name} = ?";
            if($x < count($fields)) {
                $set .= ',';
            }
            $x++;
        }
        $sql = "UPDATE {$table} SET {$set} WHERE id = {$id}";

        if(!$this->query($sql, $fields)->error()) {
            return true;
        }
        return false;
    }
    public function results() {
        return $this->_results;
    }
    public function first() {
        $return = $this->results();
        return $return[0];
    }
    public function error() {
        return $this->_error;
    }
    public function count() {
        return $this->_count;
    }
}

A: As @DanFromGermany pointed out, there is for sure a problem with escaping of the database table columns.
class Db {
  public function update($table, $id, $fields = array()) {
    $set = '';
    $x = 1;
    foreach($fields as $name => $value) {
      $set .= "`{$name}` = ?"; // Mind this row. ` were added to table column name.
      if($x < count($fields)) {
        $set .= ',';
      }
      $x++;
    }
    $sql = "UPDATE {$table} SET {$set} WHERE id = {$id}";

    if(!$this->query($sql, $fields)->error()) {
      return true;
    }
    return false;
  }
}

Also you should read up on PDOStatement::errorInfo().
It would have reported that error. ;)
Please vote @DanFromGermany s comment up, if this is really this answer helps you out.
By the way: Class names should be always starting with a capital letter. Preferably continuing in camelCase

A: In MySQL, you cannot name a column "Group" since it is a reserved word.  Rename the column to something more specific to your code, like userGroup.


text:
Q: Adjust a Control Template and still respect the Theme of the OS? In WPF how do I modifiy the template for a standard control in a way that it will respect the current Theme of the Operating System later on? If I just "edit a copy" of the template in blend, it will just give me the template of the currently running theme. Is this correct? So when I apply the modified template and run the app on different themes it will always look the same.
For custom controls and even for data templates the problem is similar. How do I provide a template that respects all possible themes of the OS?

A: I don't think this is possible. If you create a template for a control you are replacing the entire control template.
You can use styles to just configure exposed properties, but if you change the template, you are no longer related to the theme. You can create a separate override of the template for each theme, but you would have to define each explicitly and if Microsoft created a new theme you would have to create a new template to match it.
See my own related question - When overriding WPF templates do I have to override each theme's template separately?


text:
Q: Toggle a button to be viewed after a checkbox has been checked, and disappear if unchecked Below I have code for a specific application that I am building with PHP. My job is User interface, and I have looked and looked for code on how to make this work.
With this form, it's using the latest update of Jquery UI to styalize the buttons and checkboxes. I need for the button to appear when a check box has been checked, and disappear when unchecked.
Haven't been able to find any code that works for this, and is driving me half insane, and lagging me behind.
<form name="purpose" method="post" action="" >

        <input type="checkbox" id="radio1" name="homework" value="homework" >Homework
        <input type="checkbox" id="radio2" name="computer" value="computer" >Computer

        <input type="checkbox" id="radio3" name="books" value="books" >Books
        <input type="checkbox" id="radio4" name="reading" value="reading" >Reading

        <input type="checkbox" id="radio5" name="tutoring" value="tutoring" >Tutoring

        <button id="btnCheckinBtn" style="font-size: 18pt; width: 175px; height: 75px;">Check In</button>

</form>

A: Seems I misread your question, and you want the button enabled when any checkbox is checked.
This will look and see if any checkboxes are ticked, within the form with name purpose.
$("input:checkbox").change(function() {
  $("#btnCheckin").toggle(!!$('form[name="purpose"] > input:checkbox:checked').length))
});

A: IF I read your requirements properly, you need to check if  ANY of the checkboxes are check to show the button, and if ALL are unchecked, hide it?
This can occur on a click or on a keyboard action so you need to check the change event for that.  Wrap this up in a document ready handler, include jQuery and you are set.
$('input:checkbox').change(function () {
    if ($('input[type=checkbox]:checked').length > 0) {
        $('#btnCheckin').show();
    } else {
        $('#btnCheckin').hide();
    }
});

Here is a fiddle with your markup:http://jsfiddle.net/GGdtw/

A: When you click the checkbox, check to see if it is checked or unchecked, and based on that, enable or disable the button. (Using jQuery)

Also, get rid of the "display: none;" in the button style.
Fiddle: http://jsfiddle.net/mbYby/

A: You can also use jQuery '.toggle()':
http://api.jquery.com/toggle/


text:
Q: Removing certain lines/vectors from map It has been a while since I have done anything but basic work with GIS.
I have a map with a utility system, comprised of points and lines. I wish to create a map with only a select few of these lines.
Is there any easy way to copy the vectors and nodes I want, and copy them to a new layer or shapefile, or to mass delete the one I do not want?

A: You have a few options.  If you already have the lines selected then right click the layer in the table of contents, choose Selection, and choose Create Layer From Selected Features.  This will create an in-memory representation of your selected features.  Then, turn off the original data.
If you do not have the lines selected then you could select them manually-if there was only a few lines,-or write a definition query to only display lines that have some common attributes.
You probably want to avoid do a mass delete since this kind of change to the data would result in a permanent loss.


text:
Q: Wordpress sIte doesn't work after transfer from local server (database issue?) I have developed a custom WordPress theme with custom woocommerce shop locally with MAMP. It works great.
I have uploaded all the files to the server, revised the config file for new database.
Created the database, exported it from my local with in the phpMyadmin and imported it to the online server database. The database was 16MB so it didn't import well as one file or as separate tables so I used bigdump to import it. and it looked like it worked.
after that I changed the URLs to the new ones from in wp_options table in phpMyadmin of the new db.
However the site now displays error lines and the WordPress Admin Bar is missing from the top.
In addition to that the Products tab of woocommerce is missing and the plugin admin area is empty. I also cannot install plugins. etc' It all doesn't function well.
I'm guessing this is a bad transfer of the database but I have no clue.
This is the website
Error lines examples:
Warning: array_merge(): Argument #2 is not an array in /usr/local/pem/vhosts/254369/webspace/httpsdocs/wp-content/plugins/wp-pagenavi/scb/Options.php on line 46

Also...
Warning: call_user_func_array(): First argument is expected to be a valid callback,

'woocommerce_demo_store' was given in /usr/local/pem/vhosts/254369/webspace/httpsdocs/wp-includes/plugin.php on line 405

Any advise on figuring out what the problem is?

A: You shouldn't import the data by exporting all tables through phpMyAdmin. In the process you will overwrite the tables that were created for the new wordpress installation, with its own values for options such as siteurl, bloginfo etc.
So re-install Wordpress on the new server, to start again clean. Don't overwrite the tables it auto-generates.
Login to your development wordpress dashboard, go to Tools > Export and select all content, including all linked files. Go to new Wordpress, go to tools > Import, select Wordpress, install the plugin, choose the file you exported and you should be all set.
You will need to update some URL's that might not get updated within your posts/pages. You might also need to update catid's in your code, as the imported categories will get assigned new values.

A: James - regarding the import error, this is because the server you are trying to import the file on has a limit on the size of files it can import.
Go into the root folder of your server (the one in which wp-content, wp-includes etc folders are in), and either edit the php.ini file currently there, or upload a new one. You can download this sample file: http://www.reallylinux.com/docs/php.ini and upload it. Edit the post_max_size and upload_max_filesize value to 50MB or something: post_max_size = 50M
This will fix the import problem.
For the plugin error, copy the plugin files from wp-content from your dev server and import them into the live server, it should work.


text:
Q: R reactive histogram I am learning the Shiny interface for R and working through the first example.
The histogram changes based on the slider input. How do I have it update continuously, while the slider is moving? Right now, it only updates when the slider stops moving.
ui.R
library(shiny)

# Define UI for application that draws a histogram
shinyUI(fluidPage(

  # Application title
  titlePanel("Hello Shiny!"),

  # Sidebar with a slider input for the number of bins
  sidebarLayout(
    sidebarPanel(
      sliderInput("bins",
                  "Number of bins:",
                  min = 1,
                  max = 50,
                  value = 30)
    ),

    # Show a plot of the generated distribution
    mainPanel(
      plotOutput("distPlot")
    )
  )
))

server.R
library(shiny)

# Define server logic required to draw a histogram
shinyServer(function(input, output) {

  # Expression that generates a histogram. The expression is
  # wrapped in a call to renderPlot to indicate that:
  #
  #  1) It is "reactive" and therefore should re-execute automatically
  #     when inputs change
  #  2) Its output type is a plot

  output$distPlot <- renderPlot({
    x    <- faithful[, 2]  # Old Faithful Geyser data
    bins <- seq(min(x), max(x), length.out = input$bins + 1)

    # draw the histogram with the specified number of bins
    hist(x, breaks = bins, col = 'darkgray', border = 'white')
  })
})

What I have tried:
#server.R
    library(shiny)

    shinyServer(function(input,output) {
                    x<-faithful[,2]
                    bins <- reactive({
                            seq(min(x),max(x),length.out=input$bins+1)
                    })

                    output$distPlot <- renderPlot({
                    hist(x,breaks=bins(),col='darkgray',border='white')})
    })

Is there a way to make it react faster/real-time?

A: Thanks to Dean's response I investigated the shinyCustom package in github.
Here is my solution:
#Shiny UI
library(shiny)
library(shinyCustom)

# Define UI for application that draws a histogram
shinyUI(fluidPage(

  # Application title
  titlePanel("Hello Shiny!"),

  # Sidebar with a slider input for the number of bins
  sidebarLayout(
    sidebarPanel(
      useShinyCustom(slider_delay = "0"), #make a call to shinyCustom, where there is no delay
      customSliderInput("bins", #Use customSliderInput instead of sliderInput
                  "Number of bins:",
                  min = 1,
                  max = 50,
                  value = 30)
    ),

    # Show a plot of the generated distribution
    mainPanel(
      plotOutput("distPlot")
    )
  )
))

App now updates as you move the slider


text:
Q: how to replace the first element in a CSV with a sequential number? I have a csv file like this:
5/05/2017;03;07;30;35;43;01;03
9/05/2017;08;12;16;22;26;06;07
12/05/2017;02;20;28;29;44;03;09
16/05/2017;08;11;15;20;30;03;08
19/05/2017;09;11;12;19;30;04;09
23/05/2017;08;15;25;27;42;01;04
26/05/2017;05;07;26;36;39;02;10
...

that is, a date, plus a series of numbers followed by ;.
I need to remove that date in the first position with a number in sequence starting with 1004... like this:
1004;03;07;30;35;43;01;03
1005;08;12;16;22;26;06;07
1006;02;20;28;29;44;03;09
1007;08;11;15;20;30;03;08
1008;09;11;12;19;30;04;09
1009;08;15;25;27;42;01;04
1010;05;07;26;36;39;02;10
...

I can remove the date using this:
cut -f 2-8 -d';' 2.txt | xargs -I{}

but how do I add a number in sequence replacing the date?

A: awk solution:
awk -F';' 'BEGIN{ i=1004 }{ $1=i++ }1' OFS=';' file

*

*-F';' - input field separator

*i=1004 - starting increment
The output:
1004;03;07;30;35;43;01;03
1005;08;12;16;22;26;06;07
1006;02;20;28;29;44;03;09
1007;08;11;15;20;30;03;08
1008;09;11;12;19;30;04;09
1009;08;15;25;27;42;01;04
1010;05;07;26;36;39;02;10

Or you may pass the variable i from "outside":
awk -F';' '{ $1=i++ }1' i=1004 OFS=';' file

A: *

*With awk:
awk -v cnt=1004 '{ sub("^[^;]+", cnt++) } 1' file.csv

*With shell:
cnt=1004
while read -r line; do
    printf '%d;%s\n' $cnt "${line#*;}"
    let cnt++
done <file.csv

*With jot, paste, and a shell that can handle <(...) redirections:
paste -d\; <(jot $(wc -l <file.csv) 1004) <(cut -d\; -f2- file.csv)

*With Vim:
:let cnt=1004 | g/^/ s/^[^;]\+/\=cnt/ | let cnt+=1

*With Perl:
perl -F\; -lpe 'BEGIN{ $cnt=1004 } $F[0]=$cnt++; $_=join ";", @F' file.csv

A: Use Python, it's easy to read, understand, and maintain - and it's available on most Unix installations:
python - << "EOF" > outfilename
for index, line in enumerate(open("filename"), start=1004):
    linedata = line.strip().split(';')
    linedata[0] = str(index)
    print(';'.join(linedata))
EOF


text:
Q: iOS Launch a FGallery with start point I wonder if we can launch the FGallery component at a given start point.
https://github.com/gdavis/FGallery-iPhone
I tried to use the loadFullsizeImageWithIndex: method used by the thumbnails grid but... fail.
Anyone did that ?
Thanks a lot !

A: If you mean the image the controller starts with, try
gallery.startingIndex = 1; // or whatever number


text:
Q: Regular expression to look for a numeric range between two numbers I'm setting up some rules on an email filtering appliance and it will only accept regular expressions to define numeric ranges. Unfortunately I know absolutely nothing about regular expressions. I need to flag values between a certain range. for example I need to start at value 1000001 and end at value 8000000 I have partially done this with this command Kudos to this gentleman
(?<!\d)(?!1000000)\d{7}(?!\d)

This works great, except it flags 7 digit values 1000001 and above. How can I set a limit on this? Or would I need to write a completely new expression?

A: if you change \d{7} to [1-7]\d{6} that would ensure that the first digit found as a part of the number is within the range 1-7 (and as a bonus, eliminates the possibility of leading zeroes mucking things up).
(?<!\d)(?!1000000)[1-7]\d{6}(?!\d)

This will make the highest accepted value 7999999.  If it should be inclusive of the endpoint 8000000, you could add it explicitly, something like:
(?<!\d)(?!1000000)([1-7]\d{6}|8000000)(?!\d)


text:
Q: Mousemove vs mouseover vs something else I need to bind a mouse event to an area of an image.
Just think of the Facebook picture tag for a second, when you hover the face, it shows you the name.
I made a very similar thing but with maps and city names, like this:
$('img#mapaMundi').bind('mousemove', function(e) {
    x = getX();
    y = getY();
    var found = find(x, y);

    if (found == undefined) {
        console.log('There is no tagged city for this position');
    } else {
        show(found);
    }
});

And this works great, it shows the desired tag (with animation and stuff) but only while mouse is moved in the area, so if you move to the area and leave the mouse there (as it's not moving) it will dissapear.
If I use .bind('mouseover') it won't work because when you hover the image it's always in one of the edges.
What would you suggest?

A: on mouseover setInterval with a function that will check mouse position each second, and on mouseout clear that interval
If you use jQuery, .hover() provides both mouseover and mouseout

A: You can combine maybe mouseover or mouseenter and mousemove
http://api.jquery.com/mousemove/
http://api.jquery.com/mouseenter/
So when mouseenter -> mousemove
mouseleave -> do nothing?
var int = null;
$('#element').hover(function() {
int = setInterval(someFunc, 100);
}, function() {
clearInterval(int);
});

function someFunc() {
DO YOUR MOUSEMOVE THINGS
}


text:
Q: Probabilistically Sample from an Array in Perl I have an array in Perl and I would like to draw samples from it in a probabilistic manner. For example in R the function sample does it for me, e.g.
x = c('a','b','c','d')
sample(x,size = 2,prob = c(0.1,0.4,0.4,0.1))

The above code would return b,c more often. How do I do the same in Perl. Is there a module that does it for me?
Thanks in advance.

A: This may be done in PDL (at scale) using the vsearch function.
use strict;
use warnings;

use PDL;

my @x = qw( a b c d );

my $pdf = pdl( 0.1, 0.4, 0.4, 0.1 );

# vsearch requires a CDF,
my $cdf = $pdf->dcumusumover;
$cdf /= $cdf->max;

# $sample is a piddle containing the indices into @x;
my $sample = vsearch( random(10000), $cdf );

print scalar hist( $sample, 0, 4, 1 ), "\n";

results in
% perl x.pl
[991 3974 4014 1021]

A: With basic perl commands you could just do something like
my @vals = ('a','b','c','d');
my @probs = (0.1,0.4,0.4,0.1);
my @result;
for(my $i=0; $i<20; $i++) {
    my $draw = rand(1);
    my $v = 0;
    while ($draw>0 && $draw > $probs[$v]){
        $draw -= $probs[$v];
        $v++;
    }
    push @result, $vals[$v];
}

print join(", ", @result), "\n";


text:
Q: How to share Google Pay payment link through Whatsapp from Laravel website I am trying to share the UPI link mentioned below, to the customer through WhatsApp.
https://tez.google.com/pay/?pa=***&pn=***&tr=123&url=***&mc=123&tn=Purchase
But I can only open the first interface through this link and unable to fetch the parameter values. I have googled the same and can see the below link from it,
upi://pay?pa=***&pn=***&tr=123&am=1&cu=INR)

But the above link is not in the clickable format.
I am working on Laravel.
If this is not a good practice to share GPay payment link through WhatsApp, can you please suggest a workaround?
It will be more helpful if you could help me to solve this issue.
Thank you.


text:
Q: Select date interval inside WHERE clause I'm trying to query a list of loans that have been opened within the past 36 months. I'm also trying to query a count of loans that have been opened within the past 12 months as a separate column.
The query is returning the same values for both columns, how can I get get the count from both 36 month and 12 month intervals without running a separate query?
SELECT
`XDL-NAME`,
COUNT(distinct`XLN-LOANDATE`) as '36 Month Count',
COUNT(IF(`XLN-LOANDATE` >= DATE_SUB(NOW(),INTERVAL 12 MONTH), 1 , NULL)) AS '12 Month Count'
 from
 LOAN
 JOIN
 DEALER ON `XLN-DLNO` = `XDL-NUM` WHERE `XLN-LOANDATE` >= DATE_SUB(NOW(),INTERVAL 36 MONTH)

 GROUP BY `XDL-NAME`

A: Instead of count for 12 months, change to sum like below
SELECT
`XDL-NAME`,
COUNT(distinct`XLN-LOANDATE`) as '36 Month Count',
SUM(IF(`XLN-LOANDATE` >= DATE_SUB(NOW(),INTERVAL 12 MONTH), 1 , 0)) AS '12 Month Count'
 from
 LOAN
 JOIN
 DEALER ON `XLN-DLNO` = `XDL-NUM` WHERE `XLN-LOANDATE` >= DATE_SUB(NOW(),INTERVAL 36 MONTH)

 GROUP BY `XDL-NAME`

A: Try this:
SELECT
    `XDL-NAME`,
    count((SELECT `XLN-LOANDATE` WHERE `XLN-LOANDATE` >= DATE_SUB(NOW(),INTERVAL 36 MONTH))) AS '36 Month Count',
    count((SELECT `XLN-LOANDATE` WHERE `XLN-LOANDATE` >= DATE_SUB(NOW(),INTERVAL 12 MONTH))) AS '12 Month Count',
from
    LOAN
        JOIN
            DEALER ON `XLN-DLNO` = `XDL-NUM`
GROUP BY `XDL-NAME`

What I did was use subqueries to count each interval you wanted. This way they should output with Name, 36 month count, 12 month count all on one line (record).

A: I would expect this query to return the two separate counts:
SELECT `XDL-NAME`,
        COUNT(*) as `36 Month Count`,
        SUM(`XLN-LOANDATE` >= DATE_SUB(NOW(), INTERVAL 12 MONTH)) AS `12 Month Count`
FROM loan l join
     dealer d
     ON `XLN-DLNO` = `XDL-NUM`
WHERE `XLN-LOANDATE` >= DATE_SUB(NOW(), INTERVAL 36 MONTH)
GROUP BY `XDL-NAME`;

A: Try SUM like:
SUM(IF('2016-12-21' >= NOW() -INTERVAL 12 MONTH, 1, 0)) AS '12 Month Count'

Sample
mysql> SELECT IF('2016-12-21' >= NOW() -INTERVAL 12 MONTH, 1, 0);
+----------------------------------------------------+
| IF('2016-12-21' >= NOW() -INTERVAL 12 MONTH, 1, 0) |
+----------------------------------------------------+
|                                                  1 |
+----------------------------------------------------+
1 row in set (0,00 sec)

mysql> SELECT IF('2015-12-22' >= NOW() -INTERVAL 12 MONTH, 1, 0);
+----------------------------------------------------+
| IF('2015-12-22' >= NOW() -INTERVAL 12 MONTH, 1, 0) |
+----------------------------------------------------+
|                                                  1 |
+----------------------------------------------------+
1 row in set (0,00 sec)

mysql> SELECT IF('2015-12-21' >= NOW() -INTERVAL 12 MONTH, 1, 0);
+----------------------------------------------------+
| IF('2015-12-21' >= NOW() -INTERVAL 12 MONTH, 1, 0) |
+----------------------------------------------------+
|                                                  0 |
+----------------------------------------------------+
1 row in set (0,00 sec)

mysql>


text:
Q: Webview scroll and transparent layer I am developing a web application on iOS using uiwebview.
See this image.

I have a UIWebview and let them be scrollable using iScroll.
The problem is,
menu bar is a rectangle which have some transparent area.
(left upper side in this image).
I expected in the Transparent Area, I can see underlying content.
But, in the transparent area, I can not see the scrollable content.
The area just show webview's background image.(from objective-c).

is this impossible to display fixed and curved-shape menu bar on top of scrollable content?

should I have to make it using objective-c code not web languages?

A: I found a solution for myself.
use iScroll for scrollable view first.
And then make 0*0 pixel size div(position relative).
put the menu bar in the div using absolute position.
It should work well~ ^^;


text:
Q: GTM Enhanced Ecommerce Purchase Event I am implementing the purchase tracking according to the google documentation.
I have a small problem with the purchase tag configuration.
If i create a tag with the provided configuration:
Tag type : Universal Analytics
Track type : Pageview
Enable Enhanced Ecommerce Features: true
Use Data Layer: true
Trigger: event equals gtm.dom

it triggers on every page, which i don't want as it doubles my page views.
(page views are usually tracked via a AllPages-Pageview trigger).
I could add an event property to the object pushed to the dataLayer as it is done for the other ecommerce events (addToCart etc.) and an according trigger.
But as the documentation suggests a different way i assumed there is a reason and way to get the correct behavior using the provided documentation.
What am i missing and what is the correct trigger configuration?

A: First of all if you are adding Enhanced Ecommerce on website you can have 1 page view tag with "enhanced ecommerce" feature turned on (dataLayer = true) and that will handle your page views as well as Enhanced Ecommerce data. However if you want page views to be tracked as we do in usual way you can send Enhanced Ecommerce data in "Events".
So for example for EE impressions you can create an event;
Event Category = Enhanced Ecommerce
Event Action = Product Impressions
Event Label = {{Page Path}}
And enable Enhanced Ecommerce feature on -> dataLayer = True

And add trigger for this event.
Similarly for Purchase EE you can create another event
Event Category = Enhanced Ecommerce
Event Action = Purchase
Event Label = {{Page Path}}
And enable Enhanced Ecommerce feature on -> dataLayer = True

Add trigger =
Trigger Type = Dom
Page Path = /checkout/success (or what ever your final confirmation page is)

If your EE purchase dataLayer contains an event you can create event trigger as well.
Hope this helps.