text:
Q: How to output a variable from a Servlet to JSP? I'm trying to output a variable defined in a Servlet to a JSP, and I just can't do it!
Here's my code:
MainServlet:

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet(name = "MainServlet", urlPatterns = {"/MainServlet"})
public class MainServlet extends HttpServlet {

    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html");
        request.setAttribute("msg", "Bloody Hell"); // Here <<<<<<<<<<<<<<<
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    @Override
    public String getServletInfo() {
        return "Short description";
    }

}

index.jsp:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>BlueBank</title>

Whatever: ${msg}

That "msg" variable does not appear. When I test it on netbeans, the "msg" variable does not work. I don't know what I'm doing wrong.

A: Modify your servlet assuming your jsp is in the root context, use something like
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    // response.setContentType("text/html");
    request.setAttribute("msg", "Bloody Hell");
    request.getRequestDispatcher("/index.jsp").include(request, response);
}

And then access your servlet url (and it will set the attribute and then include the index jsp).


text:
Q: Box shadow around rounded corners? I'm using Twitter's Bootstrap library to quickly throw together a prototype.
Here's what my layout looks like in HTML:

        <button class="close" data-dismiss="alert">×</button>
        Awesomeness! You're pretty cool.

        <button class="close" data-dismiss="alert">×</button>
        Awesomeness! You're pretty cool.

Here's what my LESS looks like:
div.navbar div.navbar-messages {
    .drop-shadow(1px 1px 10px 1px rgba(0, 0, 0, 0.2));

    div.alert {
        -webkit-border-radius: 0px;
        -moz-border-radius: 0px;
        border-radius: 0px;

        margin-bottom: 0px;

        &:last-child {
            -webkit-border-bottom-right-radius: 4px;
            -webkit-border-bottom-left-radius: 4px;
            -moz-border-radius-bottomright: 4px;
            -moz-border-radius-bottomleft: 4px;
            border-bottom-right-radius: 4px;
            border-bottom-left-radius: 4px;
        }
    }
}

.drop-shadow(@params) {
    -moz-box-shadow: @params;
    -webkit-box-shadow: @params;
    box-shadow: @params;
}

What's really weird is that the drop shadow isn't curving around the child element's curved corners:

How can I make it properly curve around the corners?

A: I have this:
blockquote {
    border: none;
    font-style: italic;
    font-size: 20px;
    line-height: 40px;
    font-weight: 300;
    padding: 0;
    margin: 30px 0;
    text-shadow: 0 1px 1px #666666;
    background: rgba(255,255, 255, 0.4);
    box-shadow: 0px 0.5px 1px #888888;
    padding-left: 10px;
    -webkit-border-radius: 6px;
    -moz-border-radius: 6px;
    border-radius: 6px;
}

So:
-webkit-border-radius: 6px;
        -moz-border-radius: 6px;
        border-radius: 6px;

That worked for me pretty well! Thanks a lot.

A: Your div.navbar div.navbar-messages element lacks rounded corners, so the shadow appears square. As described by its name, box-shadow draws a shadow around the element's box, and not the element's contents, so if the box itself doesn't have rounded corners, then neither will its shadow.
You can try applying the same border-radius styles to div.navbar div.navbar-messages as well, so its shadow will curve around the corners:
div.navbar div.navbar-messages {
    .drop-shadow(1px 1px 10px 1px rgba(0, 0, 0, 0.2));
    .rounded-bottom-corners(4px);

    div.alert {
        -webkit-border-radius: 0px;
        -moz-border-radius: 0px;
        border-radius: 0px;

        margin-bottom: 0px;

        &:last-child {
            .rounded-bottom-corners(4px);
        }
    }
}

.drop-shadow(@params) {
    -moz-box-shadow: @params;
    -webkit-box-shadow: @params;
    box-shadow: @params;
}

.rounded-bottom-corners(@params) {
    -webkit-border-bottom-right-radius: @params;
    -webkit-border-bottom-left-radius: @params;
    -moz-border-radius-bottomright: @params;
    -moz-border-radius-bottomleft: @params;
    border-bottom-right-radius: @params;
    border-bottom-left-radius: @params;
}

A: yep...just put a border-radius on the div that has the shadow. Make sure border-radius value matches that of the object inside the div and they will match up properly.

A: You could use the filter:drop-shadow() on your code instead of the default box-shadow
Here's an example:
div.navbar {
    filter: drop-shadow(5px 5px 10px #44444d81);
}

This does the trick

redpajama_set_name: RedPajamaStackExchange


text:
Q: Porque aparecen caracteres no deseados en mi salida? Hola tengo este codigo que se ejucuta y compila bien pero me agraga caracteres que no deberian estar ahi
codigo:
void wout(char* text){
    HANDLE hcoln;
    hcoln = GetStdHandle(STD_OUTPUT_HANDLE);
    DWORD juo=strlen(text);
    LPDWORD iuo=0;
    WriteFile(hcoln, text, juo, iuo, NULL);
    delete text;
}
void winp(void* text){
    HANDLE hcoln;
    hcoln = GetStdHandle(STD_INPUT_HANDLE);
    DWORD juo=200;
    LPDWORD iuo=0;
    ReadFile(hcoln, text, juo, iuo, NULL);
    text=0;
}
int main(){
    char text;
    while(0==0){
    winp(&text);
    wout(&text);
    }
}

La salida es
Hola mundo como estas?

Hola mundo como estas?

la mundo como estas?

la mundo como estas?

la mundo como estas?

la mundo como estas?

gracias por su ayuda

A: Básicamente yo diría que tu problema es que estás pisando memoria sin control:
Fíjate que la variable text es de tipo char en la función main, esto quiere decir que esa variable tiene espacio para almacenar únicamente un caracter:
int main() {
    char text;

Sin embargo usas esa variable para almacenar una cadena de caracteres:
ReadFile(hcoln, text, juo, iuo, NULL);

Esto hace que se escriba en posiciones de memoria que no pertenecen a text sino a otras variables de tu aplicación (variables declaradas en la pila en este caso). El resultado suele ser un comportamiento errático en la aplicación, que es lo que te está sucediendo a ti.
Prueba a convertir text en un buffer con capacidad para almacenar caracteres:
int main() {
    char text[1000]; // Podrá almacenar hasta 999 caracteres

Si repasamos la documentación de ReadFile encontramos lo siguiente:

lpNumberOfBytesRead
A pointer to the variable that receives the number of bytes read when using a synchronous hFile parameter. ReadFile sets this value to zero before doing any work or error checking.
Use NULL for this parameter if this is an asynchronous operation to avoid potentially erroneous results.
This parameter can be NULL only when the lpOverlapped parameter is not NULL.

Es decir, que este parámetro no puede ser NULL si el parámetro lpOverlapped es igualmente NULL.
Si repasamos tu llamada encontramos lo siguiente:
DWORD juo=200;
LPDWORD iuo=0;

ReadFile(hcoln, text, juo, iuo, NULL);
//                         ~~~  ~~~~
//                          1    2

Donde:

*

*lpNumberOfBytesRead. Le estás pasando un 0, pero el prefijo LP de LPDWORD quiere decir Long Pointer, es decir, estamos ante un puntero cuyo valor es 0, es decir, NULL

*lpOverlapped. Es NULL directamente

Estás haciendo justo algo que desaconsejan en la propia documentación de ReadFile.
En el caso de WriteFile sucede exactamente lo mismo, estás pasando NULL a ambos parámetros y es algo que en la documentación te dicen que no lo hagas.


text:
Q: Kerberos SSH/PAM login like AD I've recently been trying to set up a new Ubuntu server environment, we've wanted to set up a single sign on system that functions similar to good old Windows AD. In this case you would SSH with a kerberos username and password and you are authenticated as usual, and created a local home directory if you dont already have one and can proceed as a normal local user.
In this case all of our servers are Ubuntu Server 16.04/16.10, and this cannot be changed.
I've followed along and studied with the O'Reilly book 'Kerberos: The Definitive Guide" and from here I've managed to set up my KDC and DNS, as far as I can tell, correctly. The problem appears to be when I try to set up a client. I poke the krb5.conf file to the right places, make sure I have user principals but whenever I try to log in, it hangs for a second then authentication fails with the error: Decrypt integrity check failed in auth.log
In this case I'm using the PAM module pam_krb5.so and pam_mkhomedir.so to create a new user home directory. These were set using Ubuntu's pam-auth-update utility.
I can get kerberos tickets just fine if I manually kinit from the client machine, but login seems to completely fail.
For a while we tried to evaluate FreeIPA but that seemed to fail spectacularly and un-resovably on Ubuntu for us, it seemed like more trouble than it's worth.
I'm really not sure what I'm missing here, and every time I try to find information on the subject it feels like I'm missing some crucial step that's expected of me but no one seems to tell me?
Thanks!


text:
Q: Fragments and DialogFragments deprecated, what will replace them? We can read in official Android doc

android.app.Fragment
  This class was deprecated in API level 28.
  Use
  the Support Library Fragment for consistent behavior across all
  devices and access to Lifecycle.This class was deprecated in API level 28.

What is going on ?
What we should use now instead of Fragments and DialogFragments ?

A: You have to change the import statement only.
From : android.app.Fragment
To: android.support.v4.app.Fragment
That's it

A: Now,You can use Fragment Support library (AndroidX) from Android P(28).
Add following in gradle.properties
android.useAndroidX=true
android.enableJetifier=true

Add following dependency in project build.gradle
implementation 'androidx.fragment:fragment:1.0.0'

Change import statement from
Fragment: import android.app.Fragment;
DialogFragment: import android.app.DialogFragment;
TO
Fragment: import androidx.fragment.app.Fragment;
DialogFragment: androidx.fragment.app.DialogFragment;
Reference link provided by Google: https://developer.android.com/jetpack/androidx/migrate


text:
Q: Starting webdriver from protractor configuration file fails to start If I start webdriver externally and point protractor to the URL, my protractor tests run just fine.
If I set up protractor to start up my webdriver server with:
  seleniumServerJar: '/usr/local/lib/node_modules/protractor/selenium/selenium-server-standalone-2.42.2.jar',
  chromeDriver: '/usr/local/lib/node_modules/protractor/selenium/chromedriver',

then the tests fail with
Starting selenium standalone server...
Selenium standalone server started at http://X.X.X.X:37711/wd/hub

/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1539
      var result = fn();
                   ^
Error: Error while waiting for Protractor to sync with the page: {"message":"Can't find variable: angular","name":"ReferenceError","line":4,"stack":"ReferenceError: Can't find variable: angular\n    at :4\n    at anonymous (:9)\n    at Na (phantomjs://webpage.evaluate():14)\n    at phantomjs://webpage.evaluate():15\n    at phantomjs://webpage.evaluate():15\n    at phantomjs://webpage.evaluate():16\n    at phantomjs://webpage.evaluate():16\n    at phantomjs://webpage.evaluate():16","stackArray":[{"sourceURL":"","line":4},{"sourceURL":"","line":9,"function":"anonymous"},{"sourceURL":"phantomjs://webpage.evaluate()","line":14,"function":"Na"},{"sourceURL":"phantomjs://webpage.evaluate()","line":15},{"sourceURL":"phantomjs://webpage.evaluate()","line":15},{"sourceURL":"phantomjs://webpage.evaluate()","line":16},{"sourceURL":"phantomjs://webpage.evaluate()","line":16},{"sourceURL":"phantomjs://webpage.evaluate()","line":16}],"sourceId":140630251385168}
    at Error (<anonymous>)
    at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1412:15
    at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1561:7
    at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1243:15
    at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1539:20)
    at notify (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:362:12)
    at notifyAll (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:331:7)
    at resolve (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:309:7)
    at reject [as errback] (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:439:5)
    at reject (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1725:5)

Any ideas what might cause this issue?


text:
Q: Javascript - Prepend Element when event listener trigger mouse enter I would like to get some advise from you guys, how can I prepend html element when the event listener listen I mouse enter to the container area. I am using ReactJS to build my frontend. I encounter an issue as I cannot prepend the html element by using the event target which is provided by the callback of the event listener. I have included my code snippet as below:
box.addEventListener("mouseleave", function (evt) {
        evt.target.style.border = "unset";
      });
      box.addEventListener("mouseenter", function (evt) {
        evt.target.style.border = "1px solid red";
        var div = document.createElement("div");
        div.style.backgroundColor = "red";
        div.style.height = "10px";
        div.style.width = "10px";
        evt.target.parentNode.insertBefore(evt.target,div);
      });

In fact, I would like to prepend below div to the container parent whenever I mouseenter the div container.

I really appreciate your contribution.

A: Unfortunately they way you are trying is not the react way.
You need to use state and if statements in your code with React way.
Here is a sample for you:
https://codesandbox.io/s/distracted-tree-1fpjnr
import { useState } from "react";
import "./styles.css";

export default function App() {
  const [isShowDiv, setIsShowDiv] = useState(false);
  return (

 setIsShowDiv(false)}
      onMouseEnter={() => setIsShowDiv(true)}
    >
      {isShowDiv && (

      )}

Hello CodeSandbox

Start editing to see some magic happen!

  );
}


text:
Q: Determine the location of $(x_0, y_0)$ in terms of $h$ and $L$ using Calculus ideas This is part of a Calculus 1 project and I am sorely stuck on this part.
Let's say you have a circle with center $(h,0)$ and radius $L$. This may or may not matter, but you can assume $h$ is positive and the tangent line of the point $(x_0, y_0)$ on the circle runs through the origin, $(0,0)$. "Determine the location of $(x_0, y_0)$ in terms of $h$ and $L$ using Calculus ideas."
Up to this point, I have found the equation for the tangent line at $(x_0, y_0)$ using implicit differentiation,  and I understand that the equation for this circle can be expressed as: $(x-h)^2+y^2=L^2$
I have tried to come up with equations to find $x_0=$ and $y_0=$ where I only use $h$ and $L$, but I'm not sure that's the right approach, let alone how to use calculus to find it. Any input is super appreciated, thank you!


text:
Q: PropertyData Value Array I'm trying to get a specific value over an wmi query. I know that this value is stored in an array itself but I can't get access on it.
ManagementObjectSearcher ^searcher =
    gcnew ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_DiskDrive WHERE PNPDeviceID LIKE '" + marshal_as<String^>(DEV_FILTER) +"%'");

for each (ManagementObject ^drive in searcher->Get())
{
    for each (ManagementObject ^o in drive->GetRelated("Win32_DiskPartition"))
    {
        for each (ManagementObject ^logDisk in o->GetRelated("Win32_LogicalDisk"))
        {
            Console::WriteLine(
                "Disk: " + drive["Caption"]
                + "\n\tSize        : " + drive["Size"]
                + "\n\tDriveLetter : " + logDisk["Name"]
                + "\n\t" + drive["PNPDeviceID"]
                + "\n\tSerialNumber: " + drive["SerialNumber"]
                + "\n\t" + drive["Capabilities"]
                + "\n\tRevision    : " + drive["FirmwareRevision"]);
        }
    }
}

on Debug investigation, I can see every single Value of drive["Capabilites"] but everything I've tried so far, I can't get this array's child values.
I want to do this in c++,
every help is appreciated.

A: To access such values you must cast the property and an array and then iterate over the elements. try this C++ CLI sample code.
#include "stdafx.h"
#using <system.management.dll>

using namespace System;
using namespace System::Management;

int main(array<System::String ^> ^args)
{
    ManagementObjectSearcher ^searcher =
        gcnew ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_DiskDrive");

    for each (ManagementObject ^drive in searcher->Get())
    {
        for each (ManagementObject ^o in drive->GetRelated("Win32_DiskPartition"))
        {
            for each (ManagementObject ^logDisk in o->GetRelated("Win32_LogicalDisk"))
            {
                Console::WriteLine(
                    "Disk: " + drive["Caption"]
                + "\n\tSize : " + drive["Size"]
                + "\n\tDriveLetter : " + logDisk["Name"]
                + "\n\t" + drive["PNPDeviceID"]
                + "\n\tSerialNumber: " + drive["SerialNumber"]
                + "\n\tRevision : " + drive["FirmwareRevision"]);
                Console::WriteLine("Capabilities");
                for each(UInt16 v in (array<UInt16>^)(drive->Properties["Capabilities"]->Value))
                {
                    Console::WriteLine(v);
                }
            }
        }
    }
    Console::ReadLine();
    return 0;
}


text:
Q: Match if date is within date range google sheets I have two columns with a start (column B) and end (column C) date range, and a cell (G1) with a date.
I want to be able to look at columns B and C and return true if G1 falls in between any of the date range of B and C, and if G1 is not within the date, return false.
Any suggestions on how to do this?

A: You can use the following formula
=IFERROR(IF(
     QUERY(L2:M14,"WHERE L <= DATE '"&TEXT(K2, "yyyy-mm-dd")&"'
                     AND M >= DATE '"&TEXT(K2, "yyyy-mm-dd")&"'")
                              >0,TRUE),FALSE)

(Please adjust ranges to your needs)
Functions used:

*

*QUERY

A: Assuming this formula is used on row 2, this will work:
=ISBETWEEN($G$1,$B2,$C2)

Change $B2 and $C2 appropriately if you're not on row 2.
Note that the ISBETWEEN() function has two additional optional boolean parameters to control whether the start/end dates are inclusive or exclusive for the range; both default to TRUE for inclusive endpoints.


text:
Q: Memory usage oddity (memory leak?) I have the following type and two relevant functions that I intend to measure as a part of a large list fold:
Type and access functions:
data Aggregate a = Aggregate (Maybe a) (a -> Aggregate a)

get :: Aggregate a -> Maybe a
get (Aggregate get' _) = get'

put :: Aggregate a -> a -> Aggregate a
put (Aggregate _ put') = put'

First function:
updateFirst :: Maybe a -> a -> Aggregate a
updateFirst cur val = Aggregate new (updateFirst new)
  where new = mplus cur (Just val)

first :: Aggregate a
first = Aggregate Nothing (updateFirst Nothing)

Second function:
updateMinimum :: Ord a => Maybe a -> a -> Aggregate a
updateMinimum cur val = Aggregate new (updateMinimum new)
  where new = min <$> (mplus cur (Just val)) <*> Just val

minimum :: Ord a => Aggregate a
minimum = Aggregate Nothing (updateMinimum Nothing)

The functions are written in a way that the memory should be constant. Therefore, I have opted in to use the Strict language extension in GHC, which forces the thunks to be evaluated. The Weigh library was used to perform the allocation measurements:
test :: A.Aggregate Double -> Int -> Maybe Double
test agg len = A.get $ F.foldl' A.put agg (take len $ iterate (+0.3) 2.0)

testGroup :: String -> A.Aggregate Double -> Weigh ()
testGroup name agg = sequence_ $ map (\cnt -> func (str cnt) (test agg) cnt) counts
  where
    counts  = map (10^) [0 .. 6]
    str cnt = name ++ (show cnt)

main :: IO ()
main =
  mainWith
    (do setColumns [Case, Allocated, Max, GCs]
        testGroup "fst" A.first
        testGroup "min" A.minimum
    )

The Weigh output is as follows:
Case          Allocated          Max  GCs
fst1                304           96    0
fst10             2,248           96    0
fst100           21,688           96    0
fst1000         216,088           96    0
fst10000      2,160,088           96    2
fst100000    21,600,088           96   20
fst1000000  216,000,088           96  207
min1                552           96    0
min10             4,728           96    0
min100           46,488           96    0
min1000         464,088           96    0
min10000      4,967,768           96    4
min100000    49,709,656    6,537,712   44
min1000000  497,226,840  103,345,512  445

Why does GHC suddenly allocate way more memory in the inputs of size 10^5 and 10^6? My GHC version is 8.4.4.

A: Strictness annotations in Haskell are "relational" so to speak. They say that something must be evaluated to WHNF (weak head normal form) whenever something else is evaluated to WHNF.
For function arguments, it means that a function argument will be evaluated to WHNF before the function application itself is evaluated to WHNF.
For strict fields, it means the field will be evaluated to WHNF whenever the containing value is evaluated to WHNF. This is useful for maintaining the "chain of strictness" in datatypes that serve as accumulators (for example a datatype working as the accumulator of a foldl'). Otherwise, thunks can hide behind lazy fields even as the containing value remains in WHNF, and cause a space leak. In particular, tuples don't have strict components, and are a common source of space leaks in accumulators.
Maybe also isn't strict on the value contained in the Just constructor. In fact, this was the cause of the problem. The value inside the Just was never forced during the course of the foldl', and thunks accumulated there.
Why didn't Strict prevent the problem? Because it only affects function and datatype definitions in the current module, and Maybe was defined elsewhere. The solution is to manually force the value inside the Just at each iteration, or perhaps define your own "strict Maybe".


text:
Q: How can I mock two Uri components in one method I have two url calls in one method that is in addnewMap() - one is the buildGetSubtenantsURL and the other is buildGetAssetsURL
public void addNewMap(MapDTO mapDTO) {
        log.info("going to add the map data into db");
        if (mapRepository.existsMapWithMapName(mapDTO.getMapName()))
            throw new BadRequestException("Map with map name " + mapDTO.getMapName()
                    + " already exists. Please provide a different map name.");
        Map<String, String> subtenantInfoMap = new HashMap<>();
        Maps mapEntity = new Maps();
        String iottenant = mapDTO.getTenant();
        String subtenantsURL = buildGetSubtenantsURL(null);
        String subTenantsResponse  = getSubtenants(subtenantsURL,iottenant);
        JSONObject subTenant = getSubtenantName(subTenantsResponse);
        checkForMultiplePagesSubtenants(subTenantsResponse, subtenantInfoMap,iottenant);

        if(subtenantInfoMap.get(mapDTO.getSubtenantName()) != null) {
            mapEntity = Maps.builder().subtenant(subtenantInfoMap.get(mapDTO.getSubtenantName()).toString()).build();
        }
        else {
            throw new DataNotFoundException(SUBTENANT_DOESNT_EXIST);
        }

        String SubtenantId = subtenantInfoMap.get(mapDTO.getSubtenantName());
        UriComponents assetsURL = buildGetAssetsURL(iottenant,SubtenantId);
        String assetsResponse = getAssets(assetsURL, iottenant);
        String mindsphereAssetId = getAssetId(assetsResponse);

        if(mindsphereAssetId.isEmpty()) {
            throw new DataNotFoundException(ASSET_ID_DOESNT_EXIST);
        }
        else {
            mapEntity = Maps.builder().mindsphereAssetId(mindsphereAssetId).build();
        }

        mapEntity = Maps.builder().mapName(mapDTO.getMapName()).displayName(getDisplayName(mapDTO))
                .description(Objects.nonNull(mapDTO.getDescription()) ? mapDTO.getDescription() : null)
                .tenant(getTenantNameForMapDTO(mapDTO)).mindsphereAssetId(mindsphereAssetId).subtenant(subtenantInfoMap.get(mapDTO.getSubtenantName()).toString())
                .mapLocation(mapDTO.getMapLocation()).operator(mapDTO.getOperator()).recipeName(mapDTO.getRecipeName()).subtenantName(mapDTO.getSubtenantName())
                .createdBy(getUserEmail()).createdAt(new Timestamp(System.currentTimeMillis()))
                .build();
        Maps createdMap = mapRepository.saveAndFlush(mapEntity);
        addStationsMappingforNewMap(createdMap);
    }

I have written the test case for the above method as:
@Test
     public void addNewMap() {

         map = Maps.builder().mapId(1l).mapName("testMap").displayName("Map Test").mindsphereAssetId("a0609ebf2eb7400da8a5fd707e7f68b7").mapLocation("hyd").operator("operator").recipeName("recipe").subtenantName("NSTI").tenant("ctlbrdev").subtenant("9b04027dde5fbd047073805ab8c1c87c")
                    .tenant(Tenant).build();
            maps = Arrays.asList(map);
            mapDTO = MapDTO.builder().mapId(1l).mapName("testMap").displayName("Map Test").subtenantName("NSTI").mapLocation("hyd").recipeName("recipe").operator("operator").description("description")
                    .tenant("ctlbrdev").build();
            ReflectionTestUtils.setField(mapService, "mindsphereBaseURL", MindsphereBaseURL);
            ReflectionTestUtils.setField(mapService, "mindsphereSubtenantsURL", mindsphereSubtenantsURL);
            ReflectionTestUtils.setField(mapService, "mindsphereAssetsURL", mindsphereAssetsURL);
            when(restTemplate.exchange(ArgumentMatchers.anyString(), ArgumentMatchers.any(HttpMethod.class), ArgumentMatchers.any(HttpEntity.class),
                    ArgumentMatchers.<Class<String>>any()))
            .thenReturn(new ResponseEntity<String>(entityDtoCreaters.getSubtenant(),HttpStatus.OK));
            when(tokenCaching.retrieveHeadersContainingTechToken("ctblrdev")).thenReturn(new HttpHeaders());
      when(mapRepository.existsMapWithMapName(any())).thenReturn(false);
      //doReturn(Tenant).when(mapService).getTenantName();
      doReturn(EMAIL).when(mapService).getUserEmail();
      when(mapRepository.saveAndFlush(any())).thenReturn(map);
      when(restTemplate.exchange(ArgumentMatchers.anyString(), ArgumentMatchers.any(HttpMethod.class), ArgumentMatchers.any(HttpEntity.class),
                ArgumentMatchers.<Class<String>>any()))
        .thenReturn(new ResponseEntity<String>(entityDtoCreaters.getSubtenant(),HttpStatus.OK));
      Map<String, String> subtenantInfoMap = new HashMap<>();
      subtenantInfoMap.get(mapDTO.getSubtenantName());
      mapService.addNewMap(mapDTO);

It is not covering the getAssets() method, hence not covering the whole method. how can I achieve this?


text:
Q: Updated Bash via Homebrew (from 5.0.17 to 5.0.18). Now I get Error message after starting Terminal Updated Bash via Homebrew (from 5.0.17 to 5.0.18). Now I get this Error message after starting Terminal:

[Command not found: /usr/local/Cellar/bash/5.0.17/bin/bash]

[Could not create a new process and open a pseudo-tty.]

Any help would be highly apprciated. TIA

A: One thing that's easy to set and easier to forget later is if you have your terminal program run a specific command rather then leave you in the default shell that chsh configures.
Have a look there after a brief inspection of your dot files before debugging the startup files systematically is my advice.


text:
Q: Синие перемычки на материнской плате, для чего они? нашел на материнской плате такие перемычки, и стало интересно. что это такое? как они называются? для чего они? куда именно их вставлять? почему не на всех материнских платах расположены?

A: На изображении:
Левый - Clear RTC, сбрасывает настройки CMOS (BIOS).
Правый - переключает системный блок в режим +5VSB(Standby) в котором питание на шину 5В подаётся даже когда компьютер выключен (для функций Wake-on-Mouse/Keyboard/Lan)
В документации к конкретной материнской плате будет расписан функционал каждого положения для джампера.

A: Это перемычки (буквальный перевод слова jumper, есть хардварный сленг - "джампер"). Используются для различных настроек, но самый популярный джампер сейчас это, пожалуй, сброс CMOS (требуется если нет возможности войти в BIOS, например при неудачном разгоне процессора). Ранее перемычки были более распространены, но сейчас большинство настроек ушло в BIOS и управляется программно, что несравненно удобнее.


text:
Q: Changing EditText on button click I want to change the text in an EditText widget when the user clicks on a button. For example: When button1 is pressed, "1" should be displayed in the EditText field but if button2 is pressed then "2" should be displayed.

A: Make sure to have an ID for your edittext field and have a onclick methods for your buttons. Then you can use .setText() on your edittext field in your java.
Your XML:
<EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/yourId"/>
<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Button 1"
    android:onClick="button_1"/>
<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Button 2"
    android:onClick="button_2"/>

Your Java:
public void button_1(View view) {
    //Button 1 is clicked
    ((EditText)findViewById(R.id.yourId)).setText("1");
}
public void button_2(View view) {
    //Button 2 is clicked
    ((EditText)findViewById(R.id.yourId)).setText("2");
}

This changes the text in the edittext field to respectivly 1 and 2 when button 1 or button 2 is clicked.


text:
Q: Count words in a given String I have two approach to determine number of words in String, But the result is 1 forever!
public static void main(String[] args) {

    System.out.println("Enter your String:");
    String string = in.next();
    System.out.println("Number of Words are:" + countWords(string));
    System.out.println("Number of Words are:" + countWords2(string));

}

public static int countWords(String str) {
    String[] splited2 = str.split(" ");
    return splited2.length;

}

public static int countWords2(String str) {
    String trimed = str.trim();
    return trimed.split("\\s+").length;
}

Why?

A: Scanner#next() method, which is what I assume you are using, reads the next token, and by default it doesn't consider whitespaces as a part of token. So, it really reads the input till it finds the first whitespace.
So, your input contains just a single word, and hence the result. Try using Scanner#nextLine() method, and you will get the expected result.

A: Replace in.next() by scanner.nextLine() because next() will give you the next token not all the line
Scanner scanner = new Scanner(System.in);
System.out.print("Enter a sentence:");
String sentence = scanner.nextLine();
System.out.println("Number of Words are:" + countWords(sentence));

Or you can use BufferedReader as it is faster in reading whole line
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String sentence = br.readLine();
System.out.println("Number of Words are:" + countWords(sentence));

A: I would suggest building a function like this:
public static int getWordCount(String string){

    int counter = 0;

    boolean wordFound = false;
    int endOfLineIndex = s.length() - 1;

    for (int i = 0; i < endOfLineIndex; i++) {

        if (Character.isLetter(s.charAt(i)) == true)) {
            wordFound = true;
        } else if (Character.isLetter(string.charAt(i)) == false && wordFound == true) {
            counter++;
            wordFound = false;
        } else if (Character.isLetter(string.charAt(i))) {
            counter++;
        }
    }
    return counter;
}

Hope I helped!


text:
Q: How can I set the name attribute of a WTForm Field, without changing the variable name? I am trying to set the name of these WTForm fields without having to change the name of the variables themselves. Any help is appreciated.
class AddProblemForm(Form):
    problem_point_value_data = [[10, 20, 30], [40, 50, 60], [70, 80, 90, 100], [120, 140, 160, 180, 200]]
    problemName = StringField('problemName',_name="problemName", validators=[validators.DataRequired(), validators.Length(min=2, max=64)])
    problem_description = PageDownField('problemDescription', validators=[validators.DataRequired(), validators.Length(min=10, max=512)])
    flag = StringField('flag', validators=[validators.DataRequired(), validators.Length(min=5, max=64)])
    problem_difficulty = SelectField('problemDifficulty', choices=[(x, x) for x in range(4)], coerce=int)
    problem_points = SelectField('problemPoints', choices=[(x, diff) for x,diff in zip(range(len(app.config['POINTS'])), app.config['POINTS'])], coerce=int)
    problem_category = SelectField('problemCategory', choices=[(x, cat) for cat,x in zip(app.config['CATEGORIES'], range(len(app.config['CATEGORIES'])))], coerce=int)
    problem_solution = TextAreaField('problemSolution', validators=[validators.DataRequired()])

A: The problem here (and yes that pun is absolutely intended!) is that you have defined a field with problemName = StringField(). There is nothing else that this field is called other than 'problemName'.
The text label is a different matter as Moses has commented, your HTML can display anything.


text:
Q: What is the Address Format of XMPP? If I type "netstat -an" on CMD how can I tell what connections are based off messaging services - particularly XMPP?

A: If the XMPP servers that a connection has been made to are using the standard ports, you can filter on the following ports:
5222 TCP     XMPP client connection (RFC 3920)        Official
5223 TCP     XMPP client connection over SSL          Unofficial
5269 TCP     XMPP server connection (RFC 3920)        Official
5298 TCP UDP XMPP JEP-0174: Link-Local Messaging /    Official
         XEP-0174: Serverless Messaging
8010 TCP     XMPP File transfers                      Unofficial

Apart from that you cannot determine what connection is being used by which protocol by looking at TCP connections. You would have to sniff the connections by using a packet sniffer (Wireshark). Wireshark does contain filters for protocols.


text:
Q: Проблема в решении задачи по программированию на создание и применение генератора
Cоздать функцию-генератор, в которую подаётся список и количество
итераций. Генератор выводит элементы списка со случайными индексами (в
случайном порядке). Примечание: нельзя выходить за пределы списка;
понадобится использование функции random.choice() из модуля random.

Моя попытка:
from random import choice

lst1 = [0,1,2,3,4,5,6,7,8,9]
def ran_gen(lst1):
    for i in lst1:
        print(choice(i))
    yield lst1

next(ran_gen(lst1))

Прошу не зверствовать в комментариях, я новичок и только осваиваю программирование, поэтому ищу помощи:) Заранее благодарю ответивших!

A: Думаю, должно быть так:
lst1 = [0,1,2,3,4,5,6,7,8,9]
def ran_gen(lst1, count):
    for i in range(count):
        yield choice(lst1)

for i in ran_gen(lst1, 10):
    print (i)

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


text:
Q: How to automate the following task? Daily i wanna copy some files from a remote system and i have to put all those files in on a folder on that date say .Is it possible to automate this task? What we do presently is we log on to the remote machine through VNC and we go to the preferred location and copy those files and put it on a folder.If some day we forget this we wont be able to take records for that day coz the files will be overwritten.So i would like to automate this task, is it possible? Can someone help me please.Thanks in adavance..
Note: The remote system runs Windows XP Professional

A: You can take the Windows-being-useless issue out of the equation very simply: create a share and mount it on your Linux machine (with smbfs or CIFS). It's fairly simple so I'll leave that between you and the Ubuntu Help Pages.
From there it's fairly simple:

*

*Create a script. Call it something logical, put it somewhere where you won't trip over it or accidentally move it. chmod +x it too.

*Get your script to do what you want. I'll assume you mounted your writable Windows share as /mnt/win (mount it under /mnt/ if you don't want it show up in nautilus) and that you want these directories stored in ~/daily-backups/.
#!/bin/bash

SRC="/mnt/win"
OUT="~/daily-backups"
DATE=$(date '+%Y-%m-%d')

NEWDIR="$OUT/$DATE"

# make the new directory for today and cd into it
mkdir -p "$NEWDIR"
cd "$NEWDIR"

cp -R "$SRC/*" . # could use rsync

*cron it up. Assuming your script is called ~/daily-backups/do-backups. Type crontab -e and in the editor add a new line like this:
0 22 * * * ~/daily-backups/do-backups

And that will run your script every day at 10pm. Obviously you might want to tune that to a more sentible time but I wouldn't leave it until midnight or the datestamp might get confusing.

A: If you can put Cygwing on that Windows box then rsync (over ssh) and cron would be the standard solution.
It's not easy.
Search for "backups with rsync", this would come up first:
http://www.mikerubel.org/computers/rsync_snapshots/ - a really good resource. Explains how to setup backups with snapshots (timestamps).


text:
Q: Google Chrome opens a blank page when searching from Chrome Omnibox / address bar When I enter a search criteria in the Omnibox, Chrome seems to offer me a blank page instead of completing the search & offering the results.
Note that if I opt for a Google Instant/Omnibox suggestion, it works fine

However, I choose to ignore the suggestion and try to do a Google search, I get a blank page.

What can I do make the Omnibox search complete successfully?

A: This is what fixed it for me:
1. Cleared my cache and cookies for the last week.
Went to: chrome://chrome/settings/ At the bottom of the page you'll see 'Show Advanced Settings' and Clear Browsing data...
2. Deleted Google Drive Extension
Open a new tab, right click on Google Drive Icon and Delete Extension
3. Turned instant search ON (it was originally turned off in my computer)
I suppose turning it off and on again would do the trick...
4. Restarted Browser
The problem is fixed and the omnibar search has been working fine for the last hour. Both instant search ON and OFF work for me...
Cheers

A: Clearing cache doesn't work.
To solve this problem, disable instant search. This is a widespread issue occurring today, and it appears that is the fix.
It worked for me, I hope it works for you.

A: I disabled instant search from Google.com's search settings option, which BTW, does not appear till you first search something (or maybe I can't find it). This solved it. However, enabling Instant Search again seems to keep the problem away and I am no longer facing it.

A: Wow all that extra stuff. All you need to do:
Add a new a search engine in wrench >> settings >> search "Manage Search Engines".
Under "other search engines" add a new search engine using this address for the URL:
http://www.google.com/search?q=%s

Name it "Google 2″ or whatever you want. Works like a charm.

A: Another option is go to setting-searchengine and select google and change .com to your country. In my case changing it to NL solved to issue.


text:
Q: Angular-cli- Unable to bundle font-awesome I have built my Angular2 app and everything is working fine. Now I included font-awesome and when I bundled the app it gives the error shown in the picture. It is unable to load woff and woff2 files.
My styles look like below -
            "styles": [
        "styles.css",
          "../node_modules/font-awesome/css/font-awesome.css",
          "../node_modules/primeng/resources/primeng.min.css",
  "../node_modules/primeng/resources/themes/omega/theme.css",
  "../node_modules/fullcalendar/dist/fullcalendar.css",
  "../node_modules/bootstrap/dist/css/bootstrap.min.css"
      ],

A: AS the folder structures are changed in angular recent version you should be referring to a wrong path fix it by
"styles": [
    "styles.css",
      "node_modules/font-awesome/css/font-awesome.css",
      "node_modules/primeng/resources/primeng.min.css",
      "node_modules/primeng/resources/themes/omega/theme.css",
      "node_modules/fullcalendar/dist/fullcalendar.css",
      "node_modules/bootstrap/dist/css/bootstrap.min.css"
  ],


text:
Q: Wrong bounding box size of text with MeasureText using NoPadding option I need to get the real bounding box, where is no padding at all(from all directions). I need it for packing words into rectangle. Unfortunately it does not work like I want. I searched a lot on the internet. Thanks in advance
// EDIT
I figured out that with other overloaded function MeasureText where I send also e.Graphics, I get this nicer but not completely what I want.
So is there any way how to clamp it to barebone text rectangle? I have an idea about drawing it into bitmap and checking top colored pixel and so on and then make a rectangle, but it would be slow I think.

e.Graphics.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
Dim wordFont As New System.Drawing.Font("Times", 100, FontStyle.Regular)
'Here is the change, I send also e.Graphics
Dim recSize = TextRenderer.MeasureText(e.Graphics, "THE", wordFont,
                                       New Size(Integer.MaxValue, Integer.MaxValue),
                                       TextFormatFlags.NoPadding)

e.Graphics.DrawRectangle(Pens.Red, New Rectangle(0, sum, recSize.Width, recSize.Height))
TextRenderer.DrawText(e.Graphics, "THE", wordFont, New Point(0, 0),
                                      Color.Black, TextFormatFlags.NoPadding)


text:
Q: Wordpress column-count sort I have a div.content with posts and I use column-count to show 2 columns but my posts are display like this http://i.imgur.com/kaX6Zol.png but I want display this http://i.imgur.com/8pIorvC.png . From left to right.
Thanks

A: Check out this code:
HTML

    Post 1

    Post 2

    Post 3

    Post 4

CSS
#placeholder {
 width:200px;
}

.post{
 width:40%;
 display:inline-block;
 text-align:center;
 border:thin solid #000;
 margin-top:10px;
}

See the code in action here: http://jsfiddle.net/zfq4q3mn/


text:
Q: Differences between subgroup analysis results from meta and metafor packages I am doing a meta analysis using R. After running an overall random effect model I wanted to look at subgroups in a mixed-effect model and was using the meta and dmetar package (Doing Meta Analysis in R), using the metagen()function which worked fine.
However, I might have issues with 1) non-independend data and 2) also correlated sampling errors in some cases. Thus, I thought about switching to the metafor package to use 1) the rma.mv() function to account for the non-independet data and using a 3-level model and 2) use the robust () function for the cases where I have correlated sampling errors.
In doing so I compared the metagen with the rma model. I could get similar results for the basic (reduced) random effects model.
But when I run the mixed-effect subgroup analysis I get very different results. I'm trying to figure out why because using one package indicates there is a significant heterogeneity between the groups whereas the other doesn't. Does anyone have any experience with these packages to know why?
Then I ran a random effects model with metagen () ...
MA1 <- metagen(TE, seTE, data = mydata, studlab = paste(ID),comb.fixed = FALSE,comb.random = TRUE,
             method.tau = "REML",  hakn = FALSE, sm = "SMD")

and rma ()
MA2 <- rma(TE, var, data = mydata, method="REML")

This yields the same results.
However if I do this:
MA1.taxa <- metagen(TE, seTE, data = mydata, studlab = paste(ID), comb.fixed = FALSE, comb.random = TRUE, method.tau = "REML",  hakn = FALSE, sm = "SMD", byvar = Taxa)

and the same using rma:
MA2.taxa <- rma(TE, var, mod= ~Taxa, data = mydata, method = "REML")

I get very different results.
It would be great if someone could help me out here. I have the feeling it might have something to do with some of the arguments which I didn't specify correctly. But in looking in the packages I couldn't figure it out.
This is my data frame:
**"ID"**|**"Study"**|**"Organism"**|**"Taxa"**|**"Species"**|**"Ne"**|**"Me"**|**"Se"**|**"Nc"**|**"Mc"**|**"Sc"**|**"TE"**|**"seTE"**|**"var"**
:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:
1|1|1|"A "|"F"|10|259.5|41.1096|10|405.5|15.8114|-4.48970286181781|0.86566827459304|0.74938156163689
2|1|1|"A "|"F"|10|285.9|12.6491|10|452.5|15.8114|-11.1441917779727|1.89336302866627|3.58482355832032
3|1|1|"A "|"F"|10|301.5|12.6491|10|459.1|12.6491|-11.9329315975384|2.02012537466928|4.08090652938268
4|2|2|"B "|"N"|8|40.58|8|8|565.3|8|-62.0123636363636|11.6055591474517|134.689003125
5|2|3|"B "|"Q"|8|15.59|1|8|436.2|5|-110.293157961666|20.6281624673369|425.521086778846
6|2|4|"B "|"R"|8|40.58|8|8|565.3|8|-62.0123636363636|11.6055591474517|134.689003125
7|3|5|"B "|"C"|4|1.887|1.9|4|519.3|26|-24.40757392403|7.05271437893494|49.7407801108356
8|3|6|"B "|"J"|4|18.4|1.5|4|519.3|24|-25.6159441945354|7.39845232761053|54.7370968439256
9|4|7|"B "|"K"|6|0.8174|2.4495|6|296.3|3.1843|-96.0142079773492|21.2399012943102|451.133406992038
10|5|8|"B "|"G"|12|20.2|2.4744|12|30.05|5.8324|-2.12287801050705|0.517088404453606|0.267380418020376
11|6|9|"C"|"A"|4|317.4|44|4|509.2|20|-4.88010696352562|1.5711445799467|2.46849529109589
12|6|10|"C"|"B"|4|333.3|20|4|541.8|16|-10.0108579072198|2.96371122455629|8.78358422256097
13|7|11|"B "|"S"|5|93|8.9443|5|477|11.1803|-34.2583184199475|8.50469827426505|72.329892736287
14|8|12|"B "|"H"|8|175.4|19.799|8|330.4|19.799|-7.4016594042858|1.4714809993973|2.16525633158727
15|9|13|"C"|"E"|6|353|7|6|584|14|-19.2655685142566|4.2992247363139|18.4833333333333
16|10|14|"C"|"O"|5|307.3|8|5|546.798|16|-17.1016587915647|4.28074511636117|18.32477875125
17|11|15|"B "|"D"|12|85.77|9|12|954.8|9|-93.2292720306513|13.9430530966266|194.40872965535
18|11|15|"B "|"D"|12|105.5|9|12|943.5|9|-89.9003831417625|13.4456304955873|180.784979423868
19|11|16|"B "|"I"|12|519.1|9|12|834.2|9|-33.8038314176245|5.06988227434525|25.7037062757202
20|11|16|"B "|"I"|12|504.6|9|12|861.6|9|-38.2988505747126|5.73992676427664|32.9467592592593
21|12|17|"B "|"M"|10|60|12.6491|6|187|31.8434|-5.56823589086092|1.16215466879402|1.35060347419974
22|12|17|"B "|"M"|10|74.6|12.6491|6|227|31.8434|-6.6818830690331|1.35186377624163|1.82753566951429
23|12|17|"B "|"M"|10|92.5|18.9737|12|276|13.8564|-10.7914331134072|1.74445205185438|3.04311296121895
24|13|18|"B "|"P"|6|334.7|29.3939|6|405.3|12.2474|-2.89426691425862|0.861952319419821|0.742961800953209
25|13|19|"B "|"P"|6|397.7|12.2474|6|407.5|39.1918|-0.311566458691052|0.581446713087198|0.338080280159906
26|14|20|"B "|"L"|3|216|36.3731|3|356|39.8372|-2.93620355270232|1.33762126119416|1.78923063839866
27|15|21|"B "|"P"|13|153.4|69.2266|19|163.1|51.8709|-0.159116969627101|0.360514880984436|0.129970979411222
28|16|22|"B "|"M"|5|124.6|2.2361|5|665.6|2.2361|-218.525630021163|54.1029220348491|2927.12617270896

A: The meta-regression model fitted via rma() assumes that there is one common $\tau^2$ value within the subgroups, while metagen() with byvar allows $\tau^2$ to differ between subgroups. An illustration:
library(metafor)
library(meta)

dat <- dat.bcg
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat)
dat$sei <- sqrt(dat$vi)

First, we fit the meta-regression model with rma(). I will remove the intercept term, so that the model coefficients are the estimated average effects for each level of the moderator:
rma(yi, vi, data=dat, mods = ~ 0 + alloc)

These are the results:
Mixed-Effects Model (k = 13; tau^2 estimator: REML)

tau^2 (estimated amount of residual heterogeneity):     0.3615 (SE = 0.2111)
tau (square root of estimated tau^2 value):             0.6013
I^2 (residual heterogeneity / unaccounted variability): 88.77%
H^2 (unaccounted variability / sampling variability):   8.91

Test for Residual Heterogeneity:
QE(df = 10) = 132.3676, p-val < .0001

Test of Moderators (coefficients 1:3):
QM(df = 3) = 15.9842, p-val = 0.0011

Model Results:

                 estimate      se     zval    pval    ci.lb    ci.ub
allocalternate    -0.5180  0.4412  -1.1740  0.2404  -1.3827   0.3468
allocrandom       -0.9658  0.2672  -3.6138  0.0003  -1.4896  -0.4420  ***
allocsystematic   -0.4289  0.3449  -1.2434  0.2137  -1.1050   0.2472

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Now the same analysis using metagen():
metagen(yi, sei, data=dat, comb.fixed=FALSE, method.tau="REML", byvar=alloc)

These are the results:
Number of studies combined: k = 13

                                         95%-CI     z  p-value
Random effects model -0.7145 [-1.0669; -0.3622] -3.97 < 0.0001

Quantifying heterogeneity:
 tau^2 = 0.3132 [0.1197; 1.1115]; tau = 0.5597 [0.3460; 1.0543];
 I^2 = 92.1% [88.3%; 94.7%]; H = 3.56 [2.93; 4.34]

Quantifying residual heterogeneity:
 I^2 = 92.4% [88.4%; 95.1%]; H = 3.64 [2.94; 4.50]

Test of heterogeneity:
      Q d.f.  p-value
 152.23   12 < 0.0001

Results for subgroups (random effects model):
                     k                     95%-CI  tau^2    tau      Q   I^2
alloc = random       7 -0.9710 [-1.5118; -0.4301] 0.3925 0.6265 110.21 94.6%
alloc = alternate    2 -0.5408 [-1.0927;  0.0111] 0.1326 0.3641   5.56 82.0%
alloc = systematic   4 -0.4242 [-1.1293;  0.2809] 0.4003 0.6327  16.59 81.9%

Test for subgroup differences (random effects model):
                    Q d.f. p-value
Between groups   1.86    2  0.3943

We see minor differences between the Model Results versus the Results for subgroups output.
One can fit a meta-regression model that allows for different $\tau^2$ values across subgroups with:
rma.mv(yi, vi, data=dat, mods = ~ 0 + alloc, random = ~ alloc | trial, struct="DIAG")

The results are then:
Multivariate Meta-Analysis Model (k = 13; method: REML)

Variance Components:

outer factor: trial (nlvls = 13)
inner factor: alloc (nlvls = 3)

            estim    sqrt  k.lvl  fixed       level
tau^2.1    0.1326  0.3641      2     no   alternate
tau^2.2    0.3925  0.6265      7     no      random
tau^2.3    0.4003  0.6327      4     no  systematic

Test for Residual Heterogeneity:
QE(df = 10) = 132.3676, p-val < .0001

Test of Moderators (coefficients 1:3):
QM(df = 3) = 17.4587, p-val = 0.0006

Model Results:

                 estimate      se     zval    pval    ci.lb    ci.ub
allocalternate    -0.5408  0.2816  -1.9204  0.0548  -1.0927   0.0111    .
allocrandom       -0.9710  0.2760  -3.5185  0.0004  -1.5118  -0.4301  ***
allocsystematic   -0.4242  0.3597  -1.1792  0.2383  -1.1293   0.2809

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

These results are now identical to the ones from metagen().


text:
Q: other way to upload files in library I have requirement to create an alternate link to upload files in document library as OOTB link (i.e.Add new document)gives option to user to overwrite existing file.(or new version of existing file if versioning is enabled)
Any idea..?

A: If I understand your question correctly, you need to create a link that points to a specific document library to upload documents. I would do the following for non-code solution:

*

*Go to the document library

*Right click on the link that says *Add Document * and then select *Copy shortcut *

*Create a link and paste the text copied from the previous step.


text:
Q: How to make SQL query from XSL Document? How to make the SQL query from XSLT document. Suggest me something how to retrieve this in SQL query. How the view shows I am not understanding. How to select from SQL query.
Here is the code, Which is giving errors.
Dataset Xsl Format:
<xsl:stylesheet version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:i18n="http://toolkit.sf.net/i18n/messages" xmlns:ddi="http://www.icpsr.umich.edu/DDI" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:outline="http://worldbank.org/toolkit/cdrom/outline" exclude-result-prefixes="ddi outline">
    <xsl:include href="gettext.xslt"/>
    <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>

    <xsl:param name="file" select="'F5'"/>

 <xsl:template match="/">

        <xsl:apply-templates select="//ddi:codeBook/ddi:fileDscr[@ID=$file]"/>

<xsl:call-template name="gettext"><xsl:with-param name="msg">Variables</xsl:with-param></xsl:call-template>

            <xsl:call-template name="gettext"><xsl:with-param name="msg">ID</xsl:with-param></xsl:call-template>
            <xsl:call-template name="gettext"><xsl:with-param name="msg">Name</xsl:with-param></xsl:call-template>
            <xsl:call-template name="gettext"><xsl:with-param name="msg">Label</xsl:with-param></xsl:call-template>
            <xsl:call-template name="gettext"><xsl:with-param name="msg">Type</xsl:with-param></xsl:call-template>
            <xsl:call-template name="gettext"><xsl:with-param name="msg">Format</xsl:with-param></xsl:call-template>
            <xsl:call-template name="gettext"><xsl:with-param name="msg">Question</xsl:with-param></xsl:call-template>

            <xsl:apply-templates select="//ddi:codeBook/ddi:dataDscr/ddi:var[@files=$file]"/>

        </xsl:template>

        <xsl:template match="ddi:var">
        <xsl:variable name="class">
        <xsl:choose>
            <xsl:when test="position() mod 2 = 0">
                <xsl:value-of select="'row-color1'"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="'row-color2'"/>
            </xsl:otherwise>
        </xsl:choose>
        </xsl:variable>
                <xsl:variable name="id" select="@ID"/>
                <xsl:variable name="link">#<xsl:value-of select="@files"/><xsl:value-of select="$id"/></xsl:variable>

            <xsl:value-of select="@ID"/>
            <xsl:value-of select="@name"/>
            <xsl:value-of select="ddi:labl"/>
            <xsl:value-of select="@intrvl"/>
            <xsl:value-of select="ddi:varFormat/@type"/>
            <xsl:value-of select="ddi:qstn/ddi:qstnLit"/>

        </xsl:template>

<xsl:template match="ddi:fileDscr">
    <xsl:variable name="file" select="@ID"/>

<xsl:value-of select="substring-before(ddi:fileTxt/ddi:fileName,'.NSDstat')"/>

            <xsl:call-template name="gettext"><xsl:with-param name="msg">Content</xsl:with-param></xsl:call-template>

                            <xsl:value-of select="normalize-space(ddi:fileTxt/ddi:fileCont)"/>

            <xsl:call-template name="gettext"><xsl:with-param name="msg">Cases</xsl:with-param></xsl:call-template>
            <xsl:value-of select="ddi:fileTxt/ddi:dimensns/ddi:caseQnty"/>

            <xsl:call-template name="gettext"><xsl:with-param name="msg">Variable(s)</xsl:with-param></xsl:call-template>
            <xsl:value-of select="ddi:fileTxt/ddi:dimensns/ddi:varQnty"/>

            <xsl:call-template name="gettext"><xsl:with-param name="msg">Structure</xsl:with-param></xsl:call-template>
            <xsl:call-template name="gettext"><xsl:with-param name="msg">Type</xsl:with-param></xsl:call-template>: <xsl:value-of select="ddi:fileTxt/ddi:fileStrc/@type"/>

                    <xsl:call-template name="gettext"><xsl:with-param name="msg">Keys</xsl:with-param></xsl:call-template>:
                    <xsl:call-template name="getVariableById"><xsl:with-param name="str"><xsl:value-of select="ddi:fileTxt/ddi:fileStrc/ddi:recGrp/@keyvar"/></xsl:with-param></xsl:call-template>

            <xsl:call-template name="gettext"><xsl:with-param name="msg">Version</xsl:with-param></xsl:call-template>
            <xsl:value-of select="ddi:fileTxt/ddi:verStmt/ddi:version"/>

            <xsl:call-template name="gettext"><xsl:with-param name="msg">Producer</xsl:with-param></xsl:call-template>
            <xsl:value-of select="ddi:fileTxt/ddi:filePlac"/>

            <xsl:call-template name="gettext"><xsl:with-param name="msg">Missing Data</xsl:with-param></xsl:call-template>

                            <xsl:value-of select="ddi:fileTxt/ddi:dataMsng"/>

</xsl:template>

<xsl:template name="fileRef">
    <xsl:param name="fileId"/>
        <xsl:apply-templates select="/ddi:codeBook/ddi:fileDscr[@ID=$fileId]/ddi:fileTxt/ddi:fileName"/>
</xsl:template>

<xsl:template match="ddi:fileName">

    <xsl:variable name="filename" select="normalize-space(.)"/>
    <xsl:choose>
        <xsl:when test=" contains( $filename , '.NSDstat' )">
            <xsl:value-of select="substring($filename,1,string-length($filename)-8)"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="$filename"/>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

<xsl:template name="getVariableById">
<xsl:param name="str"/>
<xsl:variable name="delimeter" select="' '"/>
    <xsl:choose>
    <xsl:when test="contains($str,$delimeter)">
            <xsl:variable name="varid"><xsl:value-of select="substring-before($str,$delimeter)"/></xsl:variable>
            <xsl:variable name="var" select="//ddi:codeBook/ddi:dataDscr/ddi:var[@ID=$varid]"/>
            <xsl:value-of select="$var/@name"/>(<xsl:value-of select="normalize-space($var/ddi:labl)"/>),
        <xsl:call-template name="getVariableById">
            <xsl:with-param name="str" select="substring-after($str,$delimeter)"/>
            <xsl:with-param name="delimeter" select="$delimeter"/>
        </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
            <xsl:variable name="var" select="//ddi:codeBook/ddi:dataDscr/ddi:var[@ID=$str]"/>
            <xsl:value-of select="$var/@name"/>(<xsl:value-of select="normalize-space($var/ddi:labl)"/>)
      </xsl:otherwise>
     </xsl:choose>
 </xsl:template>

A: As I told you in comment, your question is absolutely unclear... This answer is a blind shot, using my magic glass bulb... And some research...
Your style-sheet retrieves something here:
<xsl:apply-templates select="//ddi:codeBook/ddi:fileDscr[@ID=$file]"/>

The namespace ddi: is declared on top with
xmlns:ddi="http://www.icpsr.umich.edu/DDI"

Just follow this link and you get to a platform called Document, Discover and Interoperate, which is offering a public access to datas of surveys, documents and so on. I did not dive deeper, but this seems to be a public source to load data, which is - quite probably - delivered in XML-format.
As said: I did not dive deeper... Might be this is nonsense and DDI is just a common format / interface to describe this kind of data in an interchangeable format. In this case, the answer could be the included file from here <xsl:include href="gettext.xslt"/>...
Your stylesheet - at least I think so - does not call any data from any classical RDBMS, but gets an XML from somewhere and transforms this to an HTML-table. This is displayed to the user within a Web-Page. Your application is probably passing the needed data as parameter $file.
Read the getting started section for DDI here
My magic glass bulb needs new batteries now...


text:
Q: setcontentview within onpostExecution Hi I am working with android.How can I use setContentview within Onpostexecution of asynchronous task ??I used the code
  if (getIntent().hasExtra("key")) {

                                if(key.compareTo(App_id)==0)
                                  {
                                    setContentView(R.layout.home);
                                  }

                              }
                              else {

                                     finish();
                                   }

But it force closed and shows the error nullpointer exception. How Can I use setcontentview within onpost execute??
here is my logcat output
03-20 13:47:30.270: E/AndroidRuntime(1628): FATAL EXCEPTION: main
03-20 13:47:30.270: E/AndroidRuntime(1628): java.lang.RuntimeException: Unable to start     activity ComponentInfo{com.example.test/com.example.meetap.AdHome}:     java.lang.NullPointerException
03-20 13:47:30.270: E/AndroidRuntime(1628):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955)
03-20 13:47:30.270: E/AndroidRuntime(1628):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
03-20 13:47:30.270: E/AndroidRuntime(1628):     at android.app.ActivityThread.access$600(ActivityThread.java:122)
03-20 13:47:30.270: E/AndroidRuntime(1628):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
03-20 13:47:30.270: E/AndroidRuntime(1628):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-20 13:47:30.270: E/AndroidRuntime(1628):     at android.os.Looper.loop(Looper.java:137)
03-20 13:47:30.270: E/AndroidRuntime(1628):     at android.app.ActivityThread.main(ActivityThread.java:4340)
03-20 13:47:30.270: E/AndroidRuntime(1628):     at java.lang.reflect.Method.invokeNative(Native Method)
03-20 13:47:30.270: E/AndroidRuntime(1628):     at java.lang.reflect.Method.invoke(Method.java:511)
03-20 13:47:30.270: E/AndroidRuntime(1628):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-20 13:47:30.270: E/AndroidRuntime(1628):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-20 13:47:30.270: E/AndroidRuntime(1628):     at dalvik.system.NativeStart.main(Native Method)
03-20 13:47:30.270: E/AndroidRuntime(1628): Caused by: java.lang.NullPointerException
03-20 13:47:30.270: E/AndroidRuntime(1628):     at com.example.meetap.AdHome.onCreate(AdHome.java:374)
03-20 13:47:30.270: E/AndroidRuntime(1628):     at android.app.Activity.performCreate(Activity.java:4465)
03-20 13:47:30.270: E/AndroidRuntime(1628):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
03-20 13:47:30.270: E/AndroidRuntime(1628):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
03-20 13:47:30.270: E/AndroidRuntime(1628):     ... 11 more

Edit:
I have NullPointerException at
Button close=(Button)findViewById(R.id.close);
close.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
 finish();
}
});

A: Button close=(Button)findViewById(R.id.close);
close.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
 finish();
}
});

If you say NPE in the above close button is null. You need to have  setContentView(R.layout.home); before button is initialized and need to make sure that home.xml has a button with id close.
Edit:

It is defined in another xml

You need to inflate the custom layout like
View view = infalter.inflate(R.layout.customlayout,null);
Button close=(Button)view.findViewById(R.id.close);

A: have you checked your getIntent()!= null. have you check you 'key' != null


text:
Q: If isNaN not throwing non Double inputs I don't know if im using the isNaN right but can you guys help me on using it to accept only numbers in inputs
while (true){
    System.out.println("first number");
    num1=input.nextDouble();
    if (num1.isNaN()){
        System.out.println("invalid input");
    }
    else;
        break;
}

My issue is that when i input a letter, it is not displaying the invalid input message. It just stops the program because i input a letter which is not the error i want to see

A: Scanner does not return a NaN when an invalid input is given. Instead it throws an InputMismatchException. You could use a try-catch statement to catch this exception and handle it appropriately.
Alternatively, Scanner also has a hasNextDouble() function. This waits and checks if the next value is valid as a double, without actually consuming it.
So you could write your loop like this:
while (true){
    System.out.println("Please input a number:");
    if (!input.hasNextDouble()) {
        System.out.println("Not a valid number.");
        break;
    }
    double number = input.nextDouble();
    System.out.println("Your input: " + number);
}

See the documentation on Scanner.hasNextDouble


text:
Q: row-wise operation in tidyverse using entire data Say we have some data
w <- 1:3
x <- 5:7
y <- c(3, 2, 3)
z <- c(3, 2, 5)
df <- data.frame(w,x,y,z)

Then I wish to create a new vector which runs the following
apply(df, 1, function(data) sum(2^(seq_along(data)) * data))

How can I run this apply function in Tidyverse?
I'm finding issues relating to that the data is the input rather than a specific column.

A: You could ditch the loop and the packages, and simply do
rowSums(2^col(df) * df)
# [1]  94  76 138

col(df) gives you a matrix where the column values are the column numbers.  So you can use that for your exponent, multiply by the original data, take the row sums, and avoid any loops or packages all together.


text:
Q: Spring-Context 4.0 XSD property-placeholder not working I have the following property in my ApplicationContext.xml. It should load the file from the classpath with the appended System.getProperty("Environment") value.
<context:property-placeholder location="classpath*:MyConfigFile-${ENVIRONMENT}.properties"/>

This works when my Spring-context schema is:
http://www.springframework.org/schema/context/spring-context-3.0.xsd

but not when it is set to:
http://www.springframework.org/schema/context/spring-context-4.0.xsd

Or set to:
http://www.springframework.org/schema/context/spring-context-3.2.xsd

I've replaced the variable values in the following with the values from my config file and everything works fine with the 4.0 schema.
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-    method="close">
        <property name="driverClass" value="oracle.jdbc.driver.OracleDriver"/>
        <property name="jdbcUrl" value="${url}"/>
        <property name="user" value="${username}"/>
        <property name="password" value="${password}"/>
        <property name="maxPoolSize" value="15"/>
    <property name="minPoolSize" value="5"/>
</bean>

Any Suggestions?
edited
I get the following exceptions:
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:388)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:468)
at my.package.namesAPP.dao.APPParams.setAPPDBParmeters(APPParams.java:37)
at my.package.namesAPP.dao.APPParams.getAPPDBParameters(APPParams.java:31)
at my.package.namesAPP.controller.InterceptorController.preHandle(InterceptorController.java:68)
at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:130)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:932)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:738)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:551)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:568)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1111)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:478)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1045)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:199)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:462)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:279)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:232)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:534)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)
at java.lang.Thread.run(Thread.java:744)

Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:677)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
... 33 more

Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1406)
at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:594)
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:514)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:743)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:670)
... 36 more


text:
Q: PLS-00103: Encountered the symbol "END" I am pretty new at PL/SQL, so I am pretty sure that problem is in syntax somewhere.
I have two tables. For every row in the first table I should compute values X, Y, Z using data from the second table, and insert it into the first table. In the second table time values are not the same, so I should use the closest smaller value from it.
I am getting either "Encounter the symbol "END" "error or the page just dies, if I change something. Anyone can help me?
My code looks like:
    DECLARE

Nr Varchar(5) := 'G01'; /*manuali*/
pi NUMBER :=3.14159265359;
A NUMBER;
tk NUMBER;
time NUMBER;
n0 NUMBER;
n NUMBER;
M NUMBER;
E NUMBER;
i NUMBER;
E_old NUMBER;
dE NUMBER;
v NUMBER;
phi NUMBER;
u NUMBER;
r NUMBER;
x1 NUMBER;
y1 NUMBER;
x NUMBER;
y NUMBER;
z JP_BROAD_KOORD.z%TYPE;
GM NUMBER := 3.986005e14; /*m^3/s^2*/
Omegae_dot NUMBER := 7.2921151467e-5; /*rad/s*/
M0 JP_BROADCAST_NAV2.MO%TYPE;
roota JP_BROADCAST_NAV2.SQRTA%TYPE;
deltan JP_BROADCAST_NAV2.DELTA_N%TYPE;
ecc JP_BROADCAST_NAV2.ECCENTRICITY%TYPE;
omega JP_BROADCAST_NAV2.OMEGA%TYPE;
cuc JP_BROADCAST_NAV2.CUC%TYPE;
cus JP_BROADCAST_NAV2.CUS%TYPE;
crc JP_BROADCAST_NAV2.CRC%TYPE;
crs JP_BROADCAST_NAV2.CRS%TYPE;
i0 JP_BROADCAST_NAV2.IO%TYPE;
idot JP_BROADCAST_NAV2.IDOT%TYPE;
cic JP_BROADCAST_NAV2.CIC%TYPE;
cis JP_BROADCAST_NAV2.CIS%TYPE;
Omega0 JP_BROADCAST_NAV2.OMEGA2%TYPE;
Omegadot JP_BROADCAST_NAV2.OMEGA_DOT%TYPE;
toe JP_BROADCAST_NAV2.TOE%TYPE;
CURSOR BrCursor is
select TIME
from JP_BROAD_KOORD;
CURSOR NavCursor is
select Mo, Sqrta, delta_n, eccentricity, omega, cuc, cus, crc, crs, io, idot, cic, cis, omega2, omega_dot, toe
from JP_BROADCAST_NAV2
where toe=(select max(toe) from JP_BROADCAST_NAV2 where toe < TIME and Satelita_nr=Nr) and Satelita_nr=Nr;
BEGIN
FOR item in BrCursor
LOOP
OPEN NavCursor;
A := roota*roota;
tk := time-toe;
n0 := sqrt(GM/(A*A*A));
n := n0+deltan;
M := M0+n*tk;
M := remainder(M+2*pi,2*pi);
E := M;
loop
   E_old := E;
   E := M+ecc*sin(E);
   dE := remainder(E-E_old,2*pi);
   exit when abs(dE) < 1.e-12;
   end loop;
E := remainder(E+2*pi,2*pi);
v := atan2(sqrt(1-ecc*ecc)*sin(E), cos(E)-ecc);
phi := v+omega;
phi := remainder(phi,2*pi);
u := phi              + cuc*cos(2*phi)+cus*sin(2*phi);
r := A*(1-ecc*cos(E)) + crc*cos(2*phi)+crs*sin(2*phi);
i := i0+idot*tk       + cic*cos(2*phi)+cis*sin(2*phi);
Omega := Omega0+(Omegadot-Omegae_dot)*tk-Omegae_dot*toe;
Omega := remainder(Omega+2*pi,2*pi);
x1 := cos(u)*r;
y1 := sin(u)*r;
x := 0.000001*(x1*cos(Omega)-y1*cos(i)*sin(Omega));
y := 0.000001*(x1*sin(Omega)+y1*cos(i)*cos(Omega));
z := 0.000001*(y1*sin(i));
INSERT INTO JP_BROAD_KOORD (X, Y, Z)
VALUES (x, y, z);
CLOSE NavCursor;
end loop;
end loop;
END;

A:
"I am pretty new at plsql"

Now's the time to acquire good habits.
Consistent indentation is more than pedantry: it can help us identify problems in our code.
Label loops: they really help us match the head and end of loops, which is particularly useful with long chunks of code like you have here.
Employing either of these techniques might have helped you spot you had an orphaned END LOOP statement.
DECLARE
    Nr Varchar(5) := 'G01'; /*manuali*/
    ...
    toe JP_BROADCAST_NAV2.TOE%TYPE;
    CURSOR BrCursor is
        select TIME
        from JP_BROAD_KOORD;
    CURSOR NavCursor is
        select Mo, Sqrta, delta_n, eccentricity, omega, cuc, cus, crc, crs, io, idot, cic, cis, omega2, omega_dot, toe
        from JP_BROADCAST_NAV2
        where toe=(select max(toe)
                   from JP_BROADCAST_NAV2
                   where toe < TIME
                   and Satelita_nr=Nr)
         and Satelita_nr=Nr;
BEGIN
    << br_koord >>
    FOR item in BrCursor  LOOP
        OPEN NavCursor;
        A := roota*roota;
        ...
        E := M;
        << de_calc >>
        LOOP
           E_old := E;
           ...
           exit when abs(dE) < 1.e-12;
        END LOOP de_calc;
        E := remainder(E+2*pi,2*pi);
        ...
        z := 0.000001*(y1*sin(i));
        INSERT INTO JP_BROAD_KOORD (X, Y, Z)
        VALUES (x, y, z);
        CLOSE NavCursor;
    END LOOP br_koord;
END;


text:
Q: Adding a new table row using HTMX I am trying to add a new table row with Htmx. By clicking the "Add A New Row" button, a new row should be added to the table.
I can't get the row in the secondary_hx.html to be added to the table, instead it results as three forms next to each other without  or .
Any help would be appreciated. Thank you in advance.
My code is like this:
main.html:

          1
          2
          3

             <button class="add_button"
                type="submit"
                hx-post="/add_row/"
                hx-target="#Tbody"
                hx-swap="beforeend"
                >
                  Add A New Row
             </button>

partials/secondary_hx.html:

    {{ form.a }}
    {{ form.b }}
    {{ form.c }}


text:
Q: Sending user data from Qt application to server I am working on a desktop application written in Qt that does not connect to the internet (apart from through a third-party licencing application). I would like to ping a server with a piece of identifiable user information (e.g. their software key, email, IP) every time a user logs on, so it is possible to can track how many people are using the software.
I have very little experience with network programming but Qts API looks promising (https://doc.qt.io/qt-5/qtnetwork-programming.html). More generally, because I am very concerned about degrading existing user experiences with firewall popups, or security issues of sending data from their desktop / network, is there anything further related to this to be aware of? Many guides go through the steps to setup a TCP connection for example, which looks trivial, but do not go into details on these kind of wider issues.
If anyone can reccomending reading on this issue it would be much appreciated as am a bit lost where to start.

A: I suggest you to take a look to Qt examples and tutorial, and more specifically those for networking. The solution will depend of what you will have on the server side (API, socket, ping ?).
In all cases, you will trigger the firewall when you contact your server, there is no way to avoid it.
In matter of security, use HTTPS and if your server support it, better use TLS than SSL protocol.
Latest Qt version support both SSL 3 and TLS 1.2, .


text:
Q: Is "a pretend conversation" grammatically correct? I was watching a movie (native speakers) and I noticed this sentence:

'She was having a pretend conversation on the phone...'

Is it grammatically correct? I checked the word "pretend" with Cambridge Advanced Learner's Dictionary - it said "pretend" only exists in verb form. I couldn't find any other cases of using a verb + a noun to form a noun phrase like this.
I think it should be constructed thus: verb with -ing or -ed + noun = noun phrase. Am I right? Alternatively, if the speaker is right, please enlighten me and give me some examples in which this kind of grammar applies.

A: "A pretend conversation" is grammatically correct. People who are inclined to call any word that can be placed before a noun to modify its meaning an "adjective" classify pretend as an adjective when it is used like this; I'm not sure about this classification, but you can think of it that way if you find it helpful. The division between parts of speech can often seem blurry in English; pretend can also be used as a noun.
The online version of the Cambridge Advanced Learner's Dictionary seems to have a definition of pretend as an adjective:

pretend adjective
imaginary or not real:

*

*"Do you want a cup of tea?" she asks, offering me a pretend cup.

*They knew the argument was only pretend, but they still got upset."

Pretend doesn't behave exactly like a typical adjective though.
It can also be used as a noun, as in "they were playing pretend." (I found mention of this in the Oxford English Dictionary.)
I would say it is definitely no more of an adjective than the word fun. Like fun, pretend can be used:

*

*as an uncountable noun: "You mustn't be afraid of pretend" (1965 G. McInnes Road to Gundagai iii. 54, cited in the Oxford English Dictionary)

*as a predicate after a form of to be: "It was all pretend"

*as an attributive word modifying a following noun: "a pretend conversation" (your example)

Pretend is not like a normal adjective mainly in that it is not "gradable":

*

*We can't add the adjective suffixes -er or -est to pretend

*People also don't say things like "very pretend"
Actually, this probably makes it less of an adjective than fun ( "funner" and "funnest" are stigmatized, but have some use, and "very fun" does exist for some people, although other people find it ungrammatical).
Another similar word is make-believe. This also started out as a verb, but is now also used as an uncountable noun, as a predicate after be, and as an attributive "adjective":

*

*the children made believe they were doctors

*She squandered millions on a life of make-believe.

*The violence in those films was too unreal, it was make-believe.

*'But, why?' he asked in make-believe astonishment.

(Example sentences from the Collins English Dictionary)


text:
Q: Gaussian integers: Proof that if $N(\alpha) = N(\beta)$ then $\alpha = t \beta, t \in \{1, -1, i, -i \}$ I need to prove that for $\alpha, \beta$ Gaussian integers:
$$N(\alpha) = N(\beta)\Leftrightarrow \alpha = t\beta, t \in \{-1, 1, i, -i\}$$
Now I have found out that if $\alpha = t\beta \Rightarrow N(\alpha) = N(t \beta) = N(t)N(\beta) = 1 N(\beta) = N(\beta).$
How do I prove the other way around?


text:
Q: Nodejs is reloading app.get every 2 minute I am using node.js for the first time and I have a problem with it because it is refreshing one of the get methods( app.get('/addToHistory') every 2 minutes without any iteraction from my side or browser. Probably the problem is somewhere in my server.js configuration but I cannot found it.
I am trying to build an SPA with AngularJS, NodeJS and MySQL. There will be 3 pages: Home page (with some images), Image page (user can click on image from home page to see details about this image) and History (all images which user saw). There wouldn't be any login functionality. App is recognizing the user by session id, which is saved to the DB.
I am using the routing of angular to navigate between different pages.
Here is the configuration of my server.js
var mysql = require('mysql');
var cookieParser = require('cookie-parser');
var express = require('express');
var app = module.exports = express();
var session = require('express-session');
var MySQLStore = require('express-mysql-session')(session);

app.use(cookieParser());

var db_options = {
    host: 'localhost',
    //port: 3306,
    user: 'user',
    password: 'password',
    database: 'myDB'
};

var option = {
    host: 'localhost',
    //port: 3306,
    user: 'user',
    password: 'password',
    database: 'myDB',
    schema: {
        tableName: 'sessions',
        columnNames: {
            sessions_id: 'sessions_id',
            expires: 'expires',
            data: 'data'
        }
    }
};

var method = db.prototype;

function db() {
    var con = mysql.createPool(db_options);
    this.connection = con;
}

method.getcon = function () {
    return this;
};

module.exports = db;
var connection_object = new db();
var db_connection = connection_object.connection;

app.get('/load', function (req, res) {
    console.log('load');
    db_connection.query("SELECT * from sessions", function (err, rows) {
        if (err) {
            console.log("Problem with MySQL" + err);
        }
        else {
            res.end(JSON.stringify(rows));
        }
    });
});

app.get('/addToHistory', function (req, res) {
    //THIS METHOD IS RECALLING EVERY 2 MINUTES
    console.log('addToHistory');
    var imageID = req.query.imageID;
    var sessionID = req.cookies['image-session'];
    sessionID = sessionID.substring(sessionID.indexOf(':') + 1, sessionID.indexOf('.'));
    checkIfExist();

    function checkIfExist(){
        db_connection.query('SELECT * FROM `history` WHERE `session_id`="'+sessionID+'" AND `image_id`="'+imageID+'"', function (error, rows) {
            if (error) {
                console.log('Problem with MySQL' + error);
            }else{
                if(rows.length >= 1){
                    updateExisting();
                }else{
                    createNew();
                }
            }
        })
    }

    function createNew() {
        db_connection.query('INSERT INTO `history` (`session_id`, `image_id`) VALUES ("' + sessionID + '", "' + imageID + '")', function (error, rows) {
            if (error) {
                console.log('Problem with MySQL' + error);
            }else{

            }
        })
    }

    function updateExisting(){
        db_connection.query('UPDATE history SET created=NOW() WHERE `session_id`="'+sessionID+'" AND `image_id`="'+imageID+'"', function(error, rows){
            if (error) {
                console.log('Problem with MySQL' + error);
            }else{

            }
        })
    }

});

var connection = mysql.createConnection(db_options);
var sessionStore = new MySQLStore(option, connection);

app.use(session({
    name: 'image-session',
    secret: 'thisidasnkjcmsxhodsjafasd89fdashojnva',
    cookie: {maxAge: 365 * 24 * 60 * 60 * 1000, httpOnly: false, secure: false},
    resave: true,
    saveUninitialized: true,
    store: sessionStore
}));

app.use('/js', express.static(__dirname + '/app/js'));
app.use('/bower_components', express.static(__dirname + '/app/bower_components'));
app.use('/css', express.static(__dirname + '/app/css'));
app.use('/partials', express.static(__dirname + '/app/partials'));
app.use('/views', express.static(__dirname + '/app/views'));
app.use('/components', express.static(__dirname + '/app/components'));
app.use('/images', express.static(__dirname + '/app/images'));

app.use(function (req, res) {
    console.log(req.session.id)
    res.sendFile(__dirname + '/app/index.html')
});

app.listen(process.env.PORT || 8080, function () {
    console.log("Server is listening ");
});

When user click on some of the images it is opening a new page (state) with a controller which is calling a factory function. Here is my factory:
app.factory('dbCommunication', ['$http', function ($http) {

    var obj = {};

    obj.addToHistory = function(image){
        console.log('call');
        $http.get('http://localhost:8080/addToHistory?imageID='+image.id).success(function(data){
        })

        return;
    }

    return obj;

}]);

Any idea why node.js is reloading app.get('/addToHistory' every 2 minutes?
BTW. I would like to ask what do you think about my server.js configuration. Is it OK? Should I change something in it? I am not sure if it is a good idea do keep SessionID into cookie.


text:
Q: Library builder not triggering on modified file in SCons I have to build a target using a two steps compilation.
The first step: .c -> .asm
The second step: .asm -> .o
I am creating a library from some .o files.
My implementation is the following:
The first step:
c_to_asm_builder = SCons.Builder.Builder(action = SCons.Defaults.CAction,
                                emitter = {},
                                suffix = '.asm',
                                src_suffix = ['.c','.cpp'],
                                src_builder = '',
                                source_scanner = SCons.Tool.CScanner
                                )
env['Builders']['CTOASM'] = c_to_asm_builder

The second step:
suffixesASM = ['.asm', '.s']
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
for suffix in suffixesASM:
    static_obj.add_action(suffix, SCons.Defaults.ASAction)

I am then calling the builders as follows:
   env.CTOASM(['file1.c', 'file2.c', 'file3.c'], CFLAGS = '-flag')
   env.Object(['file1.asm', 'file2.asm', 'file3.asm'], ASFLAGS = '-flag')

I am creating a library like this:
env.Library('name', ['file1.o', 'file2.o'])

Everything works fine for the compilation.
The problem appers when:
I change file1.c content. I expect file1.c to pass trough these steps:
file1.c -> file1.asm -> file1.o and then name.a library to be recreated.
What happens:
Only c_to_asm_builder is retriggered by the change (file1.c -> file1.asm). The Object builder (file1.asm -> file1.o) is not retriggered and also the Library builder and Program builder are not retriggered.
I don't know what I am missing. I know that for a single step compilation that I configured in another project the Object builder and Library builder are somehow aware of each other.
How to make Library and Program builder aware of Object and CTOASM builders ?

A: You are not specifying an emitter, so either write one, or explicitly list your expected targets...
asm = env.CTOASM(['file1.asm', 'file2.asm', 'file3.asm'],
                 ['file1.c', 'file2.c', 'file3.c'], CFLAGS = '-flag')
obj = env.Object(['file1.o', 'file2.o', 'file3.o'], asm, ASFLAGS = '-flag')
lib = env.Library('name', obj)

Here is a good reference on how to add an emitter to your builder.
https://bitbucket.org/scons/scons/wiki/ToolsForFools
Just scroll down to "Using Emitters".


text:
Q: SWT Table Header Height with Image Cross Platform Java SWT Table
I added an image along with text for each column in my table.
The table displays perfectly on Windows and Linux, however on Mac Java does not use the image to resize the table header. Is there a work around or trick?
...
// Create the table columns.
TableViewer oTableViewer = new TableViewer(oSash, SWT.BORDER | SWT.MULTI);
Table oTable = oTableViewer.getTable();
...
oTable.setHeaderVisible(true);
TableColumns[] oColumns = new TableColumn[3];
for (int iColumn = 0; iColumn < oColumns.length; iColumn++)
    oColumns[iColumn] = new TableColumn(oTable, SWT.NONE);

...
Image imgCol1 = new Image(display, oStream);
Image imgCol2 = new Image(display, oStream);
Image imgCol3 = new Image(display, oStream);

// Set the column widths and names.
oColumns[0].setText("My 1st Column");
oColumns[0].setWidth(100);
oColumns[0].setImage(imgCol1);
oColumns[1].setText("My 2nd Column");
oColumns[1].setWidth(100);
oColumns[1].setImage(imgCol2);
oColumns[2].setText("My 3rd Column");
oColumns[2].setWidth(100);
oColumns[2].setImage(imgCol3);

I am using Eclipse Luna.
The Mac in question has the latest JDK installed, v8. I downloaded the JDK onto the Mac last week, so whatever was the latest and greatest 64-bit JDK last week.
Oh, I did see this question on Stackoverflow, but that did not talk of images, sadly.


text:
Q: Turning on internet connection programmatically (Android) I am developing a software for android which I want to turn on user's internet connection automatically. Like these internet on/off widgets does.

A: private void setMobileDataEnabled(Context context, boolean enabled) throws Exception{
    final ConnectivityManager conman = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    Class conmanClass = null;
    try {
        conmanClass = Class.forName(conman.getClass().getName());
    } catch (ClassNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    final Field iConnectivityManagerField = conmanClass.getDeclaredField("mService");
    iConnectivityManagerField.setAccessible(true);
    final Object iConnectivityManager = iConnectivityManagerField.get(conman);
    final Class iConnectivityManagerClass = Class.forName(iConnectivityManager.getClass().getName());
    final Method setMobileDataEnabledMethod = iConnectivityManagerClass.getDeclaredMethod("setMobileDataEnabled", Boolean.TYPE);
    setMobileDataEnabledMethod.setAccessible(true);
    setMobileDataEnabledMethod.invoke(iConnectivityManager, enabled);
}

this is for 3g activation similar goes for wifi

A: You can use the WifiManager to call setWifiEnabled
More detail here :
http://developer.android.com/reference/android/net/wifi/WifiManager.html


text:
Q: Snackbar not showing because of page refresh? I'm trying to make a register form where the user can register for our website. The data will be inserted into a SQL database. When the user doesn't fill in all the fields, I showed an alert which echoed everything the user hadn't filled in yet.
I tried to replace the alert with a much more fancy Snackbar. I copied the HTML/CSS from this example. Then I just changed the alert to the showSnackBar function in my javascript at the end of the form validation. Because the example SnackBar doesn't have the option to change the text, I tried to give the message variable in the constructor of the showSnackBar function. And then set the text using x.innerHTML = message. Unfortunately this doesn't work, I don't get an error in the console or anything.
This is my code:
 <form name="aanmeldform" id="aanmeldform">

Aanmelden met email.

Voornaam:

    <input type="text" name="firstname" value="" />

Achternaam:

    <input type="text" name="lastname" value="" />

Email:

    <input type="text" name="email" value="" />

Herhaal email:

    <input type="text" name="emailVerify" value="" />

Wachtwoord:

    <input type="password" name="password" value="" />

Herhaal wachtwoord:

    <input type="password" name="passwordVerify" value="" />

Geboortedatum:

    <input id="date" type="date" name="date" min="1900-01-01" max="2017-12-12" value="" />

Geslacht:

        <input type="radio" name="gender" value="Man" checked> Man

        <input type="radio" name="gender" value="Vrouw" /> Vrouw

    <input type="radio" name="gender" value="Anders" /> Anders

    <input type="submit" value="Aanmelden" />
</form>

Sample sample sample

CSS:
#snackbar {
    visibility: hidden; /* Hidden by default. Visible on click */
    min-width: 250px; /* Set a default minimum width */
    margin-left: -125px; /* Divide value of min-width by 2 */
    background-color: #333; /* Black background color */
    color: red; /* White text color */
    text-align: center; /* Centered text */
    border-radius: 2px; /* Rounded borders */
    padding: 16px; /* Padding */
    position: fixed; /* Sit on top of the screen */
    z-index: 18548486486; /* Add a z-index if needed */
    left: 50%; /* Center the snackbar */
    bottom: 30px; /* 30px from the bottom */
}

/* Show the snackbar when clicking on a button (class added with JavaScript) */
#snackbar.show {
    visibility: visible; /* Show the snackbar */

/* Add animation: Take 0.5 seconds to fade in and out the snackbar.
However, delay the fade out process for 2.5 seconds */
    -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

/* Animations to fade the snackbar in and out */
@-webkit-keyframes fadein {
    from {bottom: 0; opacity: 0;}
    to {bottom: 30px; opacity: 1;}
}

@keyframes fadein {
    from {bottom: 0; opacity: 0;}
    to {bottom: 30px; opacity: 1;}
}

@-webkit-keyframes fadeout {
    from {bottom: 30px; opacity: 1;}
    to {bottom: 0; opacity: 0;}
}

@keyframes fadeout {
    from {bottom: 30px; opacity: 1;}
    to {bottom: 0; opacity: 0;}
}

PHP:
$link = mysqli_connect("sample", "sample", "sample", "sample");

    // Check connection
    if($link === false){
        die("ERROR: Could not connect. " . mysqli_connect_error());
    }

    $first_name = mysqli_real_escape_string($link, $_REQUEST['firstname']);
    $last_name = mysqli_real_escape_string($link, $_REQUEST['lastname']);
    $email = mysqli_real_escape_string($link, $_REQUEST['email']);
    $password = mysqli_real_escape_string($link, $_REQUEST['password']);
    $sex = mysqli_real_escape_string($link, $_REQUEST['gender']);
    $birthdate = mysqli_real_escape_string($link, $_REQUEST['date']);

    // Attempt insert query execution
    $sql = "INSERT INTO account (email, first_name, last_name, password, sex, birthdate, credits) VALUES ('$email', '$first_name', '$last_name', '$password', '$sex', '$birthdate', '0')";
    if(mysqli_query($link, $sql)){
        echo "Records inserted successfully.";
    } else{
        echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
    }

    // Close connection
    mysqli_close($link);

JavaScript:
function validateForm() {
    var message = "";
    var voornaam = document.forms["aanmeldform"]["firstname"].value;
    if (voornaam == "") {
        message+= "Vul een geldige voornaam in\n";
    }
    var achternaam = document.forms["aanmeldform"]["lastname"].value;
    if (achternaam == "") {
        message+= "Vul een geldige achternaam in\n";
    }

    var email = document.forms["aanmeldform"]["email"].value;
    if (validateEmail(email)) {
    } else {
        message+= "Vul een geldig emailadres in\n";
    }

    var verimail = document.forms["aanmeldform"]["emailVerify"].value;
    if (verimail != email) {
        message+= "De emailadressen zijn niet gelijk\n";
    }

    var wachtwoord = document.forms["aanmeldform"]["password"].value;
    if (wachtwoord == "") {
        message+= "Vul een geldig wachtwoord in\n";
    }
    var veriwachtwoord = document.forms["aanmeldform"]["passwordVerify"].value;
    if (veriwachtwoord != wachtwoord) {
        message+= "De wachtwoorden zijn niet gelijk\n";
    }
    var datum = document.forms["aanmeldform"]["date"].value;
    if (!datum) {
        message+= "Vul een geldige geboortedatum in\n";
    }

    if (message =="") {
        showSnackBar(message);
    }
};

function validateEmail(email) {
  var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
  return re.test(email);
};

function showSnackBar(message) {
    // Get the snackbar DIV
    var x = document.getElementById("snackbar");
    //Set snackbar's text
    x.innerHTML = message;
    // Add the "show" class to DIV
    x.className = "show";

    // After x seconds, remove the show class from DIV
    setTimeout(function(){ x.className = x.className.replace("show", ""); }, 5000);
};