text:
Q: Main function not executing my second function I have made two functions and I have called them in main. When I execute the program it only runs the first function in the main after that program stops .     if i paste the second function in main above the first one it only runs the function that is defined first but does not runs the second function.
package test;

import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

import java.util.concurrent.TimeUnit;

public class Testing {
    public static void login_and_widthdrawl() throws InterruptedException {
        System.setProperty("webdriver.chrome.driver", "/home/ctp-016/Downloads/chromedriver");
        WebDriver driver = new ChromeDriver();

        driver.get("http://staging.cintech.com/login");

        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

        WebElement email = driver.findElement(By.id("email"));
        email.sendKeys("zahid12@mailinator.com");

        WebElement password = driver.findElement(By.id("password"));
        password.sendKeys("zahid12@");

        WebElement textbox = driver.findElement(By.id("login"));
        textbox.click();

        // checking widthdrawl functionality from here
        Thread.sleep(4000);
        driver.findElement(By.id("navbarDropdown")).click();
        driver
            .findElement(By.xpath("/html/body/app-root/div/app-header-guest/section[1]/nav/div/div/ul/li[3]/div/a[2]"))
            .click();

        // SELECTING BTC CRYPTO AND ENTRING VALUES FROM  HERE

        //  WebDriverWait wait = new WebDriverWait(driver, 10);
        //  WebElement ele = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("/html/body/app-root/div/app-withdrawal/section/div[1]/div/div/div[1]/div/div[1]/span")));
        //   ele.click();
        Thread.sleep(2000);

        WebElement submit1 = driver.findElement(By.xpath("//*[@id=\"select2\"]"));
        submit1.click();

        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

        Thread.sleep(2000);
        WebElement submit12 = driver.findElement(By.xpath("/html/body/span/span/span[2]/ul/li[2]"));
        submit12.click();
        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

        Thread.sleep(2000);

        WebElement volume =
            driver.findElement(By.xpath("//*[@id=\"wrapper\"]/div[1]/div/div/div[1]/div/div[3]/form/div[1]/input"));
        volume.sendKeys("0.001");

        WebElement wallet = driver.findElement(By.xpath(
            "/html/body/app-root/div/app-withdrawal/section/div[1]/div/div/div[1]/div/div[3]/form/div[2]/div/input"));
        wallet.sendKeys("1asas");

        WebElement click = driver.findElement(
            By.xpath("/html/body/app-root/div/app-withdrawal/section/div[1]/div/div/div[1]/div/div[3]/form/button"));
        click.click();

        //   WebElement secret2 = driver.findElement(By.xpath("//*[@id=\"VerifyTwoFA\"]/div/div/div/app-verify-twofactor/div/div/form/div[1]/input"));
        //    secret2.sendKeys("0");

        WebElement submit2 = driver.findElement(By.id("loginButton"));
        submit2.click();
        Thread.sleep(2000);
        Alert alert = driver.switchTo().alert();
        alert.accept();
        //driver.quit();

        // clear the fields

        WebElement volumeclear =
            driver.findElement(By.xpath("//*[@id=\"wrapper\"]/div[1]/div/div/div[1]/div/div[3]/form/div[1]/input"));
        volumeclear.clear();

        WebElement walletclear =
            driver.findElement(By.xpath("//*[@id=\"wrapper\"]/div[1]/div/div/div[1]/div/div[3]/form/div[2]/input"));
        walletclear.clear();
    }

    public static void ether() throws InterruptedException {
        System.setProperty("webdriver.chrome.driver", "/home/ctp-016/Downloads/chromedriver");
        WebDriver driver = new ChromeDriver();
        //     driver = null;
        driver.get("http://staging.cintech.com/login");

        //       driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

        //       Thread.sleep(2000);

        //  WebElement selected_value_from_combo = driver.findElement(By.xpath("//*[@id=\"select2-mySelect2-result-2d1f-3\"]"));
        //  selected_value_from_combo .click();
        //        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

        Thread.sleep(2000);

        WebElement eth_volume =
            driver.findElement(By.xpath("//*[@id=\"wrapper\"]/div[1]/div/div/div[1]/div/div[3]/form/div[1]/input"));
        eth_volume.sendKeys("1");

        WebElement eth_wallet =
            driver.findElement(By.xpath("//*[@id=\"wrapper\"]/div[1]/div/div/div[1]/div/div[3]/form/div[2]/input"));
        eth_wallet.sendKeys("1asas");

        WebElement click_widthdrawl = driver.findElement(
            By.xpath("/html/body/app-root/div/app-withdrawal/section/div[1]/div/div/div[1]/div/div[3]/form/button"));
        click_widthdrawl.click();

        //     WebElement secret_eth = driver.findElement(By.xpath("//*[@id=\"VerifyTwoFA\"]/div/div/div/app-verify-twofactor/div/div/form/div[1]/input"));
        //     secret_eth.sendKeys("0");

        WebElement submit_eth = driver.findElement(
            By.xpath("//*[@id=\"VerifyTwoFA\"]/div/div/div/app-verify-twofactor/div/div/form/div[2]/button"));
        submit_eth.click();

        Thread.sleep(2000);

        Alert alert_eth = driver.switchTo().alert();
        alert_eth.accept();

        // clear the fields

        WebElement ethvolumeclear =
            driver.findElement(By.xpath("//*[@id=\"wrapper\"]/div[1]/div/div/div[1]/div/div[3]/form/div[1]/input"));
        ethvolumeclear.clear();

        WebElement ethwalletclear =
            driver.findElement(By.xpath("//*[@id=\"wrapper\"]/div[1]/div/div/div[1]/div/div[3]/form/div[2]/input"));
        ethwalletclear.clear();
    }

    public static void main(String[] args) throws InterruptedException {
        ether();
        login_and_widthdrawl();
    }
}

A: not sure why it s happening, try this to know actual problem:-
public static void main(String[] args) throws InterruptedException {
        try{
             ether();
        login_and_widthdrawl();
        }catch(Exception e){
            e.printStackTrace();
        }
    }


text:
Q: How to declare limit in PostgreSQL I have written code like this in PostgreSQL. But I'm getting error for ROWNUM
 EXECUTE 'SELECT BENMASTDTL_BEN_CODE FROM BENMASTDTL WHERE BENMASTDTL_ENTITY_CODE =$1 AND BENMASTDTL_CUSTOMER_CODE =$2 AND
                           BENMASTDTL_ACCOUNT_NUMBER =$3 AND BENMASTDTL_IFSC=$4 AND ROWNUM=1'
      INTO STRICT W_BENMASTDTL_BEN_CODE
          USING P_ENTITY_CODE, P_CUST_CODE, P_BEN_AC_NUM, P_BEN_IFSC;

error is like column "rownum" does not exist
please help me to solve this error

redpajama_set_name: RedPajamaStackExchange


text:
Q: Publishing complete Play application to Nexus with publish? I am using Play Framework and am trying to deploy a complete application to a repository on my Nexus.
The problem is that play publish is only publishing the pom file and the jar of my application but I want to put all jars on my nexus so that I can download the complete application from it and be able to start it from that point immediately.
How can I configure or change the publish command in Play?

A: I think what you need is described in the official documentation of Play Framework in Creating a standalone version of your application:

you sometimes need to build a binary version of your application and
  deploy it to the server without any dependency on Play itself. You can
  do this with the dist task.

and...

This produces a ZIP file containing all JAR files needed to run your
  application in the target/universal folder of your application.

Having the zip, you need to upload it to the repository.


text:
Q: j_idt5:client: Validation Error: Value is required I know this is a common error, and that there is a lots of questions about it, i tired to implement from many places , i will introduce the major error.
Screenshot Here
i want to select a client & a product from selectOneMenu with and insert them to another Table with other inputs
as you can see here the client and the products are selected but when i try to add it returns as exeption Value is required  !
i tried to solve the problem with this :
Validation Error: Value is not valid
Here is my jsf page:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

        <h:head>
            <title>Facelet Title</title>
        </h:head>
        <h:body>
            <f:view>

                <h:form>

<h:outputText value="Create/Edit"/>

                    <h:panelGrid columns="2">
                        <h:outputLabel value="Client:" for="client" />
                        <h:selectOneMenu id="client" value="#{recBean.rec.client}" converter="#{clientConverter}" title="Client" required="true" >

                            <f:selectItems value="#{CliBean.lister()}" var="C" itemLabel="#{C.nomCli}" itemValue="#{C}"  />
                        </h:selectOneMenu>
                        <h:outputLabel value="Produit:" for="produit" />
                        <h:selectOneMenu id="produit" value="#{recBean.rec.produit}" converter="#{produitConverter}" title="Produit" required="true" >

                            <f:selectItems value="#{proBean.lister()}" var="P" itemLabel="#{P.libProd}" itemValue="#{P}"/>
                        </h:selectOneMenu>
                        <h:outputLabel value="DateCreRec:" for="dateCreRec" />
                        <h:inputText id="dateCreRec" value="#{recBean.rec.dateCreRec}" title="DateCreRec" required="true" requiredMessage="The DateCreRec field is required.">
                            <f:convertDateTime pattern="MM/dd/yyyy" />
                        </h:inputText>
                        <h:outputLabel value="TypeRec:" for="typeRec" />
                        <h:inputText id="typeRec" value="#{recBean.rec.typeRec}" title="TypeRec" required="true" requiredMessage="The TypeRec field is required."/>
                        <h:outputLabel value="DescCli:" for="descCli" />
                        <h:inputText id="descCli" value="#{recBean.rec.descCli}" title="DescCli" required="true" requiredMessage="The DescCli field is required."/>
                        <h:outputLabel value="Situation:" for="situation" />
                        <h:inputText id="situation" value="#{recBean.rec.situation}" title="Situation" required="true" requiredMessage="The Situation field is required."/>
                        <h:outputLabel value="PersEstim:" for="persEstim" />
                        <h:inputText id="persEstim" value="#{recBean.rec.persEstim}" title="PersEstim" required="true" requiredMessage="The PersEstim field is required."/>
                        <h:outputLabel value="Estimation:" for="estimation" />
                        <h:inputText id="estimation" value="#{recBean.rec.estimation}" title="Estimation" required="true" requiredMessage="The Estimation field is required."/>
                        <h:outputLabel value="DegUrgence:" for="degUrgence" />
                        <h:inputText id="degUrgence" value="#{recBean.rec.degUrgence}" title="DegUrgence" required="true" requiredMessage="The DegUrgence field is required."/>
                        <h:outputLabel value="DescExpert:" for="descExpert" />
                        <h:inputText id="descExpert" value="#{recBean.rec.descExpert}" title="DescExpert" required="true" requiredMessage="The DescExpert field is required."/>
                        <h:outputLabel value="DateDebut:" for="dateDebut" />
                        <h:inputText id="dateDebut" value="#{recBean.rec.dateDebut}" title="DateDebut" required="true" requiredMessage="The DateDebut field is required.">
                            <f:convertDateTime pattern="MM/dd/yyyy" />
                        </h:inputText>
                        <h:outputLabel value="DateFin:" for="dateFin" />
                        <h:inputText id="dateFin" value="#{recBean.rec.dateFin}" title="DateFin" required="true" requiredMessage="The DateFin field is required.">
                            <f:convertDateTime pattern="MM/dd/yyyy" />
                        </h:inputText>

                        <h:commandButton value="Add" action="#{recBean.ajouter()}"/>
                    </h:panelGrid>
                </h:form>
            </f:view>

        </h:body>

Here is managed bean:
@ManagedBean(name="CliBean")
@SessionScoped
public class ClientBean {
   ClientDAO dao = new ClientDAOImpl();
   public Client cli = new Client();

    private String logcli;

    public Client getCli() {
        return cli;
    }

    public void setCli(Client cli) {
        this.cli = cli;
    }

    public List<Client> lister(){
        return dao.findAll();
    }

 @Override
public String toString() {
    return String.valueOf(cli.getIdCli());
}

    public String LoginCheck(){

     Session ses = HibernateUtil.getSession();
     SessionFactory fac = HibernateUtil.getSessionFactory();
     ses.getTransaction();

             List<Client> list = ses.createSQLQuery("select * from client where login_cli='" + cli.getLoginCli() + "' and pwd_cli='" + cli.getPwdCli() + "'").list();
             if (list.size() > 0) {
                 //servlet session part

                 logcli = cli.getLoginCli();

                 HttpSession hs = sessionUtil.getSession();
                 hs.setAttribute("logcli",logcli);
                 //servlet session part
                 //BootFaces
                 FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "", "Congratulations! You've successfully logged in.");
                 FacesContext.getCurrentInstance().addMessage("loginForm:password", msg);
                 //BootFaces

            return "/success.xhtml?faces-redirect=true";
        } else {
                //FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "client not found", ""));

                //BootFaces
                FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "", "client not found !");
                FacesContext.getCurrentInstance().addMessage("loginForm:password", msg);
                //BootFaces

               }
        try {
            ses.getTransaction().commit();
        } catch (Exception e) {
        }
        ses.close();
        return null;
        }
    public String afflogin(){
        return logcli;
         }

    public String doLogout(){
        HttpSession hs = sessionUtil.getSession();
        hs.invalidate();
        return "/index.xhtml";
         }

                        }

And finally converter:
@ManagedBean
@RequestScoped
@FacesConverter(forClass=Client.class)
public class ClientConverter implements Converter{

    @Override
    public Object getAsObject(FacesContext context, UIComponent component, String codeString) {
    if (codeString == null && codeString.trim().length() > 0) {
        Integer code = Integer.valueOf(codeString);
        ClientServicesImpl clientServicesImpl = new ClientServicesImpl();
        return clientServicesImpl.searchForCode(code);
    }

return null;
}

    @Override
    public String getAsString(FacesContext context, UIComponent component, Object clientObject) {
    if (clientObject == null) {
        return "";
    }

    if (clientObject instanceof Client) {
        Client client = (Client) clientObject;

        return client.getIdCli().toString();
        //return client.getIdCli() != null ? String.valueOf(client.getIdCli()) : null;

        //return String.valueOf(((Client) clientObject).getIdCli());
    } else {
        throw new ConverterException(new FacesMessage(clientObject + " is not a valid Client"));
    }
    }
}

Note that :
equals()& hashCode() have been generated for entities client and product .
i think the major problem is from the converter .
also i saw almost all the posts about selectOneMenu before i post my question.
i wasted 3 days for this i dont want to waste more time


text:
Q: Scrolling the ListView sets colors to all the buttons that do not satisfy the conditions in getview method of SimpleAdapter I have implemented a ListView using SimpleAdapter in Android. I have set certain conditions in the getView method of the SimpleAdapter.
According to the satisfied conditions the Buttons present in each row of the ListView will be turned to Red, Green, Yellow or Orange.
The problem I am encountering is that when I scroll the ListView up and down continously I can see that some Buttons that don't satisfy the conditions are also changing the colors and at the end all the Buttons have the above mentioned color.
Can anyone suggest me where I am going wrong.My codes are as below:
     BaseAdapter waiter_adapter = new SimpleAdapter(
                    getApplicationContext(), list_details_from_db,
                    R.layout.waiter_screen_details/* waiter_order_details */,
                    new String[] { "table_no", "order_id" }, new int[] {
                            R.id.tv_table_no, R.id.order_id }) {

                @Override
                public View getView(final int position, View convertView,
                        ViewGroup parent) {
                    // TODO Auto-generated method stub
                    /*final*/ View v = super.getView(position, convertView,
                            parent);
                    // Log.i("key values sub id in get view ",
                    // ""+key_names);

                    final TextView order_id = (TextView) v
                            .findViewById(R.id.order_id);
                    Log.i("Order id check from getview ", order_id
                            .getText().toString());
                    Button bt_waiter_id = (Button) v
                            .findViewById(R.id.bt_waiter_id);
                    Button placed_id = (Button) v
                            .findViewById(R.id.placed_id);
                    Button confirmed = (Button) v
                            .findViewById(R.id.confirmed);
                    Button prepared = (Button) v
                            .findViewById(R.id.prepared);
                    prepared.setOnClickListener(new OnClickListener() {

                        @Override
                        public void onClick(View v) {
                            // TODO Auto-generated method stub
                            String o_id = order_id.getText().toString();
                            Intent prep_list = new Intent(
                                    Waiter_Order_List_ctivity.this,
                                    Prep_List_activity.class);

                            prep_list.putExtra("Order_Id", o_id
                            /* order_id_to_intent */);
                            Log.i("Order id sent to Prep list", o_id /* order_id_to_intent */);

                            startActivity(prep_list);
                        }
                    });
                    confirmed.setOnClickListener(new OnClickListener() {

                        @Override
                        public void onClick(View v) {
                            // TODO Auto-generated method stub

                        }
                    });
                    final String order_id_str = order_id.getText()
                            .toString();

                    ArrayList<HashMap<String, String>> data = db
                            .get_order_course_list(order_id_str);
                    ArrayList<HashMap<String, String>> c = db
                            .get_item_status(order_id_str);

                    // if(item_status_from_db.get(index))
                    Log.i("item status retrievd from db", "" + c);
                    Log.i("database retrieved values from order course list",
                            "" + data);
                    Log.i("data size", "" + data.size());
                    try {
                        placed_id.setText(data.get(0).get("ist"));
                        confirmed.setText(data.get(0).get("confirm_ist"));
                    } catch (Exception e) {
                        e.printStackTrace();
                    }

                    try {
                        count = 0;
                        count_confirmed = 0;
                        count_processed = 0;
                        if (list_details_from_db.get(position)
                                .get("status")
                                .compareToIgnoreCase("Initial") == 0) {
                            bt_waiter_id.setBackground(getResources()
                                    .getDrawable(
                                            R.drawable.waitr_ordr_red_btn));
                            bt_waiter_id.setText("Waiter Id:"
                                    + "\n"
                                    + list_details_from_db.get(position)
                                            .get("initial_status"));

                        } else {
                            for (int i = 0; i < data.size(); i++) {
                                String status_str = data.get(i).get(
                                        "status1");
                                if (status_str
                                        .compareToIgnoreCase("Placed") == 0) {
                                    count++;
                                }
                                if (status_str
                                        .compareToIgnoreCase("Confirmed") == 0) {
                                    count_confirmed++;
                                }
                                if (status_str
                                        .compareToIgnoreCase("Processed") == 0) {
                                    count_processed++;
                                }

                            }
                        }
                        if (count > 0) {
                            placed_id
                                    .setBackground(getResources()
                                            .getDrawable(
                                                    R.drawable.waitr_ordr_yellow_btn));
                        }
                        if (count_confirmed > 0) {
                            confirmed
                                    .setBackground(getResources()
                                            .getDrawable(
                                                    R.drawable.waitr_ordr_orange_btn));
                            /*
                             * confirmed
                             * .setOnClickListener(Waiter_Order_List_ctivity
                             * .this);
                             */
                        }
                        if (count_processed > 0) {
                            prepared.setBackground(getResources()
                                    .getDrawable(
                                            R.drawable.waitr_ordr_green_btn));
                            /*
                             * prepared.setOnClickListener(
                             * Waiter_Order_List_ctivity.this);
                             */
                        }
                        if (c.size() > 0) {
                            prepared.setBackground(getResources()
                                    .getDrawable(
                                            R.drawable.waitr_ordr_green_btn));
                        }

                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    placed_id
                            .setOnClickListener(new View.OnClickListener() {

                                @Override
                                public void onClick(View v) {
                                    // TODO Auto-generated method stub
                                    Intent intTableItm = new Intent(
                                            Waiter_Order_List_ctivity.this,
                                            Waiter_Confirm.class);
                                    intTableItm.putExtra("Order_Id",
                                            order_id_str);
                                    startActivity(intTableItm);
                                }
                            });
                    return v;
                }

            };
            w_order_list.setAdapter(waiter_adapter);

A: This depends on the reusage of the Listitems. If you change the Background in the if condition:
 if (list_details_from_db.get(position)

You have to set it to the default background in the else condition.
//edit
 @Override
            public View getView(final int position, View convertView,
                    ViewGroup parent) {
                // TODO Auto-generated method stub
                /*final*/ View v = super.getView(position, convertView,
                        parent);
                // Log.i("key values sub id in get view ",
                // ""+key_names);

                final TextView order_id = (TextView) v
                        .findViewById(R.id.order_id);
                Log.i("Order id check from getview ", order_id
                        .getText().toString());
                Button bt_waiter_id = (Button) v
                        .findViewById(R.id.bt_waiter_id);
                Button placed_id = (Button) v
                        .findViewById(R.id.placed_id);
                Button confirmed = (Button) v
                        .findViewById(R.id.confirmed);
                Button prepared = (Button) v
                        .findViewById(R.id.prepared);

                placed_id.setText("Your standard value");
                confirmed.setText("Your standard value");
                placed_id.setBackground(getResources()
                                        .getDrawable(
                                                R.drawable.your_standard_drawable));
                confirmed.setBackground(getResources()
                                        .getDrawable(
                                                R.drawable.your_standard_drawable));
                prepared.setBackground(getResources()
                                .getDrawable(
                                        R.drawable.your_standard_drawable));
                bt_waiter_id.setBackground(getResources()
                                .getDrawable(
                                        R.drawable.your_standard_drawable));
                bt_waiter_id.setText("your standard value");

                //
                //[...] Rest of your code

            }


text:
Q: Rails wont return decimals correctly I'm using Rails 3.2.5 and when it return a value o :price for editing it just brings one decimal, eg. 600.0, i need that i bring 2 decimals (eg. 600.00) in database is recorded 600.00, in my locales i already set for 2 decimals, and still dont work.
I tried
number_to_currency(:price, :precision => 2)

but it works well for a view like "show", i need that it return the propper value for editing, on textfield.
in my migration the field "price" is set do decimal(15,2).
Can someone help?
Thank You!

A: The text fields are operating on the "native" value of the field, as it is handled by ActiveRecord, not as it is stored in the database.
Currency fields are tricky since ActiveRecord is translating between the database representation and the ruby/rails representation, a BigDecimal.
If your goal is that you want to show your users $1,000.00 and enable them to edit it, some ideas:

*

*Use the Money gem Ylan S refers to.

*Use an Edit in place widget Eg screencast. You'd use number_to_currency to display the value. When clicked, the input field would show the value without the currency symbol, commas for thousands separators, etc. Note that this is how Excel works: when you edit the value of a currency field, you don't enter 1,000. You enter 1000.

A: In my experience, instead of using decimal for storing currency, it's best to store the amounts in cents, as an integer. This will take care of multiple problems, including the one you are having now.
I have had much success in the past using the Money gem and its companion money-rails.

A: Issue solved using 'delocalize' gem.
Old but gold! :) Thank you all!

A: The simplest way to have your text_field display a formatted value is to pass it explicitly, like this:
f.text_field :price, :value => number_to_currency(:price, :precision => 2)

You'll need to interpret (and possibly re-format) the value in the controller method that handles the form.
See How can I format the value shown in a Rails edit field?


text:
Q: How to setup a lookup column refering to a document library's file url I am using SP2013 on-premise.
I have two document libraries. Some files in DocLibA have a relationship with DocLibB's documents. I would like to create a column in DocLibA and link to 0-1 files in DocLibB. So that when a user browse DocLibA's view, he can directly download the related document with a single click.
I have tried to setup a lookup column to DocLibB's title column. But it just gives me a link to open listform.aspx page (/_layouts/15/listform.aspx?PageType=4&ListId={5475cxxxxx...}) which shows the file's properties. I want to directly link to the document (i.e. /DocLibB/file.pdf).
Could you please advice?

A: Assume you have a column in your DocLibA view that is a single value lookup column to a column in DocLibB (it actually doesn't matter which column in this case).
You can use Client Side Rendering to change the default link, which is to the display form of the item in DocLibB, to the item itself.
Place this code on the view page of DocLibA. The only change you need to make is to the name of the lookup column YourLookupColumnInternalName:
SP.SOD.executeFunc("clienttemplates.js", "SPClientTemplates", CSR_Setup);

function CSR_Setup() {
    var overridectx = {};
    overridectx.Templates = {};
    overridectx.Templates.Fields = {
        "YourLookupColumnInternalName": { "View": CSR_AddLinkToFile }
    };
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overridectx);
}

function CSR_AddLinkToFile(ctx) {
    return String.format("{1}", ctx.CurrentItem.FileRef, ctx.CurrentItem.FileLeafRef);
}

A: You can setup a calculated column in DocLibA that builds the URL to the document in DocLibB, or alternatively, build the URL from a workflow that is setup to start at creation/edit of the item in DocLibA


text:
Q: How to make two collapsible div mutually exclusive I have two collapsible div A(collapseOne) and B(collapseTwo) that are based on twitter's bootstrap. How to make A is collapsed when B is expanded or vice versa?
My code looks like below,

MyName

          Show details

MyName

Item1

Item2

Item3

Item4

Item5

Show brief

I want to div collapseOne is hidden and collapseTwo is visible by default. After clicking link Show brief, make collapseTwo hidden and collapseOne is shown.

A: Just use the sample they provide with the documentation.  I've simplified it for you here, make sure all your divs have the same data-parent in order to act as an accordion.

              Toggle 1

                Inner content 1

           Toggle 2

              Inner content 2


text:
Q: UIButton action in UITableViewCell selecting wrong row When I select buttons within these UITableViewCells, the button sometimes passes data from the wrong row. In this table view, there are 10 sections, each with a section header and with only 1 row. The row height takes up most of the screen, as there are 6 buttons within it. Each UIButton, when selected, opens a new viewcontroller with an enlarged view of the button's image (removed this code to make it more readable here).
Here is the problem: each button successfully pushes a modal viewcontroller; however, as I scroll down, sometimes the buttons pass the data from the same button from the section below it (e.g. button1 in section 4 when clicked may pass the data for button1 in section 5). Similarly, as I scroll back up, sometimes the buttons pass the data from the same button from the section above it (e.g. button5 in section 7 when clicked may pass the data for button5 in section 6).
I think this problem occurs because the iPhone is pulling the most recently loaded cell (when cellForRowAtIndexPath is called), but I would like it to pass the data for the row in which the button is located.
Thoughts? Thanks in advance for any help you can provide.
Edit: Added data code as requested
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}

// dataDict pulled from plist
NSDictionary *button1Dict = [dataDict objectForKey:@"button1"];
NSDictionary *button2Dict = [dataDict objectForKey:@"button2"];
NSDictionary *button3Dict = [dataDict objectForKey:@"button3"];
NSDictionary *button4Dict = [dataDict objectForKey:@"button4"];
NSDictionary *button5Dict = [dataDict objectForKey:@"button5"];
NSDictionary *button6Dict = [dataDict objectForKey:@"button6"];

// selectedCatTag and selectedItemTag for each button are alloc and init in viewDidLoad
button1SelectedCatTag = (NSUInteger *)[[button1Dict objectForKey:@"selectedCatTag"] integerValue];
button2SelectedCatTag = (NSUInteger *)[[button2Dict objectForKey:@"selectedCatTag"] integerValue];
button3SelectedCatTag = (NSUInteger *)[[button3Dict objectForKey:@"selectedCatTag"] integerValue];
button4SelectedCatTag = (NSUInteger *)[[button4Dict objectForKey:@"selectedCatTag"] integerValue];
button5SelectedCatTag = (NSUInteger *)[[button5Dict objectForKey:@"selectedCatTag"] integerValue];
button6SelectedCatTag = (NSUInteger *)[[button6Dict objectForKey:@"selectedCatTag"] integerValue];

button1SelectedItemTag = (NSUInteger *)[[button1Dict objectForKey:@"selectedItemTag"] integerValue];
button2SelectedItemTag = (NSUInteger *)[[button2Dict objectForKey:@"selectedItemTag"] integerValue];
button3SelectedItemTag = (NSUInteger *)[[button3Dict objectForKey:@"selectedItemTag"] integerValue];
button4SelectedItemTag = (NSUInteger *)[[button4Dict objectForKey:@"selectedItemTag"] integerValue];
button5SelectedItemTag = (NSUInteger *)[[button5Dict objectForKey:@"selectedItemTag"] integerValue];
button6SelectedItemTag = (NSUInteger *)[[button6Dict objectForKey:@"selectedItemTag"] integerValue];

UIButton *button1 = (UIButton *)[cell viewWithTag:1];
UIButton *button2 = (UIButton *)[cell viewWithTag:2];
UIButton *button3 = (UIButton *)[cell viewWithTag:3];
UIButton *button4 = (UIButton *)[cell viewWithTag:4];
UIButton *button5 = (UIButton *)[cell viewWithTag:5];
UIButton *button6 = (UIButton *)[cell viewWithTag:6];

CGFloat kImageSquareSideLength = 100.0;

if (button1Dict) {
    NSDictionary *selectedCatDict = [dataCategories objectAtIndex:(int)button1SelectedCatTag];
    NSString *imageName = [[selectedCatDict objectForKey:@"itemImages"] objectAtIndex:(NSUInteger)button1SelectedItemTag];
    [button1 setImage:[[UIImage imageNamed:imageName] imageByScalingAndCroppingForSize:CGSizeMake(kImageSquareSideLength, kImageSquareSideLength)] forState:UIControlStateNormal];
    [button1 addTarget:self action:@selector(button1Pressed:) forControlEvents:UIControlEventTouchUpInside];
}
if (button2Dict) {
    NSDictionary *selectedCatDict = [dataCategories objectAtIndex:(int)button2SelectedCatTag];
    NSString *imageName = [[selectedCatDict objectForKey:@"itemImages"] objectAtIndex:(NSUInteger)button2SelectedItemTag];
    [button2 setImage:[[UIImage imageNamed:imageName] imageByScalingAndCroppingForSize:CGSizeMake(kImageSquareSideLength, kImageSquareSideLength)] forState:UIControlStateNormal];
    [button2 addTarget:self action:@selector(button2Pressed:) forControlEvents:UIControlEventTouchUpInside];
}
if (button3Dict) {
    NSDictionary *selectedCatDict = [dataCategories objectAtIndex:(int)button3SelectedCatTag];
    NSString *imageName = [[selectedCatDict objectForKey:@"itemImages"] objectAtIndex:(NSUInteger)button3SelectedItemTag];
    [button3 setImage:[[UIImage imageNamed:imageName] imageByScalingAndCroppingForSize:CGSizeMake(kImageSquareSideLength, kImageSquareSideLength)] forState:UIControlStateNormal];
    [button3 addTarget:self action:@selector(button3Pressed:) forControlEvents:UIControlEventTouchUpInside];
}
if (button4Dict) {
    NSDictionary *selectedCatDict = [dataCategories objectAtIndex:(int)button4SelectedCatTag];
    NSString *imageName = [[selectedCatDict objectForKey:@"itemImages"] objectAtIndex:(NSUInteger)button4SelectedItemTag];
    [button4 setImage:[[UIImage imageNamed:imageName] imageByScalingAndCroppingForSize:CGSizeMake(kImageSquareSideLength, kImageSquareSideLength)] forState:UIControlStateNormal];
    [button4 addTarget:self action:@selector(button4Pressed:) forControlEvents:UIControlEventTouchUpInside];
}
if (button5Dict) {
    NSDictionary *selectedCatDict = [dataCategories objectAtIndex:(int)button5SelectedCatTag];
    NSString *imageName = [[selectedCatDict objectForKey:@"itemImages"] objectAtIndex:(NSUInteger)button5SelectedItemTag];
    [button5 setImage:[[UIImage imageNamed:imageName] imageByScalingAndCroppingForSize:CGSizeMake(kImageSquareSideLength, kImageSquareSideLength)] forState:UIControlStateNormal];
    [button5 addTarget:self action:@selector(button5Pressed:) forControlEvents:UIControlEventTouchUpInside];
}

if (button6Dict) {
    NSDictionary *selectedCatDict = [dataCategories objectAtIndex:(int)button6SelectedCatTag];
    NSString *imageName = [[selectedCatDict objectForKey:@"itemImages"] objectAtIndex:(NSUInteger)button6SelectedItemTag];
    [button6 setImage:[[UIImage imageNamed:imageName] imageByScalingAndCroppingForSize:CGSizeMake(kImageSquareSideLength, kImageSquareSideLength)] forState:UIControlStateNormal];
    [button6 addTarget:self action:@selector(button6Pressed:) forControlEvents:UIControlEventTouchUpInside];
}

return cell;

}

//all other button actions are identical to button1Pressed
- (IBAction)button1Pressed:(id)sender
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
SelectedItemViewController *destVC = [storyboard instantiateViewControllerWithIdentifier:@"SelectedItemViewController"];

destVC.selectedOutfitDict = @"DiscoverOutfits";
destVC.selectedCatTag = (int *)button1SelectedCatTag;
destVC.selectedItemTag = (int *)button1SelectedItemTag;

[self presentViewController:destVC animated:NO completion:nil];
}

A: yes you can get particular cell from which button is taped. write in your IBAction method and you will get particular cell taped button in indexPath object
UIView *senderButton = (UIView*) sender;
       NSIndexPath *indexPath = [(UITableView *)self.superview indexPathForCell: (UITableViewCell*)[[senderButton superview]superview]];

hope this will help

A: Sometimes its tagging problem.
Change the tag like this:
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

   UIButton *button1 = [[UIButton alloc] init];
   button1.tag = indexPath.section +  indexPath.row + 8956;// 8956 is some random weird     number
  [cell.contentView addSubview:button1];
  [button1 release];

// same code for other buttons

}

UIButton *button1 = (UIButton *)[cell.contentView viewWithTag: indexPath.section +  indexPath.row + 8956];
UIButton *button2 = (UIButton *)[cell.contentView viewWithTag: indexPath.section + indexPath.row +8956];
UIButton *button3 = (UIButton *)[cell.contentView viewWithTag: indexPath.section + indexPath.row +8956];
UIButton *button4 = (UIButton *)[cell.contentView viewWithTag: indexPath.section + indexPath.row +8956];
UIButton *button5 = (UIButton *)[cell.contentView viewWithTag: indexPath.section + indexPath.row +8956];
UIButton *button6 = (UIButton *)[cell.contentView viewWithTag: indexPath.section + indexPath.row +8956];

Working??


text:
Q: Issues Installing SimpleElastix on Ubuntu for Python I am trying to install SimpleElastix/SimpleITK on an Ubuntu computer for either Python2 or 3, whichever we can get to work. Using pip install doesn't work as various methods don't import then (e.g. no "GetDefaultParameterMethod" exists). I tried following the instructions on their website (https://simpleelastix.readthedocs.io/GettingStarted.html#compiling-on-linux), but even though no errors are thrown throughout the process, I am still unable to import.
For Python3, the typical "No module" error pops up, but for Python2 I get the following:
>>> import SimpleITK as sitk
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/SimpleITK-1.0.1rc1.dev345+g9dfa8-py2.7-linux-x86_64.egg/SimpleITK/__init__.py", line 1, in <module>
    from .SimpleITK import *
  File "/usr/local/lib/python2.7/dist-packages/SimpleITK-1.0.1rc1.dev345+g9dfa8-py2.7-linux-x86_64.egg/SimpleITK/SimpleITK.py", line 17, in <module>
    _SimpleITK = swig_import_helper()
  File "/usr/local/lib/python2.7/dist-packages/SimpleITK-1.0.1rc1.dev345+g9dfa8-py2.7-linux-x86_64.egg/SimpleITK/SimpleITK.py", line 16, in swig_import_helper
    return importlib.import_module('_SimpleITK')
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named _SimpleITK

Any help would be greatly appreciated :)


text:
Q: How to use fastScrollEnabled in RecyclerView? I am new to RecyclerView and I want to implement the fast scroll feature in RecyclerView like google contact application and search on the internet and i found that now Android provide officially New fastScrollEnabled boolean flag for RecyclerView. So my question is can someone provide the sample implementation of it.
Here is the official document from google
https://developer.android.com/topic/libraries/support-library/revisions.html#26-0-0

A: As you know that, RecyclerView supports "fast scroller" in Support Library 26.0.0.

Note: Keep in mind it's XML-only though.

A: With Support Library 26, we can easily enable fast scrolling for RecyclerView. Let's get to it!
Let's go over each property one by one :

*

*fastScrollEnabled : boolean value to enable the fast scrolling. Setting this as true will require that we provide the following four
properties.

*fastScrollHorizontalThumbDrawable : A StateListDrawable that will be used to draw the thumb which will be draggable across the
horizontal axis.

*fastScrollHorizontalTrackDrawable : A StateListDrawable that will be used to draw the line that will represent the scrollbar on
horizontal axis.

*fastScrollVerticalThumbDrawable : A StateListDrawable that will be used to draw the thumb which will be draggable on vertical axis.

*fastScrollVerticalTrackDrawable : A StateListDrawable that will be used to draw the line that will represent the scrollbar on
vertical axis.

add in build.gradle
    dependencies {
    ....
    compile 'com.android.support:design:26.0.1'
    compile 'com.android.support:recyclerview-v7:26.0.1'
    ....
}

Since Support Library 26 has now been moved to Google's maven repository, let's include that in our project level build.gradle
allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

activity_main.xml
<android.support.v7.widget.RecyclerView
    android:id="@+id/recyclerView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:fastScrollEnabled="true"
    app:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
    app:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
    app:fastScrollVerticalThumbDrawable="@drawable/thumb_drawable"
    app:fastScrollVerticalTrackDrawable="@drawable/line_drawable">

 </android.support.v7.widget.RecyclerView>

add below four xml file in your drawable folder,
line_drawable.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:state_pressed="true"
        android:drawable="@drawable/line"/>

    <item
        android:drawable="@drawable/line"/>
</selector>

line.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle">

    <solid android:color="@android:color/darker_gray" />

    <padding
        android:top="10dp"
        android:left="10dp"
        android:right="10dp"
        android:bottom="10dp"/>
</shape>

thumb_drawable.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:state_pressed="true"
        android:drawable="@drawable/thumb"/>

    <item
        android:drawable="@drawable/thumb"/>
</selector>

thumb.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle">

    <corners
        android:topLeftRadius="44dp"
        android:topRightRadius="44dp"
        android:bottomLeftRadius="44dp" />

    <padding
        android:paddingLeft="22dp"
        android:paddingRight="22dp" />

    <solid android:color="@color/colorPrimaryDark" />

</shape>

A: For an eye candy scroll bar thumb(round borders) :
   <android.support.v7.widget.RecyclerView
                android:id="@+id/netflixVideoGridView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                app:fastScrollEnabled="true"
                app:fastScrollHorizontalThumbDrawable="@drawable/fast_scroll_thumb"
                app:fastScrollHorizontalTrackDrawable="@drawable/fast_scroll_track"
                app:fastScrollVerticalThumbDrawable="@drawable/fast_scroll_thumb"
                app:fastScrollVerticalTrackDrawable="@drawable/fast_scroll_track"
                 />

fast_scroll_thumb.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:state_pressed="true"
        android:drawable="@drawable/thumb"/>

    <item
        android:drawable="@drawable/thumb"/>
</selector>

thumb.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">

    <corners
        android:radius="50dp" />

    <padding
        android:paddingLeft="22dp"
        android:paddingRight="22dp" />

    <solid android:color="@color/colorPrimaryDark" />

    <stroke
        android:width="1dp"
        android:color="#69f0ae" />

</shape>

track.xml:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="#80ffffff" />
    <padding
        android:padding="0dp"/>
</shape>

Result:

A: Add the attributes to the RecyclerView tag in your layout file:
<android.support.v7.widget.RecyclerView
    xmlns:app="http://schemas.android.com/apk/res-auto"
    ...
    app:fastScrollEnabled="true"
    app:fastScrollHorizontalThumbDrawable="@drawable/fast_scroll_thumb"
    app:fastScrollHorizontalTrackDrawable="@drawable/fast_scroll_track"
    app:fastScrollVerticalThumbDrawable="@drawable/fast_scroll_thumb"
    app:fastScrollVerticalTrackDrawable="@drawable/fast_scroll_track"
/>

Make two drawables. The "track" drawable can be any drawable, but the "thumb" drawable must be a state list drawable.
Example drawable/fast_scroll_track.xml file:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="#80ffffff" />
</shape>

Example drawable/fast_scroll_thumb.xml file:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true">
        <shape android:shape="rectangle">
            <solid android:color="#ff0" />
        </shape>
    </item>
    <item>
        <shape android:shape="rectangle">
            <solid android:color="#fff" />
        </shape>
    </item>
</selector>


text:
Q: Return free space of all drives on a server using powershell If the free space of a drive is 100% free and I set the minimum threshold space to 25%, the script incorrect reports that the drive is below threshold.. meaning 100 < 25
Although If I were to replace
$FreePercent = "{0:N0}" -f (100 * $objDisk.FreeSpace/$objDisk.Size)  with
$FreePercent =  (100 * $objDisk.FreeSpace/$objDisk.Size) ...
I get correct results.
How do i fix the rounding off problem.
Here is my code
# For Loop -  get % free space of all drives
#Define Variables
$Notify = 0
$MinFreePercent = "25"
#$FileDriveSpace = "c:\temp\DriveSpace.txt"
$ComputerName = $(Get-WmiObject Win32_Computersystem).name
$OutArray = @()

$outarray += "Disk space Alerts and Utilizations on server $ComputerName"
$AllDisks = get-wmiobject Win32_LogicalDisk -Filter "DriveType = 3"
#Omit the a, b drives if exist
$AllDisks = $AllDisks | ? { $_.DeviceID -notmatch "[ab]:"}
foreach ($objdisk in $AllDisks)
{
   #$FreePercent = "{0:P0} " -f ($objDisk.FreeSpace/$objDisk.Size)
   $FreePercent = "{0:N0}" -f (100 * $objDisk.FreeSpace/$objDisk.Size)

   If ($FreePercent -lt $MinFreePercent)
      {
        $Threshold = "Threshold Reached"
        $Notify = 1
      }
   Else
      { $Threshold = "N/A"}

   $DeviceId = $objDisk.DeviceID
   $myobj = "" | Select "Drive","PercentFreeSpace", "Threshold"
   $myobj.Drive = $DeviceId
   $myobj.PercentFreeSpace = $FreePercent
   $myobj.Threshold = $Threshold

   $outLine = $DeviceId + " " + $FreePercent + " " + $Threshold + " " + $MinFreePercent
   $outLine

   #Add the object to the out-array
   $outarray += $myobj
   #Wipe the object just to be sure
   $myobj = $null
}

A: So the problem here is the -f or formatting operator.  It's taking your awesome drive percent free [int] and turning it into a plain old boring [string].  I personally use the [math] accelerator and call the round method.
[math]::Round($mynumber,0)
You could also save yourself some time by looking in the technet gallery for this type of thing:
http://gallery.technet.microsoft.com/Get-HardDrive-0eef638f
I don't remember if that version returns data as a string or an integer but you'll see an example of the round method in action.


text:
Q: Getting error for insert statement for MySQL INSERT INTO `Employees`
        (employeeFirstName, employeeLastName, managerID, employeeRole)
VALUES ("Kim", "Brooks", NULL, "Manager");

INSERT INTO `Employees`
        (employeeFirstName, employeeLastName, managerID, employeeRole)
VALUES ("Alice", "Brown",
        (SELECT employeeID
        FROM Employees
        WHERE employeeFirstName = "Kim"
        and employeeLastName = "Brooks"
        ), "Instructor"
    );

I have the above code. However, for my second insert statement, it gives me an error stating "Table 'Employees' is specified twice, both as a target for 'INSERT' and as a separate source of data.


text:
Q: Nodered boilerplate and Analytics for Apache Hadoop binding issue I have created the nodered boilerplate and i have binded the Analytics for Apache Hadoop service.
So it clearly appears as a binded service into the dashboard.

But when I launch the Nodered app and add a HDFS node, I get the following message:
"Unbounded Service: Big Insights service not bound. This node wont work"
Any idea of what i am doing wrong? It used to work well for me a few weeks ago.

A: You will need to attach the BigInsights for Apache Hadoop service service to your app.
Please attach the service and restage/restage your app.


text:
Q: Can we integrate test results TestNG reports or extent reports to Microsoft teams Our tech director wanted test results which are currently in testng reports to be updated in Microsoft teams channel once the tests are run.
We are currently using testng reports to analyze reports after test runs.
Can we integrate Selenium testng results or extent reports to microsoft teams.

A: If you are Using Jenkins to schedule the tests, you can use the Post Build Actions > Editable Email Notification in you build job.

*

*Add Project Recipient List  - In this option you can add any number of email recipients. Refer the image for more details -
Project Recipient List in Jenkins

*If you need to integrate with your Microsoft Teams Channel, you can get the email for that channel by following the below steps:

*

*Go to the channel name and click More options  More options button > Get email address.

*This option needs to be enable by your IT admin.

*Also you  can look at incoming web hooks option in Microsoft Teams here

*So, if you have any CI/CD server (like Jenkins) notifying test results, you can integrate any email address in the post build action of the Job.

A: You can also use Travis CI to send the notifications to your teams channel. Here are the steps.

*

*Pick your team and the relevant channel (Ex: Your Team > General)

*click on the three little dots on the bottom of channel > more apps (screenshot below)

*Then select connectors > and pick travis CI> install it.

*You have now two options. Now you can easily login in to Travis CI (assuming you have account and configured your TESTNG reports) and make a connection or as mentioned above get the email address and configure it in your build.

*When ever TESTNG build reports are complete this channel will be notified as an "Adaptive cards".
Hope it helps.

A: There is an npm package to publish test results back to either microsoft teams or slack.
https://www.npmjs.com/package/test-results-reporter
You need to create an incoming-webhook and a simple config file to get started.
If you are using Azure DevOps, add the below command in your pipeline yaml file.
- script: npx test-results-reporter publish -c config.json


text:
Q: Is it possible to merge two datasets where a variable's value in the first is used to select a variable in the second? I would like to know how to merge two datasets in SAS using a variable's value in the first dataset to select and test a variable in the second dataset.
As an example consider two datasets. The first dataset contains four baby names and the days they were born. The second data set contains three doctors and an array of indicator variables noting if each doctor worked on a particular day. For example Dr. Smith worked on days 2 and 3 only. I would like to create a dataset that lists all the possible baby-doctor combinations where the doctor was working on the day the baby was born.
data babies;
input baby_name $ birth_day;
datalines;
Jake 1
Sonny 4
North 5
Apple 6
;
run;

data doctors;
input  DrLastname $ day1 day2 day3 day4 day5 day6;
datalines;
Jones 1 0 0 1 1 1
Smith 0 1 1 0 0 0
Lewis 1 1 1 0 0 0
;
run;

The solution seems like it should be something like this
proc sql;
 create table merged as
 select babies.*, doctors.*
 from babies, doctors
 where doctors.day(babies.birth_day) = 1; *<--- incorrect;
quit;

The output should be:
baby_name birth_day DrLastName
Jake      1         Jones
Jake      1         Lewis
Sonny     4         Jones
North     5         Jones
Apple     6         Jones

I have run into this problem a few times and would love to know if this is kind of merge is possible in SAS. Thanks for any help you can provide.

A: While I probably would also transpose the dataset, it is possible to do so without transposing.
data babies_doctors;
  set babies;
  do _i = 1 to nobs_doctors;
    set doctors point=_i nobs=nobs_doctors;
    array days day1-day6;
    if days[birth_Day] then output;
  end;
run;

This will not be fast, as it checks all rows in the dataset, but it's possible.
Fastest is probably to load it into a vertical hash table (which you could do easily) or a temporary array.
data babies_doctors_array;
  array drnames[32767] $80 _temporary_;
  array drdays[32767,6] _temporary_;
  if _n_=1 then do;
    do _i = 1 to nobs_doctors;
      set doctors point=_i nobs=nobs_doctors;
      array days day1-day6;
      drnames[_i]=DrLastname;
      do _j = 1 to dim(days);
        drdays[_i,_j]=days[_j];
      end;
    end;
  end;
  set babies;
  do _k = 1 to nobs_doctors;
    if drdays[_k,birth_day]=1 then do;
        baby_drlastname = drnames[_k];
        output;
    end;
  end;
run;

A: I might shift the second dataset and then merge on day.
Something like (in untested pseudo code):
    data new_1-new_6;
    set doctor;
    array day_1-day_6 day_{6}
    for i in 1 to 6:
      if day_{i} = 1 then do;
         day = i;
         output new_{i};
      end;
    end;
    run;

    data stacked;
      set day_1-day_6;
    run;

Then simply merge based on the field day.


text:
Q: Declare a static variable in a foreach in PHP i have a very simple question. How can i make this code
$i = 0;
foreach($Array as $Value)
{

    echo $i;
    $i++
}

but written like this?
foreach($Array as $Value)
{
    $i = 0;
    echo $i;
    $i++
}

should i use a STATIC variable? or what? I don't have a clear view on this.
Thank you!

A: You shouldn't really do that. static variables are used to persist a variable's value between invocations of the function they're embedded in. They're not useful for a simple loop. Your second code will simply reset the counter to zero on every iteration.
e.g. this is a correct usage:
function count() {
   static $x = 0; // executed the first time count() is called, then never again"
   echo ++$x;
}
count(); // 1
count(); // 2
count(); // 3

You can certainly have
foreach($array as $val) {
   static $x = 0;
   echo ++$x;
}

but you don't gain anything, since that particular piece of code never goes out of scope for the duration of the loop, so $x's value would never get "lost".

A: you may want use
foreach($Array as $i => $Value)
{
    echo $i;
}

or
foreach(array_values($Array) as $i=>$Value)
{

    echo $i;
}

While first your example is correct, too


text:
Q: how to test/verify OPTIONS method after disabling on apache2 webserver i have this issue with web application inspection software. the recommendation was to disable OPTION METHODS on the webserver.
upon research. i have included this snippet on my httpd.conf then restarted the server.
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK|OPTIONS)
RewriteRule .* - [F]

how can i verify if the code is implemented and will block all OPTIONS request?
i have tried this
curl --request OPTIONS http://10.1.1.1/mysite
but all i get is 301 Moved Permantently
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

<title>301 Moved Permanently</title>

Moved Permanently

The document has moved here.

<address>Apache/2.2.22 (Ubuntu) Server at 10.1.1.1 Port 80</address>

A: Rather than using mod_rewrite, you should be able to disable arbitrary methods using the Limit or LimitExcept directives which are designed to to just what you want.
You can test using nc or telnet to talk directly to the httpd process
$ nc yourhost.tld 80
OPTIONS / HTTP/1.1
Host: yourhost.tld

 (press enter a couple of times here and the server responds)

HTTP/1.1 200 OK
Date: Mon, 16 Dec 2013 09:16:40 GMT
Server: Apache
Allow: GET,HEAD,POST,OPTIONS,TRACE
Content-Length: 0
Connection: close
Content-Type: text/html; charset=UTF-8
$


text:
Q: Sequence not reset when truncating a table After adding primary key in my table, i truncate my table having 14 records. Now, when i am insert again, it is starting from 15. I want to start again by 1. Please tell me how?
Table definition:
SQL> create table first(id number(5),name varchar(5));

SQL> alter table first add(constraint first_pk primary key(id));

SQL> create sequence first_seq start with 1;

SQL> create or replace trigger first_trg
before insert on first for each row
begin
select first_seq.nextval into:new.id from dual;
end;
/

SQL> insert into first values(1,'mini');

A: You need to reset your sequence. You could simply recreate the sequence, but if you wish to do it manually then here is of the methods to reset the sequence.
For the sake of a example, I have created a sequence called my_seq.
First, select the current value from the sequence.
SQL> select my_seq.currval from dual;

   CURRVAL
----------
         4

In order to reset it, I am going to increment it by -4 which will make it return 0.
SQL> alter sequence my_seq increment by -4;

Sequence altered.

SQL> select my_seq.currval from dual;

   CURRVAL
----------
         4

SQL> select my_seq.nextval from dual;

   NEXTVAL
----------
         0

Now, alter the sequence to increment by 1.
SQL> alter sequence my_seq increment by 1;

Sequence altered.

SQL> select my_seq.nextval from dual;

   NEXTVAL
----------
         1


text:
Q: Sort a Custom Listview Adapter by Date I want to programm a ChatApp with Firebase. Right now I am displaying the Users I chat with. But now I want them to be sorted by a Date String I am using:
For Example: 21-06-2017 17:20. It should be sorted from the latest Time to the earliest Time.
My Adapter:
public class ChatAdapter extends ArrayAdapter<String> {

private Activity context;
private List<Chats> chatsList = new ArrayList<>();

public ChatAdapter(Activity context, List<Chats> chatsList) {
    super(context, R.layout.abc_main_chat_item);
    this.context = context;
    this.chatsList = chatsList;
}

@Override
public View getView(final int position, final View convertView, ViewGroup parent) {
    LayoutInflater inflater = context.getLayoutInflater();
    View listViewItem = inflater.inflate(R.layout.abc_main_chat_item, null, true);

    TextView tvusername = (TextView) listViewItem.findViewById(R.id.group_name);
    TextView tvuid = (TextView) listViewItem.findViewById(R.id.useruid);
    TextView tvlastmessage = (TextView) listViewItem.findViewById(R.id.latestMessage);
    TextView tvlastmessagetime = (TextView) listViewItem.findViewById(R.id.latestMessageTime);
    ImageView ivphoto = (ImageView) listViewItem.findViewById(R.id.profileImg);

    tvusername.setText(chatsList.get(position).getUsername());
    tvlastmessage.setText(chatsList.get(position).getLastMessage());
    tvlastmessagetime.setText(chatsList.get(position).getLastMessageTime());
    tvuid.setText(chatsList.get(position).getUseruid());
    Picasso.with(getContext()).load(chatsList.get(position).getPhotoURL()).placeholder(R.drawable.ic_person_grey_round).into(ivphoto);

    listViewItem.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent i = new Intent(context, Chat_Room.class);
            i.putExtra("room_name", chatsList.get(position).getUsername());
            i.putExtra("room_uid", chatsList.get(position).getUseruid());
            context.startActivity(i);

        }
    });

    listViewItem.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            final Dialog dialog = new Dialog(context);
            dialog.setContentView(R.layout.abcd_listview_alertdia_layout);
            ArrayList<String> list_of_chats = new ArrayList<>();
            final ArrayAdapter<String> arrayAdapter;
            arrayAdapter = new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, list_of_chats);

            list_of_chats.add(0, "Chatverlauf mit "+ chatsList.get(position).getUsername()+" löschen?");
            list_of_chats.add(1, "Profil von "+chatsList.get(position).getUsername()+" anschauen");
            arrayAdapter.notifyDataSetChanged();
            final ListView lv = (ListView) dialog.findViewById(R.id.lv);
            lv.setAdapter(arrayAdapter);
            lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> parent, View view, final int position2, long id) {
                    if (position2 == 0) {
                        dialog.dismiss();
                        AlertDialog.Builder alert = new AlertDialog.Builder(context);
                        alert.setTitle("Chatverlauf mit "+chatsList.get(position).getUsername()+" löschen?")
                                .setMessage("Du kannst das Löschen nicht rückgängig machen. Bist du dir sicher?")
                                .setNegativeButton("Abbrechen", new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                                        dialog.cancel();
                                    }
                                })
                                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                                        FirebaseDatabase.getInstance().getReference().child("chats").child("userchats").child(FirebaseAuth.getInstance().getCurrentUser().getUid()).child(chatsList.get(position).getUseruid()).setValue(null);
                                        FirebaseDatabase.getInstance().getReference().child("chats").child("users").child(FirebaseAuth.getInstance().getCurrentUser().getUid()).child("messages").child(chatsList.get(position).getUseruid()).setValue(null);
                                    }
                                }).setCancelable(true)
                                .show();
                        lv.setAdapter(arrayAdapter);
                        arrayAdapter.notifyDataSetChanged();
                    }
                    if (position2 == 1) {
                        Intent intent = new Intent(context, ViewContact.class);
                        intent.putExtra("useruid", chatsList.get(position).getUseruid());
                        context.startActivity(intent);
                    }
                }
            });
            dialog.show();
            return true;
        }
    });

    ivphoto.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            final Dialog dialog = new Dialog(context);
            dialog.setContentView(R.layout.abcd_profile_pic_dialog_layout);
            ImageView imageView = (ImageView) dialog.findViewById(R.id.alertImage);
            TextView textView = (TextView)dialog.findViewById(R.id.alertdialogtv);
            ImageView message = (ImageView)dialog.findViewById(R.id.alertMessage);
            ImageView profile = (ImageView)dialog.findViewById(R.id.alertProfile);
            profile.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent(context, ViewContact.class);
                    intent.putExtra("useruid", chatsList.get(position).getUseruid());
                    context.startActivity(intent);
                    dialog.dismiss();
                }
            });
            message.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent(getContext(), Chat_Room.class);
                    intent.putExtra("room_name", chatsList.get(position).getUsername());
                    intent.putExtra("room_uid", chatsList.get(position).getUseruid());
                    context.startActivity(intent);
                }
            });
            Picasso.with(getContext()).load(chatsList.get(position).getPhotoURL()).placeholder(R.drawable.ic_person_grey_round).into(imageView);
            textView.setText(chatsList.get(position).getUsername());
            dialog.setCancelable(true);
            dialog.show();
        }
    });

    return  listViewItem;
}

This is how i got my ArrayLists:
`for(DataSnapshot snapshot : dataSnapshot.getChildren()){
                    username.add(snapshot.child("roomname").getValue().toString());
                    photoURL.add(snapshot.child("photoURL").getValue().toString());
                    lastmessage.add(snapshot.child("lastMessage").getValue().toString());
                    lastmessagetime.add(snapshot.child("lastMessageTime").getValue().toString());
                    useruid.add(snapshot.child("userUiD").getValue().toString());
                }

                ChatAdapter chatAdapter = new ChatAdapter(getActivity(), username, useruid, photoURL, lastmessage, lastmessagetime);
                listView.setAdapter(chatAdapter);`

But how can I pass it as a List ??
How can I add them to the list?
Is it even possible to sort it?
I hope you Guys can help me :)
Thanks.

A: This is of course possible.
But first, your data structure looks weird and unpractical.
Your messages are passed in single arrays which makes it quite complicated:
ArrayList<String> username, ArrayList<String> useruid, ArrayList<String> photoURL, ArrayList<String> lastmessage, ArrayList<String> lastmessagetime
Better would be to have a list of Messageobjects, where a message object contains the single items, something like this:
public class Message {

   String username;
   String useruid;
   String photoURL;
   String message;
   Date timestamp;
   //...getter and setter
}

Even better would be to have a Message object just contain a userId, messageText and timeStamp. that's all you would need.
Then you could pass a List<Message> messages into your adapter.
To sort the message list you can implement the Comparable class where you can then sort the objects in a way you like.
public class Message implements Comparable<Message>{

   String username;
   String useruid;
   String photoURL;
   String message;
   Date timestamp;

   @Override
   public int compareTo(@NonNull Message o) {
       return this.timestamp.compareTo(o.timestamp)
   }
}

If you have added Comparable to your Messageclass, you can use
Collections.sort(messages); to sort the list.
Just have a look at the java comparable, there are various examples. Also check out this stackoverflow answer.
edit: to answer your additional question:
in your case, when you are getting your elements you would do something like:
List<Message> messages = new ArrayList<Message>();

for(DataSnapshot snapshot : dataSnapshot.getChildren()){
     Message message = new Message();
     message.setName(snapshot.child("roomname").getValue().toString());
     …
     //set all your properties and then add that object to the messages list
     messages.add(message);
     }
Collections.sort(messages); // sort the message list
ChatAdapter chatAdapter = new ChatAdapter(getActivity(), messages);
listView.setAdapter(chatAdapter);


text:
Q: Angular multiple checkbox value A student wants to register one class or more than one class. As the class list is dynamic, I have used ngFor to display in a table format with checkbox at then end to select the class. But, no idea how to get value when a student checkbox to select class.
I have tried to use the select option but that didn't go through well.

    Code
    Name
    Capacity
    Remaining
    Location
    Instructor
    Register?

    {{ item.Code }}
    {{ item.Name }}
    {{ item.Capacity }}
    {{ item.Remaining }}
    {{ item.Location }}
    {{ item.Instructor }}

      <ion-checkbox style="text-align: center;" (onchange)="checkboxChange()" [(ngModel)]="checkItem"></ion-checkbox>

I expect when student register for any class then, capacity of class will be reduced by one and update to firebase database.

A: Since you have multiple checkboxes, you need an array to keep track of these checkboxes.
Component:
checkboxes = [];

Initialize all checkboxes with false to keep them unchecked at the beginning.
ngOnInit() {
  // This array will be the same length as the iterable object used in *ngFor.
  this.checkboxes = new Array(this.classItem.length).fill(false);
}

Template:
In the template, bind each checkbox to their respective value.

  ...
  <ion-checkbox style="text-align: center;" (onchange)="checkboxChange(i)"
    [(ngModel)]="checkboxes[i]"></ion-checkbox>
  ...

When a checkbox is checked or unchecked, modify available capacity of the class.
checkboxChange(i) {
  if (this.checkboxes[i]) {
    this.capacity++;
  } else {
    this.capacity--;
  }
}

A: Here is my solution to your problem. Firstly I added component ts file with mock data in checkItem array of type ClassDescription with ClassDescription interface.
Note that I have used normal html input checkbox instead  , I just verified on ionic documentation and it will work same as below reference of Ionic Checkbox

    Code
    Name
    Capacity
    Remaining
    Location
    Instructor
    Register?

    {{ item.code }}
    {{ item.name }}
    {{ item.capacity }}
    {{ item.remaining }}
    {{ item.location }}
    {{ item.instructor }}

      <input type="checkbox"  [(ngModel)]="item.register"  (change)="onChecked(item)"
[disabled]="(item.remaining === 0) && item.register == !true">

My Stackblitz solution is here Stackblitz solution. Next you can add your logic for firebase inside onChecked function.
    import { Component } from '@angular/core';

    interface ClassDescription {
    code : string;
    name : string ;
    capacity: string ;
    remaining : number ;
    location : string ;
    instructor : string;
    register: boolean;
    }
   @Component({
   selector: 'my-app',
   templateUrl: './app.component.html',
   styleUrls: [ './app.component.css' ]
   })
  export class AppComponent  {

     onChecked(item) {
     if(item.register)
       {
         item.remaining = item.remaining - 1 ;
       }
      else{
          item.remaining = item.remaining + 1 ;
        }

     }

    classItem: ClassDescription[]= [
   {
      'code' : '101',
      'name' : 'Micro services',
      'capacity': '30',
      'remaining' : 5 ,
      'location' : 'Engineering dept',
      'instructor' : 'Dr. Neha',
      'register': false
    },
    {
       'code' : '102',
      'name' : 'Computer Science',
      'capacity': '30',
      'remaining' : 0 ,
      'location' : 'Mcarthy hall',
      'instructor' : 'Dr. Rob',
       'register': false
     },
    {
      'code' : '103',
     'name' : 'Programming fundamental',
      'capacity': '30',
     'remaining' : 5 ,
     'location' : 'Harvard hall',
     'instructor' : 'Dr. Steven',
      'register': false
     }
     ];

    }

A:

    Code
    Name
    Capacity
    Remaining
    Location
    Instructor
    Register?

    {{ item.code }}
    {{ item.name }}
    {{ item.capacity }}
    {{ item.remaining }}
    {{ item.location }}
    {{ item.instructor }}

      <ion-checkbox style="text-align: center;" (ionChange)="checkboxStateChanged(i)" [checked]="item.checked"></ion-checkbox>

in your ts :
classSelectedIndexes : number[] = []; //storing the selected item indexes just in case

checkboxStateChanged(index : number){
 this.item[i].checked= !this.item[i].checked;
 if(this.item[i].checked){
  //do something if true
 }
  else{
  //do something if false
 }
}

It is expected to have a checked property in your classItem all initialized to false
i.e your classItem should be of type :
interface ClassType {
code : string;
name : string ;
capacity: string ;
remaining : number ;
location : string ;
instructor : string;
checked: boolean;
}


text:
Q: iTextSharp extracts wrapped cell contents into new lines - how do you identify to which column a given wrapped piece of data belongs now? I am using iTextSharp to extract data from pdfs.
I stumbled across the following problem, depicted by the scenario below:
I created a sample excel file to illustrate. Here is what it looks like:

I convert it to a pdf, using one of the many free online converters available out there, which generates a pdf looking like (when I generated the pdf I did not apply the styling to the excel):

Now, using iTextSharp to extract the data from the pdf, returns me the following string as the data extracted:

As you can see, wrapped cell data generate new lines, where each wrapped piece of data separated by a single white space.
The problem: how does one identify, now, to which column a given piece of wrapped data belongs to ? If only iTextSharp preserved as many white spaces as columns...
In my example - how can I identify to which column does 111 belong ?

Update 1:
A similar problem occurs whenever a field has more than one word (i.e., contains white spaces). For example, considering the 1st line of the sample above:
say it looked like
---A---  ---B---  ---C---  ---D---
aaaaaaa    bb b     cccc

iText again would generate the extraction for this one as:
aaaaaaa bb b cccc

Same problem here, in having to determine the borders of each column.

Update 2:
A sample of the real pdf file I am working with:

This is how the pdf data looks like.

A: In addition to Chris' generic answer, some background in iText(Sharp) content parsing...
iText(Sharp) provides a framework for content extraction in the namespace iTextSharp.text.pdf.parser / package com.itextpdf.text.pdf.parser. This franework reads the page content, keeps track of the current graphics state, and forwards information on pieces of content to the IExtRenderListener or IRenderListener / ExtRenderListener or RenderListener the user (i.e. you) provides. In particular it does not interpret structure into this information.
This render listener may be a text extraction strategy (ITextExtractionStrategy / TextExtractionStrategy), i.e. a special render listener which is predominantly designed to extract a pure text stream without formatting or layout information. And for this special case iText(Sharp) additionally provides two sample implementations, the SimpleTextExtractionStrategy and the LocationTextExtractionStrategy.
For your task you need a more sophisticated render listener which either

*

*exports the text with coordinates (Chris in one of his answers has provided an extended LocationTextExtractionStrategy which can additionally provide positions and bounding boxes of text chunks) allowing you in additional code to analyse tabular structures; or

*does the analysis of tabular data itself.

I do not have an example for the latter variant because generically recognizing and parsing tables is a whole project in itself. You might want to look into the Tabula project for inspiration; this project is surprisingly good at the task of table extraction.
PS: If you feel more at home with trying to extract structured content from a pure string representation of the content which nonetheless tries to reflect the original layout, you might try something like what is proposed in this answer, a variant of the LocationTextExtractionStrategy working similar to the pdftotext -layout tool; only the changes to be applied to the LocationTextExtractionStrategy are shown there.
PPS: Extraction of data from very specific PDF tables may be much easier; for example have a look at this answer which demonstrates that after some PDF analysis the specific way a given table is created might give rise to a simple custom render listener for extracting the table data. This can make sense for a single PDF with a table spanning many many pages like in the case of that answer, or it can make sense if you have many PDFs identically created by the same software.
This is why I asked for a representative sample file in a comment to your question

Concerning your comments

Still with the pdf example above, both with an implementation from scratch of ITextExtractionStrategy and with extending LocationExtractionStrategy, I see that each RenderText is called at the following chunks: Fi, el, d, A, Fi, el, d... and so on. Can this be changed?

The chunks of text you get as separate RenderText calls are not separated by accident or some random decision of iText. They are the very strings drawn separately in the page content!
In your sample "Fi", "el", "d", and "A" come in different RenderText calls because the content stream contains operations in which first "Fi" is drawn, then "el", then "d", then "A".
This may sound weird at first. A common cause for such torn up words is that PDF does not use the kerning information from fonts; to apply kerning, therefore, the PDF generating software has to insert tiny forward or backward jumps between characters which should be farther from or nearer to each other than without kerning. Thus, words often are torn apart between kerning pairs.
So this cannot be changed, you will get those pieces, and it is the job of the text extraction strategy to put them together.
By the way, there are worse PDFs, some PDF generators position each and every glyph separately, foremost such generators which predominantly build GUIs but can as a feature automatically export GUI canvasses as PDFs.

I would expect that in entering the realm of "adding my own implementation" I would have control over how to determine what is a "chunk" of text.

You can... well, you have to decide which of the incoming pieces belong together and which don't. E.g. do glyphs with the same y coordinate form a single line? Or do they form separate lines in different columns which just happen to be located next to each other.
So yes, you decide which glyphs you interpret as a single word or as content of a single table cell, but your input consists of the groups of glyphs used in the actual PDF content stream.

Not only that, in none of the interface's methods I can "spot" how/where it deals with non-text data/images - so I could intercede with the spacing issue (RenderImage is not called)

RenderImage will be called for embedded bitmap images, JPEGs etc. If you want to be informed about vector graphics, your strategy will also have to implement IExtRenderListener which provides methods ModifyPath, RenderPath and ClipPath.

A: This isn't really an answer but I needed a spot to show some things that might help you understand things.
First "conversion" from Excel, Word, PowerPoint, HTML or whatever to PDF is almost always going to be a destructive change. The destructive part is very important and it happens because you are taking data from a program that has very specific knowledge of what that data represents (Excel) and you are turning it into drawing commands in a very generic universal format (PDF) that only cares about what the data looks like, not the data itself. Unless the data is "tagged" (and it almost never is these days still) then there is no context for the drawing commands. There are no paragraphs, there are no sentences, there are no columns, rows, tables, etc. There's literally just draw this letter at x,y and draw this word at a,b.
Second, imagine you Excel file had that following data and for some reason that last column was narrower than the others when the PDF was made:
Column A | Column B | Column
                      C
Data #1    Data #2    Data
                      #3

You and I have context so we know that the second and fourth lines are really just the continuation of the first and third lines. But since iText doesn't have any context during extraction it doesn't think like that and it sees four lines of text. In fact, since it doesn't have context it doesn't even see columns, just the lines themselves.
Third, although a very small thing you need to understand that you don't draw spaces in PDF. Imagine the three column table below:
Column A | Column B | Column C
                      Yes

If you extracted that from a PDF you'd get this data:
Column A | Column B | Column C
Yes

Inside the PDF the word "Yes" will be just drawn at a certain x coordinate that you and I consider to be under the third column and it won't have a bunch of spaces in front of it.
As I said at the beginning, this isn't much of an answer but hopefully it will explain to you the problem that you are trying to solve. If your PDF is tagged then it will have context and you can use that context during extraction. Context isn't universal, however, so there usually isn't just a magic "insert context" checkbox. Excel actually does have a checkbox (if I remember correctly) to make a tagged PDF during export and it ultimately creates a tagged PDF using HTML-like tags for tables. Very primitive but it will works. However it will be up to you to parse this context.

A: Leaving here an alternative strategy for extracting the data - that does not solve the problem of who are spaces treated/can be treated, but gives you somewhat more control over the extraction by specifying geometric areas you want to extract text from. Taken from here.
 public static System.util.RectangleJ GetRectangle(float distanceInPixelsFromLeft, float distanceInPixelsFromBottom, float width, float height)
    {
        return new System.util.RectangleJ(
            distanceInPixelsFromLeft,
            distanceInPixelsFromBottom,
            width,
            height);
    }

      public static void Strategy2()
    {
        // In this example, I'll declare a pageNumber integer variable to
        // only capture text from the page I'm interested in
        int pageNumber = 1;

        var text = new StringBuilder();

        List<Tuple<string, int>> result = new List<Tuple<string, int>>();

        // The PdfReader object implements IDisposable.Dispose, so you can
        // wrap it in the using keyword to automatically dispose of it

        using (var pdfReader = new PdfReader("D:/Example.pdf"))
        {
            float distanceInPixelsFromLeft = 20;
            //float distanceInPixelsFromBottom = 730;
            float width = 300;
            float height = 10;

            for (int i = 800; i >= 0; i -= 10)
            {
                var rect = GetRectangle(distanceInPixelsFromLeft, i, width, height);

                var filters = new RenderFilter[1];
                filters[0] = new RegionTextRenderFilter(rect);

                ITextExtractionStrategy strategy =
                    new FilteredTextRenderListener(
                        new LocationTextExtractionStrategy(),
                        filters);

                var currentText = PdfTextExtractor.GetTextFromPage(
                    pdfReader,
                    pageNumber,
                    strategy);

                currentText =
                    Encoding.UTF8.GetString(Encoding.Convert(
                        Encoding.Default,
                        Encoding.UTF8,
                        Encoding.Default.GetBytes(currentText)));

                //text.Append(currentText);
                result.Add(new Tuple<string, int>(currentText, currentText.Length));
            }
        }

        // You'll do something else with it, here I write it to a console window
        //Console.WriteLine(text.ToString());
        foreach (var line in result.Distinct().Where(r => !string.IsNullOrWhiteSpace(r.Item1)))
        {
            Console.WriteLine("Text: [{0}], Length: {1}", line.Item1, line.Item2);
        }
        //Console.WriteLine("", string.Join("\r\n", result.Distinct().Where(r => !string.IsNullOrWhiteSpace(r.Item1))));

Outputs:

PS.: We are still left with the problem of how to deal with spaces/non text data.


text:
Q: Using waitForQualityGate in a Jenkins declarative pipeline The following SonarQube (6.3) analysis stage in a declarative pipeline in Jenkins 2.50 is failing with this error in the console log: http://pastebin.com/t2ja23vC. More specifically:

SonarQube installation defined in this job (SonarGate) does not match any configured installation. Number of installations that can be configured: 1.

Update: after changing "SonarQube" to "SonarGate" in the Jenkins settings (under SonarQube servers, so it'll match the Jenkinsfile), I get a different error: http://pastebin.com/HZZ6fY6V

java.lang.IllegalStateException: Unable to get SonarQube task id and/or server name. Please use the 'withSonarQubeEnv' wrapper to run your analysis.

The stage is a modification of the example from the SonarQube docs: https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Jenkins#AnalyzingwithSonarQubeScannerforJenkins-AnalyzinginaJenkinspipeline
stage ("SonarQube analysis") {
     steps {
        script {
           STAGE_NAME = "SonarQube analysis"

           if (BRANCH_NAME == "develop") {
              echo "In 'develop' branch, don't analyze."
           }
           else { // this is a PR build, run sonar analysis
              withSonarQubeEnv("SonarGate") {
                 sh "../../../sonar-scanner-2.9.0.670/bin/sonar-scanner"
              }
           }
        }
     }
  }

  stage ("SonarQube Gatekeeper") {
     steps {
        script {
           STAGE_NAME = "SonarQube Gatekeeper"

           if (BRANCH_NAME == "develop") {
              echo "In 'develop' branch, skip."
           }
           else { // this is a PR build, fail on threshold spill
              def qualitygate = waitForQualityGate()
              if (qualitygate.status != "OK") {
                 error "Pipeline aborted due to quality gate coverage failure: ${qualitygate.status}"
              }
           }
        }
     }
  }

I also created a webhook, sonarqube-webhook, with the URL http://****/sonarqube-webhook/. Should it be like that, or http://****/sonarqube/sonarqube-webhook? To access the server dashboard I use http://****/sonarqube.
In SonarQube's Quality Gates section I created a new quality gate:

I am not sure if the setting in SonarGate is correct. I do use jenkins-mocha to generate an lcov.info file that is used in Sonar to generate the coverage data.
Perhaps the quality gate setting is the wrong setting to do? The end result is to fail the job in Jenkins if coverage % is not met.

Finally, I am not sure if the following configurations in the Jenkins system configuration are at all required:

And
(It's 9000 not 900... cut text in the screen shot)

A: The SonarQube Jenkins plugin scans the build output for two specific lines, which it uses to get the SonarQube report task properties and project URL. If your invocation of sonar-scanner does not output these lines, the waitForQualityGate() call won't have the task ID to look them up. So you will have to figure out the correct settings to make it more verbose.
See the extractSonarProjectURLFromLogs and extractReportTask methods in the SonarUtils class of the plugin to understand how they work:

*

*ANALYSIS SUCCESSFUL, you can browse <project URL> is used to add a link to the badge (in the build history)

*Working dir: <dir with report-task.txt> is used to pass the task ID to the waitForQualityGate step

A: This was discovered to be a bug in the SonarQube scanner for Jenkins, when using a Jenkins slave for jobs (if the job is run on the master, it'd work). You can read more here: https://jira.sonarsource.com/browse/SONARJNKNS-282
I have tested this using a test build of v2.61 of the scanner plug-in and found it working.
The solution is to upgrade to v2.61 when released.
This stage will then work:
stage ("SonarQube analysis") {
   steps {
      withSonarQubeEnv('SonarQube') {
         sh "../../../sonar-scanner-2.9.0.670/bin/sonar-scanner"
      }

      def qualitygate = waitForQualityGate()
      if (qualitygate.status != "OK") {
         error "Pipeline aborted due to quality gate coverage failure: ${qualitygate.status}"
      }
   }
}

A: If you're running SonarCube in a docker container check that the memory isn't exhausted. We were maxing out. Which seemed to be the issue.


text:
Q: Covering space of a graph is a graph I'm trying to understand the following proof in May's Concise.

Can someone enlighten me as to what this easy path lifting argument is?
I guess that if $e\in E\setminus E^0$, then I can lift the segment of the edge containing $p(e)$ to a path starting a $e$. Can I then uniquely extend this over a neighborhood, eventually arriving at a vertex?

A: I think the proof should work like this.
Take a point $e \in E\setminus E^0$ then $p(e)$ does not belong to $B^0$ hence there must be a path $\alpha$ that parametrizes an edge having in the interior $p(e)$.
Let assume that $\alpha(t)=p(e)$ for a $t \in (0,1)$, by a lifting argument one can prove that there is a unique lifting $\beta \colon [0,1] \to E$ such that

*

*$p \circ \beta = \alpha$

*$\beta(t) = e$.

Since $\alpha$ parametrizes an edge of $B$ we have that $\alpha(0), \alpha(1) \in B^0$, while $\alpha(s) \in B \setminus B^0$ for $s \in (0,1)$.
Since both $E^0$ and $E \setminus E^0$ are saturated sets, that is they are unions of fibers of $p$, we have that

*

*$\beta(0), \beta(1) \in p^{-1}(B^0)=E^0$

*$\beta(s) \in p^{-1}(B\setminus B^0)=E\setminus E^0$
which implies that $\beta$ parametrizes an edge of $E$.

Hope this helps.


text:
Q: How do I query with '.includes' across more than two tables? I have the following associations:
class Captain
  has_many :boats
end

class Boat
  belongs_to :captain
  has_many :classifications
end

class Classification
  has_many :boats
end

I want to find out which captains have boats that have classifications with :name attributes of "catamaran."
This has been my best guess so far:
Captain.includes(:boats, :classifications).where(:boats => {:classifications => {:name => "catamaran"}})

A: Try this
Captain.joins(boats: :classifications).where(classifications: { name: "catamaran" })

This query results in following SQL query
SELECT * FROM `captains`
   INNER JOIN `boats` ON `boats`.`captain_id` = `captains`.`id`
   INNER JOIN `join_table` ON `join_table`.`boat_id` = `boat`.`id`
   INNER JOIN `classifications` ON `join_table`.`classification_id` = `classifications`.id

A: @Sujan Adiga has right!
If you use the include method, active record generate 2 separates sql query. The first for your main Model, and the second for your inclued model. But you don't have access on the included model in your first query.
When you use the joins method, active record generate sql query with joins statement. So you can use the joined model in your clause where.


text:
Q: Unmapped column in a dependence restriction in SSIS I have an issue in SSIS in the dependence restriction. I am trying to import data from an excel file. I have used the EXCEL FILE, that it is connected to a derived column. After we have the UNION ALL component. Everytime I try to assign one column to the Account column it throws an error telling the metadata...

if I click in the restriction dependence between the UNION ALL component and the DERIVED COLUMN component IT shows that account is not mapped... but in the source (excel source component) it is mapped!!! it is driving me mad.

why i cannot add the account in this table?! to the source column? i HAVE TRIED to remove and recreating everything again... same problem again. I even opened a new package to test.. driving me mad.

A: does it make sense that the solution was to COPY one good excel source and then just change the new sheet?  If I created from root with a new excel source it would throw always the previous errors. So it was just to copy the excel source that was working and then just changing to the desired (new) sheet. and it worked this way. Reset the metadata seems to be flick in SSIS. I would like if someone could share a secure way to do it!


text:
Q: rowcolors causes caption to be colored I have no clue why \rowcolors colors as well the \caption. The MWE doesn't make much sense by itself but should demenstrate the issue.
\documentclass[a4paper,11pt,english]{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage[table]{xcolor}
\usepackage{xltabular}
\usepackage{booktabs}
\aboverulesep=0pt
\belowrulesep=0pt
\cmidrulekern=-\tabcolsep
\definecolor{HTML-D0}{HTML}{E03E2D}
\usepackage{caption}
\captionsetup[table]{font=small, format=hang}
\definecolor{HTML-B2}{HTML}{3598db}
\usepackage{ragged2e} % Allow left, center and right alignment
\begin{document}

{\rowcolors{1}{HTML-B2}{HTML-B2}
\noindent
\begin{xltabular}{\textwidth}{!{\color{HTML-D0}\vrule width 65536sp} X X}
\arrayrulecolor{HTML-D0}\midrule[65536sp]\arrayrulecolor{black}
Mugur &\Centering{} 3\\
\midrule[65536sp]
\caption{Main}\end{xltabular}
}
\end{document}

Running with luatex 1.13.2.

A: You can use \hiderowcolors and if necessary re-start with \showrowcolors

\documentclass[a4paper,11pt,english]{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage[table]{xcolor}
\usepackage{xltabular}
\usepackage{booktabs}
\aboverulesep=0pt
\belowrulesep=0pt
\cmidrulekern=-\tabcolsep
\definecolor{HTML-D0}{HTML}{E03E2D}
\usepackage{caption}
\captionsetup[table]{font=small, format=hang}
\definecolor{HTML-B2}{HTML}{3598db}
\usepackage{ragged2e} % Allow left, center and right alignment
\begin{document}

{\rowcolors{1}{HTML-B2}{HTML-B2}

\begin{xltabular}{\textwidth}{!{\color{HTML-D0}\vrule width 65536sp} X X}
\arrayrulecolor{HTML-D0}\midrule[65536sp]\arrayrulecolor{black}
Mugur &\Centering{} 3\\
\midrule[65536sp]
\hiderowcolors\caption{Main}\\
\showrowcolors
aa&bb
\end{xltabular}
}
\end{document}


text:
Q: Cannot knit Rmd file since I changed the name of User directory I am using R for windows on RStudio.
I recently changed the name of User directory for a reason, and it seems that the change is causing a problem in knitting Rmd file.
If I try to knit Rmd file, the following error massage appears:

Error: invalid
  version specification 'find'
  In addition: Warning message:
  In system(paste(shQuote(path), "--version"), intern = TRUE) :
    running command '"C:/PROGRA~3/CHOCOL~1/bin/pandoc.exe" --version' had status 65535
  Execution halted

I entered '"C:/PROGRA~3/CHOCOL~1/bin/pandoc.exe" --version' in cmd, it says

Cannot find file at 'c:\users\MY OLD USER NAME\appdata\local\pandoc\pandoc.exe'

So, I guess that knitr or pandoc is trying to find the wrong path.
How can I fix the problem? How can I change the path?
Here is the list of what I have tried:

*

*Uninstalled R and RStudio, and then installed them.

*Then, I installed all the packages needed by install.packeges.

*

*Thus, I am using the latest version of R, RStudio, and packages.

*Searched 'pandoc' in registry editor, and tried to find the old path (but I couldn't)

A: It seems you installed Pandoc by yourself through Chocolatey, and the installation was broken after you changed the name of your User directory.
First, you do not have to install Pandoc separately if you are using RStudio, because RStudio has bundled Pandoc with it.
If you have to install Pandoc for some reason, you may need to reinstall it (perhaps you have to reinstall Chocolatey, too).
choco uninstall pandoc
choco install pandoc