text:
Q: react modal still showing the main component where it came from Hello im new in learning react i am facing an issue where when i show my popup modal component i can still see and click on my main ui can you help me with this

     import React, { useState } from 'react';
    import styled from 'styled-components'
    import { makeStyles } from '@material-ui/core/styles';
    import AppBar from '@material-ui/core/AppBar';
    import Toolbar from '@material-ui/core/Toolbar';
    import Typography from '@material-ui/core/Typography';
    import Button from '@material-ui/core/Button';
    import IconButton from '@material-ui/core/IconButton';
    import { postinfo } from '../services/node';
    import { useHistory } from "react-router-dom";
    import MenuIcon from '@material-ui/icons/Menu';
    import Msgbox from './msgbox';
    const Container = styled.div`
         background: white;

         display: flex;
         justify-content: center;
         align-items: center;
         flex-direction: column;

         margin-top: 5rem;
         transition: all 0.3s ease-in-out;

         h4{
            font-size:22px;
            font-weight: 500;
            color: grey;
            margin-bottom: 10px;
            text-transform: uppercase;
            text-align: center;
        }
        h1{
            font-size:30px;
            font-weight: 1500;
            color: #007f7b;
            margin-bottom: 30px;
            text-transform: uppercase;
            text-align: center;
        }

        p{
            font-size:25px;
            font-weight: 100;
            color: black;
            margin-bottom: 10px;
        }
        label{
            text-transform: uppercase;
            font-weight: 400;
            color: grey;
            margin-bottom: 0.5rem;
            text-align: center;
        }

    `;
    const InputSection= styled.div`
        width: 100%;
        min-width: 350px;
        max-width: 450px;
        display: flex;
        flex-direction: column;
        padding: 1rem;

        label{
            text-transform: uppercase;
            font-weight: 400;
            color: grey;

        }
        input{
            border: 3px solid #eee;
            border-radius: 1rem;
            background-color: transparent;
            outline: none;
            padding: 12px 3px 12px 15px;
            font-size: 16px;
            transition: all 0.2s ease;
            z-index: 500;
            &:hover,
            &:focus{
                box-shadow: 0 0 1px 0 rgba(8,11,14,0.06),
                0 16px 16px -1px rgba(8,11,14,0.1);
            }

        }

    `;
    const SubmitButton= styled.button`
        background-color: #007f7b;
        color: #fff;
        border: none;
        width: 150px;
        height: 36px;
        font-family: "Oswald", sans-serif;
        font-size: 14px;
        letter-spacing: 0.03rem;
        line-height: 36px;
        border-radius: 2px;
        box-shadow: 0 0 1px 0 rgba(8,11,14,0.06),
                0 6px 6px -1px rgba(8,11,14,0.1);

        &:hover{
            box-shadow: 0 0 1px 0 rgba(8,11,14,0.06),
            0 16px 16px -1px rgba(8,11,14,0.1);
        }
        margin-top: 2rem;
    `;
    const Error = styled.h1`
        color:red;
        font-size: 20px;
        text-align: center;
        margin-bottom: 1rem;
    `;
    const modal= styled.div`
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
    `
const UserUi =function(){
    const [showModal, setShowModal] = useState(false);
const openModal = () => {
        setShowModal(prev => !prev);
      };
  return (

                    <Container>

Your Contact Information

                        <InputSection type="email" name='email' onChange={e => setEmail(e.target.value)}>
                        <Error>{email.error}</Error>
                        Email
                        <input
                        type="text">
                        </input>
                        </InputSection>
                        <InputSection type="text" name='name' onChange={e => setName(e.target.value)}>
                        <Error>{name.error}</Error>
                        Name
                        <input
                        type="text">
                        </input>
                        </InputSection>
                        <InputSection type="text" name='phone' onChange={e => setPhone(e.target.value)}>
                        <Error>{phone.error}</Error>
                        Phone
                        <input
                        type="text">
                        </input>
                        </InputSection>
                        <InputSection type="text" name='refe' onChange={e => setReference(e.target.value)}>
                        Referring Advisor
                        <input
                        type="text">
                        </input>
                        </InputSection>

                        <SubmitButton type='submit' onClick={openModal}>Save</SubmitButton>
                        <Msgbox showModal={showModal} setShowModal={setShowModal} />
                    </Container>

                )

    }

export default UserUi

and here is the modal component
import React, { useState as UseState, useEffect as UseEffect ,useRef as UseRef, useCallback as UseCallback} from 'react';
import styled from 'styled-components'
import { makeStyles } from '@material-ui/core/styles';
import AppBar from '@material-ui/core/AppBar';
import Card from '@material-ui/core/Card';
import CardActions from '@material-ui/core/CardActions';
import CardContent from '@material-ui/core/CardContent';
import Toolbar from '@material-ui/core/Toolbar';
import Typography from '@material-ui/core/Typography';
import Button from '@material-ui/core/Button';
import IconButton from '@material-ui/core/IconButton';
import { postinfo } from '../services/node';
import { useHistory as Userhistory } from "react-router-dom";
import MenuIcon from '@material-ui/icons/Menu';
import { MdClose } from 'react-icons/md';
import { useSpring as UseSpring, animated as Animated} from 'react-spring';
const Background = styled.div`
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  position: fixed;
  display: flex;
  justify-content: center;
  align-items: center;
`;

const ModalWrapper = styled.div`
  width: 800px;
  height: 500px;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.2);
  background: #fff;
  color: #000;
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: relative;
  z-index: 10;
  border-radius: 10px;
`;

const ModalImg = styled.img`
  width: 100%;
  height: 100%;
  border-radius: 10px 0 0 10px;
  background: #000;
`;

const ModalContent = styled.div`
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  line-height: 1.8;
  color: #141414;
  p {
    margin-bottom: 1rem;
  }
  button {
    padding: 10px 24px;
    background: #141414;
    color: #fff;
    border: none;
  }
`;

const CloseModalButton = styled(MdClose)`
  cursor: pointer;
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  padding: 0;
  z-index: 10;
`;

const Container = styled.div`
    display: flex;
    justify-content: center;

     h4{
        font-size:45px;
        font-weight: 500;
        color: #007f7b;
        margin-bottom: 10px;

        text-align: center;
    }
    h3{
        font-size:20px;
        font-weight: 500;
        color: black;
        margin-bottom: 10px;

        text-align: center;
    }
    p{
        font-size:25px;
        font-weight: 100;
        color: black;
        margin-bottom: 10px;
    }
    label{
        text-transform: uppercase;
        font-weight: 400;
        color: grey;
        margin-bottom: 0.5rem;
        text-align: center;
    }
`;

const SubmitButton= styled.button`
    background-color: #007f7b;
    color: #fff;
    border: none;
    width: 150px;
    height: 36px;
    font-family: "Oswald", sans-serif;
    font-size: 14px;
    letter-spacing: 0.03rem;
    line-height: 36px;
    border-radius: 2px;
    box-shadow: 0 0 1px 0 rgba(8,11,14,0.06),
            0 6px 6px -1px rgba(8,11,14,0.1);

    &:hover{
        box-shadow: 0 0 1px 0 rgba(8,11,14,0.06),
        0 16px 16px -1px rgba(8,11,14,0.1);
    }
    margin-top: 2rem;
`;
const Error = styled.h1`
    color:red;
    font-size: 20px;
    text-align: center;
    margin-bottom: 1rem;
`;

export const msgbox = ({ showModal, setShowModal }) => {
    const [Fist, setFirst] = UseState('');
    const [second, setSecond] = UseState('');
    const [third, setThird] = UseState('');
    const modalRef = UseRef();

    const animation = UseSpring({
      config: {
        duration: 250
      },
      opacity: showModal ? 1 : 0,
      transform: showModal ? `translateY(0%)` : `translateY(-100%)`
    });

    const closeModal = e => {
      if (modalRef.current === e.target) {
        setShowModal(false);
      }
    };

    const keyPress = UseCallback(
      e => {
        if (e.key === 'Escape' && showModal) {
          setShowModal(false);
          console.log('I pressed');
        }
      },
      [setShowModal, showModal]
    );

    UseEffect(
      () => {
        document.addEventListener('keydown', keyPress);
        return () => document.removeEventListener('keydown', keyPress);
      },
      [keyPress]
    );
    History = Userhistory();

        return (
          <>
      {showModal ? (
        <Background onClick={closeModal} ref={modalRef}>
          <Animated.div style={animation}>
            <ModalWrapper showModal={showModal}>
              <ModalImg src={require('../assets/modal.jpg')} alt='camera' />
              <ModalContent>

Are you ready?

Get exclusive access to our next launch.

                <button>Join Now</button>
              </ModalContent>
              <CloseModalButton
                aria-label='Close modal'
                onClick={() => setShowModal(prev => !prev)}
              />
            </ModalWrapper>
          </Animated.div>
        </Background>
      ) : null}
    </>

        )
    }

export default msgbox

advance thanks to you guys hope you can help me i tried alot of ways how i can show the modal but i still have no answer. i am just trying to show the modal in front of my user component am i doing anything wrong on my styled-component or i put the modal component on the wrong place.

A: The input tags' z-index property is causing the inputs to appear on top of the modal.  Setting it to zero should fix that.
References:
w3schools.com. CSS z-index Property. https://www.w3schools.com/cssref/pr_pos_z-index.asp. (accessed November 22, 2020)


text:
Q: How to set `aria-disabled` as true using JavaScript I have no idea about JS. But there is needed one line of code in my Ruby. I have the below html.

      <button class="otherButtonClass ui-state-hover ui-state-focus" type="button" role="button" aria-disabled="false">
      <button class="otherButtonClass" type="button" role="button" aria-disabled="false" style="display: none;">
      <button class="cancelButtonClass" type="button" role="button" aria-disabled="false">

I want JS code to make the first and second button to make them visible. What would be the code?
Please help.

A: The current way of setting aria- attributes is to reference the properties directly.
To get:
let el = document.getElementById('foobar');
console.log(el.ariaDisabled); // Should log the current value of aria-disabled.

To set:
let el = document.getElementById('foobar');
el.ariaDisabled = 'true';
console.log(el.ariaDisabled); // Should log 'true'.

Reference: Element.ariaDisabled MDN

A: http://jsfiddle.net/SQ7SH/1/
var buttons = document.querySelectorAll('.ui-dialog-buttonset button');
    buttons[0].setAttribute('aria-disabled', true);
    buttons[1].setAttribute('aria-disabled', true);

Also button require close tag

A: var buttons = document.getElementsByClassName('otherButtonClass');
for(var i = 0; i < buttons.length; i++){
    buttons[i].setAttribute('aria-disabled', 'true');
}

A: As asked there is needed one line of code:
document.querySelectorAll('.ui-dialog-buttonset .otherButtonClass').forEach(function (item) {item.setAttribute('aria-disabled', true);});

redpajama_set_name: RedPajamaStackExchange


text:
Q: Adding Bean to Start Up of Spring Boot Using Byte Buddy Am just trying to instrument my spring-boot application. I would like to add a @Bean into the main class. The intention is to initialize the tracer as part of the bean
Initially Tried the below
new AgentBuilder.Default()
                    .type(ElementMatchers.nameStartsWith("my.package.name"))
                    .transform((builder, typeDescription, classLoader, module) -> builder.visit(
                            Advice.to(BootUpInterceptor.class)
                                    .on(hasMethodName("main"))

                            )

                    ).installOn(instrumentation);

@Advice.OnMethodEnter
    static void initializeTracerAtMain(@Advice.Origin String methodName) throws Exception{
        System.out.println("Initializing Tracer in  Method "+methodName);

// Tracer Initializers
    }

Basically am initializing configuration for jaeger tracer. This is working but I need to use GlobalTracer to register the tracer.
How can I add this initializer as a bean to my existing main classs ? Am I missing anything?

A: If you have a Java configuration class, you could instrument it and add a @Bean-annotated method using defineMethod. Alternatively, you could instrument the constructor of an application context and register the bean explicitly in an exit-advice.


text:
Q: Trouble in proving that $\|x\|_p = \max|x_j|$ We define p-norm in this way: $\|x\|_p = \{\sum ^N_j=_1|x_j|^p\}^ {1\over p}$
We know that It change to $\|x\|_p = \max|x_j| $    when $ p \to \infty $
 How can I prove this ?

A: What we have to prove is that if $x_1,\dots,x_K$ are real numbers such that $0\leqslant x_k\lt 1$, then
$$\lim_{p\to \infty}\left(1+\sum_{k=1}^Kx_k^p\right)^{1/p}=1.$$
It's equivalent to show that
$$\lim_{p\to \infty}\frac 1p\log\left(1+\sum_{k=1}^Kx_k^p\right)=0.$$
It's the case, since for $t\geqslant 0$, $0\leqslant\log(1+t)\leqslant t$.


text:
Q: Azure CLI in a Docker Container I have an Ubuntu 18.04 Docker image that I need Azure CLI installed in. For a Docker image, it seems the preferred way is to use pip, however, I have other pip Azure libraries needed in the container that overlap with the CLI install and get blown away because Azure CLI requires older versions; then making it so I can't run my python scripts.
I have tried to use the script installer but that hasn't worked and errored out because I believe the install is interactive.
The last option I can find is the manual apt install, though I am not sure this is a correct way nor do I have a good idea of how to replicate that in a Dockerfile.
Is there a preferred/good way of getting Azure CLI in a container not using pip?
    FROM ubuntu:18.04

    RUN apt-get update && apt-get -y upgrade && \
        apt-get -f -y install curl python3-pip python-pip && \
        pip3 install --upgrade pip && \
        pip2 install --upgrade pip && \
        pip3 install azure-storage-blob==12.3.0 & \\
        pip3 install azure-cli

A: I have a preference to use the package manager to install dependencies, it's why I will do something like that:

*

*Add base dependencies for https repostory and curl

*Add the gpg key and repository for the CLI

*Add the CLI

This is the Dockerfile with thoses steps:
FROM ubuntu:18.04
RUN apt-get update && apt-get -y upgrade && \
    apt-get -f -y install curl apt-transport-https lsb-release gnupg python3-pip python-pip && \
    curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.asc.gpg && \
    CLI_REPO=$(lsb_release -cs) && \
    echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ ${CLI_REPO} main" \
    > /etc/apt/sources.list.d/azure-cli.list && \
    apt-get update && \
    apt-get install -y azure-cli && \
    rm -rf /var/lib/apt/lists/*

In addition, I clean up the apt cache by removing /var/lib/apt/lists. Tt reduces the image size, since the apt cache is not stored in a layer.

A: See: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt#option-1-install-with-one-command
RUN curl -LsS https://aka.ms/InstallAzureCLIDeb | bash && rm -rf /var/lib/apt/lists/*


text:
Q: How to reduce query time in mysql? I need to reduce query time from 1.3sec to 0.1sec.
if I don't compare sum(amount) with sum(pd.amount_take) my query time is 0.03sec
My Code sql:
SELECT p.po_id,
date_format(p.po_date,'%d-%m-%Y') AS po_date,
p.branch_id,
b.fullname as branch_send,
p.branch_id2,
bb.fullname as branch_recieve

FROM tbl_po_branch p

LEFT JOIN tbl_branch b ON b.branch_id=p.branch_id
LEFT JOIN tbl_branch bb ON bb.branch_id=p.branch_id2
LEFT JOIN tbl_users u ON p.user_id=u.user_id

WHERE b.owner_id= 1
AND p.status = 1
AND (SELECT sum(amount) FROM tbl_po_branch_detail WHERE PO_id=p.PO_id
     AND branch_id=p.branch_id)
> (SELECT sum(pd.amount_take) FROM tbl_po_detail pd
LEFT JOIN tbl_po po ON pd.po_id=po.po_id AND pd.branch_id=po.branch_id
WHERE po.po_id2=p.po_id
AND po.branch_id2=p.branch_id
AND po.branch_id=p.branch_id2
AND po.status='2')
Group By p.PO_id,p.branch_id,p.branch_id2
ORDER BY p.po_date DESC,b.fullname

A: i optimised it a bit.
SELECT p.po_id,
       DATE_FORMAT(p.po_date,'%d-%m-%Y') AS po_date,
       p.branch_id,
       b.fullname as branch_send,
       p.branch_id2,
       bb.fullname as branch_recieve
FROM tbl_po_branch p
LEFT JOIN tbl_branch b ON b.branch_id=p.branch_id
LEFT JOIN tbl_branch bb ON bb.branch_id=p.branch_id2
LEFT JOIN tbl_users u ON p.user_id=u.user_id
WHERE b.owner_id= 1
  AND p.status = 1
  AND (SELECT SUM(pd.amount_take)
       FROM tbl_po_detail pd
       JOIN tbl_po po ON pd.po_id=po.po_id
         AND pd.branch_id=po.branch_id
       WHERE po.po_id2=p.po_id
         AND po.branch_id2=p.branch_id
         AND po.branch_id=p.branch_id2
         AND po.status='2')
      < (SELECT SUM(amount)
         FROM tbl_po_branch_detail
         WHERE PO_id=p.PO_id AND branch_id=p.branch_id
         GROUP BY PO_id, branch_id)
GROUP BY p.PO_id,p.branch_id,p.branch_id2
ORDER BY p.po_date DESC,b.fullname

A: These could be useful

*

*We could drop the tbl_users table since it is not used

*Move the sub-query in the where into joins since joins are better in performance than sub-queries

SELECT
    p.po_id,
    date_format(p.po_date,'%d-%m-%Y') AS po_date,
    p.branch_id,
    b.fullname as branch_send,
    p.branch_id2,
    bb.fullname as branch_recieve,
    SUM(pod.amount) as amount,
    SUM(CASE WHEN po.status = '2' THEN pd.amount_take ELSE 0 END) as amount_take

FROM tbl_po_branch p
LEFT JOIN tbl_branch b ON b.branch_id = p.branch_id
LEFT JOIN tbl_branch bb ON bb.branch_id = p.branch_id2
LEFT JOIN tbl_po_branch_detail pod ON pod.PO_id = p.PO_id AND pod.branch_id=p.branch_id
LEFT JOIN tbl_po po ON po.po_id2=p.po_id AND po.branch_id2=p.branch_id AND po.branch_id=p.branch_id2
LEFT JOIN tbl_po_detail pd ON pd.po_id=po.po_id AND pd.branch_id=po.branch_id

WHERE b.owner_id= 1 AND p.status = 1
Group By p.po_id, p.po_date, p.branch_id,b.fullname, p.branch_id2, bb.fullname
HAVING amount > amount_take
ORDER BY p.po_date DESC,b.fullname


text:
Q: По каким параметрам сокета можно определить, что TCP-соединение установлено? Создаю TCP-сокет, делаю неблокирующим, ассоциирую с epoll_event, добавляю в epoll и вызываю connect. Если connect возвращиет EWOULDBLOCK, навешиваю коллбек на EPOLLOUT, в котором хочу определить когда сокет будет готов для работы и снять EPOLLOUT, чтобы больше не триггерился на запись.
Как определить что соединение готово (или завершилось с ошибкой)?

A: socklen_t err_len;
int error;
err_len = sizeof(error);
if(getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &err_len) < 0 || error != 0) {
    ошибка соединения error
} else {
    соединились !
}


text:
Q: passing value to blade without use of foreach i am trying to fetch a single row  value using its' key in blade file table. how do it pass value to it.
i have fetched the whole table in another blade file using foreach
i have passed the data from my controller but it doesn't recognize them.
loaninterest.blade.php

  Loan Id
  Member
  @for($i=0;$i<$loan->duration; $i++ )
  installment
  @endfor

  {{++$key}}
  {{$loan->member->name}}
 @for($i=0;$i<$loan->duration; $i++ )
  {{$loan->interest_amount}}
 @endfor

 </form>

LoanController.php
  public function loanInterest(){
    $loanData = Loan::all();
    //$findUser =Loan::findOrFail($criteria);
    return view($this->_pagePath.'loan.loaninterest',compact('loanData'));
}

web.php
 Route::any('loaninterest/{criteria?}','LoanController@loanInterest')-> name('loaninterest');

i called loaninterest blade file as below
loan.blade.php

    id }}">Interest detail

how do i pass loanData in blade. i get this error
Undefined variable:loan

A: Why you pass url when you used route
id) }}">Interest detail

public function loanInterest(){
        // $loanData = Loan::all();
        $loanData =Loan::findOrFail($criteria); // or your where condition
        return view($this->_pagePath.'loan.loaninterest',compact('loanData'));
}

In controller you are querying all data from table but you want only one data so you have to do findOrFail with unique id or use firstOrFail.
Try with this.
Hope this helps :)

A: Route parameters are send in a separate array try below code
Syntax is
  route('routename', [parameter1, paramater2])

check docs
you can try
 $loan->id]) }}">Interest detail

for displaying loan data in view
 public function loanInterest(){
    $loanData = Loan::all();
    return view($this->_pagePath.'loan.loaninterest', compact('loanData')); //verify if $this->pagePath etc is correct
}

In view
@foreach ( $loanData as $loanDeta )
    {{ $lanData->interest_amount }}
@endforeach


text:
Q: How to run ASP.NET web api from github I am new in asp.net  and angular development.I dont know how to run asp.net web api from github. As we run angular code by using "ng build --prod --base-href https://ownername.github.io/repositoryname/ so i want to know could we run asp.net web api by using such kind of any command or something other which is used for this.
Basically i want to run my project on  network i tried by IIS server but no result is showing so now i want to try github process
Help would be appricated

A: asp.net core apps have to run in a .net core process on a server so the hosting environment needs to specifically support this.  a variety of web servers can be configured to proxy the requests. Unfortunately, I don't think GitHub allows running app processes for asp.net core.
However you ca easily deploy to azure with even a free account
https://learn.microsoft.com/en-us/aspnet/core/tutorials/publish-to-azure-webapp-using-vs?view=aspnetcore-2.2


text:
Q: Awk CSV Text Qualified Columns Records With Given Column Count I have almost no experience using awk.  I would like to output all records in a csv that have a certain number of columns, but I need to define a column not by delimiter, but by pattern. The command:
"c:\Program Files\Git\usr\bin\awk" -F, 'NF==13' TestInput2.csv

Works to return all records in csv with exactly 13 columns. This, however, only works if there are no column values containing a comma.  It does not work for quoted columns where "a,b","c" is two columns, not three.
I know there is FPAT like FPAT='([^,]+)|("[^"]+")'
I need to combine the FPAT and NF to work like the F and NF above, but I cannot figure out how to write a single line awk that works.  It would be something like:
"c:\Program Files\Git\usr\bin\awk" FPAT='([^,]+)|("[^"]+")' 'NF==13' TestInput2.csv

However, that does not work.
Per Request in Comment:
Input
"aa","bb","cc,dd","ee","ff,gg""
"aa","bb","cc","dd","ee"
"aa","bb","cc","dd"

Desired output:
"aa","bb","cc,dd","ee","ff,gg""
"aa","bb","cc","dd","ee"

The output is the first two rows because they both have 5 columns
The third row is not returned because it only has 4 columns
If I had rows with 1,2,3,4,6,7,... columns they would also not be returned.
Notice that the commas in the quotes are not counted as rows which is why row 1 is considered to have five columns.
I hope that helps describe the problem more accurately.

A: Well, not too bad really. Read a small awk tutorial and then fiddled with regex.
For awk at windows command line, best to use a .awk file.  Something like:

"c:\Program Files\Git\usr\bin\awk" -f simawk3.awk TestInput3.csv

That way you don't need to escape things on behalf of the cmd shell.
As far as the code in the .awk file, its very simple:
/regex-here/ { print $0 }
Replace regex-here with your regex that matches a row.  Every time a row matches, print $0 will print the row.
Finally, for the regex, I came up with a variety of one-liners, here's one:
/^(((([^",]|\,|\"))|"(([^"\]|\"|\\))"),){12}(((([^",]|\,|\"))|"(([^"\]|\"|\\))"))$/
That one finds records with 13 columns with or without quotes around the column value - if quoted then the value can contain escaped quotes, escaped escapes or commas - if not quoted then the value can contain escaped quotes or escaped commas or non-escaped escapes such as the two, 13-column, records below
"c_big,in\"t","c_bit","c_\\"ch,ar_10","c_datetime2_7","c_decimal_18_2","c_float","c_int","c_money","c_nchar\,_10",c_nvar\schar_max,"c_uniq\",ueidentifier","c_varchar_50",c_v\\a\"r\,\,\,ch
c_big\,in\"t,"c_bit","c_\\"ch,ar_10","c_datetime2_7","c_decimal_18_2","c_float","c_int","c_money","c_nchar\,_10",c_nvar\schar_max,"c_uniq\",ueidentifier","c_varchar_50",c_v\\a\"r\,\,\,ch
In the regex above, I didn't worry about accurately capturing each field value, since I just need to verify the count of fields and output those records that have the correct number of fields, but I am sure it can be done.
There are likely many other ways to do it.  I hope this helps anyone who had a similar need.


text:
Q: git lfs locks works fine inside corporate network, but takes more than 10 minutes when used by contractor connecting through VPN Our contractors are migrating from SVN to Git, and we are in need to provide them with file locking option. As SVN supports this feature, git doesn't have one, so i'm trying to use Git LFS module for this problem. After installing GIT LFS, i locked some of the files using
    git lfs lock file

and typed command
    git lfs locks

it worked very fast, i got respond less then in a second.
But on the side of our contractors, who connect to our network through VPN, response time was more than 10 minutes, and still no output. What might be the problem? And is there any any to solve it?
Git itself and git lfs are installed on Windows 10 and all the commands are run from git bash terminal.
git lfs version 2.7.1
I expect same response time from git lfs lock

A: Issue is solved, the problem was ni git version. Our contractors used 2.19, thay updated to 2.21.0.windows.1, and everything worked fine! Thanks everyone for help.


text:
Q: Extract all parents of a given node I'm trying to extract all parents of a each given GO Id (a node) using EBI-RDF sparql endpoint, I was based on this two similar questions to formulate the query, here're two examples illustrating the problem:
Example 1 (Link to the structure):
biological_process (GO:0008150)
           |__ metabolic process (GO:0008152)
                           |__ methylation (GO:0032259)

In this example, using the following query:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX dbpedia2: <http://dbpedia.org/property/>
PREFIX dbpedia: <http://dbpedia.org/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

PREFIX obo: <http://purl.obolibrary.org/obo/>

SELECT (count(?mid) as ?depth)
       (group_concat(distinct ?midId ; separator = " / ") AS ?treePath)
FROM <http://rdf.ebi.ac.uk/dataset/go>
WHERE {
    obo:GO_0032259 rdfs:subClassOf* ?mid .
    ?mid rdfs:subClassOf* ?class .
    ?mid <http://www.geneontology.org/formats/oboInOwl#id> ?midId.
}
GROUP BY ?treePath
ORDER BY ?depth

I got the desired results without problems:
c |              treePath
--|-------------------------------------
6 | GO:0008150 / GO:0008152 / GO:0032259

But when the term exists in multiple branches (e.g GO:0007267) as in the case below, the previous approach didn't work:
Example 2 (Link to the structure)
biological_process (GO:0008150)
           |__ cellular_process (GO:0009987)
           |           |__ cell communication (GO:0007154)
           |                       |__ cell-cell signaling (GO:0007267)
           |
           |__ signaling (GO:0023052)
                      |__ cell-cell signaling (GO:0007267)

The result:
c |                            treePath
--|---------------------------------------------------------------
15| GO:0007154 / GO:0007267 / GO:0008150 / GO:0009987 / GO:0023052

What I wanted to get is the following:
GO:0008150 / GO:0009987 / GO:0007154 / GO:0007267
GO:0008150 / GO:0023052 / GO:0007267

What I understood is that under the hood I'm calculating the depth of each level and using it to construct the path, this works fine when we have an element that belongs only to one branch.
SELECT (count(?mid) as ?depth) ?midId
FROM <http://rdf.ebi.ac.uk/dataset/go>
WHERE {
    obo:GO_0032259 rdfs:subClassOf* ?mid .
    ?mid rdfs:subClassOf* ?class .
    ?mid <http://www.geneontology.org/formats/oboInOwl#id> ?midId.
}
GROUP BY ?midId
ORDER BY ?depth

The result:
depth |   midId
------|------------
1     | GO:0008150
2     | GO:0008152
3     | GO:0032259

In the second example, things are missed up and I didn't get why, in any ways I'm sure that part of the problem are terms that have the same depth/level, but I don't know how can I solve this.
depth |   midId
------|------------
2     | GO:0008150
2     | GO:0009987
2     | GO:0023052
3     | GO:0007154
6     | GO:0007267

A: Thanks to @AKSW I found a decent solution using HyperGraphQL (a GraphQL interface for querying and serving linked data on the Web).
I'll leave the detailed answer here, it may help someone.

*

*I downloaded and set up HyperGraphQL download page

*Linked it to EBI Sparql endpoint as described in this tutorial
The config.json file I used:
{
    "name": "ebi-hgql",
    "schema": "ebischema.graphql",
    "server": {
        "port": 8081,
        "graphql": "/graphql",
        "graphiql": "/graphiql"
    },
    "services": [
        {
            "id": "ebi-sparql",
            "type": "SPARQLEndpointService",
            "url": "http://www.ebi.ac.uk/rdf/services/sparql",
            "graph": "http://rdf.ebi.ac.uk/dataset/go",
            "user": "",
            "password": ""
        }
    ]
}

Here's how my ebischema.graphql file looks like (Since I needed only the Class, id, label and subClassOf):
type __Context {
    Class:          _@href(iri: "http://www.w3.org/2002/07/owl#Class")
    id:             _@href(iri: "http://www.geneontology.org/formats/oboInOwl#id")
    label:          _@href(iri: "http://www.w3.org/2000/01/rdf-schema#label")
    subClassOf:     _@href(iri: "http://www.w3.org/2000/01/rdf-schema#subClassOf")
}

type Class @service(id:"ebi-sparql") {
    id: [String] @service(id:"ebi-sparql")
    label: [String] @service(id:"ebi-sparql")
    subClassOf: [Class] @service(id:"ebi-sparql")
}

*I started testing some simple query, but constantly getting an empty response; the answer to this issue solved my problem.

*Finally I constructed the query to get the tree
Using this query:
{
  Class_GET_BY_ID(uris:[
    "http://purl.obolibrary.org/obo/GO_0032259",
    "http://purl.obolibrary.org/obo/GO_0007267"]) {
    id
    label
    subClassOf {
      id
      label
      subClassOf {
        id
        label
      }
    }
  }
}

I got some interesting results:
{
  "extensions": {},
  "data": {
    "@context": {
      "_type": "@type",
      "_id": "@id",
      "id": "http://www.geneontology.org/formats/oboInOwl#id",
      "label": "http://www.w3.org/2000/01/rdf-schema#label",
      "Class_GET_BY_ID": "http://hypergraphql.org/query/Class_GET_BY_ID",
      "subClassOf": "http://www.w3.org/2000/01/rdf-schema#subClassOf"
    },
    "Class_GET_BY_ID": [
      {
        "id": [
          "GO:0032259"
        ],
        "label": [
          "methylation"
        ],
        "subClassOf": [
          {
            "id": [
              "GO:0008152"
            ],
            "label": [
              "metabolic process"
            ],
            "subClassOf": [
              {
                "id": [
                  "GO:0008150"
                ],
                "label": [
                  "biological_process"
                ]
              }
            ]
          }
        ]
      },
      {
        "id": [
          "GO:0007267"
        ],
        "label": [
          "cell-cell signaling"
        ],
        "subClassOf": [
          {
            "id": [
              "GO:0007154"
            ],
            "label": [
              "cell communication"
            ],
            "subClassOf": [
              {
                "id": [
                  "GO:0009987"
                ],
                "label": [
                  "cellular process"
                ]
              }
            ]
          },
          {
            "id": [
              "GO:0023052"
            ],
            "label": [
              "signaling"
            ],
            "subClassOf": [
              {
                "id": [
                  "GO:0008150"
                ],
                "label": [
                  "biological_process"
                ]
              }
            ]
          }
        ]
      }
    ]
  },
  "errors": []
}

EDIT
This was exactly what I wanted, but I noticed that I can't add another sublevel like this:
{
  Class_GET_BY_ID(uris:[
    "http://purl.obolibrary.org/obo/GO_0032259",
    "http://purl.obolibrary.org/obo/GO_0007267"]) {
    id
    label
    subClassOf {
      id
      label
      subClassOf {
        id
        label
        subClassOf {  # <--- 4th sublevel
          id
          label
        }
      }
    }
  }
}

I created a new question: Endpoint returned Content-Type: text/html which is not recognized for SELECT queries


text:
Q: What are the BIN$... tables in Oracle's ALL_TAB_COLUMNS table? When I query ALL_TAB_COLUMNS in Oracle, I see tables called
BIN$frKctA83wMPgQEOSh0Az+A==$0
BIN$frKctA8cwMPgQEOSh0Az+A==$0
BIN$frQ1pdU2TgXgQEOSh0APxA==$0
BIN$frQ1pdVGTgXgQEOSh0APxA==$0

There is no corresponding entry in ALL_TABLES. What are those?

A: Since version 10g, dropped tables (also dropped objects in general) are put in the recycle bin and can be restored easily. The names you see are tables in the recycle bin.
You can bypass the recycle bin by adding the PURGE keyword in your DROP statements.
You will find additional information in the Administrator's Guide Documentation.


text:
Q: Python Change an int for a string I have a question with np.where
I have something like this:
import pandas as pd
import numpy as np
a = [{'a1':'Marco 1'}, {'a1':'2'}, {'a1':'Marco 3'}]
df = pd.DataFrame(a)

df['a1'] = np.where(df['a1'].str.contains('Marco'), 'Marco', df['a1'])

And I want to know how to change the value in a1 == 2, for some string like 'Marco2'.

A: try via np.where():
df['a1']=np.where(df['a1'].str.isnumeric(),'Marco '+df['a1'],df['a1'])

OR
via boolean masking with loc accessor:
df.loc[df['a1'].str.isnumeric(),'a1']='Macro '+df.loc[df['a1'].str.isnumeric(),'a1']

Note: you can also use str.isdigit() method in place of str.isnumeric() method

A: you can try str.split
df['a1'] = 'Marco ' + df['a1'].str.split(r'Marco').str[-1]
df['a1']

# 0    Marco   1
# 1     Marco  2
# 2    Marco   3
# Name: a1, dtype: object

or str.replace
df['a1'] = df['a1'].str.replace(r'(Marco)*\s*(\d+)', r'Marco \2')
df['a1']

# 0    Marco 1
# 1     Marco 2
# 2     Marco 3
# Name: a1, dtype: object


text:
Q: Dividing $9x^2+5x+1$ by $2x-6$
$$
\require{enclose}
\begin{array}{rll}
   2x-6 \enclose{longdiv}{9x^2+5x+1}\end{array}
$$

Does $9x^2+5x+1$ have a root of $x-3$? I am trying to simplify this equation.

A: If you go through the process of long division, you find that $9x^2 + 5x + 1 $ divided by $x - 3$ gives you  $9x + 32$ with a remainder of 97 so $x - 3$ is NOT a root of $9x^2 + 5x + 1 $.
Another way of checking would be plugging in the value, $x = 3$; we do this after setting the original polynomial ($9x^2 + 5x + 1 $) to $0$  in order to form the associated polynomial equation. Using the associated polynomial equation, any values of $x$ that results in $0$ is a root of the original polynomial.  In this case, plugging in $x = 3$ does NOT equal $0$ so, again, $x = 3$ is NOT a root.

A: Here I have showed you how to work this out using synthetic division.
Firstly 2X - 6 cannot be equal to 0.
Therefore, X cannot be equal to 3.
Now we take that 3 and use it in our synthetic division as a multiplier.
As you can see the quotient is 9X + 32 and the remainder is 97.
Since the remainder is not 0 therefore X-3 is not a root.


text:
Q: c++ array declaration in a header I was wondering if it is possible to declare an array (size not known at this time), as a private member of a class and later set the size in the constructor of the class.  For example:
class Test {
int a[];
public:
Test(int size);
};

Test::Test(int size) {
a[size];   // this is wrong, but what can i do here?
}

Is this possible or should I use dynamic arrays?  Thanks!

A: As other answers have pointed out, the size of an array is fixed at compile time. However, by using templates you can parameterise the size at compile time:
template <int N> class Test {
    int a[N];
public:
    Test() { }
};

Test<5> test;
Test<40> biggertest;

This technique does not let you compute the size at run time (as the dynamic std::vector solution does), but depending on your needs this may be sufficient.

A: First of all, it is generally better to initialize things in the initialization list of the constructor, not in the body of the constructor.
You can only initialize an array with a predefined bound if you know that bound at compile time. In this situation, you will need to dynamically allocate the space.
You must remember then to have a destructor that would delete the array when the object is destroyed or you would get a memory leak.

A: See Martin's solution (use std::vector), and remember that even if you need to pass a buffer to a C API std::vector lets you do it by passing &vec[0] :
std::vector<char> vec(10);
memset(&vec[0], 0, vec.size());

It's guaranteed to work, but only if the vector isn't empty (C++ quirks, <sigh>).

A: Short Answer: No (The size of an array is defined at compile time only)
Long Answer:
You can use a vector to achieve the same result:
class Test
{
    std::vector<int> a;
    public:
        Test(std::size_t size):
            a(size)
        {}
};

A: No this is not possible.  Array declarations in headers must have constant sized value.  Otherwise it's impossible for constructs like "sizeof" to function properly.  You'll need to declare the array as a pointer type and use new[] in the constructor.  Example.
class Test {
    int *a;
public:
    Test(int size) {
       a = new int[size];
    }
    ~Test() { delete [] a; }
private:
    Test(const Test& other);
    Test& operator=(const Test& other);
};

A: No, this is not possible.  You should use a dynamic array such as an std::vector.  C99 allows a struct to have an unsized array as the last member only, but even when you do this you still have to manually allocate the memory yourself, e.g. with malloc().

A: What you're talking about is not possible.  Classes always have a constant size.  You could have your class use a pointer to a dynamically allocated array or you could use a std::vector.


text:
Q: C++ memory leaks with strings in a class I'm developing in Visual C++ 2010 and I'm using a library called "Visual Leak Detector" to check for memory leaks. Then I found one that I can't explain and solve.
Here is my code:
ManageRenderListenerCommand::ManageRenderListenerCommand(string action):mAction(action){
}

void ManageRenderListenerCommand::execute(){
    //Do something with action
}

The header file is:
class ManageRenderListenerCommand : public IOgreCommand{
private:
    string      mAction;
public:
    ManageRenderListenerCommand(string action);
    void execute();
};

UPDATE: It's called here:
void OgreMediator::onOgreChanged(AbstractOgreNegotiator* negotiator, NegotiatorEvent& negotiatorEvent){
    IOgreCommand* command = NULL;
    if(negotiatorEvent.matchEvent("addToViewport")){
        command = new AddToViewportCommand(mCameraManager, mSceneCreator, mEngine);
    }else if (negotiatorEvent.matchEvent("manageRenderListener")){
        command = new ManageRenderListenerCommand(negotiatorEvent.getMessage());
    }else if (negotiatorEvent.matchEvent("manageMouseCamera")){
        command = new ManageMouseCameraCommand(mCameraManager, mMouseManager->getLastEvent());
    }

    //Execute the created command
    if (command){
        command->execute();
        delete command;
    }
}

And the stacks of the four memory leaks are very similar, so here it's one of them:
---------- Block 163 at 0x023CEAE0: 8 bytes ----------
  Call Stack:
    c:\program files\microsoft visual studio 10.0\vc\include\xmemory (36): CataractSimulator.exe!std::_Allocate<std::_Container_proxy> + 0x15 bytes
    c:\program files\microsoft visual studio 10.0\vc\include\xmemory (187): CataractSimulator.exe!std::allocator<std::_Container_proxy>::allocate + 0xB bytes
    c:\program files\microsoft visual studio 10.0\vc\include\xstring (469): CataractSimulator.exe!std::_String_val<char,std::allocator<char> >::_String_val<char,std::allocator<char> > + 0xA bytes
    c:\program files\microsoft visual studio 10.0\vc\include\xstring (543): CataractSimulator.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> > + 0x5F bytes
    c:\users\cps\desktop\surgery-sim\project\simulator\src\managerenderlistenercommand.cpp (10): CataractSimulator.exe!ManageRenderListenerCommand::ManageRenderListenerCommand
    c:\users\cps\desktop\surgery-sim\project\simulator\src\ogremediator.cpp (28): CataractSimulator.exe!OgreMediator::onOgreChanged + 0x53 bytes
    c:\users\cps\desktop\surgery-sim\project\simulator\src\abstractogrenegotiator.cpp (5): CataractSimulator.exe!AbstractOgreNegotiator::notifyMediator + 0x1C bytes
    c:\users\cps\desktop\surgery-sim\project\simulator\src\ogrerenderobserverregistry.cpp (37): CataractSimulator.exe!OgreRenderObserverRegistry::addListener + 0x15 bytes
    c:\users\cps\desktop\surgery-sim\project\simulator\src\ogremediator.cpp (73): CataractSimulator.exe!OgreMediator::addRenderListener
    c:\users\cps\desktop\surgery-sim\project\simulator\src\mousemanager.cpp (6): CataractSimulator.exe!MouseManager::startMouse
    c:\users\cps\desktop\surgery-sim\project\simulator\src\ogremediator.cpp (58): CataractSimulator.exe!OgreMediator::initFramework
    c:\users\cps\desktop\surgery-sim\project\simulator\src\simulatorapi.cpp (27): CataractSimulator.exe!SimulatorAPI::Facade::initFramework
    c:\users\cps\desktop\surgery-sim\project\simulator\src\simulatorapi.cpp (60): CataractSimulator.exe!SimulatorAPI::initFramework
    c:\users\cps\desktop\surgery-sim\project\simulator\src\loader.cpp (23): CataractSimulator.exe!Loader::Facade::initFramework + 0x16 bytes
    c:\users\cps\desktop\surgery-sim\project\simulator\src\loader.cpp (45): CataractSimulator.exe!Loader::go
    c:\users\cps\desktop\surgery-sim\project\cataractsimulator\src\cataractloader.cpp (5): CataractSimulator.exe!CataractLoader::go + 0x8 bytes
    c:\users\cps\desktop\surgery-sim\project\cataractsimulator\src\cataractloader.cpp (26): CataractSimulator.exe!main
    f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (555): CataractSimulator.exe!__tmainCRTStartup + 0x19 bytes
    f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (371): CataractSimulator.exe!mainCRTStartup
    0x7791ED6C (File and line number not available): kernel32.dll!BaseThreadInitThunk + 0x12 bytes
    0x77A1377B (File and line number not available): ntdll.dll!RtlInitializeExceptionChain + 0xEF bytes
    0x77A1374E (File and line number not available): ntdll.dll!RtlInitializeExceptionChain + 0xC2 bytes
  Data:
    14 4E 3D 02    00 00 00 00                                   .N=..... ........

A: If IOgreCommand (or any class that IOgreCommand derives from) doesn't have a virtual destructor, then any class that derives from IOgreCommand will not have its destructor called when deleting an IOgreCommand pointer.


text:
Q: Mention who wrote the question on the 10k flag page to better suss out non-answers When going through the 10k+ flag list, I have a recurring nag: it's inconvenient to find when the question asker is trying to clarify his or her question with what they did so far, and when an answerer just provides a bad answer.

Take the above example: it's flagged as "not an answer", but reading it by itself, it's vaguely an answer, just not a very good one.
However, due to the level of tangential information, it sounds like someone trying to clarify what they've tried so far, not provide a solution (e.g., "How do I effectively level archery? I've tried mammoths, but is there a better way? This is my equipment.")
But I have no way to tell that quickly because the asker is missing from the flag preview. I have to click through to the question and confirm that no, it's just a bad answer, not the OP leaving an edit as a new answer.
Would it be possible to get the user card added for both parties—the asker and the answerer—on answer flags?


text:
Q: Parse PATH using FOR /F in BAT script I need to parse the %PATH% list in a .BAT script, but I'm not having much luck with paths that contain spaces.
for %%a in (%PATH%) do @echo %%a

The above parses on spaces (default), but I need to parse on semi-colons.  I'm trying to use this but it's throwing me an error:
for /f "tokens=* delims=;" %%a in (%PATH%) do @echo %%a

The result is one line: "The system cannot find the file C:\Windows\system32."
I'm sure I'm missing something very basic but any help would be greatly appreciated. TY!

A: SET TempPath="%Path:;=";"%"
FOR %%a IN (%TempPath%) DO echo.%%~a

A: To do this correctly, you need something more complicated than a simple FOR. Try the following in a batch file:
@ECHO OFF
SET TEMPPATH=%PATH%
:PARSE_START
IF "%TEMPPATH%"=="" GOTO EXIT
FOR /F "tokens=1* delims=;" %%a in ("%TEMPPATH%") Do ECHO %%a
FOR /F "tokens=1* delims=;" %%a in ("%TEMPPATH%") Do SET TEMPPATH=%%b
GOTO PARSE_START
:EXIT


text:
Q: split a string on a - delimiter in bash? How do I split a string basis on a delimiter in Bash?
I have string stored in a variable as shown below:
DATA="111111-777777-Hello"

Now I would like to split above string on - delimiter and store two numbers in two different variables.
NUMBER1="111111"
NUMBER2="777777"

If NUMBER1 and NUMBER2 is an empty string and not a number then exit out of the script with non zero status code.

A: IFS=- read -r number1 number2 _ <<<"$DATA"
[[ $number1 && $number2 ]] || { echo "Initial columns not read" >&2; exit 1; }
[[ $number1$number2 = *[![:digit:]]* ]] && { echo "Values are not numeric" >&2; exit 1; }

echo "Number 1 is $number1"
echo "Number 2 is $number2"

Setting IFS to your delimiter on the same line as the read command (with no separator such as ; between) scopes it to that single read operation, so it won't modify the shell's behavior elsewhere in the script.
Note the _ as an extra argument to read -- the rest of the line is stored there, preventing it from being appended to number2.

A: if you want to split it into an array use this
split() {
    #  split string separator
    #  split a string into an array
    #  the array returned will be newArray
    #  on error return status is 1
    #  usage:- split bash?ksh?zsh?dash ? >>> returns an array of 3 elements bash[0] ksh[1] zsh[2] dash[3]
   local string="${1}" separator="${2}"
   declare cutOneCharacter;
   declare tempvar
   # appending $sepeartor to the ending of $string
   # bacon?tuna?hamburger ? >>>>> if not appeneded the result will be>>>>>> bacon tuna //o_O where is hamburger ?
   # if appeneded the result will be >>>> bacon tuna harmburger
   string="$string$separator"
   [[ ${newArray[@]} ]] && unset newArray
   splitUsage() {
     echo  "Usage: split string separator" >&2
   }

  (( "${#@}" != "2" )) && splitUsage && return 1;
  while [ -n "${string}" ];do
    cutOneCharacter=$( printf "%c" "$string" )
    if [[ "${cutOneCharacter}" == "${separator}" ]];then
        newArray+=( "${tempvar}" )
        unset tempvar;
    else
        tempvar+="${cutOneCharacter}"
    fi
    string=${string#*?}
  done
  echo"${newArray[@]}"
  return 0;
}

more details are here

A: With bash, manipulating IFS
data="111111-777777-Hello"
mapfile -t data < <(IFS=-; printf "%s\n" $data)  # variable is not quoted
echo "${data[0]}"    # 111111
echo "${data[1]}"    # 777777

Don't use ALLCAPS variable names -- leave them reserved for the shell.


text:
Q: JCheckbox changes state twice when I show a dialog on statechange, how to fix? I have a checkbox that, when the user selects it, should spawn a dialog with further info, and upon reaction from the user, do something. My code looks basically like this:
private void onItemStateChanged(java.awt.event.ItemEvent evt) {
    System.out.println("STATE CHANGED!");//TODO debug code
    if (evt.getStateChange() == ItemEvent.SELECTED) {
        int returnVal = JOptionPane.showConfirmDialog(this, "blablatext");
        if (returnVal == JOptionPane.OK_OPTION) {
            this.field1TF.setText("");
            this.field1TF.setEditable(false);
            this.field2TF.setText("");
            this.filed2TF.setEditable(false);
        }else if(returnVal == JOptionPane.NO_OPTION){
            this.field1TF.setText("");
            this.field1TF.setEditable(false);
            this.field2TF.setText("");
            this.field2TF.setEditable(false);
        }
    } else if(evt.getStateChange() == ItemEvent.DESELECTED){
        this.field1TF.setEditable(true);
        this.field2TF.setEditable(true);
    }
}

My problem now is, that my checkbox changes state always twice when I click on it.
It somehow has to do with the JOptionPane.showConfirmDialog because if I comment that out, it works as intended.
Am I not aware of something simple I should care about here, or what do I have to do to get my desired reaction? (User clicks checkbox -> is asked a question -> chooses YES/NO/Cancel -> program acts accordingly)

A: change that to the ActionListener
JCheckBox http://download.oracle.com/javase/tutorial/uiswing/components/button.html#checkbox
ActionListener http://download.oracle.com/javase/tutorial/uiswing/events/actionlistener.html

A: eeerggrrhh, you have to look at ItemListener, and by using this demo ....
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

/** @see http://stackoverflow.com/questions/5806712 */
public class ComponentEventDemo extends JPanel
    implements ActionListener, ComponentListener, ItemListener {

    private static final long serialVersionUID = 1L;
    private JFrame frame;
    private JTextArea display;
    private JLabel label;
    private String newline = "\n";
    private JTextField field1TF;
    private JTextField field2TF;
    private JCheckBox checkbox;

    public ComponentEventDemo() {
        super(new BorderLayout());
        display = new JTextArea();
        display.setEditable(false);
        JPanel panel = new JPanel(new GridLayout(0, 4));
        field1TF = new JTextField();
        field1TF.setDisabledTextColor(Color.red);
        field2TF = new JTextField();
        field2TF.setDisabledTextColor(Color.red);
        label = new JLabel("This is a label", JLabel.CENTER);
        label.addComponentListener(this);
        checkbox = new JCheckBox("Label visible", true);
        checkbox.addActionListener(this);
        checkbox.addComponentListener(this);
        checkbox.addItemListener(this);
        panel.add(checkbox);
        panel.add(label);
        panel.add(field1TF);
        panel.add(field2TF);
        panel.addComponentListener(this);
        JScrollPane scrollPane = new JScrollPane(display);
        scrollPane.setPreferredSize(new Dimension(650, 200));
        frame = new JFrame("ComponentEventDemo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.add(scrollPane, BorderLayout.CENTER);
        frame.add(panel, BorderLayout.SOUTH);
        frame.addComponentListener(this);
        frame.setLocation(200, 200);
        frame.pack();
        frame.setVisible(true);
    }

    public void itemStateChanged(ItemEvent evt) {
        System.out.println("STATE CHANGED!");//TODO debug code
        if (evt.getStateChange() == ItemEvent.SELECTED) {
            int returnVal = JOptionPane.showConfirmDialog(frame, "blablatext");
            if (returnVal == 0) {
                field1TF.setText("SELECTED - OK btn");
                field1TF.setEditable(false);
                field2TF.setText("SELECTED - OK btn");
                field2TF.setEditable(false);
            } else if (returnVal == 1) {
                field1TF.setText("SELECTED - canc btn");
                field1TF.setEditable(true);
                field2TF.setText("SELECTED - canc btn");
                field2TF.setEditable(true);
            }
        } else if (evt.getStateChange() == ItemEvent.DESELECTED) {
            field1TF.setEditable(true);
            field1TF.setText("DESELECTED");
            field2TF.setEditable(true);
            field2TF.setText("DESELECTED");
        }
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        boolean selected = checkbox.isSelected();
        System.out.println("Checkbox "
            + (selected ? "is" : "is not") + " selected.");
            if (selected) {
                //some stuff
            } else {
                //some reversal stuff
            }
    }

    protected void displayMessage(String message) {
        display.append(message + newline);
        display.setCaretPosition(display.getDocument().getLength());
    }

    @Override
    public void componentHidden(ComponentEvent e) {
        displayMessage(e.getComponent().getClass().getName() + " --- Hidden");
    }

    @Override
    public void componentMoved(ComponentEvent e) {
        displayMessage(e.getComponent().getClass().getName() + " --- Moved");
    }

    @Override
    public void componentResized(ComponentEvent e) {
        displayMessage(e.getComponent().getClass().getName() + " --- Resized ");
    }

    @Override
    public void componentShown(ComponentEvent e) {
        displayMessage(e.getComponent().getClass().getName() + " --- Shown");

    }

    public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                ComponentEventDemo ced = new ComponentEventDemo();
            }
        });
    }
}

A: Adding an ItemListener and checking for isSelected did it for me :
        checkbox.addItemListener(new ItemListener() {
                @Override
                public void itemStateChanged(ItemEvent e) {
                    if(checkbox.isSelected()){
                        System.out.println(checkbox.getText() + " ++ " + checkbox.isSelected());
                        //do stuff
                    }else{
                        System.out.println(checkbox.getText() + " -- " + checkbox.isSelected());
                        //do other stuff
                    }

                }
        });


text:
Q: How to load an Initial View Controller from Custom View controller class In my storyboard I have a FirstViewController which is also an Initial View Controller. I have another UIViewController in my StoryBoard named as BaseViewController. I have added a NavigationBar on this. I want to derive FirstViewController from BaseViewController so for that I have written following code.
class FirstViewController: BaseViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

But when I am running the App, it is not displaying the content of BaseViewController. Instead, it is loading only the content of FirstViewController. I want that every UIViewControllere which would be derived from BaseViewController should have its NavigationBar.What I need
to change to get this?

A: if the purpose of your BaseViewController is just to provide NavigationBar to ViewControllers. You can embed your FirstViewController(rootcontroller of NavController) in a NavigationController(set as Initial View Controller).
If you want different navbar for different controllers you have to set it programmatically like i do.
Take a look here-
extension UIViewController {

    func setNavBar(title : String, modType : ModuleType = .home, barHexColor : String? = nil, isBackBtn : Bool, isMenuBtn : Bool, isJummperBtn : Bool, isScreenshotBtn : Bool) {

        k_ModuleType = modType
        var barColor = "E14145"
        var arrLeftItems = [UIBarButtonItem]()
        var arrRightItems = [UIBarButtonItem]()

        if let aBarColor = barHexColor {
            barColor = aBarColor
        }

        self.navigationController?.navigationBar.isTranslucent = false
        self.navigationController?.navigationBar.barTintColor = UIColor(hexString: barColor)
        self.navigationController?.navigationBar.tintColor = UIColor.white

        if isBackBtn {
            let btnBack = UIButton(type: .custom)
            btnBack.setImage(UIImage(named: "Back2"), for: .normal)
            btnBack.frame = CGRect(x: 0, y: 0, width: 30, height: 30)
            btnBack.addTarget(self, action: #selector(self.barBackAction(_:)), for: .touchUpInside)
            let itemBack = UIBarButtonItem(customView: btnBack)
            arrLeftItems.append(itemBack)
        }

        if isMenuBtn {
            let btnMenu = UIButton(type: .custom)
            btnMenu.setImage(UIImage(named: "menu2"), for: .normal)
            btnMenu.frame = CGRect(x: 0, y: 0, width: 30, height: 30)
            btnMenu.addTarget(self, action: #selector(self.barMenuAction(_:)), for: .touchUpInside)
            let itemMenu = UIBarButtonItem(customView: btnMenu)
            arrLeftItems.append(itemMenu)
        }

        if isScreenshotBtn {
            let btnScreenshot = UIButton(type: .custom)
            btnScreenshot.setImage(UIImage(named: "screenshot2"), for: .normal)
            btnScreenshot.frame = CGRect(x: 0, y: 0, width: 30, height: 30)
            btnScreenshot.addTarget(self, action: #selector(self.barScreenshotAction(_:)), for: .touchUpInside)
            let itemScreenshot = UIBarButtonItem(customView: btnScreenshot)
            arrRightItems.append(itemScreenshot)
        }

        if isJummperBtn {
            let btnJumpper = UIButton(type: .custom)
            btnJumpper.setImage(UIImage(named: "jumpper2"), for: .normal)
            btnJumpper.frame = CGRect(x: 0, y: 0, width: 30, height: 30)
            btnJumpper.addTarget(self, action: #selector(self.barJumpperAction(_:)), for: .touchUpInside)
            let itemJumpper = UIBarButtonItem(customView: btnJumpper)
            arrRightItems.append(itemJumpper)
        }

        self.navigationItem.setLeftBarButtonItems(arrLeftItems, animated: true)
        self.navigationItem.setRightBarButtonItems(arrRightItems, animated: true)

        let lblNavTitle = UILabel(frame: CGRect(x: 0, y: 0,
                                                width: DeviceType.isIPad() ? 200 : 110,
                                                height: 40))
        lblNavTitle.textAlignment  = .center
        lblNavTitle.numberOfLines = 0
        lblNavTitle.textColor = UIColor.white
        lblNavTitle.text = title
        lblNavTitle.font = UIFont.systemFont(ofSize: DeviceType.isIPad() ? 21 : 16,
                                             weight: .medium)
        lblNavTitle.backgroundColor = UIColor.clear
        self.navigationItem.titleView = lblNavTitle

        self.navigationItem.titleView?.isUserInteractionEnabled = true
        let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.tapTitle(_:)))
        tapGesture.numberOfTapsRequired = 1
        self.navigationItem.titleView?.addGestureRecognizer(tapGesture)
    }

Then in FirstViewController's Viewdidload() method
override func viewdidload()
{
   super.viewdidload()

        self.setNavBar(title            : aTitle,
                       barHexColor      : nil,
                       isBackBtn        : false,
                       isMenuBtn        : true,
                       isJummperBtn     : true,
                       isScreenshotBtn  : true)
}

A: @interface CommonViewController ()<UITextFieldDelegate>//,UITableViewDelegate,UITableViewDataSource>
{

    APIFactory *fireAPI;
    Supportive *support;
    MBProgressHUD *HUD;

    BOOL blinkStatus;
}

@end

@implementation CommonViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}
-(UIStatusBarStyle)preferredStatusBarStyle{
    return UIStatusBarStyleLightContent;
}

- (void)viewDidLoad
{

    [super viewDidLoad];

    fireAPI = [[APIFactory alloc] init];
    support = [[Supportive alloc] init];
    self.dbManager = [[DBManager alloc] initWithDatabaseFilename:@"IntelliDealer.sqlite"];
    self.dataArray = [[NSMutableArray alloc]init];
    self.strVC=@"OrderViewController";
    [self setNavigationBar];

    if (self.epcCartOrder.count==0) {
        lblBadge.hidden = YES;
        badgeImgView.hidden = YES;
    }
    else{
        lblBadge.hidden = NO;
        badgeImgView.hidden = NO;
    }

}

-(void)setNavigationBar{

    NSString *query1;

    query1 =[NSString stringWithFormat:@"SELECT * FROM Dealer_Spare_Order WHERE spareOrderListId=%d ORDER BY spareAddTime DESC",[[[UICKeyChainStore keyChainStore] stringForKey:@"DealerEnableOrderList"] intValue]];

    self.epcCartOrder = [[NSMutableArray alloc] initWithArray:[self.dbManager loadDataFromDB:query1]];

    [Supportive ShowLog:[NSString stringWithFormat:@"no of rows => %lu",(unsigned long)self.epcCartOrder.count]];

    self.navigationController.navigationBarHidden = YES;

    CustomTitleView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 768, iPhoneX ? 100:70)];
    CustomTitleView.backgroundColor = [UIColor colorWithRed:231/255.f green:66/255.f blue:57/255.f alpha:1.0f];

    backButton =[UIButton buttonWithType:UIButtonTypeCustom];
    [backButton addTarget:self action:@selector(didclickOnBackButton) forControlEvents:UIControlEventTouchUpInside];
    backButtonImage = [UIImageView new];

    menuButton =[UIButton buttonWithType:UIButtonTypeCustom];
    menuButton.tag = 100;
    [menuButton addTarget:self action:@selector(didclickOnMenuButton) forControlEvents:UIControlEventTouchUpInside];

    lblDealerName = [[UILabel alloc] init];
    lblDealerName.numberOfLines=3;
    lblDealerName.text= [[UICKeyChainStore keyChainStore] stringForKey:@"DealerName"];
    lblDealerName.textAlignment=NSTextAlignmentCenter;
     lblDealerName.textColor = [UIColor whiteColor];
    lblDealerName.backgroundColor=[UIColor clearColor];
    lblDealerName.userInteractionEnabled=NO;

    btnDealerName =[UIButton buttonWithType:UIButtonTypeCustom];
    [btnDealerName addTarget:self action:@selector(didclickOnDealerName) forControlEvents:UIControlEventTouchUpInside];
    [btnDealerName addSubview:lblDealerName];

    addToCartButton =[UIButton buttonWithType:UIButtonTypeCustom];
    [addToCartButton addTarget:self action:@selector(didclickOnAddToCartButtonButton) forControlEvents:UIControlEventTouchUpInside];

    addToCartButtonImage = [UIImageView new];

    [self.view addSubview:CustomTitleView];

    [CustomTitleView addSubview:backButtonImage];
    [CustomTitleView addSubview:backButton];
    [CustomTitleView addSubview:menuButton];
    [CustomTitleView addSubview:btnDealerName];
    //[CustomTitleView addSubview:cartButton];
    [CustomTitleView addSubview:addToCartButtonImage];
    [CustomTitleView addSubview:addToCartButton];

    if(UI_USER_INTERFACE_IDIOM () == UIUserInterfaceIdiomPad) {

        [backButton setFrame:CGRectMake(0, 8, 45, 60)];
//        [backButton setImage:[UIImage imageNamed:@"back_arrow"] forState:UIControlStateNormal];

        [backButtonImage setFrame:CGRectMake(0, 18, 40, 40)];
        [backButtonImage setImage:[UIImage imageNamed:@"back_arrow"]];

        [menuButton setFrame:CGRectMake(50, 18, 40, 40)];
        [menuButton setImage:[UIImage imageNamed:@"ipadnavigatio"] forState:UIControlStateNormal];

        [btnDealerName setFrame:CGRectMake(100, 24, 590, 30)];

        [lblDealerName setFrame:CGRectMake(0, 0, 590, 30)];
        [lblDealerName setTextAlignment:NSTextAlignmentCenter];

        lblDealerName.font = [UIFont fontWithName:@"Arial" size:22];

       [addToCartButton setFrame:CGRectMake(690, 10, 70, 60)];

        [addToCartButtonImage setFrame:CGRectMake(700, 23, 40, 38)];
        [addToCartButtonImage setImage:[UIImage imageNamed:@"ipadaddtocart"]];

        badgeImgView = [[UIImageView alloc]init];

        //badgeImgView.hidden =YES;

        badgeImgView.image = [UIImage imageNamed:@"order_bg"];
        lblBadge = [[UILabel alloc] init];

        if (self.epcCartOrder.count<10) {

            badgeImgView.frame =CGRectMake(36,9, 23, 23);
            lblBadge.frame = CGRectMake(7, 0, 23, 23);

        }
        else{
            badgeImgView.frame =CGRectMake(38,9, 25, 25);
            lblBadge.frame = CGRectMake(4, 0, 25, 25);
        }

        /*important--------- */
        lblBadge.textColor = [UIColor whiteColor];
        lblBadge.font = [UIFont fontWithName:@"Arial" size:15];

        lblBadge.backgroundColor=[UIColor clearColor];
        lblBadge.textColor=[UIColor whiteColor];
        lblBadge.userInteractionEnabled=NO;
        //lblBadge.hidden = YES;
        lblBadge.text=[NSString stringWithFormat:@"%lu", (unsigned long)self.epcCartOrder.count];

        //[CustomTitleView addSubview:_textFieldSearch];
        [addToCartButtonImage addSubview: badgeImgView];
        [badgeImgView addSubview:lblBadge];
        [addToCartButton addSubview: badgeImgView];

    }
    else if (UI_USER_INTERFACE_IDIOM () == UIUserInterfaceIdiomPhone){

       double customViewWidth = self.view.frame.size.width - 40;

        [backButton setFrame:CGRectMake(5, iPhoneX ? 20:10, 40, 60)];
//        [backButton setImage:[UIImage imageNamed:@"back_arrow"] forState:UIControlStateNormal];

        [backButtonImage setFrame:CGRectMake(10, iPhoneX ? 55:25, 35, 35)];
        [backButtonImage setImage:[UIImage imageNamed:@"back_arrow"]];

        [menuButton setFrame:CGRectMake(50, iPhoneX ? 55:25, 35, 35)];
        [menuButton setImage:[UIImage imageNamed:@"ipadnavigatio.png"] forState:UIControlStateNormal];

        [btnDealerName setFrame:CGRectMake(90, iPhoneX ? 50:20, 180, 51)];
        [lblDealerName setFrame:CGRectMake(0, 0, 180, 51)];
         lblDealerName.font = [UIFont fontWithName:@"Arial" size:15];

        [addToCartButton setFrame:CGRectMake(customViewWidth - 8, iPhoneX ? 55:15, 50, 55)];

        [addToCartButtonImage setFrame:CGRectMake(customViewWidth , iPhoneX ? 60:30, 30, 30)];
        [addToCartButtonImage setImage:[UIImage imageNamed:@"ipadaddtocart"]];

        badgeImgView = [[UIImageView alloc]init];

        badgeImgView.image = [UIImage imageNamed:@"order_bg"];

        lblBadge = [[UILabel alloc] init];
        lblBadge.textColor = [UIColor whiteColor];
        lblBadge.font = [UIFont fontWithName:@"Arial" size:15];

        lblBadge.backgroundColor=[UIColor clearColor];
        lblBadge.textColor=[UIColor whiteColor];
        lblBadge.userInteractionEnabled=NO;
        lblBadge.text=[NSString stringWithFormat:@"%lu", (unsigned long)self.epcCartOrder.count];

        [addToCartButtonImage addSubview: badgeImgView];
        [badgeImgView addSubview:lblBadge];
        [addToCartButton addSubview: badgeImgView];

        if (self.epcCartOrder.count<10) {

            badgeImgView.frame=CGRectMake(28, iPhoneX ?  1:9, 20, 20);
            lblBadge.frame = CGRectMake(6, 0, 20, 20);

        }
        else{

            badgeImgView.frame=CGRectMake(28, 6, 22, 22);
            lblBadge.frame = CGRectMake(2, 0, 22, 22);
        }
        //lblBadge.center = badgeImgView.center;

        /*important--------- */

       // [CustomTitleView addSubview:_textFieldSearch];

    }

}


text:
Q: Microsoft Flow Error: "You are not authorized to send mail on behalf of the specified sending account" Using Microsoft flow I am trying to send an email Notification on behalf of an Administrator's account.
Unfortunately, my attempt results in the below error.
You are not authorized to send mail on behalf of the specified sending account

I used the Office365 Outlook Connector in my flow, with action Send an email (V2) and, afterwards, i added the Administrator's account in the "From" field, of the action.

A: Suppose the connection in "Send an email (V2)" is of User1. And you need to send email on behalf of Admin Account i.e. AdminUser1.
User1 should should have Send on behalf permission on AdminUser1 Mailbox.
Steps :

*

*Go To exchange Admin Center

*Click on MailBoxes from the left navigation

*Click on the AdminUser1 (it will open AdminUser1 Mailbox settings in callout menu)

*click on Manage mailbox delegation (under Mailbox Permissions) (refer below image)

*Click on Edit  for the send on behalf permissions

*Add the User1 here.

*Once these settings are configured, User1 will have permissions to send email on behalf of AdminUser


text:
Q: Your usage has exceeded our rate limiting thresholds So, we're doing some gitops style workflows and in order for Flux/Argo to see our git repos, we use PATs.  But the PAT's are tied to like, my user account.  And so now that we have all these processes using my PAT, I'm being rate limited:
Your usage has exceeded our rate limiting thresholds
Anyone else have this issue and get around this?  Are we supposed to use fake (i.e. "service accounts") and their PATs instead?


text:
Q: How to resize the following picture in LaTeX using pstricks?
\documentclass[a4paper, 12pt, oneside]{article}

\usepackage{pst-all}
\usepackage{pstricks}
\usepackage{tikz}
\begin{center}
\begin{figure}

%\bpsp(3,2.5)
%\psgrid[subgriddiv=1,griddots=10,gridlabels=10pt](-2,0)(8,3)
\vspace{3cm}
\rput(5.7,0.25){
\psline(0,1)(2,1)
\psline[linestyle=dashed](2,1)(3,1)
\psline(3,1)(4,1)
\psdot(0,1)
\psdot(1,1)
\psdot(2,1)
\psdot(3,1)
\psdot(4,1)
\pscurve[linestyle=dotted](5.3,1.59)(5.45,1.3)(5.4,1.04)
\pscurve[linestyle=dotted](5.3,.45)(5.45,.71)(5.4,.98)
\psline(4,1)(5,0)
\psline(4,1)(5,2)
\psline(5.4,1)(4,1)
\psline(-1,2)(0,1)(-1,0)
\psdot(-1,2)
\psdot(-1,0)
\psdot(5.4,1)
\psline(5.3,.4)(4,1)(5.3,1.6)
\psline(-1.3,1.5)(0,1)(-1.3,.5)
\psdot(-1.3,1.5)
\psdot(-1.3,.5)
\pscurve[linestyle=dotted](-1.1,2)(-1.5,1)(-1.1,0)
\psdot(5.3,1.6)
\psdot(5.3,.4)
\psdot(5,0)
\psdot(5,2)
\rput(0.1,.8){$u_0$}
\rput(1,.8){$u_1$}
\rput(2,.8){$u_2$}
\rput(3.8,.8){$u_{k-s-t}$}
\rput[l](-3.5,1){$s$ vertices $\Bigg\{$}
\rput[l](5.6,1){$\Bigg\} t$ vertices}
}
%epsp
\caption{The graph $\mathcal{P}(k,s,t)$}\label{pkst}

\end{figure}
\end{center}

I am trying to scale the size of the figure. How we can do that?

A: No need for scaling. Just use the correct image size for pspicture:
\documentclass[a4paper, 12pt, oneside]{article}
\usepackage{pst-all}
\usepackage{tikz}
\begin{document}

\begin{figure}
\centering
\begin{pspicture}[showgrid=false](-3,0)(7.5,2)
  \psline{*-*}(0,1)(2,1)\psdot(1,1)
  \psline[linestyle=dashed]{-*}(2,1)(3,1)
  \psline{-*}(3,1)(4,1)
  \psarc[linestyle=dotted](0,1){1.5}{135}{225}
  \psarc[linestyle=dotted](4,1){1.5}{-45}{45}
  \rput(0,1){\psforeach{\iA}{135,157.5,205.5,225}{\psline{-*}(1.5;\iA)}}
  \rput(4,1){\psforeach{\iA}{-45,-22.5,0,22.5,45}{\psline{-*}(1.5;\iA)}}
  \uput{10pt}[-90](0,1){$u_0$}
  \uput{10pt}[-90](1,1){$u_1$}
  \uput{10pt}[-90](2,1){$u_2$}
  \uput*{10pt}[-90](4,1){$u_{k-s-t}$}
  \rput[r](-1.5,1){$s$ vertices $\Bigg\{$}
  \rput[l](5.6,1){$\Bigg\} t$ vertices}
\end{pspicture}
\caption{The graph $\mathcal{P}(k,s,t)$}\label{pkst}
\end{figure}

\end{document}

A: You can resize a pspicture, without resizing the text – which leads to inconsistent font sizes, using \psset{unit=...} at the beginning (the default unit is 1cm; I chose here unit=0.8cm). Here is an example. I took the opportunity to simplify your code, with a systematic use of psnodes, and the adjunction of the pst-eucl package/
    \documentclass[a4paper,, oneside]{article}

    \usepackage{pst-all, pst-eucl}

    \begin{document}

    \begin{figure}
    \psset{unit=0.8cm}
    \centering
    \begin{pspicture}(-3.5,-1.3)(7.5,1.3)
    \pstGeonode[PointName={u_0,u_1,u_2,none, u_{k-s-t},none}, PosAngle=-90](0,0){U0}(1,0){U1}(2,0){U2}(3,0){U3}(4,0){U4}(5.4,0){B0}
    \psline(U0)(U2)\psline[linestyle=dashed, dash=3pt 2pt](U2)(U3)\psline(U3)(B0)
    \foreach \ang/\i in {-50/1,-30/2,30/3,50/4}{\dotnode[PointName=none](-1.4;\ang){A\i}\AtoB(A\i)(U4){B\i} \psline(A\i)\psline[arrows=-*](U4)(B\i)}
    \pstArcOAB[linestyle=dotted]{U0}{A1}{A4}
    \pstArcOAB[linestyle=dotted]{U4}{B2}{B3}
    \pnodes[-0.8em, 0](A2){C2}(A3){C3}
    \pnodes[0.8em, 0](B2){D2}(B3){D3}
    \psset{braceWidth=1pt, braceWidthInner=3pt, braceWidthOuter=3pt}
    \psbrace[ref=rC, nodesepA=-2pt](C2)(C3){$s$ vertices}
    \psbrace[ref=lC, nodesepA= 2pt](D2)(D3){$t$ vertices}
    \end{pspicture}
    \caption{The graph $\mathcal{P}(k,s,t)$}\label{pkst}
    \end{figure}

    \end{document}


text:
Q: how to fix error #1009: Cannot access a property or method of a null object reference hi im making my flash game this pops up when i test it i am new to flash so i have no idea how to fix it ive searched the web for 2 hours trying fix but no luck  all help is appreciated so heres my code:
stop();
Quit.addEventListener(MouseEvent.CLICK, func55);

function func55(event:MouseEvent):void
{
    gotoAndStop(2);
    myTimer.stop(); myTimer.removeEventListener(TimerEvent.TIMER, timerListener);
    myTimer2.stop(); myTimer2.removeEventListener(TimerEvent.TIMER, timerListener);
}

Help.addEventListener(MouseEvent.CLICK, func49);

function func49(event:MouseEvent):void
{
    gotoAndStop(4);
    myTimer.stop(); myTimer.removeEventListener(TimerEvent.TIMER, timerListener);
    myTimer2.stop(); myTimer2.removeEventListener(TimerEvent.TIMER, timerListener);
}

var mytimer13:Timer = new Timer(2000,0);
mytimer13.addEventListener(TimerEvent.TIMER, timerListener10);
function timerListener10(e:TimerEvent):void {
Hungry_bar.scaleX-=0.05;
if(Hungry_bar.scaleX<=0.05){
        gotoAndStop(12)
        myTimer.stop(); myTimer.removeEventListener(TimerEvent.TIMER, timerListener);
        myTimer2.stop(); myTimer2.removeEventListener(TimerEvent.TIMER, timerListener);
    }
}
myTimer.start();

var mytimer15:Timer = new Timer(3000,0);
mytimer15.addEventListener(TimerEvent.TIMER, timerListener12);
function timerListener12(e:TimerEvent):void {
Fun_bar.scaleX-=0.05;
if(Fun_bar.scaleX<=0.05){
        gotoAndStop(13)
        myTimer.stop(); myTimer.removeEventListener(TimerEvent.TIMER, timerListener);
        myTimer2.stop(); myTimer2.removeEventListener(TimerEvent.TIMER, timerListener);
    }
}
myTimer2.start();

Feed.addEventListener(MouseEvent.CLICK,feed)
function feed11(e:MouseEvent){
    Hungry_bar.scaleX+=0.05
    if(Hungry_bar.scaleX>=1.5){
        gotoAndStop(14)
        myTimer.stop(); myTimer.removeEventListener(TimerEvent.TIMER, timerListener);
        myTimer2.stop(); myTimer2.removeEventListener(TimerEvent.TIMER, timerListener);
    }
}

Fun.addEventListener(MouseEvent.CLICK,happy)
function happy11(e:MouseEvent){
    Fun_bar.scaleX+=0.05
    if(Fun_bar.scaleX>=1.5){
        gotoAndStop(15)
        myTimer.stop(); myTimer.removeEventListener(TimerEvent.TIMER, timerListener);
        myTimer2.stop(); myTimer2.removeEventListener(TimerEvent.TIMER, timerListener);
    }
}


text:
Q: testflightapp.com, how it works, and can I assume it is safe and work longer? I heard and tried testflightapp.com and I surprised. Because only by installing their profiling with a few taps, iOS allowed installing apps from them. I have shocked. Is this normal? How are they work? And can I assume them as safe and work longer without any accidental service shutdown? (such as sued by Apple...)

A: You still need to use your own AdHoc distribution profiles, nothing changed there. The profile you can install via their website is only for submitting the UDID to the website.
This question is already answered here: How does TestFlight do it?

A: It's a standard way to distribute your apps introduced with iOS 4. "All" that Testflight did was build a webapp and community around it.


text:
Q: Using Paley-Wiener theorem and Fourier inversion formula to get this result I want to solve the problem #8 of Stein's book Complex analysis in Chapter 4, for the first part I've got the following:
We know that the coefficients of a series are:
$$a_n=\frac{f^{(n)}(z_0)}{n!}$$
Since the series is centered at $z_0=0$ and using the inverse Fourier transform we get :
$$f^{(n)}=(2 \pi i )^{n} \int_{-\infty}^{\infty}\hat{f}(\zeta)\zeta^{n}e^{2\pi ix\zeta}d\zeta=(2 \pi i )^{n} \int_{-M}^{M}\hat{f}(\zeta)\zeta^{n}e^{2\pi ix\zeta}d\zeta$$
and evaluating at zero and dividing by the factorial we have:
$$a_n=\frac{(2 \pi i )^{n}}{n!} \int_{-M}^{M}\hat{f}(\zeta)\zeta^{n}d\zeta$$
but then I don't know how to bound this to get that
$$\limsup_{n-> \infty}(n!|a_n|)^{1/n} \le 2 \pi M$$
I was trying to do the following:
$$|a_n|\le \frac{(2 \pi )^n}{n!}\int_{-M}^{M}|\hat{f}(\zeta)||\zeta^{n}|d\zeta$$
the thing is that I don't know how to ensure that the integral is less than $M^n$
Another way I thought of was to use Cauchy's inequalities then I will get the following
$$|a_n| \le \frac{n!}{R^n}||f||_{C}$$
for an appropiate election of the radius of the circle, so I want to pick the circle with center in zero and of radius $M$ but then How can I bound the integral? and I don't think this could take me to the result.
For the second part I don't understand if I can use that $\hat{f}$ is compact supported, if I can then I use Paley- Weiner theorem but I don't know how modify it to get the result since that $\epsilon$ is annoying me. If I can't use it then I can hardly think in a way to prove this.
Can someone help me with this issue please? Thanks in advance.

A: You were already on the right track, but stopped a little too soon. You showed
$$
           a_n = \frac{(2\pi i)^{n}}{n!}\int_{-M}^{M}\hat{f}(\zeta)\zeta^n d\zeta
$$
Therefore,
\begin{align}
           (n! |a_n|)^{1/n}&=2\pi\left|\int_{-M}^{M}\hat{f}(\zeta)\zeta^n d\zeta\right|^{1/n} \\
  &\le 2\pi\left(\int_{-M}^{M}|\hat{f}(\zeta)|d\zeta M^{n}\right)^{1/n} \\
  &= 2\pi M\left(\int_{-M}^{M}|\hat{f}(\zeta)|d\zeta\right)^{1/n}
\end{align}
The limit of the right side exists as $n\rightarrow\infty$ and, assuming $\int_{-M}^{M}|\hat{f}(\zeta)|d\zeta \ne 0$, that limit is $2\pi M$. Therefore,
\begin{align}
        \limsup_{n} (n!|a_n|)^{1/n} & \le \limsup_{n} 2\pi M\left(\int_{-M}^{M}|\hat{f}(\zeta)|d\zeta\right)^{1/n} \\ & = \lim_{n}2\pi M\left(\int_{-M}^{M}|\hat{f}(\zeta)|d\zeta\right)^{1/n} = 2\pi M.
\end{align}
The only assumption needed for $\hat{f}$ is that it is absolutely integrable on $[-M,M]$.
For the converse, assume that $f(z)=\sum_{n=0}^{\infty}a_n z^n$, and assume that
$$
    \limsup_{n}(n!|a_n|)^{1/n} \le 2\pi M.
$$
Let $\epsilon > 0$ be given. Then there exists $N$ such that
$$
              \sup_{n \ge N}(n!|a_n|)^{1/n} \le (2\pi M+\epsilon) \\
               n!|a_n| \le (2\pi M+\epsilon)^{n} \;\;\; n \ge N \\
                 \sum_{n=0}^{\infty}|a_n||z|^{n} \le
        \sum_{n=0}^{N-1}\left(|a_n|-\frac{(2\pi M+\epsilon)^{n}}{n!}\right)|z|^{n}+\sum_{n=N}^{\infty}\frac{1}{n!}(2\pi M+\epsilon)^{n}|z|^{n}
$$
A little juggling of constants to bound the first few terms by the full exponential series gives
$$
        |f(z)| \le C\sum_{n=0}^{\infty}\frac{1}{n!}(2\pi M+\epsilon)^{n}|z|^{n}
   = e^{(2\pi M+\epsilon)|z|}.
$$

A: If $f\in L^1(\mathbb{R})$ then $\hat{f}$ is continuous, and since it is supported in $[-M,M]$, it must be bounded, by some $C>0$. Therefore
$$ n!a_n\leq (2\pi)^n\int_{-M}^M|\hat{f}(t)||t|^n\;dt \leq C(2\pi)^n\int_{-M}^M|t|^n\;dt =\frac{2CM^{n+1}}{n+1}(2\pi )^n$$
Now taking $n$th roots of both sides yields
$$ (n!a_n)^{\frac{1}{n}}\leq \frac{(2CM)^{\frac{1}{n}}}{(n+1)^{\frac{1}{n}}}2\pi M$$
and since $\lim_{n\to\infty}K^{\frac{1}{n}}=1=\lim_{n\to\infty}(n+1)^{\frac{1}{n}}$ for any constant $K$, it follows that
$$ \limsup_{n\to\infty}(n!a_n)^{\frac{1}{n}}\leq2\pi M $$


text:
Q: QByteArray en 2 partes? Buenas tardes, estoy haciendo un ejercicio que involucra Puerto Serial, enviar y recibir una cadena, al momento de mandar la cadena todo bien, pero al recibirla la obtengo en 2 partes, ambos dispositivos tienen la misma configuración
PuertoAP->setBaudRate(QSerialPort::Baud115200);
PuertoAP->setDataBits(QSerialPort::Data8);
PuertoAP->setParity(QSerialPort::NoParity);
PuertoAP->setStopBits(QSerialPort::OneStop);
PuertoAP->setFlowControl(QSerialPort::NoFlowControl);

Es una cadena de 15 datos, primero llegan 8 y luego 7, si pongo el tamaño de la cadena a 24 me parte la cadena en 3 partes de 8 datos, Alguien sabe a que se deba? muchas gracias por su tiempo.

A:
Alguien sabe a que se deba?

Se debe a que es así como funciona. Los datos nunca se envían enteros si no en paquetes tanto si quieres enviar varios gigas de información como si envías pequeñas cadenas.

¿Qué debes hacer?
Normalmente, implementando este tipo de comunicaciones los mensajes se envían con una cabecera que incluye el tamaño de la información a recibir y no se considera la información recibida hasta haber obtenido el dato al completo.


text:
Q: mySQL nested loop wont execute I'm working on a SOAP based webservice where in a part of it i have to perform some queries on the database using nested loop, the problem is that the inner loop just gets executed for ONE time only, before giving up.This is the code:
          for(int i=0; i<selec.length; i++){
                for(int j=0; j<sintom.length;j++){
                    var[(i*sintom.length)+j] = "INSERT INTO malattia (nome, eta,  descrizione, sesso, etnia, sintomi) "
                + "VALUES ('" + malattia + "','" + eta + "','" + descrizione + "','" +  sexarra[0] + "','" + selec[i] + "','" + sintom[j] + "')";
        }

      }

This is where the queries are supposed to get executed:
        if (errore.equals("")) {
              try {
                    Statement st = conn.createStatement();
      for(int i=0; i<selec.length; i++){
        for(int j=0;j<sintom.length;j++){

                     st.executeUpdate(var[(i*sintom.length)+j]);}}

What happens is that no matter the size of select it will work fine as long as the length of sintom is 1,bigger than 1 and it wont work.
Thanks for your expert advices, always appreciated!

A: Your use-case is a perfect example of a case where a prepared statement should be used. Read more about them in the JDBC tutorial.
Using a prepared statement would allow

*

*avoiding SQL injection attacks. You should never use string concatenation to build your SQL query. A malicious user could enter some special value which would completely change the meaning of your query. A non-malicious user could enter special characters (quotes, for example) which would make the query fail because it's not syntaxically correct.

*letting the database prepare the execution plan only once, for all the insert queries you're executing. Indeed, the query is always the same. Only the parameters change.

So, the code should look like this:
PreparedStatement ps = conn.prepareStatement("INSERT INTO malattia (nome, eta, ...) values (?, ?, ...)");
for (int i= 0; ...) {
    for (int j = 0; ...) {
        ps.setString(1, malattia);
        ps.setString(2, eta);
        ...
        ps.executeUpdate();
    }
}

A: Try to use PreparedStatement and its Batch capability instead of plain query to simplify code and prevent SQL-injection.


text:
Q: execution failed for the task class not found `org.postgresql.Driver` I'm trying to run several *.sql scripts. My gradle task looks like this
task initdb(dependsOn: initProperties) << {
Class.forName(props.getProperty("db.driver"))
sql = Sql.newInstance(
        props.getProperty("db.url"),
        props.getProperty("db.admin"),
        props.getProperty("db.password"),
        props.getProperty("db.driver")
);
FileTree tree = null
//create database
fileTree(dir: 'src/main/sql/db', include: "0010_create_data_base.sql").each {
    sql.execute(it.text)
}
//create schema
fileTree(dir: 'src/main/sql/db', include: "0020_create_schema.sql").each {
    sql.execute(it.text)
}
//create tables
fileTree(dir: 'src/main/sql/tables', include: "**.sql").each {
    sql.execute(it.text)
}
//load data
fileTree(dir: 'src/main/sql/data', include: "**.sql").each {
    sql.execute(it.text)
}
}

Properties file contains
db.admin=admin
db.admin.password=pass
db.driver=org.postgresql.Driver
db.url=jdbc:postgresql://localhost:5432

My dependency for the driver
dependencies {
    //jdbc postresql
    compile 'org.postgresql:postgresql:9.2-1004-jdbc4'
}

Also there is a classpath
buildscript {
    dependencies {
        classpath 'org.postgresql:postgresql:9.2-1004-jdbc4'
    }
}

But I've got an error

What's the problem? It cannot find .jar?

A: Here how it works on my machine.
I've added configuration
configurations {
    driver
}

My dependency looks like this
dependencies {
    driver 'org.postgresql:postgresql:9.2-1003-jdbc4'
}

My buildscript dependency
buildscript {
    dependencies {
         classpath 'org.postgresql:postgresql:9.2-1003-jdbc4'
    }
}

And here my initdb task
task initdb(dependsOn: initProperties) << {
URLClassLoader loader = GroovyObject.class.classLoader as URLClassLoader
configurations.driver.each {
    File file -> loader.addURL(file.toURI().toURL())
}
Class driver = loader.loadClass(props.getProperty("db.driver")) //org.postgresql.Driver
def sql = Sql.newInstance(
        props.getProperty("db.url") + "/postgres",
        props.getProperty("db.admin"),
        props.getProperty("db.admin.password"),
        props.getProperty("db.driver")
);
FileTree tree = null
//create database
fileTree(dir: 'src/main/sql/db', include: "0010_create_data_base.sql").each {
    sql.execute(it.text)
}
//initalizing it again to new database
sql = Sql.newInstance(
        props.getProperty("db.url") + "/" + props.getProperty("db.name"),
        props.getProperty("db.admin"),
        props.getProperty("db.admin.password"),
        props.getProperty("db.driver")
);
//create schema
fileTree(dir: 'src/main/sql/db', include: "0020_create_schema.sql").each {
    sql.execute(it.text)
}
//create tables
fileTree(dir: 'src/main/sql/tables', include: "**.sql").each {
    sql.execute(it.text)
}
//load data
fileTree(dir: 'src/main/sql/data', include: "**.sql").each {
    sql.execute(it.text)
}
}


text:
Q: Activate a List of URLs in Excel Column I have 1700+ book title records in an Excel file.  Each of these 1700+ records has a cover image referenced, and those cover images are named by part of the title's ISBN# (such as 3-539-4.jpg).  All of these cover images need to be visually checked against their title records for a proper match.
What I've come up with as a process is to have the local URL in a column next to the title column.  Clicking each URL will open the image in my preview app so the cover image title can be verified as matching the title in the adjacent cell.  I have the local URLs in the column, but need a shortcut to making them all active, rather than setting each one individually in the Insert Hyperlink function (which would take approximately 1.5 forevers).
Is there a macro or VBA module i can use to make this happen over the whole column of URLs?
Below is an image of what I've started, showing the first one active.

A: For each myCell in Range("A1:A1700")
    ActiveSheet.Hyperlinks.Add myCell, Address:=MyCell.Value
Next myCell

Adjust for the actual range your links are in.
You should also be aware that there is no validation on the link, so a cell containing "Random Text" will link to "Random Text" whether or not that is a valid link


text:
Q: Bootstrap won't compile css SyntaxError: Cannot read property 'toCSS' I am using Google App engine and Bootstrap 3 with an Ubuntu local environment. When I try to load a page the browser returns this error which I think is essentially saying less.js can't compile the .css file. Pre-compiled bootstrap is not used in my system as I pull in parts in our less and work from there. This error appears 10% of the time.
SyntaxError: Cannot read property 'toCSS' of null
in admin-bootstrap-theme.less
at http://127.0.0.1:8080/js/less.js:7952:30
at http://127.0.0.1:8080/js/less.js:7860:13
at callback.type (http://127.0.0.1:8080/js/less.js:7809:13)
at handleResponse (http://127.0.0.1:8080/js/less.js:7734:13)
at doXHR (http://127.0.0.1:8080/js/less.js:7754:9)
at loadFile (http://127.0.0.1:8080/js/less.js:7803:5)
at loadStyleSheet (http://127.0.0.1:8080/js/less.js:7827:5)
at loadStyleSheets (http://127.0.0.1:8080/js/less.js:7867:9)
at Object.less.refresh (http://127.0.0.1:8080/js/less.js:7944:5)
at http://127.0.0.1:8080/js/less.js:7970:6

Similarly, this error appears along side the first.
SyntaxError: Cannot read property 'toCSS' of null
in admin-bootstrap.less
at http://127.0.0.1:8080/js/less.js:7952:30
at http://127.0.0.1:8080/js/less.js:7860:13
at callback.type (http://127.0.0.1:8080/js/less.js:7809:13)
at handleResponse (http://127.0.0.1:8080/js/less.js:7734:13)
at doXHR (http://127.0.0.1:8080/js/less.js:7754:9)
at loadFile (http://127.0.0.1:8080/js/less.js:7803:5)
at loadStyleSheet (http://127.0.0.1:8080/js/less.js:7827:5)
at loadStyleSheets (http://127.0.0.1:8080/js/less.js:7867:9)
at Object.less.refresh (http://127.0.0.1:8080/js/less.js:7944:5)
at http://127.0.0.1:8080/js/less.js:7970:6

Finally, the more confusing part and also common part is this error which is much more common, without much of a stacktrace.
NameError: .box-shadow is undefined
in theme.less on line 28, column 3:

27  @shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 1px 1px rgba(0,0,0,.075);
28  .box-shadow(@shadow);
29

So I have tried reinstalling all my files with proper permissions. I recently updated python. I tried saving the files without a BOM as discussed in another post. Any help would be much appreciated.

A: I found the answer when my coworker and I were double checking our dependencies. Turns out that the version of less.js was very low 1.7.3. When we upgraded the compiler to 2.5.3 the compilation succeeded and everything was a success.


text:
Q: How to insert a node after another node using doubly linked list? I want to insert a node after another node in a doubly-linked list but when I provide such a key that doesn't exist in the Linked list then this method gives me an error. How should I fix this error? here is my code. Thanks in Advance.
{
   public void AddAfter(int insertAfter, int data)
   {
   DLNode n = new DLNode(data);
   DLNode curr = head;
   if(head == null)
       head = n;
   else
   {
       while(curr.Data != insertAfter && curr != null)
       {
           curr = curr.next;
       }
       if(curr != null)
       {
           n.next = curr.next;
           n.prev = curr;
           n.next.prev = n;
           curr.next = n;
           NumNodes++;

       }
       else
           System.out.println("The Key "+insertAfter+" doesn't exist: ");
   }
  }
}

A:
... but when I provide such a key that doesn't exist in the Linked list then this method gives me an error.

The problem occur in your while loop condition (e.g., curr.Data != insertAfter && curr != null). Here, you are first accessing the data field of the curr variable and then checking whether curr is null or not.

How should I fix this error?

You need to do it in reverse order. The following code should solve your problem.
public void AddAfter(int insertAfter, int data) {
    DLNode n = new DLNode(data);
    DLNode curr = head;

    if(head == null) {
        head = n;
    }
    else {
        while(curr != null && curr.Data != insertAfter) {
            curr = curr.next;
        }
        if(curr != null) {
            n.next = curr.next;
            n.prev = curr;
            n.next.prev = n;
            curr.next = n;
            NumNodes++;
        }
        else {
            System.out.println("The Key "+insertAfter+" doesn't exist: ");
        }
    }
}


text:
Q: $H\lhd G$, $|H|=p^k$ then $H$ is included in every $p$-Sylow subgroup of $G$ Let $G$ be a finite group and let $H$ be a normal subgroup of G, with $|H|=p^k$. Then you have to prove that $H \subset P$, for every $P\in\mathrm{Syl}_p(G)$.
What I thought is that, as $p$-Sylow are maximal $p$-subgroups then, as $H$ is a $p$-subgroup then it is included in $P$. But I'm not using the fact that $H$ is a normal subgroup, thus I guess I'm missing something, what it is?

A: Fistly $H\subset P$ for some $P\in \mathrm{Syl}_p(G)$ because a Sylow $p$-subgroup is a maximal $p$-subgroup of $G$. Note that Sylow $p$-subgroups are conjugate. We have $H = gHg^{-1}\subset gPg^{-1}$ because $H$ is normal. This gives the result.
Or argue by contradiction. If $H$ is not contained in $P$ for some $P\in\mathrm{Syl}_p(G)$, then $HP$ is a $p$-subgroup of $G$ (because $H$ is normal) and that $P\subsetneq HP$, a contradicition for $P$ to be a maximal $p$-subgroup.


text:
Q: Cant Access Data in List of Dictionaries I'm trying to access some data within nested ordered dictionaries. This dictionary was created by using the XMLTODICT module. Obviously I would like to create my own dictionaries but this one is out of my control.
I've tried to access them numerous ways.
Example:
Using a for loop:
I can access the first level using v["name"] which gives me Child_Policy and Parent Policy
When I do v["class"]["name"] I would expect to get "Test1" but that's not the case.
I've also tried v[("class", )] variations as well with no luck.
Any input would be much appreciated
The data below is retrieved from a device via XML and converted to dictionary with XMLTODICT.
[
  {
    "@xmlns": "http://cisco.com/ns/yang/Cisco-IOS-XE-policy",
    "name": "Child_Policy",
    "class": [
      {
        "name": "Test1",
        "action-list": {
          "action-type": "bandwidth",
          "bandwidth": {
            "percent": "30"
          }
        }
      },
      {
        "name": "Test2",
        "action-list": {
          "action-type": "bandwidth",
          "bandwidth": {
            "percent": "30"
          }
        }
      }
    ]
  },
  {
    "@xmlns": "http://cisco.com/ns/yang/Cisco-IOS-XE-policy",
    "name": "Parent_Policy",
    "class": {
      "name": "class-default",
      "action-list": [
        {
          "action-type": "shape",
          "shape": {
            "average": {
              "bit-rate": "10000000"
            }
          }
        },
        {
          "action-type": "service-policy",
          "service-policy": "Child_Policy"
        }
      ]
    }
  }
]

My expectations result is to retrieve values from the nested dictionary and produce and output similar to this:
Queue_1:        Test1
Action_1:       bandwidth
Allocation_1:   40

Queue_2:        Test2
Action_2:       bandwidth

Allocation_2:   10

I have now issue formatting the output, just getting the values is the issue.

#

I had some time tonight so I changed the code be be dynamic:
    int = 0
    int_2 = 0
    for v in policy_dict.values():
        print("\n")
        print("{:15} {:<35}".format("Policy: ", v[0]["name"]))
        print("_______")
        for i in v:
            int_2 = int_2 + 1
            try:
                print("\n")
                print("{:15} {:<35}".format("Queue_%s: " % int_2, v[0]["class"][int]["name"]))
                print("{:15} {:<35}".format("Action_%s: " % int_2, v[0]["class"][int]["action-list"]["action-type"]))
                print("{:15} {:<35}".format("Allocation_%s: " % int_2, v[0]["class"][int]["action-list"]["bandwidth"]["percent"]))
                int = int + 1
            except KeyError:
                break
                pass

A: According to the sample you posted you can try to retrieve values like:
v[0]["class"][0]["name"]

This outputs:
Test1


text:
Q: How to change SQLite DB journal_mode to WAL in Windows? I'm writing a Java Swing application that works with a SQLite DB locally which syncs with an online MySQL DB from minute to minute and it's a thread. So even when the syncing process is ongoing the user should be able to change the data.
So I know I can do it by changing to journal mode WAL and i've done it in Linux. It worked perfectly. But in Windows it doesn't work. When I try to convert the journal mode using the statement PRAGMA journal_mode=WAL; it always returns delete not WAL
I've done a bit of research and i found this on SQLite web.

The journal_mode pragma returns a string which is the new journal
  mode. On success, the pragma will return the string "wal". If the
  conversion to WAL could not be completed (for example, if the VFS does
  not support the necessary shared-memory primitives) then the
  journaling mode will be unchanged and the string returned from the
  primitive will be the prior journaling mode (for example "delete").

How can I resolve this issue? For an example, can I change the DB VFS?
I'm using the Sqliteman to manage my DBs.

A: Ok i just found out what was wrong. The problem was with Sqliteman. The windows version of the program cannot handle the DBs in WAL journal mode. Other applications can.
Problem solved. But, if somebody can find me a windows version of Sqliteman which works with WAL please direct me to that. Sqliteman is a huge time saver.


text:
Q: EAS Submit failed for IOS "ITC.apps.validation.bundle_not_available" I'm using EAS, i have already a version of my app in production (that was uploaded manually) and i'm trying to submit a new version using "eas submit -p ios" and i'm facing this:
"One or more platforms cannot be created for this app due to your provider's contract state. - Creation of apps for the platform(s) iOS is not available due to your provider's contract state.
An attribute value is invalid. - ITC.apps.validation.bundle_not_available
The provided entity is missing a required attribute - You must provide a value for the attribute 'companyName' with this request"
Terminal error

A: "Contract state" is usually as a result of pending Agreements to be accepted on the App Store COnnect Portal.
Do that and try again.