text:
Q: Error using region argument when fortifying shapefile I'm trying to use ggplot to plot the polygons of a shapefile (this one) in order to visualize some data about the regions contained therein. The code below produces an error:
library(rgdal)
library(tidyverse)
library(maptools)

hsa <- readOGR(dsn = "Data/hsa_bdry", layer = "HSA_Bdry") %>% fortify(region = "HSA93")

ggplot() + geom_polygon(data = hsa, aes(x = long, y = lat, group = group))

Error: TopologyException: Input geom 0 is invalid: Self-intersection at or near point -103.18495682693303 24.986200983871445 at -103.18495682693303 24.986200983871445

How can I keep the data from the shapefile @data slot attached to the fortified data frame without getting plotting errors?
What I've tried so far:
If I remove the region argument from fortify it succeeds in producing a map, but I need the region id so I can merge on the rest of my data (to pass to aes arguments in ggplot).
I tried adding spTransform(CRS("+init=epsg:4269")) to my pipeline before calling fortify (the documentation for the shapefile says it uses North American Datum 1983, which is EPSG 4269) but then I get an error

Error in spTransform(xSP, CRSobj, ...) :
    No transformation possible from NA reference system

A: As the error message indicates, there are invalid self-intersecting points in the shapefile, causing problems for fortify. You can pre-process the shapefile with gBuffer from rgeos package first:
# read in the shapefile as SpatialPolygonsDataFrame, but don't fortify it yet
hsa <- readOGR(dsn = "hsa_bdry", layer = "HSA_Bdry")

# check if there are invalid geometries & correct that
rgeos::gIsValid(hsa) #returns FALSE
hsa <- rgeos::gBuffer(hsa, byid = TRUE, width = 0)
rgeos::gIsValid(hsa) #returns TRUE

# fortify shouldn't encounter problems now.
hsa <- hsa %>% fortify(region = "HSA93")

Here's a example of the result, using basic theme options:
ggplot() +
  geom_polygon(data = hsa, aes(x = long, y = lat, group = group),
               fill = "white", col = "black") +
  coord_map()

This post from GIS Stack Exchange discusses this issue too.
Edit: add visual inspection of invalid geometries before gBuffer (optional)
If you wish to inspect the invalid geometries before correcting them, you can view the shapefile & zoom in at the coordinates with reported problems. I usually prefer to do this in GIS software myself, but it's possible to plot the SpatialPolygonsDataFrame in R using base package's plot function.
# after loading in the shapefile but before any transformation
plot(hsa, col = "lightblue");axis(1);axis(2); title(main = "Full view")
points(x = -103.18495682693303, y = 24.986200983871445,
       col = "red", cex = 5)

# toggle xlim & ylim till we get a good zoom
plot(hsa, col = "lightblue",
     xlim = c(-103.185, -103.18),
     ylim = c(24.98, 24.99)); axis(1); axis(2); title(main = "Zoom in")
points(x = -103.18495682693303, y = 24.986200983871445,
       col = "red", cex = 5)

We can see where the problem lies. The point where the two lines meet in that triangle overlap just slightly. It's minor enough that you probably won't notice it yourself, but it'll cause problems when we try to fortify it.

After performing the gBuffer step, view the shapefile again (no change to the code except title):


text:
Q: Soil maps - displaying specific soil types QGIS I'm trying to isolate a couple specific soil types from the GIS soils layers for a county in my state in the US.
I downloaded the data:
ftp://ftp.igsb.uiowa.edu/gis_library/Counties/Adair/soil_01/soils_01.zip
And loaded the .shp file as a vector layer. I can see all the shapes of different soil types but can't figure out how to isolate and display just a couple of them.
Can anyone help with this problem?

A: To isolate and work with only a certain soil type you want to open your attribute table (right click on the layer in the layers panel and and open the attribute table)
Then use the select by expression button: see pic below

You will want to use the expression
"SOILNAME" LIKE '%SHELBY%' to select all soils with the name SHELBY in the field of SOILNAME
If you wanted to select all records with SHELBY in the SOILNAME field and with a value of 1 in the SOILS_01_ field (assuming that is an INT field and not a text field) you would use:
"SOILNAME" LIKE '%SHELBY%' AND "SOILS_01_" = 1
Once you have selected your records, go back out to the Layers Properties (where you opened the attribute table) and select save layer as.  Choose options similar to the ones below:

You want to save only selected features, and then load that layer onto the map.  Once you have done that you will have a result like mine below (my result I used a Select by Expression of "PTMAT_DESC" LIKE '%Loess%' to show me only records where the field PTMAT_DESC has a value of anything containing the characters Loess .  The final result is shown below.

Once you have that data you can use what Whyzar mentions to improve your symbology and how you are visualizing your data.
Here is a good tutorial on select by expression:
http://maps.cga.harvard.edu/qgis/wkshop/query.php
QGIS Select by Expression

A: There are several ways you may attempt to style your GIS data in QGIS. Here is a tutorial which I believe is a good resource in styling your soils GIS data.
Here are same snapshots of the step involved and their results

redpajama_set_name: RedPajamaStackExchange


text:
Q: Hardhat compile, deploy and verify in a single script I am using hardhat to compile, deploy and verify an Ethereum Smart Contract. Currently, I am mannually peforming these commands:

*

*npx hardhat compile

*npx hardhat run scripts/deploy.js
Wait until the deployment script returns the contract address. Then manually copy the returned address to the verify command:

*npx hardhat verify 0x<contract-address>

*Copy the compiled contract json (abi) file to my project's directory in the filesystem.
Is there any way that I can run all these commands automatically? I am thinking to automate it using shell/bash/powershell scripting but I am not sure if this is the best way to achieve this.
Many thanks!

A: Just saw this so just posting my answer for future reference.

*

*Running npx hardhat run scripts/deploy.js automatically compiles uncompiled code. So you don't need to run it every time.

*For the Automation you mentioned (deploy + verify in one script) you can just add the below lines of code in your deploy.js script to automatically verify it after it deploys:
   //wait for 5 block transactions to ensure deployment before verifying

   await myContract.deployTransaction.wait(5);

   //verify

   await hre.run("verify:verify", {
     address: myContract.address,
     contract: "contracts/MyContract.sol:MyContract", //Filename.sol:ClassName
   constructorArguments: [arg1, arg2, arg3],
});

Now you can just call your usual deploy command npx hardhat run scripts/deploy.js and the terminal will log the deployment + the verification like:
MyContract deployed to "0xTheDeployedContractAddress"  constructor arguments:  arg1, arg2, arg3
Nothing to compile
Successfully submitted source code for contract
contracts/MyContract.sol:Contrac at 0xTheDeployedContractAddress
for verification on the block explorer. Waiting for verification result...

Successfully verified contract HoloVCore on Etherscan.
https://goerli.etherscan.io/address/0xTheDeployedContractAddress#code

Here's a sample of my overall deploy.js script
    const hre = require("hardhat");

    async function main() {
       const arg1 = "Contract Name";
       const arg2 = "TKN";
       const arg3 = 100000;
       const MyContract = await hre.ethers.getContractFactory("MyContract");
       const myContract = await MyContract.deploy(arg1, arg2, arg3);

       await myContract.deployed();

       console.log(`VLX Token deployed to ${myContract.address}`);

       //wait for 5 block transactions to ensure deployment before verifying
       await myContract.deployTransaction.wait(5);

       //verify (source: https://hardhat.org/hardhat-runner/plugins/nomiclabs-hardhat-etherscan#using-programmatically)
       await hre.run("verify:verify", {
          address: myContract.address,
          contract: "contracts/MyContract.sol:MyContract", //Filename.sol:ClassName
          constructorArguments: [arg1, arg2, arg3],
       });
    }

    main().catch((error) => {
       console.error(error);
       process.exitCode = 1;
    });

Remember to adjust the wait(n) parameter to adjust the wait time depending on the traffic on the network you're deploying to.
For more info about programatically verifying, check this link from Hardhat-Etherscan docs

A: You can also create a folder called utils and import it into your deploy folder in a much more organized manner.
const { run } = require("hardhat")

const verify = async (contractAddress, args) => {
    console.log("Verifying contract...")
    try {
        await run("verify:verify", {
            address: contractAddress,
            constructorArguments: args,
        })
    } catch (e) {
        if (e.message.toLowerCase().includes("already verified")) {
            console.log("Already verified!")
        } else {
            console.log(e)
        }
    }
}

module.exports = {
    verify,
}


text:
Q: Query how many times a link been shared from a time We can use FQL › link_stat to query the total numbers. Can we give a specified time to query?
https://developers.facebook.com/docs/reference/fql/link_stat/

A: No, the only indexable field, the fields you can specify on the where clause, is url.  Indexable fields are marked with a asterix '*' in Facebook's documentation.


text:
Q: Returning a typescript type to method that expects a different type but same properties does not throw error I have 2 classes, one is named "InventoryDTO" and the other is named "Inventory".
The 2 classes store the same properties.. i.e
export class InventoryDto {
  id?: number
  name: string
  active?: boolean
}

The 2 classes are the same, but one of the classes is heavily annotated with decorators (its for the database).
If I return the Inventory to the InventoryDto - I can't get typescript to complain about it because technically its the same properties.
  create(dto: CreatInvenoryDto): Promise<InventoryDto> {
// this returns Inventory NOT InventoryDTO - but typescript is fine with it.
    return this.dataAccessService.create(dto)
  }

I would like it to complain, am I missing something in the tsconfig, I have set strict: true
But still the same, its basically allowing me to return the type even though they are different because they are compatible..
Any way to enforce this?
Thanks

A: The best you can do is probably to add a "hidden" field:
class Entity {
  __type: 'entity' = 'entity';
}

class Dto {
  __type: 'dto' = 'dto';
}

class Inventory extends Entity {
  id?: number
  name: string
  active?: boolean

  constructor(name: string, id?: number, active?: boolean) {
    super();

    this.id = id;
    this.name = name;
    this.active = active;
  }
}

class InventoryDto extends Dto {
  id?: number
  name: string
  active?: boolean

  constructor(name: string, id?: number, active?: boolean) {
    super();

    this.id = id;
    this.name = name;
    this.active = active;
  }
}

function save(dto: InventoryDto) {
}

let inv: Inventory;
save(inv);

Playground

A: You could pick the fields you require and return only those. Ignoring TypeScript all together, if you wrote this in plain JS you'd be returning the entire inventory from the create method rather than just those fields which probably isn't what you want.
You could try something like this to retain type safety and only return the required fields:
create(dto: CreatInvenoryDto): Promise<InventoryDto> {
  const { id, name, active } = this.dataAccessService.create(dto)
  const inventoryDto: InventoryDto = { id, name, active }
  return inventoryDto
}


text:
Q: Phantom JS not capturing clipPath and react from svg I have code that defines a clip-path under an SVG and then later references that clip-path in a group element by URL, but the clip path is ignored when taking a screenshot with Phantom JS:
Phantom JS version 1.9.8 and script which I using
var webPage = require('webpage');
var page = webPage.create();
var system = require("system");
page.settings.userAgent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36';
page.viewportSize = { width: 1150, height: 900 };

page.open(system.args[1], function start(status) {
    window.setTimeout(function () {
        page.render(system.args[2], {format: 'png', quality: '80'});
        phantom.exit();
    }, 3000);
});

I am unable to post the complete SVG code here, I have just posted only that portion which using clip-path and react
<g id="inset">
<polygon class="st3" points="4.5,113.4 56.4,113.4 56.4,180.2 26.6,180.2 31.6,191 17.8,180.2 4.5,180.2   "></polygon>
<g>
    <path class="st4" d="M9.6,119.9H8.8v-3.7h0.8V119.9z"></path>
    <path class="st4" d="M13.4,119.9h-0.8l-1.5-2.4v2.4h-0.8v-3.7h0.8l1.5,2.4v-2.4h0.8V119.9z"></path>
    <path class="st4" d="M17.1,118.7c0,0.4-0.2,0.7-0.4,0.9c-0.3,0.2-0.6,0.3-1,0.3c-0.5,0-0.8-0.2-1.1-0.5s-0.4-0.8-0.4-1.3V118
        c0-0.4,0.1-0.7,0.2-0.9c0.1-0.3,0.3-0.5,0.5-0.6c0.2-0.1,0.5-0.2,0.8-0.2c0.4,0,0.8,0.1,1,0.3c0.3,0.2,0.4,0.5,0.5,1h-0.8
        c0-0.2-0.1-0.4-0.2-0.5c-0.1-0.1-0.3-0.2-0.5-0.2c-0.3,0-0.4,0.1-0.6,0.3c-0.1,0.2-0.2,0.5-0.2,0.8v0.3c0,0.4,0.1,0.7,0.2,0.9
        c0.1,0.2,0.3,0.3,0.6,0.3c0.2,0,0.4-0.1,0.5-0.2c0.1-0.1,0.2-0.3,0.2-0.5H17.1z"></path>
    <path class="st4" d="M18.5,119.3h1.6v0.6h-2.4v-3.7h0.8V119.3z"></path>
    <path class="st4" d="M21.5,119.9h-0.8v-3.7h0.8V119.9z"></path>
    <path class="st4" d="M25.3,119.9h-0.8l-1.5-2.4v2.4h-0.8v-3.7h0.8l1.5,2.4v-2.4h0.8V119.9z"></path>
    <path class="st4" d="M28.3,118.3h-1.5v1h1.7v0.6h-2.5v-3.7h2.5v0.6h-1.7v0.9h1.5V118.3z"></path>
    <path class="st4" d="M31.9,119l0.8-2.8h0.8l-1.3,3.7h-0.8l-1.3-3.7h0.8L31.9,119z"></path>
    <path class="st4" d="M34.9,119.9h-0.8v-3.7h0.8V119.9z"></path>
    <path class="st4" d="M36.5,119.3h1.6v0.6h-2.4v-3.7h0.8V119.3z"></path>
    <path class="st4" d="M39.4,119.3H41v0.6h-2.4v-3.7h0.8V119.3z"></path>
    <path class="st4" d="M43.7,119.2h-1.3l-0.3,0.8h-0.8l1.4-3.7h0.7l1.4,3.7H44L43.7,119.2z M42.6,118.6h0.9l-0.5-1.4L42.6,118.6z"></path>
    <path class="st4" d="M48.1,119.5c-0.1,0.2-0.3,0.3-0.6,0.4c-0.2,0.1-0.5,0.1-0.8,0.1c-0.3,0-0.6-0.1-0.8-0.2
        c-0.2-0.1-0.4-0.3-0.6-0.6c-0.1-0.3-0.2-0.6-0.2-0.9V118c0-0.4,0.1-0.7,0.2-1s0.3-0.5,0.5-0.6c0.2-0.1,0.5-0.2,0.8-0.2
        c0.4,0,0.8,0.1,1,0.3c0.2,0.2,0.4,0.5,0.4,0.9h-0.7c0-0.2-0.1-0.4-0.2-0.5c-0.1-0.1-0.3-0.1-0.5-0.1c-0.3,0-0.5,0.1-0.6,0.3
        c-0.1,0.2-0.2,0.5-0.2,0.9v0.2c0,0.4,0.1,0.7,0.2,0.9c0.1,0.2,0.4,0.3,0.6,0.3c0.3,0,0.5-0.1,0.6-0.2v-0.6h-0.7V118h1.5V119.5z"></path>
    <path class="st4" d="M51.1,118.3h-1.5v1h1.7v0.6h-2.5v-3.7h2.5v0.6h-1.7v0.9h1.5V118.3z"></path>
</g>
<g>
    <g>
        <rect x="6.4" y="122.2" class="st5" width="48.1" height="55.8"></rect>
        <path class="st4" d="M54.2,122.5v55.2H6.8v-55.2H54.2 M54.8,121.9h-0.7H6.8H6.1v0.7v55.2v0.7h0.7h47.4h0.7v-0.7v-55.2V121.9
            L54.8,121.9z"></path>
    </g>
    <rect x="6.8" y="155.6" class="st6" width="36" height="22"></rect>
    <g>
        <defs>
            <rect id="SVGID_3_" x="6.8" y="122.5" width="47.4" height="55.2"></rect>
        </defs>
        <clipPath id="SVGID_4_">
            <use xlink:href="#SVGID_3_"></use>
        </clipPath>
        <g class="st7" clip-path="url(#SVGID_4_)">
            <g>
                <g>
                    <path id="89451" data-id="89451" class="st0" d="M56.9,193.2l-0.5-2.6l-3.4-2.1l-1.8-2.8l-0.7-1.5l-1.5,0.8l-1.7-1.6l-0.9-3l2.2-8.1l1.8-1.6l1.7-4.2
                        l-0.5-1.8l-3.4-1.9l1.8-6.9l0.1-7.6l1.2-1.5l-0.5-2.1l-1.5-1.8l3.2-2.8l0.4-1.5l-0.6-0.5l-0.2-3.7l-0.7-0.2l0.2-0.9l-2.2-1.5
                        l-7.2,0.7l-2.5-0.5c0,0,1.5-2,1.5-2.3c0-0.3,1.3-2.8,1.5-3.2c-0.1,0.1-0.2,0.2-0.2,0.2l-0.1-1.9l-7.8-0.1c0,0,0.1,3.2-0.1,3.5
                        c-0.1,0.4,0.1,0.5,0.1,0.5l0.1,5.6h-8l-0.1,7.9l-20.7,0.2l0.2,27.4c0,0,0.3,0.3,0.6,0.5c0.3,0.2,1,1.2,1.3,0.2
                        c0.3-1.1,0.3-3.5,0.5-4c0.2-0.5-0.2-2.2-0.2-2.2s0.2-0.5,0.2-0.7c0-0.2,0.5-2.1,0.5-2.1s0.5-0.8,0.4-1.3
                        c-0.1-0.5-0.2-0.5-0.1-1c0.2-0.5,0.7-1.9,0.8-2.2c0.2-0.3,0.9-1.4,1.8-1.5c0.9-0.1,2.5,0.2,3.5,0.3s1.2,0.5,1.7,0.5
                        c0.5-0.1,1.1-0.4,1.6-0.3c0.5,0.1,1.6,0.5,2.2,1c0.5,0.5,0.3,0.8,0.9,1c0.6,0.2,0.5,0.5,1.2,0.5s1.2-0.2,1.7,0.2
                        c0.5,0.3,2.5,1.1,3.4,1.3s4.9,2.6,4.9,2.6s1.2,0.7,1.6,1.2c0.5,0.5,0.3,0.7,1.3,1.2c1,0.5,0.6,1.6,0.3,2.1
                        c-0.3,0.5-0.2,0.8-0.2,1.2c0.1,0.4-0.1,1.4,0.2,1.3c0.2-0.1,0.6,0,0.8,0.3c0.2,0.3,0.4,0.3,0.9,0.6c0.5,0.3,0.1,0.8,0.1,1.2
                        c0,0.3,0.4,0.6-0.1,1.4c-0.5,0.8-0.2,0.8-0.2,1.6c0.1,0.8-0.2,1.1-0.5,1.6c-0.4,0.5,0.2,0.8,0.2,1.4c0,0.5,0.1,0.7-0.4,0.8
                        c-0.5,0.2-0.4,0.5-0.2,1.1c0.2,0.5,0.3,0.8,0.3,1.2c0,0.5,0.4,0.6-0.5,0.6s0,0.5-0.3,0.8c-0.3,0.4-0.6,0.1-0.6,0.8
                        c0,0.8-0.2,1.3,0.5,1.1c0.8-0.2,1.4-0.1,1.8,0.6c0.4,0.7,0.4,1.9,0.4,2.9c0,1-0.8,2.2-0.3,2.8c0.5,0.6,0.3,1.3,0.6,1.8
                        c0.3,0.5,0.1,1.2,0.1,1.2s-0.6,0.5-0.6,0.9c0,0.4-0.4,0.2-0.6,0.2c-0.2,0-1.5,0.2-1.5,0.8s0.4,0.5-0.2,2.2
                        c-0.5,1.6-0.4,2.7-0.4,2.7l22.2,0.2l-0.8-0.6l-0.2-4.5l1.8-1.9H56.9z" style="fill: rgb(233, 247, 225);" color-default="#E9F7E1"></path>
                </g>
            </g>
            <g>
                <path class="st8" d="M48.2,117.7c0.4-0.4,1.5-1.6,2.4-0.6c0.4,0.4,0.9,0.9,0.8,1.6c-0.1,0.7-0.9,1-1.2,1.1
                    c-1.2,0.5-2.1,1.1-2.1,1.1l-0.5,0.3l-0.2-0.3c-0.2,0-0.5,0.2-1.2,0.7c-0.9,0.7-1.1,0.8-1.2,0.8c-0.1,0-0.2,0.2-0.4,0.4
                    c-0.5,0.5-1.1,0.7-1.5,0.9c-0.5,0.2-0.7,0.3-0.8,0.5c-0.2,0.6-0.6,0.8-0.9,1.1c-0.3,0.2-0.3,0.3-0.3,0.5c0,1.2,0,1.5-0.6,2.8
                    c0,0,0,0,0,0c0.1,0.3-0.1,0.6-0.6,1.4c-0.3,0.5-0.4,0.8-0.4,1.1c-0.1,0.9-0.4,1.3-1.9,2.1c-0.9,0.4-1.5,0.3-2,0.2
                    c0,0.1,0,0.2,0,0.3c0.1,1.2,0.1,2.1,0.1,2.7c0,1,0,1.4,0.3,2c0.3,0.7,0.3,1.3,0.3,1.9c0,0.6,0,0.8,0.3,1.1
                    c0.1,0.1,0.2,0.2,0.3,0.3c0.6,0.5,0.8,0.8,1,1.9c0,0.2,0.1,0.5,0.1,0.6c0.1,0.6,0.4,1.6-0.8,1.9c-0.9,0.2-1.4-0.8-1.9-1.7
                    c-0.1-0.3-0.3-0.6-0.4-0.8c-0.7-0.3-1.8-1.6-2.4-2.4l-0.1-0.1l0-0.1c-0.1-0.4-0.7-1.4-1.5-1.7c-0.4-0.1-0.9,0-1.5,0.3
                    c-0.4,0.7-1,1.8-1.2,2.1c-0.1,0.4-0.3,1.4-0.3,1.9l-0.1,0.4l-0.4,0.1c0,0-1,0.3-1.2,1.1c-0.1,0.3-0.1,0.6-0.2,0.9
                    c-0.1,0.7-0.2,1.5-1.2,2.2c-0.3,0.2-0.4,0.3-0.6,0.4c-0.4,0.3-0.6,0.4-1.9,0.9c-0.5,0.2-0.9,0.3-1.3,0.4
                    c-1.1,0.3-1.4,0.4-1.5,1.2l-1.3-0.1c0.2-1.7,1.2-2,2.4-2.3c0.3-0.1,0.7-0.2,1.2-0.4c1.3-0.5,1.3-0.5,1.6-0.8
                    c0.1-0.1,0.3-0.2,0.6-0.4c0.5-0.3,0.5-0.7,0.6-1.3c0-0.3,0.1-0.7,0.2-1.1c0.3-1,1.2-1.5,1.7-1.7c0.1-0.5,0.2-1.3,0.3-1.8
                    c0.2-0.6,1.2-2.2,1.3-2.5l0.1-0.1l0.1-0.1c0.9-0.6,1.8-0.8,2.7-0.5c1.4,0.4,2.1,1.9,2.3,2.4c0.7,0.8,1.6,1.8,1.9,1.9
                    c0.5,0.2,0.7,0.7,1.1,1.4c0,0.1,0.1,0.2,0.2,0.4c0-0.2-0.1-0.3-0.1-0.5c-0.1-0.7-0.2-0.8-0.6-1.2c-0.1-0.1-0.2-0.2-0.3-0.3
                    c-0.6-0.6-0.6-1.3-0.6-1.9c0-0.5,0-0.9-0.2-1.4c-0.4-0.9-0.4-1.5-0.4-2.6c0-0.6,0-1.4,0-2.6c-0.1-1.5-0.1-1.8,0.4-2
                    c0.4-0.2,0.8,0.1,0.9,0.2c0.3,0.2,0.7,0.5,1.5,0.1c1.1-0.5,1.1-0.7,1.2-1c0-0.4,0.1-0.9,0.6-1.7c0.1-0.2,0.2-0.3,0.3-0.4
                    c0-0.3,0.1-0.5,0.2-0.8c0.5-1.2,0.5-1.3,0.5-2.3c0-1,0.5-1.3,0.9-1.6c0.2-0.2,0.4-0.3,0.5-0.5c0.3-0.8,0.9-1,1.5-1.2
                    c0.4-0.2,0.7-0.3,1.1-0.6c0.5-0.5,0.5-0.5,0.7-0.6c0.1,0,0.2-0.1,1-0.7c1-0.7,1.7-1.1,2.3-1c0,0,0.1,0,0.1,0
                    c0.4-0.2,1.1-0.6,2-1c0.2-0.1,0.3-0.1,0.4-0.2c-0.1-0.1-0.2-0.2-0.3-0.4c-0.2,0-0.8,0.5-1.4,0.8h0L48.2,117.7"></path>
            </g>
        </g>
    </g>
</g>

After taking screenshot with phantom JS Image Here


text:
Q: Java - Find the the words before and after a given word in a string Say I have a string
String str = "This problem sucks and is hard"

and I wanted to get the words before and after "problem", so "This" and "sucks". Is regex the best way to accomplish this (keeping in mind that I'm a beginner with regex), or does Java have some kind of library (i.e. StringUtils) that can accomplish this for me?

A: To find the words before and after a given word, you can use this regex:
(\w+)\W+problem\W+(\w+)
The capture groups are the words you're looking for.
In Java, that would be:
Pattern p = Pattern.compile("(\\w+)\\W+problem\\W+(\\w+)");

Matcher m = p.matcher("This problem sucks and is hard");
if (m.find())
    System.out.printf("'%s', '%s'", m.group(1), m.group(2));

Output
'This', 'sucks'

If you want full Unicode support, add flag UNICODE_CHARACTER_CLASS, or inline as (?U):
Pattern p = Pattern.compile("(?U)(\\w+)\\W+problema\\W+(\\w+)");

Matcher m = p.matcher("Questo problema è schifoso e dura");
if (m.find())
    System.out.printf("'%s', '%s'", m.group(1), m.group(2));

Output
'Questo', 'è'

For finding multiple matches, use a while loop:
Pattern p = Pattern.compile("(?U)(\\w+)\\W+problems\\W+(\\w+)");

Matcher m = p.matcher("Big problems or small problems, they are all just problems, man!");
while (m.find())
    System.out.printf("'%s', '%s'%n", m.group(1), m.group(2));

Output
'Big', 'or'
'small', 'they'
'just', 'man'

Note: The use of \W+ allows symbols to occur between words, e.g. "No(!) problem here" will still find "No" and "here".
Also note that a number is considered a word: "I found 1 problem here" returns "1" and "here".

A: There is a StringUtils library by apache which does have the methods to substring before and after the string. Additionally there is java's own substring which you can play with to get what you need.
Apache StringUtils library API:
https://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/StringUtils.html
The methods that you might need - substringBefore() and substringBefore().
https://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/StringUtils.html#substringBefore(java.lang.String,%20java.lang.String)
Check this out if you want to explore java's own api's
Java: Getting a substring from a string starting after a particular character

A: A bit verbose but this gets the job done accurately and quickly:
import java.io.*;
import java.util.*;
public class HelloWorld{

public static void main(String []args){
    String EntireString="Hello World this is a test";
    String SearchWord="World";
    System.out.println(getPreviousWordFromString(EntireString,SearchWord));
}

public static String getPreviousWordFromString(String EntireString, String SearchWord) {
    List<Integer> IndicesOfWords = new ArrayList();

    boolean isWord = false;

    int indexOfSearchWord=-1;

    if(EntireString.indexOf(SearchWord)!=-1) {
        indexOfSearchWord = EntireString.indexOf(SearchWord)-1;
    } else {
        System.out.println("ERROR: SearchWord passed (2nd arg) does not exist in string EntireString. EntireString: "+EntireString+" SearchWord: "+SearchWord);
        return "";
    }

    if(EntireString.indexOf(SearchWord)==0) {
        System.out.println("ERROR: The search word passed is the first word in the search string, so there are no words before it.");
        return "";
    }

    for (int i = 0; i < EntireString.length(); i++) {
        if (Character.isLetter(EntireString.charAt(i)) && i != indexOfSearchWord) {
            isWord = true;
        } else if (!Character.isLetter(EntireString.charAt(i)) && isWord) {
            IndicesOfWords.add(i);
            isWord = false;
        } else if (Character.isLetter(EntireString.charAt(i)) && i == indexOfSearchWord) {
            IndicesOfWords.add(i);
        }
    }

    if(IndicesOfWords.size()>0) {
        boolean isFirstWordAWord=true;
        for (int i = 0; i < IndicesOfWords.get(0); i++) {
            if(!Character.isLetter(EntireString.charAt(i))) {
                isFirstWordAWord=false;
            }
        }
        if(isFirstWordAWord==true) {
            String firstWord = EntireString.substring(0,IndicesOfWords.get(0));
            IndicesOfWords.add(0,0);
        }
    } else {
        return "";
    }

    String ResultingWord = "";

    for (int i = IndicesOfWords.size()-1; i >= 0; i--) {

        if (EntireString.substring(IndicesOfWords.get(i)).contains(SearchWord)) {
            if (i > 0) {
                ResultingWord=EntireString.substring(IndicesOfWords.get(i-1),IndicesOfWords.get(i));
                break;
            }
            if (i==0) {
                ResultingWord=EntireString.substring(IndicesOfWords.get(0),IndicesOfWords.get(1));
            }
        }
    }

    return ResultingWord;
}


text:
Q: How to append a letter(text) to an existing column of numbers at beginning of cell Can you offer guidance here - I have a column of numbers and need to add a "D" to the beginning of each number in the cell. I do not want the "D" to populate in empty cells. Thank you.Terri

A: Say we have constant data in column D like:

and we run this VBA macro:
Sub dural()
    Dim rng As Range, r As Range
    Set rng = Columns("D").Cells.SpecialCells(2)

    For Each r In rng
        r.Value = "D" & r.Value
    Next r
End Sub

the result:

The use of SpecialCells avoids prepending the "D" to empty cells.

A: If you're just looking for a quick-and-dirty solution, I would put a formula in a neighboring column, do a copy/paste-as-value over the original, then delete your formula column.
Formula:
=IF(D1<>"","D"&D1,"")


text:
Q: Git stage / git add Tengo problema con gits, en algunos archivos modificados no hace el stage desde VisualCode o agregarlos de forma general con git add . o git add [Path] de forma especifica, no muestra algún error o pista, al ejecutar git status, los archivos siguen en stage para el commit, la única forma de quitarlos de ahí es aplicando git restore.
Como dato curioso, solo son los que llevan un texto especifico en el archivo, ejemplo "Casas"


text:
Q: Asp.net 5 web api dependency resolver I have created project with an asp.net 5 web api template. The startup.cs file content is like this.
public class Startup
{
    public Startup(IHostingEnvironment env)
    {
    }

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMvc();
    }

    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        app.UseStaticFiles();

        app.UseMvc();
    }
}

I want to use a IoC framework like Autofac, StructureMap and Ninject. But How can I change default web api dependency resolver with a framework?
For example StructureMap container is set like this:
        var container = new StructureMap.Container(m=>m.Scan(x =>
                                                             {
              x.TheCallingAssembly();
              x.WithDefaultConventions();

                                                             }));

But can not set it in web api life.

A: Documentation here might help:
http://docs.asp.net/en/latest/fundamentals/dependency-injection.html#replacing-the-default-services-container

A: Check out the StructureMap.Dnx project:
https://github.com/structuremap/structuremap.dnx
Usage
The package contains a single, public extension method, Populate.
It's used to populate a StructureMap container using a set of ServiceDescriptors or an IServiceCollection.
Example
using System;
using Microsoft.Extensions.DependencyInjection;
using StructureMap;

public class Startup
{
    public IServiceProvider ConfigureServices(IServiceCollection services)
    {
        services.AddMvc();
        services.AddWhatever();

        var container = new Container();

        // You can populate the container instance in one of two ways:

        // 1. Use StructureMap's `Configure` method and call
        //    `Populate` on the `ConfigurationExpression`.

        container.Configure(config =>
        {
            // Register stuff in container, using the StructureMap APIs...

            config.Populate(services);
        });

        // 2. Call `Populate` directly on the container instance.
        //    This will internally do a call to `Configure`.

        // Register stuff in container, using the StructureMap APIs...

        // Here we populate the container using the service collection.
        // This will register all services from the collection
        // into the container with the appropriate lifetime.
        container.Populate(services);

        // Finally, make sure we return an IServiceProvider. This makes
        // DNX use the StructureMap container to resolve its services.
        return container.GetInstance<IServiceProvider>();
    }
}


text:
Q: How to create database,table with primary key and auto increment in SQL I would like to create a table that they have an ID int primary key, However, I would like to insert the values manually, that means I don't need the ID incremented by itself?

A: In PostgreSQL these are totally different concepts.

*

*you have primary keys

*You have sequence generators that can generate ints.  A serial type is an int that gets its value from a sequence generator.

The two have nothing to do with eachouther.
Yes you can:
CREATE TABLE a (b int primary key);

You can also
CREATE TABLE a (b serial);

You can of course do both
CREATE TABLE a (b serial primary key);


text:
Q: Graceful stop of arangod on Windows10? Learning ArangoDB. I have had corrupt databases and had to reinstall arrangodb because it wouldn't start up.  Of course I was not properly shutting down the database, I would close lid and let the PC go to sleep, a little concerning that the database isn't a little more durable. I was using mmfiles, but just changed to dbrocks. hopefully that will help. Using 3.3.11.
1) How do I shutdown the arango server process gracefully in Windows? Didn't see anything in arangod help from the command line. If I stop in the services window, will that properly shut the server down and flush all the data to disk properly?
2) How to I start ArrangDB from the command line too?
Thanks, Mark

A: Your arangodb database should be fine with sleep / wakeup. It is a different story, when you have hard power off situations. In which case a database repair should fix your startup issues. The arangodb service, if installed as one, is shutdown gracefully, when Windows is shut down.
Do you have log files or your situation or have a database in such a state? We would like to fix it, if it's a bug. Also in case a database does get corrupted


text:
Q: Twitter API to get tweet and re-tweets count in php Is there any API for getting twitter tweets and retweets count.
Please help me
Thanks in advance.

A:
function getTweetCount($url)
{
    $url = urlencode($url);
    $twitterEndpoint = "http://urls.api.twitter.com/1/urls/count.json?url=%s";
    $fileData = file_get_contents(sprintf($twitterEndpoint, $url));
    $json = json_decode($fileData, true);
    unset($fileData); // free memory
    //print_r($json);
    return $json['count'];
}


text:
Q: BeautifulSoup returning 'None' when trying to find value of input I have been attempting to use BS to find the value of an input field on a webpage. However, no matter what I try, it always returns as 'None' although the element certainly exists. Here is a sample of the HTML.

Street Address:

<input type="text" name="entry_street_address" id="entry_street_address" value="1234 Example Ln" maxlength="64" required> * Required

So I attempt to use BS4 to grab the value of 'entry_street_address':
r = session.get("sampleurl.com/wheremydataisstored")

time.sleep(3)
soup = bs4(r.content,'html5lib')
info = soup.find('input', {'id': 'entry_street_address'}).get('value')
print(info)

Unfortunately, this always returns:
AttributeError: 'NoneType' object has no attribute 'get'

This always happens. No matter if I do html5lib, lxml, html.parser, no matter how long I .sleep() to wait for the page to load, etc. I'm not really sure where it's going wrong!


text:
Q: Bug jumping problem In the real axis, there is a bug standing at coordinate $x=1$. At each step, from the position $x=a$, the bug can jump to either $x=a+2$ or $x=\frac{a}{2}$. How many positions in total are there (including the initial position) that the bug can jump to by at most $n$ steps?
Isn't the answer trivially $2^n+1$? Am I missing something here?
EDIT: For examples, I tested the following:
$n=1$: Trivially, the answer is $2+1=3$.
$n=2$: The possible sequences are $1,3,5$ and $1,3,3/2$ and $1,1/2,7/2$ and $1,1/2,1/4$, which gives us a total of $7$ positions, but this is not equal to $2^2+1$. So, my hypothesis is incorrect.
Does anyone have any other idea in mind to solve this problem? We want to avoid collisions, where two possibilities land on the same position at some point, and we end up double-counting it.

A: From any starting location, the operation "forward, forward, backward" (FFB) is equivalent to "backward, forward" (BF), because $(x+2+2)/2=x/2+2$. This means that when counting the locations reachable in at most $n$ jumps, we can ignore any sequence that contains FFB, since it's equivalent to a shorter sequence.
An FFB-free sequence is one in which every B is immediately preceded by at most one F. Such a sequence is determined by the following data:

*

*how many Bs it has;

*for each B, whether there's an F immediately before it;

*the number of Fs that come after all the Bs.

Each such sequence takes the bug to a different final location. To see this, notice that the bug's position is always of the form $\frac m{2^k}$, where $m$ is odd and $k$ is the number of backwards jumps. A forward jump increases $m$ by $2^{k+1}$, and there's never any cancellation between the numerator and denominator since the numerator is odd, so sequences that give the same result must have the same number of Bs. Now consider the effect of the Fs on the binary representation of $m$: an F immediately before the $i$th B increments the bit at position $i$ (counting from 0 on the right), and Fs at the end of the sequence only affect higher-order bits. This means that given a final location $\frac m{2^k}$, there is a unique FFB-free sequence that brings the bug there (which we can essentially "read off" from $k$ and the binary representation of $m$).
Therefore, the count we want is just the number of FFB-free sequences of length at most $n$. Picking such a sequence is equivalent to picking:

*

*the number of Bs ($0\le b\le n$);

*the number of Fs not at the end ($0\le f\le b$ and $b+f\le n$);

*the positions of those Fs (a set of size $f$ from among $b$ choices);

*the number of Fs at the end (from $0$ to $n-b-f$).

The number of ways to do this is:
$$C(n)=\sum_{b=0}^n\sum_{f=0}^{\min(b,n-b)}\binom bf(n-b-f+1).$$

A: To finally prove Lahtonen's observation that the number of reachable locations after at most $n$ steps is given by A001924, we use the equivalence to $001$-avoiding binary strings from Karl's answer.
Let $a_n$ be the number of length-$n$ $001$-avoiding binary strings not ending in $0$; it is easy to show that $a_n=F_{n+1}$. Now let $b_n$ be the same but without the ending restriction. Since right $0$-padding is a bijection between $a_k$-strings for $k\le n$ and $b_n$-strings
$$b_n=\sum_{k=0}^nF_{k+1}=F_{n+3}-1$$
Finally let $c_n$ count the OP's desired result – $001$-avoiding binary strings of length at most $n$:
$$c_n=\sum_{k=0}^n(F_{k+3}-1)=F_{n+5}-(n+4)$$
which is essentially A001924.

A: $\newcommand{\BUG}{\operatorname{BUG}}$
This is not a solution to the problem, but I think it answers your question about the "trivial answer".
Let $\BUG(n)$ be the number of positions that the bug can jump to in at most $n$ steps. For example, in zero steps, the bug can only be at the starting position $1$, so $\BUG(0)=1$. In at most one step, the bug can get to $1/2$ or $3$, or it can be at its starting position (zero steps). So, $\BUG(1)=3$.
In general, since there are two options at each step, taking exactly $n$ steps will get the bug to at most $2^n$ different positions. Therefore, the number of possible positions after at most $n$ steps is at most $\sum_{k=0}^n 2^k$. So:
$$
\BUG(n) \leq \sum_{k=0}^n 2^k = 2^{n+1}-1.
$$
Note that for $n=0$ and $n=1$, this formula actually produces the exact number. I think this is the trivial solution you were looking for. So, we can ask: do we actually have $\BUG(n) = 2^{n+1}-1$?
The answer to this is no, as pointed out in the comments, since we can reach (for example) $5/2$ in two different ways: $1 \rightarrow 1/2 \rightarrow 5/2$ or $1 \rightarrow 3 \rightarrow 5 \rightarrow 5/2$. You can check by hand that:
$$
\BUG(3) = 14 < 15 = 2^{3+1}-1.
$$
So, the guess $\BUG(n) = 2^{n+1}-1$ is wrong. I don't what the real solution is; this seems like it could be a really tricky problem.

A: No proof yet, but I am now convinced that, as I commented under the question, the OEIS entry A001924 is the answer. I have verified by computer that if $N(m)$ stands for the number of places the bug can reach in at most $m$ jumps, the sequence $(N(m))_{m\ge0}$ begins with
$$1,3,7,14,26,46,79,133,221,364,\ldots$$
There are several descriptions of this sequence in the OEIS. I haven't gone through the list and checked, if it would be easy to connect this to any of them. Hopefully during the weekend...
Anyway, I'm sure you all recognize the sequence $(N(m)+m+4)_{m\ge0}$:
$$5,8,13,21,34,55,89,144,233,377,\ldots$$


text:
Q: Reverse Array (HackerRank) Am I leaning in the right direction with my code? I'm currently working on hacker rank and am on the easy section of data structures yet I still am confused about how to reverse this array!
Out of all my attempts, I like these two that I did. Check it out.
one attempt:

two attempts:

A: You should be walking down the input array, then populating the target array in the opposite direction:
public static int[] reverseArray(int[] a) {
    int[] b = new int[a.length];

    for (int i=0; i < a.length; ++i) {
        b[i] = a[a.length-i-1];
    }

    return b;
}

Just for fun, here is way to reverse the order of an original array, without using any extra storage:
// give input int[] a
for (int i=0; i < a.length / 2; ++i) {
    a[i] = a[a.length-i-1];
}

Note that this approach just walks down half of the array, and swaps elements about the median.

A: You can reverse array in two ways

*

*Either by fetching elements from last to start index and putting elements into new array

for example
int[] b = new int[n];
for(int i = n-1; i>=0 ; i--){
   n[i] = arrayTobeReverse[i];
}

for more you can visit : https://www.geeksforgeeks.org/reverse-an-array-in-java/

*By using Collection.reverse() method first you have to convert array into List using     Arrays.asList(array) you can create List using array and then reverse the List.
for example :
import java.util.*;

public class ReverseDemo
{
    public static void main(String[] args)
    {
        // Let us create a list of strings
        List<String>  mylist = new ArrayList<String>();
        mylist.add("practice");
        mylist.add("code");
        mylist.add("quiz");
        mylist.add("geeksforgeeks");

        System.out.println("Original List : " + mylist);

        // Here we are using reverse() method
        // to reverse the element order of mylist
        Collections.reverse(mylist);

        System.out.println("Modified List: " + mylist);
    }
}


text:
Q: HTML5 video slider - Creating elements on the fly I'm creating a custom HTML5 (full-width) video slider. Everything is going fine so far, but I'm wondering what's the quickest way to load video's.
Currently my approach is to create <video> elements on the fly. So when the next slide is loaded, the video element is created. I attached an eventlistener to the video to make sure to play it when it's loaded properly.
/**
 * Load and create the video on the fly
 */
var loadVideo = function(slide) {
    var video = $('<video muted></video>'),
        source = $('<source src="' + slide.attr('data-video') + '" type="video/mp4">');

    video.html(source);

    video.on('click', function() {
        var video = $(this)[0];
        if(video.playing) {
            video.pause();
        } else {
            video.play();
        }
    });

    video[0].addEventListener('canplay', showVideo(video), false);
    video[0].addEventListener('ended', hideVideo(video), false);

    // Append the newly created video element with it's source to the slide
    slide.html(video);
};

This works pretty good, and I think it's faster then loading 3/4/5 video's all at once when the DOM is rendered. Is this true? And would you have any tips/suggestions?
Thanks


text:
Q: Is it possible to use  tag in React Native tag? Now I am using firebase JS SDK to use phone authentication. I followed the web method.
Here is my code:
  handleClick = () => {
    this.state.verify_otp = "flex";
    this.state.register = "none";
    this.recaptcha = new firebase.auth.RecaptchaVerifier("recaptcha1");
    this.number = this.state.phone;
  };

.
<View
    style={{
        alignItems: "center",
        justifyContent: "center",
        flex: 1,
        display: this.state.captcha,
    }}
>

</View>

Is it possible to use a  tag in react-native code?

A: No, not natively. React Native doesn't support direct HTML, as it is not a web framework.
For rendering HTML in React Native, see Render HTML in React Native

A: No, it's not possible to use html tags in react-native
edit: list of basic RN components https://reactnative.dev/docs/components-and-apis#basic-components

A: No, you cannot use the
 element inside a react native component because React Native does not have a DOM.

A: Unfortunately its not possible. Div is an HTML element which can be read by Browser. For mobile app,  Its View
However you can build your own div
class Div extends Component {  //or Class Span extends Component

  static propTypes = {
      style : PropTypes.obj
      onClick : PropTypes.func   // ...
  }

  render (){
        return (
        <View>

    /* whatever is needed to pass everything through  ... */

       </View>
 )    }

}

A: You could use react-native-render-html to achieve like follow.
(if couldn't work have to install react-native-webview)
import * as React from 'react';
import { Text, View, StyleSheet,ScrollView, Dimensions } from 'react-native';
import Constants from 'expo-constants';
import HTML from 'react-native-render-html';

const htmlContent = `

This HTML snippet is Using react-native-render-html !

Trying many tag to render html

Here is what you want to add!!!!!
`
    ;
export default function App() {
  return (
    <View style={styles.container}>
     <ScrollView style={{ flex: 1 }}>

      </ScrollView>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    paddingTop: Constants.statusBarHeight,
    backgroundColor: '#ecf0f1',
    padding: 8,
  }
});

Code example on snack


text:
Q: Custom list model not updating JList So I made this custom ListModel, but it's not updating what's visible on the associated JList when I call addElements and extractElements. I suspect I'm not using the various "fire" methods correctly, but I can't see any problems myself. Any help is appreciated, thank you
public class PartsList extends AbstractListModel {

    private Vector<String> parts;

    public PartsList() {
        parts = new Vector<String>();
    }

/**
 * Adds an array of Strings to this list
 *
 * @param toAdd
 *            The array of Strings to add
 */
public void addElements(String[] toAdd) {
    for (String item : toAdd) {
        parts.addElement(item);
    }
    fireContentsChanged(this, 0, parts.size() - toAdd.length);
    fireIntervalAdded(this, parts.size() - toAdd.length, parts.size());
}

/**
 * Takes a list of indices and returns a String array of the
 * items at those indices while removing them
 *
 * @param toGet
 *            The (sorted) int array containing the indices
 * @return String[] The items saved at the given indices
 */
public String[] extractElements(int[] toGet) {
    String[] items = new String[toGet.length];
    int i = 0;
    for (int item : toGet) {
        items[i] = parts.remove(item - i); // The -i cancels out the fact an item was removed in previous iterations
        System.out.println(item - i);
        i++;
    }
    fireIntervalRemoved(this, parts.size(), parts.size() + i);
    fireContentsChanged(this, 0, parts.size());
    return items;
}
}

Update: Solved
The was some old code I forgot to clean up in a different class that was interfering with this but not anything else somehow.
I would just delete this question, but I can't.

A: The JList will use the getSize() and getElementAt() methods to determine how many elements to display. You don't implement those methods so I would guess you get an empty model.
Don't extend AbstractListModel. Instead extend the DefaultListModel and use the strorage provided by that class (so there is no need for the Vector).
Then just implement your addElements() and extractElements() method in the extended class. Your looping code will then just use the methods provided by the DefaultListModel class, like addElement(...) and remove(...) inside the loop to add/remove elements and those methods will fire the proper events.

A: This code does not deal with duplicate elements like: {1,2,1} in the integer array argument.
To deal with this you may want to use a set.
class PartsList extends AbstractListModel<String> {

private final Vector<String> parts;

public PartsList() {
    parts = new Vector<>();
}

/**
 * Adds an array of Strings to this list
 *
 * @param toAdd The array of Strings to add
 */
public void addElements(String[] toAdd) {
    for (String item : toAdd) {
        parts.addElement(item);
    }
    fireContentsChanged(this, 0, parts.size() - toAdd.length);
}

/**
 * Takes a list of indices and returns a String array of the items at those
 * indices while removing them
 *
 * @param toGet The (sorted) int array containing the indices
 * @return String[] The items saved at the given indices
 */
public String[] extractElements(int[] toGet) {
    Arrays.sort(toGet);
    String[] items = new String[toGet.length];
    int i = 0;
    for (int item : toGet) {
        items[i] = parts.remove(item - i); // The -i cancels out the fact an item was removed in previous iterations
        i++;
    }
    fireContentsChanged(this, 0, parts.size());
    return items;
}

@Override
public int getSize() {
    return parts.size();
}

@Override
public String getElementAt(int index) {
        return parts.get(index);
}
}


text:
Q: vue.js .sync can't read property of undefined My child component looks like this:

                Label
                <VTextField
                  :value="addOnLabel"
                  @input="$emit('update:addOnLabel', $event.target.value)"
                  solo
                  outline
                  reverse
                  type="text"
                />

props: {
    addOnLabel: {},
  },

My parent looks like this:
<MultiplierDropDown :addOnLabel.sync="addOnLabel"/>

Problem: as soon as I start typing something in the input field, it says Error in v-on handler: "TypeError: Cannot read property 'value' of undefined"

A: Try replacing $event.target.value with $event

A: On a <v-text-field>, the @input event emits the value of the model bound to it.
On a normal <input>, you need "$emit('update:addOnLabel', $event.target.value)", but here you just need "$emit('update:addOnLabel', $event)"

A: Try replacing
@input="$emit('update:addOnLabel', $event.target.value)"

with
v-on:input.native="$emit('update:addOnLabel', $event.target.value)"


text:
Q: Siesta iOS POST request errors out with "unsupported URL" I am having trouble with Siesta - an iOS REST Client Framework https://bustoutsolutions.github.io/siesta/.
Below is a simple example of a POST request to a REST API server, which fails with a "unsupported URL" error. Does anybody out there have any experience with Siesta and what could be wrong?
Siesta configuration & login server call
let api = Service(base: "http://myapidomain.net/rest")

enabledLogCategories = LogCategory.all

let parameters = ["username": "username", "password": "password"]

api.resource(url: "users/login").request(.POST, json: NSDictionary(dictionary: parameters)).success { data in
    debugPrint("success logging in")
}.failure { error in
    debugPrint("failed to log in")
}

Debug log
[Siesta:Configuration] Computing configuration for Siesta.Resource(users/login)[]
[Siesta:Configuration] Applying config 0 [Siesta default response transformers] to Siesta.Resource(users/login)[]
[Siesta:NetworkDetails] Request:
    headers: (1)
      Content-Type: application/json
[Siesta:Network] POST users/login
[Siesta:Network] – ← POST users/login
[Siesta:NetworkDetails] Raw response headers: –
[Siesta:NetworkDetails] Raw response body: 0 bytes
[Siesta:NetworkDetails] Response after transformer pipeline:  (new data)
   Failure
     userMessage:    "unsupported URL"
     nsError:        "unsupported URL"
"failed to log in"

A: The Service.resource(url:) method — the one with the parameter labeled url: — expects a complete URL. It looks like you want Service.resource(_:), which takes a path relative to the Service's base URL.
Try:
api.resource("users/login")


text:
Q: Declare a variable, having a key being a concatenation of two types I would like to lock the creation of an object by declaring that the keys in it are the concatenation of two types. Since it's blurry, let me picture it with some code :
type Letter = 'A' | 'B' | 'C';

boxes: { [ID in Letter]: string }[] = ...;

Right now, this code allows one to create a set of boxes like this :
boxes = [{ A: 1 }]; // Correct
boxes = [{ D: 1 }]; // Incorrect

What I would like to achieve is do the same thing, but incorporate digits in the keys. Something like this :
type Letter = 'A' | 'B' | 'C';
type Digit = '0' | '1' | '2';

boxes: { [ID in (Letter + '-' + Digit)]: string }[] = ...;

Where a user could then create this
boxes = { 'A-1': 1 };

Is it possible, and if so, how ?
PS : the keys have to be dynamic, i.e. I can't declare a new type made of all possible combinations

A: A-1 string requires to evaluate (Letter + '-' + Digit) at runtime. It's impossible to achieve type safety for such keys in TypeScript.
If type safety is a requirement, keys like A-1 can't be considered an appropriate way.

A: No this is not possible, there is no support for manipulation of string literals.
If your set of strings is limited (as in the provided example) then your best bet is to generate all the combinations (should not be that many and you could write a script to generate them)
If you have a lot of possible combinations, then you might do better with just a simple index signature.
Another approach is to redefine your data structure in a way where the second part of the index is actually a nested object, it's more verbose, but typesafe:
type Letter = 'A' | 'B' | 'C';
type Digit = '0' | '1' | '2';

type UnionOfJustOneProperty<T extends string, TAll extends string> = T extends string ? { [P in T]: string } & { [P in Exclude<TAll, T>]?: never }: never;
let boxes: { [P in Letter]: UnionOfJustOneProperty<Digit,Digit> }[] = [
    {
        A: { "0": "value"},
        B: { "1": "value"},
        C: { "0": "value", /* "1": "" */} // the commented code causes an error, we can only have one key in the object
    }
];


text:
Q: JWT Validation in Azure Function V2 I am trying to implement JWT token validation in Azure Function V2 using azure AD . However I am getting this error below
IDX10501: Signature validation failed. Unable to match keys:
kid: 'BB8CeFVqyaGrGNuehJIiL4dfjzw',
I am not sure what I am doing wrong here
Here is my code
public class AccessTokenProvider : IAccessTokenProvider
    {
        private const string AUTH_HEADER_NAME   = "Authorization";
        private const string BEARER_PREFIX      = "Bearer ";
        private readonly string _audience;
        private readonly string _issuer;
        private readonly bool _enabled;

        public AccessTokenProvider(bool enabled , string audience, string issuer)
        {
            _enabled        = enabled;
            _audience       = audience;
            _issuer         = issuer;
        }

        public AccessTokenResult ValidateToken(HttpRequest request)
        {
            try
            {
                if(!_enabled)
                {
                    return AccessTokenResult.Success(null);
                }
                // Get the token from the header
                if (request != null &&
                    request.Headers.ContainsKey(AUTH_HEADER_NAME) &&
                    request.Headers[AUTH_HEADER_NAME].ToString().StartsWith(BEARER_PREFIX))
                {
                     var sharedKey = new SymmetricSecurityKey(Convert.FromBase64String("PublicKey"));
                     var token = request.Headers[AUTH_HEADER_NAME].ToString().Substring(BEARER_PREFIX.Length);
                    // Create the parameters
                    var tokenParams = new TokenValidationParameters()
                    {
                        RequireSignedTokens         = true,
                        ValidAudience               = _audience,
                        ValidateAudience            = true,
                        ValidIssuer                 = _issuer,
                        ValidateIssuer              = true,
                        ValidateIssuerSigningKey    = true,
                        ValidateLifetime            = true,
                        IssuerSigningKey            = sharedKey
                    };

                    // Validate the token
                    var handler     = new JwtSecurityTokenHandler();

                    var result      = handler.ValidateToken(token, tokenParams, out var securityToken);
                    return AccessTokenResult.Success(result);
                }
                else
                {
                    return AccessTokenResult.NoToken();
                }
            }
            catch (SecurityTokenExpiredException)
            {
                return AccessTokenResult.Expired();
            }
            catch (Exception ex)
            {
                return AccessTokenResult.Error(ex);
            }
        }

I have this code in my Startup.cs
private static void RegisterJwtTokenValidation(IServiceCollection services)
        {
            // Get the configuration files for the OAuth token issuer
            var audience        = Environment.GetEnvironmentVariable("Authentication.Audiences");
            var issuer          = Environment.GetEnvironmentVariable("Authentication.Issuer");
            var authEnabled     = Environment.GetEnvironmentVariable("Authentication.Enabled");

            if (!bool.TryParse(authEnabled, out bool isAuthEnabled))
            {
                isAuthEnabled = false;
            }

            // Register the access token provider as a singleton
            services.AddSingleton<IAccessTokenProvider, AccessTokenProvider>(s => new AccessTokenProvider(isAuthEnabled, audience, issuer));
        }

Note: Code reference https://www.ben-morris.com/custom-token-authentication-in-azure-functions-using-bindings/

A: Depends on your use case, you may want to use the out of the box authentication mechanism for App Services:

*

*Authentication and authorization in Azure App Service
If you need to access user claims, you can have a look at the documentation as well:

*

*Advanced usage of authentication and authorization in Azure App Service - Access user claims


text:
Q: Running JQuery with CoffeeScript How can I properly use jQuery and CoffeeScript? All of the examples that I have seen thus far compile the CofeeScript at runtime in the browser; this is not ideal. Normally, I'd simply write in plain old JavaScript, but I think CoffeeScript can allow me do get more done with less code, once I know how to get started. I've worked with JQuery before, but I've not used CoffeeScript. I'm not sure where to get started? Should I place $(document).ready in my external CofeeScript/Javascript?

A: Just have to put the jquery code after $ ->
Here is a small article about it, and if you are starting The Little Book on CoffeeScript is quite useful, it's very clear and goes from scratch

A:
All of the examples that I have seen thus far compile the CoffeeScript at runtime in the browser; this is not ideal.

Agreed. You should look at projects like The Middleman that let you transparently compile your CoffeeScript to JavaScript on a local server for development, then bundle up the minified JS for deployment. (The Middleman also includes support for Haml and Sass, if you're into those, but you can just use HTML and CSS as well.)
The big advantage of The Middleman (or Rails, or any other web framework with CoffeeScript support) over just running coffee -cw is that the latest version of your compiled CoffeeScript is served every time you refresh the page; you never have to worry about waiting for background compilation to finish.


text:
Q: Converting nested fields of JSON into java objects Following is my class
class Feed {
    Long id;
    String title;
    String text;
    Short type;
    Object object;
}

Feed.object can be of any type based on Feed.type. When I upload the document of the class into elasticsearch every thing works fine, however, when the document is fetched back then org.codehaus.jackson.map.ObjectMapper converts Feed.object in LinkedHashMap. Is there a way to get the actual object? The JSON string I get is of Feed.
Following is the conversion:
Feed feed = mapper.readValue(response.getHits().getHits()[0].getSourceAsString(), Feed.class);

A: You can use @JsonTypeInfo to indicate what is the class of object according to the value of type in Feed class. For example,
class Feed {
    Long id;
    String title;
    String text;
    Short type;
    @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXTERNAL_POPERTY, propery = "type")
    @JsonSubTypes({
        @JsonSubTypes.Type(value = Foo.class, name = "1"),
        @JsonSubTypes.Type(value = Bar.class, name = "2")
    })
    Object object;
}


text:
Q: UIScrollView not working in swift 3 I have made a baseViewController which is derived from UIViewController, SlideMenuDelegate and UIWebViewDelegate
Then I have created subclass which are derived from baseviewcontroller

*

*LoginVC - displays login screen

*PlayVC - shows a webview if login is successful.

Everything is fine except that webview is not scrolling at all.
I have tried everything suggested in all posts so far regarding scrolling
Below is my code written in PlayVC.swift
@IBOutlet weak var web1: UIWebView!

override func viewDidLoad() {
    super.viewDidLoad()
    addSlideMenuButton()

    let webUrl : URL = URL(string: "http://brainyknights.com")!
    let webRequest : URLRequest = URLRequest(url: webUrl)

    web1.scalesPageToFit = true
    web1.isUserInteractionEnabled = true
    web1.scrollView.isScrollEnabled = true
    web1.loadRequest(webRequest)

    // Do any additional setup after loading the view.
}

A: remove this line web1.scalesPageToFit = true
@IBOutlet weak var web1: UIWebView!

    override func viewDidLoad() {
        super.viewDidLoad()
        addSlideMenuButton()

        let webUrl : URL = URL(string: "http://brainyknights.com")!
        let webRequest : URLRequest = URLRequest(url: webUrl)

        //web1.scalesPageToFit = true
        web1.isUserInteractionEnabled = true
        web1.scrollView.isScrollEnabled = true
        web1.loadRequest(webRequest)

        // Do any additional setup after loading the view.
    }

A: According Apple Documentation

scalesPageToFit
A Boolean value determining whether the webpage scales to fit the view
  and the user can change the scale.

if web1.scalesPageToFit is true then the web content will fit in your UIWebView frame and the contentSize will have the same height and width as your UIWebViewframe making imposible to be scrollable
so remove this line and must work
web1.scalesPageToFit = true

I hope this helps you


text:
Q: How can I turn 2 strings into a key? I have 2 strings with alphabetic values (a-e) & numeric values (1-5):
 num = 12345
 let = abcde

How can I get this using a for loop?
[1a, 2b, 3c, 4d, 5e]

A: Assuming that let and num are strings
>>> num = "12345"
>>> let = "abcde"

you could use zip:
>>> [''.join(i) for i in zip(num,let)]
['1a', '2b', '3c', '4d', '5e']

A: there you go:
num = '12345'
let = 'abcde'

keys = [n+l for n,l in zip(num, let)]


text:
Q: Fetch API not getting full HTML page I'm using the Fetch API to get some (public) data from a webpage. Here is my code:
const proxyurl = "https://cors-anywhere.herokuapp.com/";
var bookUrl = "the+old+man+and+the+sea";
var url = 'https://miss.ent.sirsidynix.net/client/en_US/mlsathome/search/results?qu=' +
bookUrl + '&te=ILS';

fetch(proxyurl + url).then(function(result){
    return result.text();
}).then(function(text){
    var parser = new DOMParser();
    var html = parser.parseFromString(text, 'text/html');
    var divs = html.getElementsByTagName('div');
    var x = html.getElementsByTagName('thead');
    console.log(divs);
    console.log(x);
});

The output in the console for divs is "HTMLCollection(80)" so I know the page has loaded, but the output for x is "HTMLCollection(0)" meaning that it found no thead elements. However, when I look at the source code for the page, I can see multiple thead tags. whenever I load the page, the tables do take a little longer to load. How do I get the Fetch API to get the entire page?


text:
Q: R: perform parameter sweep and collect results in long data frame I am looking the right R idiom to run a function over a set of parameters and create a long data frame from the results. Imagine that you have the following toy function:
fun <- function(sd, mean, foobar = "foobar") {
  list(random = rnorm(10) * sd + mean + 1:10, foobar = foobar)
}

Now you want to run fun over different values of sd and mean:
par_sd <- rep(1:5, 3)
par_mean <- rep(0:2, each = 5)
pars <- data.frame(sd = par_sd, mean = par_mean)

I want to run fun for the parameters in each row of pars, and collect the results in a data frame with columns sd, mean, pos, value. Here is a rather clumsy solution:
set.seed(42)

## Run fun
res <- lapply(seq_len(nrow(pars)), function(x) {
  do.call(fun, as.list(pars[x, ]))
})

## Select the result we need
res <- lapply(res, "[[", "random")

## Make it a single data frame
res <- do.call(rbind, res)

## Together with the parameters
res <- as.data.frame(cbind(sd = par_sd, mean = par_mean, res))
colnames(res) <- c("sd", "mean", 1:10)

## Make it a long data frame
res <- reshape2::melt(res, id.vars=c("sd", "mean"),
         variable.name = "pos", value.name="value")

## Done
res[1:5,]
#>   sd mean pos      value
#> 1  1    0   1 2.37095845
#> 2  2    0   1 3.60973931
#> 3  3    0   1 0.08008422
#> 4  4    0   1 2.82180049
#> 5  5    0   1 2.02999300

Is there a simpler way to do this? Anyone knows a package that does things like this? My quick search did not give any good results...

A: If you're willing to amend fun() to return a data.frame, I find the most elegant solution is plyr's mdply.
fun <- function(sd, mean, foobar = "foobar") {
  data.frame(random = rnorm(10) * sd + mean + 1:10, foobar = foobar)
}

par_sd <- rep(1:5, 3)
par_mean <- rep(0:2, each = 5)
pars <- data.frame(sd = par_sd, mean = par_mean)

results = mdply(pars, fun, foobar = "stuff")
str(results)

A: mapply would seem a good fit:
> str(with(pars, mapply(fun, sd=sd, mean=mean) ) )
List of 30
 $ : num [1:10] 3.16 2.28 2.84 1.49 3.43 ...
 $ : chr "foobar"
 $ : num [1:10] 3.429 0.157 0.583 1.542 6.485 ...
 $ : chr "foobar"
 $ : num [1:10] -4.56 -1.51 -1.33 7.16 3.21 ...
 $ : chr "foobar"
 $ : num [1:10] -2.275 2.225 4.196 0.962 15.739 ...
 $ : chr "foobar"
 $ : num [1:10] 6.23 10.08 2.85 6.81 4.51 ...
 $ : chr "foobar"
 $ : num [1:10] 1.65 3.15 5.62 5.91 6.14 ...
 $ : chr "foobar"
 $ : num [1:10] 4.26 1.95 7.33 2.72 6.29 ...
 $ : chr "foobar"
 $ : num [1:10] 7.53 6.74 3.6 6.43 3.08 ...
 $ : chr "foobar"
 $ : num [1:10] -0.4181 -0.0584 5.5812 1.038 8.2482 ...
 $ : chr "foobar"
 $ : num [1:10] 0.2377 4.8557 5.2177 -0.0706 2.0434 ...
 $ : chr "foobar"
 $ : num [1:10] 2.95 4.3 5.26 8.58 5.81 ...
 $ : chr "foobar"
 $ : num [1:10] -0.85 4.83 8.19 5.17 6.58 ...
 $ : chr "foobar"
 $ : num [1:10] 3.59 11.46 6.29 6.57 2.97 ...
 $ : chr "foobar"
 $ : num [1:10] 0.117 3.142 10.473 10.196 5.56 ...
 $ : chr "foobar"
 $ : num [1:10] 13.03 2.64 -1.07 5.29 1.97 ...
 $ : chr "foobar"
 - attr(*, "dim")= int [1:2] 2 15
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:2] "random" "foobar"
  ..$ : NULL

By default mapply will attempt to simplify and if you wanted to keep them as separate objects you could negate that default:
> str(with(pars, mapply(fun, sd=sd, mean=mean, SIMPLIFY=FALSE) ) )
List of 15
 $ :'data.frame':   10 obs. of  2 variables:
  ..$ random: num [1:10] 1.08 0.68 3.16 3.38 5.96 ...
  ..$ foobar: Factor w/ 1 level "foobar": 1 1 1 1 1 1 1 1 1 1
 $ :'data.frame':   10 obs. of  2 variables:
  ..$ random: num [1:10] 0.0927 5.1506 -1.0109 2.7136 2.1263 ...
  ..$ foobar: Factor w/ 1 level "foobar": 1 1 1 1 1 1 1 1 1 1
 $ :'data.frame':   10 obs. of  2 variables:
  ..$ random: num [1:10] -0.331 2.9 -1.705 5.471 4.712 ...
  ..$ foobar: Factor w/ 1 level "foobar": 1 1 1 1 1 1 1 1 1 1
snipped

And if you need them in one stacked dataframe, it's just:
> str(do.call( rbind, with(pars, mapply(fun, sd=sd, mean=mean, SIMPLIFY=FALSE) ) ))
'data.frame':   150 obs. of  2 variables:
 $ random: num  1 3.34 2.5 4.72 4.25 ...
 $ foobar: Factor w/ 1 level "foobar": 1 1 1 1 1 1 1 1 1 1 ...

If you want these "labeled" with the sd and mean values, just this modification of the constructor function:
 fun <- function(sd, mean, foobar = "foobar") {
         data.frame(random = rnorm(10) * sd + mean + 1:10,
                    sd=sd, mean=mean, foobar = foobar)
        }
 str(do.call( rbind, with(pars,
                     mapply(fun, sd=sd, mean=mean, SIMPLIFY=FALSE) ) ))
 #---------------
'data.frame':   150 obs. of  4 variables:
 $ random: num  1.42 1.13 3.73 4.5 5.63 ...
 $ sd    : int  1 1 1 1 1 1 1 1 1 1 ...
 $ mean  : int  0 0 0 0 0 0 0 0 0 0 ...
 $ foobar: Factor w/ 1 level "foobar": 1 1 1 1 1 1 1 1 1 1 ...


text:
Q: undefined method `...' for nil:NilClass in Rails ActiveRecord I am not sure what's wrong with my code here:
class ZombieController < ApplicationController
  def index
    @zombies = Zombie.all

    respond_to do |format|
        #format.json {render json: @rotting_zombies}
        format.html
    end

  end
end

class Zombie < ActiveRecord::Base
  attr_accessible  :name, :rotting, :age
  has_many :tweets
  has_one :brain, dependent: :destroy
  scope :rotting, where(rotting: true)
  scope :fresh, where("age < 30")
  scope :recent,order('created_at desc').limit(3)

end

class Brain < ActiveRecord::Base
  attr_accessible :flavor, :status, :zombie_id
  belongs_to :zombie
end

On Zombie index view I render the zombie name with brain flavour as follows:

List

Name

Flavor

<% @zombies.each do |zombie|%>

    <%= zombie.name %>
    <%= zombie.brain.flavor %>

<% end %>

The errors I am receiving are undefined methodflavor' for nil:NilClass.`
what might be wrong here? As far as I know I correctly defined the relationship both for zombie and brain model.

A: For fixing the issue that Rails trying to fetch property from a nil object, there are few ways:
By checking nil in view
change your views/zombies/index.html.erb
<%= zombie.brain.flavor %>

to
<%= zombie.brain ? zombie.brain.flavor : "string with no brain here" %>

By delegate
In your  models/zombie.rb
add delegate :flavor, :to=>:brain, :prefix=>true, :allow_nil=>true
And in your views/zombies/index, change the line as
<%= zombie.brain_flavor %>

By try()
Thanks @unnitallman
change your views/zombies/index.html.erb
<%= zombie.brain.flavor %>

to
<%= zombie.try(:brain).flavor %>


text:
Q: .NET 3.5 - Calling a webservice asynchonously multiple times from a WPF app Following on from my previous question [link text][1] , I have a new problem.
I have a WPF application that will call a webservice. This web service will be called asynchronously by pushing the 'GO' button. The results may take 30 seconds or so to come back.
The issue is that I want the users to be able to click the 'GO' button as many times as they like to issue multiple requests.
What I dont want is for the client to open up a new connection to the webservice every time the button is pressed. The web service method is very simple:
invokeExecutionRequest(int executionID)
This method just returns a flag specfying success or failure of the execution request.
Now if possible I dont really want to queue these requests on the client, because a queue has already been established on the server. What is the most elegant way to achieve this?

A: If you are using WCF for communication to your web service then you can control the connection open/close:

*

*Have one universal WCF connection (likely a global variable for the scope of the window)

*On each click of the Go button, check if the connection is open. If not open the connection, if it is then there is nothing to do.

*At some logical point (closing the window, doing some action that means Go wouldn't be clicked) close the connection.

A: I ended up just using BackGroundWorkers to fire off the web service requests. I think we are still openining multiple connections this way, however the number of requests is not large and we are considering changing our architecture so that one master request sent to the queue handler can initiate all other requests.
If I had more time to solve this I think WCF would have been the best option.


text:
Q: Styling current page in ASP.NET menu I have master page with menu bar and a few nested pages. What is best practice to highlight selected menu item? For example:
[ Profile ] [Forum] [Statistics]

Statistics
blblalbla

A: This is what I use:
    //select menu item with matching NavigateUrl property
    foreach (MenuItem ParentMenu in menu.Items)
    {
        if (ParentMenu.NavigateUrl.ToLower() == Page.AppRelativeVirtualPath.ToLower())
        {
            ParentMenu.Selected = true;
        }
        else
        {
            foreach (MenuItem childMenu in ParentMenu.ChildItems)
            {
                if (childMenu.NavigateUrl.ToLower() == Page.AppRelativeVirtualPath.ToLower())
                {
                    childMenu.Selected = true;
                }
            }
        }
    }

A: The best way would be to put the menu in a control.  You can then have properties such as SelectedMenu which render the style of the selected menu item.
You can read about user controls here:
http://msdn.microsoft.com/en-us/library/fb3w5b53.aspx
They can be a little tricky at first, but once you have got the hang of them they will be very useful to you.

A: you can highlight the menuitem based on the current url.

A: Use StaticSelectedStyle and DynamicSelectedStyle properties


text:
Q: How to link a button to an email address I have a button (styled with CSS). The HTML looks like this:

Kontakt

Now I want to link the button to an email address. The following solution did not work. It shows the email address (email@email.de) as text in the button.

Kontakt

and the solution with the div container as the inner HTML element also does not work:

Kontakt

Any ideas on how I can show the word "Kontakt" as Text on the Button which links to an email address?

A: Just write
Kontakt

A: Easy solution is to wrap button with a element.

<button class="button">Kontakt</button>

A:

.btn {
  background: #3498db;
  background-image: -webkit-linear-gradient(top, #3498db, #2980b9);
  background-image: -moz-linear-gradient(top, #3498db, #2980b9);
  background-image: -ms-linear-gradient(top, #3498db, #2980b9);
  background-image: -o-linear-gradient(top, #3498db, #2980b9);
  background-image: linear-gradient(to bottom, #3498db, #2980b9);
  -webkit-border-radius: 28;
  -moz-border-radius: 28;
  border-radius: 28px;
  font-family: Arial;
  color: #ffffff;
  font-size: 20px;
  padding: 10px 20px 10px 20px;
  text-decoration: none;
}

.btn:hover {
  background: #3cb0fd;
  background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db);
  background-image: -moz-linear-gradient(top, #3cb0fd, #3498db);
  background-image: -ms-linear-gradient(top, #3cb0fd, #3498db);
  background-image: -o-linear-gradient(top, #3cb0fd, #3498db);
  background-image: linear-gradient(to bottom, #3cb0fd, #3498db);
  text-decoration: none;
}
Get In Touch

A: Use  tag.
Kontakt

and add css to make the  tag like button.

A: Just write this in you HTML file
Kontakt

and for the css add the following
a {
    text-decoration: none; /* to hide the underline */
}
a:visited {
    /* this will style the button after clicking for example the color of the text */
    color: white; /* change it to the text color in your normal style */
}
a:hover {
    /* the style here will appear when the mouse is over the button */
    /* this will help you to make it act like a real button */
}

or add onclick to the button tag and inside it add some javascript, example:
<button onclick="window.open('mailto:email@email.de');">Kontakt</button>


text:
Q: Linking APEX accounts to schemas? Is it possible to link apex accounts to multiple schemas or they can only link to the individual schema?

A: Yes, it is possible.
Logon as Admin, go to

*

*manage workspaces

*manage workspace to schema assignment

*click "Add schema" (upper right corner)

*follow the wizard (it's easy; choose a schema and add it to desired workspace)


text:
Q: jQuery.getScript(..) returns XMLHttpRequest error I'm trying to load some scripts from within my app.js file that contains all the javascript logic for my application, but am getting following error in chrome console:
XMLHttpRequest cannot load file:///... Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
$.getScript('lib/fastclick.js', function () {
     /* ... */
});

this is being tested locally, haven't uploaded it to my server yet, maybe the issue will not appear there, however I would like to know the cause and perhaps the fix to be able and continue working locally.

A:
this is being tested locally, haven't uploaded it to my server yet, maybe the issue will not appear there,

Correct.
Your local test environment should include an HTTP server. There are many differences between a webpage environment loaded over HTTP and one loaded over FILE.

however I would like to know the cause

Web pages running on your hard disk are not allowed to access other files on your hard disk with JS. Imagine what would happen if that wasn't the case and you opened an HTML document attached to an email sent by someone malicious.


text:
Q: How to display my inputted data after clicking "submit" button? i'm really sorry if im asking too dumb question, im really not a pro in programming, but im trying hard. So here is my problem, i created these 2 layouts.
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:background="#E0E0E0" >

<EditText
    android:id="@+id/editText1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="53dp"
    android:ems="14"
    android:inputType="textPersonName" >

    <requestFocus />
</EditText>

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/editText1"
    android:layout_alignParentTop="true"
    android:layout_marginTop="14dp"
    android:text="Name:"
    android:textAppearance="?android:attr/textAppearanceLarge" />

 <TextView
     android:id="@+id/textView2"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_alignLeft="@+id/editText1"
     android:layout_alignTop="@+id/myRadioGroup"
     android:layout_marginLeft="19dp"
     android:layout_marginTop="16dp"
     android:text="Gender:"
     android:textAppearance="?android:attr/textAppearanceMedium" />

 <RadioGroup
     android:id="@+id/myRadioGroup"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_below="@+id/editText1"
     android:layout_centerHorizontal="true"
     android:layout_marginTop="16dp"
     android:checkedButton="@+id/sound" >

     <RadioButton
         android:id="@+id/sound"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="Male" />

     <RadioButton
         android:id="@+id/vibration"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="Female" />
 </RadioGroup>

 <TextView
     android:id="@+id/textView3"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_alignLeft="@+id/textView2"
     android:layout_below="@+id/myRadioGroup"
     android:layout_marginTop="22dp"
     android:text="Known Computer Languages:"
     android:textAppearance="?android:attr/textAppearanceMedium" />

 <CheckBox
     android:id="@+id/checkBox1"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_alignLeft="@+id/textView3"
     android:layout_below="@+id/textView3"
     android:layout_marginTop="18dp"
     android:text="C#" />

 <CheckBox
     android:id="@+id/checkBox2"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_alignLeft="@+id/checkBox1"
     android:layout_below="@+id/checkBox1"
     android:text="C++" />

 <CheckBox
     android:id="@+id/checkBox3"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_alignLeft="@+id/checkBox2"
     android:layout_below="@+id/checkBox2"
     android:text="Java" />

 <CheckBox
     android:id="@+id/checkBox4"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_alignLeft="@+id/checkBox3"
     android:layout_below="@+id/checkBox3"
     android:text="JavaScript" />

 <CheckBox
     android:id="@+id/checkBox5"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_alignRight="@+id/textView3"
     android:layout_alignTop="@+id/checkBox1"
     android:text="Python" />

 <CheckBox
     android:id="@+id/checkBox6"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_alignBaseline="@+id/checkBox2"
     android:layout_alignBottom="@+id/checkBox2"
     android:layout_alignLeft="@+id/checkBox5"
     android:text="Ruby" />

 <CheckBox
     android:id="@+id/checkBox7"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_alignBaseline="@+id/checkBox3"
     android:layout_alignBottom="@+id/checkBox3"
     android:layout_alignLeft="@+id/checkBox6"
     android:text="PHP" />

 <CheckBox
     android:id="@+id/checkBox8"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_alignLeft="@+id/checkBox7"
     android:layout_alignTop="@+id/checkBox4"
     android:text="SQL" />

 <Button
     android:id="@+id/button1"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_alignParentBottom="true"
     android:layout_centerHorizontal="true"
     android:layout_marginBottom="23dp"
     android:text="Next Page" />

and here is the other one:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:background="#E0E0E0">

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:layout_marginLeft="18dp"
    android:layout_marginTop="15dp"
    android:text="How long have you been learning programming?"
    android:textAppearance="?android:attr/textAppearanceSmall" />

<EditText
    android:id="@+id/editText1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/textView1"
    android:layout_below="@+id/textView1"
    android:ems="10" >

</EditText>

<TextView
    android:id="@+id/textView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/editText1"
    android:layout_below="@+id/editText1"
    android:layout_marginTop="16dp"
    android:text="What programming language are you most interested in?"
    android:textAppearance="?android:attr/textAppearanceSmall" />

<EditText
    android:id="@+id/editText2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/textView2"
    android:layout_below="@+id/textView2"
    android:ems="10" >

    <requestFocus />
</EditText>

<TextView
    android:id="@+id/textView3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/editText2"
    android:layout_below="@+id/editText2"
    android:layout_marginTop="16dp"
    android:text="Programming language you find easy"
    android:textAppearance="?android:attr/textAppearanceSmall" />

<EditText
    android:id="@+id/editText3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/textView3"
    android:layout_below="@+id/textView3"
    android:ems="10" />

<TextView
    android:id="@+id/textView4"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/editText3"
    android:layout_below="@+id/editText3"
    android:layout_marginTop="15dp"
    android:text="Programming language you find difficult"
    android:textAppearance="?android:attr/textAppearanceSmall" />

<EditText
    android:id="@+id/editText4"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/textView4"
    android:layout_below="@+id/textView4"
    android:ems="10" />

<ToggleButton
    android:id="@+id/toggleButton1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/textView5"
    android:layout_below="@+id/textView5"
    android:layout_marginLeft="29dp"
    android:layout_marginTop="14dp"
    android:text="ToggleButton" />

<Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignRight="@+id/editText4"
    android:layout_alignTop="@+id/toggleButton1"
    android:text="Submit" />

<TextView
    android:id="@+id/textView5"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/editText4"
    android:layout_below="@+id/editText4"
    android:layout_marginTop="16dp"
    android:text="Please toggle on the button if you want to view the inputs after submission, toggle off if not."
    android:textAppearance="?android:attr/textAppearanceSmall" />

So my problem is, in the first layout, i want to be able to after i click next, i should be able to move to the next layout. (Haven't done it yet, since i really do not know how, tried to follow some youtube videos but i really cannot understand them) Assuming i connected the 2 layouts, and i move on to the next layout. Which contains a "submit" button at the end, i want to be able to let the user choose if he/she wants to immediately display the data they input into the layout 1 and 2. I put a toggle button in layout 2, which means that, if the toggle button is "on" before clicking submit, it should immediately show all the data they inputted including the questions. If they toggle the toggle button off before clicking submit, it should only display a small text notification on the bottom side something like, "form successfully submitted".
Im really really sorry if im asking this alot of questions and a wall of text. My teacher just expects too much of me, and im trying my best. (well, maybe not "too much" im might be just really just slow learner in programming) Thank you all. Im using eclipse by the way..

A: Create a class ModelPerson to hold the values a person
public class ModelPerson {
        String name = null;
        String gender = null; //insert the radio button value into this
        //
        //write getter and setter methods for above variables
        }

In Activity 1: Inside submit button clickListener(), start new intent , put values into it
ModelPerson  personObj  = new ModelPerson();
personObj.setName(editText1.getText.getString);
Intent intent = new Intent(Activity1.this,
                    Activity2.class);
            intent.putExtra("PersonsDetails", personObj)
            startActivity(intent);

In Activity 2: Inside onCreate() get the intent values using getExtra() method and retrieve the values from the Model person object.


text:
Q: Can VLC play Blu-ray films? I just tried to play a Blu-ray disc and VLC says Your input can't be opened:
VLC is unable to open the MRL 'dvd://E:\'. Check the log for details.
I have a disc in the drive!

*

*Will it not play because my monitor is in 4:3 view or something?

*What can can I use to play it?

*Any simple programs?

*Any quality software I can use now?  Or is everything paidware?

I have an LG drive on an HP computer using Windows 7.

A: Yes VLC can play Blu-ray discs.
You will need to update the keys database and AACS dynamic library, both of which can be downloaded from http://vlc-bluray.whoknowsmy.name/.

A: For legal reasons, AACS and BD+ DRM libraries and keys are not shipped in VLC. However, by doing some tricks, VLC can play Blu-Ray movies.
How to Play Blu-Ray with VLC in Windows 8/Windows 7 64-bit/32-bit:
http://www.techisky.com/how-to/play-blu-ray-with-vlc-media-player-in-windows8.html

A: I also met this problem before and find the answer later, which is because VLC can only support part of Blu-ray discs(non-commercial). It can do nothing to the AACS and BD+ protected BDs. So you need install a professional Blu-ray player on your PC. I have a small tool here http://www.macblurayplayer.com/how-to-use-blu-ray-player-on-win7.htm
Hope it helps.


text:
Q: Which studio owns the rights to the Watcher? I understand that the first time that the Watcher shows up in the comics is in the Fantastic Four to warn about Galactus, but he is involved throughout several events in the Marvel Universe (such as Civil War).  There is also the running gag that Stan Lee is secretly playing that character since he is playing some sort of non-important character in every movie.
That all being said, with Galactus, the Silver Surfer and the Fantastic Four being owned by another studio, and the Watcher often being tied to those properties, which studio owns the rights to Uatu?

A: We don't know for sure
The film rights for Marvel's assorted characters are a complicated situation, especially when it comes to non-title, franchise-spanning characters like Uatu. To my knowledge, detailed information about the ownership of characters in that category has never been made publicly available.
However
There's some (admittedly scant) evidence to suggest his rights are owned by Fox. In 2014, BleedingCool reported on restrictions placed on sketch card artists related to Fantastic Four characters; they include an image of a letter allegedly sent to an (unnamed) artist forbidding them from drawing, among other characters, the Watcher (click to embiggen):

Transcript: (emphasis theirs)

All  Marvel characters related to Fantastic Four are now off limits and will be immediately rejected by Marvel.
This includes but is not limited to:
[...]
The Watcher

This came shortly before Marvel announced the cancellation of the Fantastic Four title series, which is said by anonymous inside sources to be related to conflict between Marvel and Fox over the 2015 Fantastic Four film
I want to emphasize that this has not been publicly confirmed, and may be related to any number of other factors. It is, however, notable.

A: Updated answer:
In Guardians of the Galaxy Vol. 2,

we see Stan Lee conversing with three Watchers. His character is credited as "Watcher Informant," confirming who the characters are meant to be.

This means that Marvel Studios likely either already held the rights to the race, or made a deal similar to the one they used to acquire Ego's rights from Fox.


text:
Q: TextureView: Perform TextureView.getBitmap() in Background I am displaying CameraView in TextureView and am using TextureView.getBitmap() to get bitmaps from the TextureView.
Each time i call TextureView.getBitmap() it causes the Camera preview to freeze for a nano second. I would like to run this task in the background.
Thanks
here is the code i've tried:
     findViewById(R.id.capture).setOnClickListener(new OnClickListener() {
           @Override
           public void onClick(View v) {
             Bitmap bmp =  mTextureView.getBitmap();
             rev = new ArrayList<Bitmap>();
             rev.add(bmp);
             Toast.makeText(getApplicationContext(),""+ rev.size(), Toast.LENGTH_LONG).show();
           }
        });

Here is my Logcat
       08-22 03:59:57.867: E/AndroidRuntime(4859): FATAL EXCEPTION: main
        08-22 03:59:57.867: E/AndroidRuntime(4859): java.lang.NullPointerException
        08-22 03:59:57.867: E/AndroidRuntime(4859):     at                              com.example.hangout_gif_camera.MainActivity$1.onClick(MainActivity.java:41)
      08-22 03:59:57.867: E/AndroidRuntime(4859):   at            android.view.View.performClick(View.java:4211)
     08-22 03:59:57.867: E/AndroidRuntime(4859):    at       android.view.View$PerformClick.run(View.java:17446)
     08-22 03:59:57.867: E/AndroidRuntime(4859):    at   android.os.Handler.handleCallback(Handler.java:725)
    08-22 03:59:57.867: E/AndroidRuntime(4859):     at         android.os.Handler.dispatchMessage(Handler.java:92)
    08-22 03:59:57.867: E/AndroidRuntime(4859):     at android.os.Looper.loop(Looper.java:153)
     08-22 03:59:57.867: E/AndroidRuntime(4859):    at android.app.ActivityThread.main(ActivityThread.java:5297)
   08-22 03:59:57.867: E/AndroidRuntime(4859):  at java.lang.reflect.Method.invokeNative(Native Method)
    08-22 03:59:57.867: E/AndroidRuntime(4859):     at java.lang.reflect.Method.invoke(Method.java:511)
    08-22 03:59:57.867: E/AndroidRuntime(4859):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
    08-22 03:59:57.867: E/AndroidRuntime(4859):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
      08-22 03:59:57.867: E/AndroidRuntime(4859):   at dalvik.system.NativeStart.main(Native Method)

A:  freeze for a nano second

You wont even gonna realize that it freezes our eyes cant react that fast (except if you are superman).
But if you really want it to run in a separate Thread you can try this:
EDIT:
findViewById(R.id.capture).setOnClickListener(new OnClickListener() {
               @Override
               public void onClick(View v) {
                 Thread td = new Thread(new Runnable() {
                   public void run()
                   {
                         Bitmap bmp =  mTextureView.getBitmap();
                         rev = new ArrayList<Bitmap>();
                         rev.add(bmp);
                         runOnUiThread(new Runnable() {

                            @Override
                            public void run() {
                                 Toast.makeText(getApplicationContext(),""+ rev.size(), Toast.LENGTH_LONG).show();
                            }
                        });
                   }
                 });
                 td.start(); //start the thread

               }
            });

A: You have to fire TextureView.getBitmap() on the on the main UI thread.  Then pass that Bitmap off to an AsyncTask and do the rest there.  That's how I'm doing it and it works fine.
Beware of memory issues if you are capturing every frame of the TextureView, for example from MediaRecorder.


text:
Q: Intel S2600CP2J Motherboard with Noctua NH-D9DX i4 CPU Cooler + dual Xeon CPU E5-2670 Heat problems I have built a workstation from these components; All components used are brand new except the Motherboard and CPUs.

*

*Intel S2600CP2J Server Motherboard

*2x Noctua NH-D9DX i4 Xeon Heatsink/fans

*2x Xeon E5-2670 CPU's

*Enthoo Pro Case (PH-Es614P_WT)

*Corsair RM850x PSU

*32 GB RAM

*2x GTX 970's (MSI and Gigabyte)

Workstation Build Image 1 (out of the case, no GTX970s)
Workstation Build Image 2 (in case, 2x GTX970's)
It is all working fine, except the CPUs are getting rather hot; they are going up to around 80/90c after a few minutes data processing on 100% load; I have been advised this is way to hot and they should be at around 60c.
The heatskinks and fans are connected and are spinning, but I cannot seem to find a way in the bios to get this to increase cooling.
The Motherboard is in the case and the case Fan Hub is connected to Sys_fan_7 on the MB (the only spare 4pin fan header). The CPU fans are connected to CPU_Fan_1 and CPU_Fan_2.
I have tried changing the limited options in the BIOS with no change; all there seems to be is an option for power or performance, but no related to CPU fans.
I have not updated the BIOS as I have been advised this could cause major issues if this fails, and have taken this advice as being a newbie system builder.
Additionally, someone else that had built this machine using the same parts as I, explained that after he updated the BIOS there was no drop in CPU temp; indeed as it now fully implemented the Turbo boost of the Xeon CPU's this infact increased CPU temp slightly.
Additionally I currently have two GTX970's in the workstation, which I have now removed to keep case and CPU temp down.

THE SOLUTION IS THE LAST POST DONE BY MYSELF - ALL FIXED NOW!

Chris

A: This is my research for cooling system in PC, i hope it can resolve your problem :
http://www.slideshare.net/rizalpahlevi212/tfsc-technology
http://www.slideshare.net/rizalpahlevi212/tfsc-three-fan-smart-cooling-technology

A: The answer turned out to be..
Basically you had to run the SDR update, which in turn reset the FAN settings for a Non-Intel case which finally sorted out the CPU heat problems.
They are now running at a cool 60c when on 100% load across all 32 threads for weeks continuously processing data.


text:
Q: Convert nested type in C# using delegates / LINQ How can I convert a List<List<string>> to a List<string[]> in C# in a concise way using delegates/LINQ?

A: I believe this will do it:
var result = (from list in listOfLists select list.ToArray()).ToList()

A: var lists = new List<List<string>>();
List<string[]> arrays = lists.ConvertAll(l => l.ToArray());

A: List<List<string>> listOfLists = new List<List<string>>();

listOfLists.Add(new List<string>(){ "bla", "foo", "bar"});
listOfLists.Add(new List<string>() { "alfa", "beta", "gama" });
listOfLists.Add(new List<string>() { "earth", "moon", "sun" });
listOfLists.Add(new List<string>() { "cat", "dog", "owl" });

List<string[]> listOfArrays = new List<string[]>();

listOfArrays = listOfLists.Select(l => l.ToArray()).ToList();