text:
Q: How to remove annotation tick mark in line chart of google api chart? I got this chart in line chart of google api.

Here i'm trying to display the point value in above the point. so i'm using annotation. Here how to remove annotation tick mark in between the points(23 & 2008, 145 & 2009...) in google api chart.
<script type="text/javascript">
        google.load("visualization", "1", {packages: ["corechart"]});
        google.setOnLoadCallback(drawChart);
        function drawChart() {

            var data = new google.visualization.DataTable();
            data.addColumn('string', 'Year');
            data.addColumn({type: 'number', role: 'annotation'});
            data.addColumn('number', 'Sales');

            data.addRows([
                ['2008', 23, 54],
                ['2009', 145, 55],
                ['2010', 245, 56],
                ['2011', 350, 57]
            ]);
            var options = {
                width: 400,
                height: 200,
                pointSize: 4,
                legend: {position: 'none'},
                chartArea: {
                    left: 0,
                    top: 60,
                    width: 400,
                    height: 50},
                vAxis: {
                    baselineColor: '#fff',
                    gridlines: {color: 'transparent'},
                        maxValue:'58',
                        minValue:'52'
                },
                tooltip: {trigger: 'none'},
                annotation: {
                    1: {
                        style: 'default'

                    }
                }
            };

            var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
            chart.draw(data, options);

        }
    </script>

A: You can remove the annotation tick marks or 'stems' by setting the stemColor parameter to none:
annotations: {
   stemColor : 'none'
}

A: It seems it's not possible to do that using API.
Those 4 ticks are presented as SVG elements:
<g>
    <rect x="50.375" y="105" width="1" height="5" stroke="none" stroke-width="0" fill="#999999"></rect>
    <rect x="150.125" y="105" width="1" height="5" stroke="none" stroke-width="0" fill="#999999"></rect>
    <rect x="249.875" y="105" width="1" height="5" stroke="none" stroke-width="0" fill="#999999"></rect>
    <rect x="349.625" y="105" width="1" height="5" stroke="none" stroke-width="0" fill="#999999"></rect>
</g>

and there is nothing special to hook on to change it. Using for example CSS rule display: none
You can do something like this:
var rectTags = document.getElementsByTagName("rect");

function drawChart() {
   ...

    chart.draw(data, options);

    for (var i = 0; i < rectTags.length; i++) {
        if (rectTags[i].hasAttribute("width")) {
            var width = rectTags[i].getAttribute("width");
            if (parseInt(width) == 1) {
                rectTags[i].setAttribute("width", 0);
            }
        }
    }
    ...

But you can use this solution only in case you have no other rect elements with width 1. So, you can do additional check if rectTags is the same as number of data raws.
See example at jsBin
This example uses SVG and it won't work with IE7/IE8. See Can't display SVG charts in Internet Explorer 8


text:
Q: Different virtual hosts (Apache) for different subdirectories? I want to host a webpage for 150 users. Each user will have a unique webpage by the url url/username/index.html.  Here username is unique for all users rest all remains common.
So do I need to make 150 virtual hosts in Apache Server or is there some other way out?

A: You could enable per-user web directories with mod_userdir which maps
http://example.com/~username/index.html

to the corresponding file
/home/username/public_html/index.html

in the user directory per default.
To get rid of the tilde, you could use Apache's rewrite engine and forbid access to all URLs starting with ~ and use Aliases to map the individual paths to their user directories.
Add this to your VirtualHost config:
RewriteEngine On
# forbid URLs starting with /~
RewriteRule ^/~  -  [F]

# map individual paths to user dirs
Alias /bart    /home/bart/public_html
Alias /homer   /home/homer/public_html
Alias /lisa    /home/lisa/public_html
Alias /maggie  /home/maggie/public_html
# ...

If you don't need to serve any files from your DocumentRoot, you could use one AliasMatch instead of 150 Aliases:
# map all paths to user dirs
AliasMatch ^/([^/]+)(/.*)?$  /home/$1/public_html$2

You need to enable mod_userdir and mod_rewrite in your server, on Debian you would do this with a2enmod and a restart.
sudo a2enmod userdir rewrite
sudo service apache2 restart

A: This cannot even be done with virtual hosts because you would need different host names (or ports) for telling them apart.
This is just one host with subdirectories for different users. So you may have to (or at least want) to set different file permissions for each of those subdirectories.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Udev script stops after first command My udev rule points to a bash script with two commands.
While the first command echo runs fine, the second line ifuse seems not to be executed.
$ cat /etc/udev/rules.d/test.rules
ACTION=="add", SUBSYSTEM=="usb", ENV{PRODUCT}=="5ac/12a8/804", ENV{INTERFACE}=="255/253/1" RUN+="/bin/sh /home/user/test.sh"

$ cat /home/user/test.sh
#!/bin/sh
echo "Phone connected" >> /home/user/test.log
sleep 3
/usr/bin/ifuse /home/user/media/iOS

Remarks:

*

*ifuse works if I execute the script manually: $ sh test.sh

*Replacing the udev RUN+ statement with "/bin/su user -c /home/user/test.sh" doesn't help

*Man page ifuse: https://www.mankier.com/1/ifuse


text:
Q: javascript function not recognized inside bootstrap dropdown button I'm trying to build a Bootstrap button dropdown list, where each element in the list calls a function and pass its id into it.  My js functions are defined in an object called Search, which is instantiated on page load.  Here's my setup.

                        <button type="button" id='filelist' class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false" onclick='search.print()'>
                            List Of </button>

Var1

Var2

                    <input type='text' class='form-control' id='uploadtype_text' readonly>

                            Browse… <input type="file" name='filelist'>

                    <input type="text" class="form-control" readonly>

                        <input type="submit" name="uploadfile_form" value="Submit" class="btn btn-danger"/>
                        <button type='button' name='clear' class='btn btn-success' onclick='search.clearResults()'>Clear</button>

search.print() gets called correctly when I attach it to the main "List Of" button, however, when I click any of the li elements, I'm getting the error
search.print is not a function

I've gotten this working before in other cases, but for some reason this is breaking, and I can't figure it out.  I seems like a syntax error or something I'm missing.  The variable search doesn't look like it's getting overridden either.  I don't get it.
Here's a fiddle
https://jsfiddle.net/rnxx4rnc/

A: You need to bind search to the window object.
$(function() {
  window.search = new Search();
});


text:
Q: How does the clock() function in  access the system clock? I'm using an STM32 microcontroller with minimal libraries attached. I'd like to use the clock() function from <ctime> (and potentially the new std::chrono) but I'm stuck at clock() returning -1.
This isn't surprising, since I don't expect the libraries in gcc-arm-none-eabi to know the peripheral layout of my microcontroller.
How do I tell clock where it gets its tick count from? Can I simply redeclare it, or is there a lower-level function that I need to implement?

A: This is normally part of the job of porting a libc implementation to a new platform. When you compile a copy of glibc or newlib (the two most popular implementations of the C standard library) you have to provide a series of stub methods, one of these will be providing the time. gcc-arm-none-eabi is a target predefined in newlib that implements a lot of these stubs, but not the ones for getting the time, because like you said these are application specific.
The best thing to do would be to build the toolchain yourself, implementing this method. You can follow the instructions here, but just before you build newlib edit the target to fill in this stub. A good reference to implementing the stubs is available here.
Alternatively you could implement your own clock function directly, when you link your application it will prefer your version over the one in the library. Be warned, however, this means that anything in the library that calls clock will still call the broken library version, so you may need to reimplement a lot of functions.


text:
Q: How can I serialize an entity timestamp in the right format to use it with datatables? I am serializing data from my entity to a json file. This json file I am using later to load datatables:
$table = $this->getDoctrine()->getRepository($EntityName)->findAll();

$serializer = new Serializer(array(new GetSetMethodNormalizer()), array('json' => new JsonEncoder()));
$data = $serializer->serialize($table, 'json');

It is working well. But now I added a datetime field in my entity:
 /**
 * @ORM\Column(type="datetime")
 */
 private $timestamp;

And now my json file is getting extremly large:
[{"id":1,"uniqueId":"5235523423","timestamp":{"timezone":{"name":"Europe\/Berlin","transitions":[{"ts":-9223372036854775808,"time":"-292277022657-01-27T08:29:52+0000","offset":3208,"isdst":false,"abbr":"LMT"},{"ts":-2147483648,"time":"1901-12-13T20:45:52+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-1693706400,"time":"1916-04-30T22:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-1680483600,"time":"1916-09-30T23:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-1663455600,"time":"1917-04-16T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-1650150000,"time":"1917-09-17T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-1632006000,"time":"1918-04-15T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-1618700400,"time":"1918-09-16T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-938905200,"time":"1940-04-01T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-857257200,"time":"1942-11-02T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-844556400,"time":"1943-03-29T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-828226800,"time":"1943-10-04T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-812502000,"time":"1944-04-03T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-796777200,"time":"1944-10-02T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-781052400,"time":"1945-04-02T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-776563200,"time":"1945-05-24T00:00:00+0000","offset":10800,"isdst":true,"abbr":"CEMT"},{"ts":-765936000,"time":"1945-09-24T00:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-761180400,"time":"1945-11-18T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-757386000,"time":"1945-12-31T23:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-748479600,"time":"1946-04-14T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-733273200,"time":"1946-10-07T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-717631200,"time":"1947-04-06T02:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-714610800,"time":"1947-05-11T01:00:00+0000","offset":10800,"isdst":true,"abbr":"CEMT"},{"ts":-710380800,"time":"1947-06-29T00:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-701910000,"time":"1947-10-05T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-684975600,"time":"1948-04-18T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-670460400,"time":"1948-10-03T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-654130800,"time":"1949-04-10T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-639010800,"time":"1949-10-02T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":315529200,"time":"1979-12-31T23:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":323830800,"time":"1980-04-06T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":338950800,"time":"1980-09-28T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":354675600,"time":"1981-03-29T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":370400400,"time":"1981-09-27T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":386125200,"time":"1982-03-28T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":401850000,"time":"1982-09-26T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":417574800,"time":"1983-03-27T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":433299600,"time":"1983-09-25T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":449024400,"time":"1984-03-25T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":465354000,"time":"1984-09-30T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":481078800,"time":"1985-03-31T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":496803600,"time":"1985-09-29T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":512528400,"time":"1986-03-30T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":528253200,"time":"1986-09-28T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":543978000,"time":"1987-03-29T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":559702800,"time":"1987-09-27T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":575427600,"time":"1988-03-27T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":591152400,"time":"1988-09-25T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":606877200,"time":"1989-03-26T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":622602000,"time":"1989-09-24T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":638326800,"time":"1990-03-25T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":654656400,"time":"1990-09-30T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":670381200,"time":"1991-03-31T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":686106000,"time":"1991-09-29T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":701830800,"time":"1992-03-29T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":717555600,"time":"1992-09-27T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":733280400,"time":"1993-03-28T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":749005200,"time":"1993-09-26T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":764730000,"time":"1994-03-27T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":780454800,"time":"1994-09-25T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":796179600,"time":"1995-03-26T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":811904400,"time":"1995-09-24T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":828234000,"time":"1996-03-31T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":846378000,"time":"1996-10-27T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":859683600,"time":"1997-03-30T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":877827600,"time":"1997-10-26T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":891133200,"time":"1998-03-29T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":909277200,"time":"1998-10-25T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":922582800,"time":"1999-03-28T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":941331600,"time":"1999-10-31T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":954032400,"time":"2000-03-26T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":972781200,"time":"2000-10-29T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":985482000,"time":"2001-03-25T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1004230800,"time":"2001-10-28T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1017536400,"time":"2002-03-31T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1035680400,"time":"2002-10-27T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1048986000,"time":"2003-03-30T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1067130000,"time":"2003-10-26T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1080435600,"time":"2004-03-28T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1099184400,"time":"2004-10-31T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1111885200,"time":"2005-03-27T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1130634000,"time":"2005-10-30T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1143334800,"time":"2006-03-26T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1162083600,"time":"2006-10-29T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1174784400,"time":"2007-03-25T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1193533200,"time":"2007-10-28T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1206838800,"time":"2008-03-30T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1224982800,"time":"2008-10-26T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1238288400,"time":"2009-03-29T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1256432400,"time":"2009-10-25T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1269738000,"time":"2010-03-28T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1288486800,"time":"2010-10-31T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1301187600,"time":"2011-03-27T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1319936400,"time":"2011-10-30T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1332637200,"time":"2012-03-25T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1351386000,"time":"2012-10-28T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1364691600,"time":"2013-03-31T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1382835600,"time":"2013-10-27T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1396141200,"time":"2014-03-30T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1414285200,"time":"2014-10-26T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1427590800,"time":"2015-03-29T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1445734800,"time":"2015-10-25T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1459040400,"time":"2016-03-27T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1477789200,"time":"2016-10-30T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1490490000,"time":"2017-03-26T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1509238800,"time":"2017-10-29T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1521939600,"time":"2018-03-25T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1540688400,"time":"2018-10-28T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1553994000,"time":"2019-03-31T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1572138000,"time":"2019-10-27T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1585443600,"time":"2020-03-29T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1603587600,"time":"2020-10-25T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1616893200,"time":"2021-03-28T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1635642000,"time":"2021-10-31T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1648342800,"time":"2022-03-27T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1667091600,"time":"2022-10-30T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1679792400,"time":"2023-03-26T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1698541200,"time":"2023-10-29T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1711846800,"time":"2024-03-31T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1729990800,"time":"2024-10-27T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1743296400,"time":"2025-03-30T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1761440400,"time":"2025-10-26T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1774746000,"time":"2026-03-29T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1792890000,"time":"2026-10-25T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1806195600,"time":"2027-03-28T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1824944400,"time":"2027-10-31T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1837645200,"time":"2028-03-26T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1856394000,"time":"2028-10-29T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1869094800,"time":"2029-03-25T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1887843600,"time":"2029-10-28T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1901149200,"time":"2030-03-31T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1919293200,"time":"2030-10-27T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1932598800,"time":"2031-03-30T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1950742800,"time":"2031-10-26T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1964048400,"time":"2032-03-28T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1982797200,"time":"2032-10-31T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1995498000,"time":"2033-03-27T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":2014246800,"time":"2033-10-30T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":2026947600,"time":"2034-03-26T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":2045696400,"time":"2034-10-29T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":2058397200,"time":"2035-03-25T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":2077146000,"time":"2035-10-28T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":2090451600,"time":"2036-03-30T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":2108595600,"time":"2036-10-26T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":2121901200,"time":"2037-03-29T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":2140045200,"time":"2037-10-25T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"}],"location":{"country_code":"DE","latitude":52.5,"longitude":13.366659999999996,"comments":"Germany (most areas)"}},"offset":3600,"timestamp":1545278400},"name":"cat"},{"id":2,"uniqueId":"3413123523","timestamp":{"timezone":{"name":"Europe\/Berlin","transitions":[{"ts":-9223372036854775808,"time":"-292277022657-01-27T08:29:52+0000","offset":3208,"isdst":false,"abbr":"LMT"},{"ts":-2147483648,"time":"1901-12-13T20:45:52+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-1693706400,"time":"1916-04-30T22:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-1680483600,"time":"1916-09-30T23:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-1663455600,"time":"1917-04-16T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-1650150000,"time":"1917-09-17T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-1632006000,"time":"1918-04-15T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-1618700400,"time":"1918-09-16T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-938905200,"time":"1940-04-01T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-857257200,"time":"1942-11-02T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-844556400,"time":"1943-03-29T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-828226800,"time":"1943-10-04T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-812502000,"time":"1944-04-03T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-796777200,"time":"1944-10-02T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-781052400,"time":"1945-04-02T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-776563200,"time":"1945-05-24T00:00:00+0000","offset":10800,"isdst":true,"abbr":"CEMT"},{"ts":-765936000,"time":"1945-09-24T00:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-761180400,"time":"1945-11-18T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-757386000,"time":"1945-12-31T23:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-748479600,"time":"1946-04-14T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-733273200,"time":"1946-10-07T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-717631200,"time":"1947-04-06T02:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-714610800,"time":"1947-05-11T01:00:00+0000","offset":10800,"isdst":true,"abbr":"CEMT"},{"ts":-710380800,"time":"1947-06-29T00:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-701910000,"time":"1947-10-05T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-684975600,"time":"1948-04-18T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-670460400,"time":"1948-10-03T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":-654130800,"time":"1949-04-10T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":-639010800,"time":"1949-10-02T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":315529200,"time":"1979-12-31T23:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":323830800,"time":"1980-04-06T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":338950800,"time":"1980-09-28T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":354675600,"time":"1981-03-29T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":370400400,"time":"1981-09-27T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":386125200,"time":"1982-03-28T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":401850000,"time":"1982-09-26T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":417574800,"time":"1983-03-27T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":433299600,"time":"1983-09-25T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":449024400,"time":"1984-03-25T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":465354000,"time":"1984-09-30T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":481078800,"time":"1985-03-31T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":496803600,"time":"1985-09-29T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":512528400,"time":"1986-03-30T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":528253200,"time":"1986-09-28T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":543978000,"time":"1987-03-29T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":559702800,"time":"1987-09-27T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":575427600,"time":"1988-03-27T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":591152400,"time":"1988-09-25T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":606877200,"time":"1989-03-26T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":622602000,"time":"1989-09-24T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":638326800,"time":"1990-03-25T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":654656400,"time":"1990-09-30T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":670381200,"time":"1991-03-31T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":686106000,"time":"1991-09-29T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":701830800,"time":"1992-03-29T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":717555600,"time":"1992-09-27T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":733280400,"time":"1993-03-28T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":749005200,"time":"1993-09-26T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":764730000,"time":"1994-03-27T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":780454800,"time":"1994-09-25T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":796179600,"time":"1995-03-26T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":811904400,"time":"1995-09-24T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":828234000,"time":"1996-03-31T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":846378000,"time":"1996-10-27T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":859683600,"time":"1997-03-30T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":877827600,"time":"1997-10-26T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":891133200,"time":"1998-03-29T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":909277200,"time":"1998-10-25T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":922582800,"time":"1999-03-28T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":941331600,"time":"1999-10-31T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":954032400,"time":"2000-03-26T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":972781200,"time":"2000-10-29T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":985482000,"time":"2001-03-25T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1004230800,"time":"2001-10-28T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1017536400,"time":"2002-03-31T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1035680400,"time":"2002-10-27T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1048986000,"time":"2003-03-30T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1067130000,"time":"2003-10-26T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1080435600,"time":"2004-03-28T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1099184400,"time":"2004-10-31T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1111885200,"time":"2005-03-27T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1130634000,"time":"2005-10-30T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1143334800,"time":"2006-03-26T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1162083600,"time":"2006-10-29T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1174784400,"time":"2007-03-25T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1193533200,"time":"2007-10-28T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1206838800,"time":"2008-03-30T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1224982800,"time":"2008-10-26T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1238288400,"time":"2009-03-29T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1256432400,"time":"2009-10-25T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1269738000,"time":"2010-03-28T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1288486800,"time":"2010-10-31T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1301187600,"time":"2011-03-27T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1319936400,"time":"2011-10-30T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1332637200,"time":"2012-03-25T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1351386000,"time":"2012-10-28T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1364691600,"time":"2013-03-31T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1382835600,"time":"2013-10-27T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1396141200,"time":"2014-03-30T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1414285200,"time":"2014-10-26T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1427590800,"time":"2015-03-29T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1445734800,"time":"2015-10-25T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1459040400,"time":"2016-03-27T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1477789200,"time":"2016-10-30T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1490490000,"time":"2017-03-26T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1509238800,"time":"2017-10-29T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1521939600,"time":"2018-03-25T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1540688400,"time":"2018-10-28T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1553994000,"time":"2019-03-31T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1572138000,"time":"2019-10-27T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1585443600,"time":"2020-03-29T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1603587600,"time":"2020-10-25T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1616893200,"time":"2021-03-28T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1635642000,"time":"2021-10-31T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1648342800,"time":"2022-03-27T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1667091600,"time":"2022-10-30T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1679792400,"time":"2023-03-26T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1698541200,"time":"2023-10-29T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1711846800,"time":"2024-03-31T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1729990800,"time":"2024-10-27T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1743296400,"time":"2025-03-30T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1761440400,"time":"2025-10-26T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1774746000,"time":"2026-03-29T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1792890000,"time":"2026-10-25T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1806195600,"time":"2027-03-28T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1824944400,"time":"2027-10-31T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1837645200,"time":"2028-03-26T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1856394000,"time":"2028-10-29T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1869094800,"time":"2029-03-25T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1887843600,"time":"2029-10-28T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1901149200,"time":"2030-03-31T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1919293200,"time":"2030-10-27T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1932598800,"time":"2031-03-30T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1950742800,"time":"2031-10-26T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1964048400,"time":"2032-03-28T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":1982797200,"time":"2032-10-31T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":1995498000,"time":"2033-03-27T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":2014246800,"time":"2033-10-30T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":2026947600,"time":"2034-03-26T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":2045696400,"time":"2034-10-29T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":2058397200,"time":"2035-03-25T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":2077146000,"time":"2035-10-28T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":2090451600,"time":"2036-03-30T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":2108595600,"time":"2036-10-26T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"},{"ts":2121901200,"time":"2037-03-29T01:00:00+0000","offset":7200,"isdst":true,"abbr":"CEST"},{"ts":2140045200,"time":"2037-10-25T01:00:00+0000","offset":3600,"isdst":false,"abbr":"CET"}],"location":{"country_code":"DE","latitude":52.5,"longitude":13.366659999999996,"comments":"Germany (most areas)"}},"offset":3600,"timestamp":1545131760},"name":"frog"}]

I do not know why this is happening, but also my datatables cannot recognize this field anymore:

DataTables warning: table id=DataTables_Table_0 - Requested unknown
  parameter 'timestamp' for row 0, column 1. For more information about
  this error, please see http://datatables.net/tn/4

A: You are not specified the version of Symfony.
Just use DateTimeNormalizer if your Symfony version >= 3.1:
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;

$serializer = new Serializer(array(new DateTimeNormalizer('U'), new GetSetMethodNormalizer()), array('json' => new JsonEncoder()));

Use U format to get timestamp, or specify format you need, in example, Y/m/d


text:
Q: Can a capacitor be charged with multiple batteries connected in series I connect 2 9-volt batteries in series. Then I connect that to a capacitor. Will that then charge the capacitor to 18 volts?

A: Yes. Of course only if the connection between the two voltage sources (batteries) is between opposite polarities (positive terminal of one battery connected to negative terminal of the other battery) so that the voltages add.


text:
Q: Retq instruction, where does it return I am unable to understand where the assembly instruction retq returns to.
I understand that when my normal code executes then it return to the address specified in the stack. But how does it know where in the stack is the return address located?
In short, does it use rbp or esp for finding the address on the stack?

A: After studying assembly code, here are my thoughts,
let's look at a sample:
fun:
push %rbp
mov %rsp,%rbp
...
...
pop %rbp
retq

main:
...
...
callq  "address" <fun>
...
...

We can see there is a instruction before retq. The pop %rbp (sometimes it is a leave instruction but they are similar) instruction will

*

*save the content of current stack pointer %rsp to base stack pointer %rbp.

*move the %rsp pointer to previous address on stack.

For example: before pop command, the %rsp pointed to 0x0000 0000 0000 00D0. After the pop command it points to 0x0000 0000 0000 00D8  (assume the stack grows from high address to low address).
After the pop command, now %rsp points to a new address and retq takes this address as return address.

A: ret is how you spell pop rip on x86: a stack pop and an indirect branch to that value.  https://www.felixcloutier.com/x86/ret documents exactly what it does and doesn't do.
It's effectively pop %tmp / jmp *%tmp where tmp is an internal temporary register.
ret depends only on RSP.
Using RBP as a frame pointer is a totally optional software convention that modern compilers don't even do when optimization is enabled.


text:
Q: How to fetch jQuery JSON request parameters in servlet? I have the following javascript code:
var data = {message:"Hi"}

var sendJson = function (){
    alert(data);
    $.ajax({
        url:"./jsonTest",
        data: data,
        contentType:"application/json",
        type:"post",
        dataType:"json"
    }).success(function(reply) {
        alert("successful");
    });
}

How can I fetch the JSON object on my servlet?
I was previously trying to get it using
request.getParameter("data")

and trying to convert it to a JsonObject, but I kept getting null.

A: @Kebs,
If this isn't figured out yet .. You can find the answer here :)

A: try the line below.  data is only the javascript variable but jquery will put the message member in the URL params instead of data.
request.getParameter("message");

A: In case data is object it will be transformed to request parameter string like

pameterName1=value1&pameterName2=value2

and you can get it by using
request.getParameter("pameterName1");

A: You might want to check out JAX-RS containers (Jersey) which build on top of basic Servlet API, but make it much more convenient to get data binding for JSON.
But if you must use raw Servlet API, then POST contents will be available through request object; get the InputStream, and use a JSON library like Jackson to bind to object:
MyBean bean = new ObjectMapper().readValue(httpRequest.getInputStream(), MyBean.class);
and similarly if you need to return a JSON object, do the reverse:
objectMapper.writeValue(httpResponse.getOutputStream(), resultObject);


text:
Q: Why are `take` and `drop` defined for negative arguments? The Prelude shows examples for take and drop with negative arguments:
take (-1) [1,2] == []
drop (-1) [1,2] == [1,2]

Why are these defined the way they are, when e.g. x !! (-1) does the "safer" thing and crashes? It seems like a hackish and very un-Haskell-like way to make these functions total, even when the argument doesn't make sense. Is there some greater design philosophy behind this that I'm not seeing? Is this behavior guaranteed by the standard, or is this just how GHC decided to implement it?

A: I think it's a matter of design choice here.
The current definition ensures that the property
take x list ++ drop x list == list

holds for any x, including negative ones as well as those larger than length list.
I can however see the value in a variant of take/drop which errors out: sometimes a crash is preferred to a wrong result.

A:
x !! (-1) does the "safer" thing and crashes

Crashing is not safe.  Making a function non-total destroys your ability
to reason about the behaviour of a function based on its type.
Let us imagine that take and drop did have "crash on negative" behaviour. Consider their type:
take, drop :: Int -> [a] -> [a]

One thing this type definitely doesn't tell you that this function could crash!  It's helpful to reason about code as though we were using a total language, even though we are not - an idea called fast and loose reasoning - but to be able to do that, you have to avoid using (and writing) non-total functions as much as possible.
What to do, then, about operations that might fail or have no result?  Types are the answer!  A truly safe variant of (!!) would have a type that models the failure case, like:
safeIndex :: [a] -> Int -> Maybe a

This is preferable to the type of (!!),
(!!) :: [a] -> Int -> a

Which, by simple observation, can have no (total) inhabitants - you cannot "invent" an a if the list is empty!
Finally, let us return to take and drop.  Although their type doesn't fully say what the behaviour is, coupled with their names (and ideally a few QuickCheck properties) we get a pretty good idea.  As other responders have pointed out, this behaviour is appropriate in many cases.  If you truly have a need to reject negative length inputs, you don't have to choose between non-totality (crashing) or the possibility of surprising behaviour (negative length accepted) - model the possible outcomes responsibly with types.
This type makes it clear that there is "no result"
for some inputs:
takePos, dropPos :: Int -> [a] -> Maybe [a]

Better still, this type uses natural numbers;
functions with this type cannot even be
applied to a negative number!
takeNat, dropNat :: Nat -> [a] -> [a]

A: There would be mainly one good reason to make take partial: it could guarantee that the result list, if there is one, has always the requested number of elements.
Now, take already violates this in the other direction: when you try to take more elements than there are in the list, is simply takes as many as there are, i.e. fewer than requested. Perhaps not the most elegant thing to do, but in practice this tends to work out quite usefully.
The main invariant for take is combined with drop:
take n xs ++ drop n xs  ≡  xs

and that holds true even if n is negative.
A good reason not to check the length of the list is that it makes the functions perform nicely on lazy infinite lists: for instance,
take hugeNum [1..] ++ 0 : drop hugeNum [1..]

will immediately give 1 as the first result element. This would not be possible if take and drop first had to check whether there are enough elements in the input.


text:
Q: Device ineligible in Xcode 6 when device connected powered by iOS 8.1 Till yesterday my configuration for devices/tools looked as below
iOS - 8.0.2
Xcode - 6.0.1
OSX - Mavericks

I have upgraded by iOS version from 8.0.2 to 8.1 today and when I connect my device to my mac, i am seeing, my device in "Ineligibale Device"
I have looked into similar issues and most of the solution is advised to change the deployment target from 7.0 to 8.0. But I need my deployment target to be on 7.0
I restarted my device and any my mac but still have the same problem. When I disconnect the device and connect it again. I see error message as below in Window->Devices ".. running a version of iOS that is not supported by this version of Xcode"
This I interpret as Xcode 6.0.1 doesn't support devices with iOS8.1. But this looks weird to me. I looked any Xcode update and Xcode 6.1 is only available to install in Yosemite and not in Mavericks. My check and install in Xcode in Mavericks tells me everything is up to date
Any suggestion on how to solve this one? I don't want to change the deployment target as my app should support both 7.0 and 8.0

A: You have to install the Xcode 6.1 update. The 6.0.1 does't support iOS 8.1.
I had the same problem this morning

For the same issue in Xcode 6.3 + iOS 8.3, change the destination in product->destination

A: If you meet the same issue in XCode6.3 and iOS8.3, you can try:
Select your iPhone in XCode via Product > Destination (solution found here: http://zachwaugh.me/posts/fixing-xcode-6-3-beta/)

A: Try to re-install Xcode 6. The new installation will take care of the new iOS 8.1. I just solved the same problem a moment ago. Otherwise, you need to upgrade your OS to Yosemite.

A: Try to update your XCode to 6.3.2 , this issue is fixed by apple in XCode 6.3.2. So just Update your Xcode and every thing will be fine, you don't need to change your "iOS Deployment Target" settings.

A: I had this issue with Xcode 6.4 (Swift 1.2) and iOS 9.0.2.
I found a workaround. First you have to install the next version of XCode (which is Xcode 7.0).
Close all Xcode applications.
Now, if you try to open your old project in the older version you will get the message :"Device ineligible for current OS version".
So you open the newer Xcode version. DO NOT open any project. Then open the old Xcode version (in my case Xcode 6.4) and launch the app. My quess is that the old Xcode version uses the new Xcodes compiler and thats why it allows compilation on the newer device.
Hope this helped ;)

A: I experienced this with compatible Xcode and iOS versions (i.e. needing an Xcode update was not the issue).
I resolved it as follows:

*

*disconnect your device from Xcode

*delete the old version of your project application directly on the device

*reconnect your device to Xcode

A: I had this problem with my iPhone6+ and was using the "product->destination" workaround.
Then I noticed that I didn't have an iPhone6+ simulator.
I knew I had had one before, but I added one again.
Then suddenly I had two iPhone6+ simulators. Adding a new one had obviously made Xcode see the missing one. So I deleted one of the iPhone6+ simulators.
Then I noticed that my actual iPhone6+ device was no longer in ineligible devices :)
Hope this helps someone.

A: If you update Xcode, you might have lost your iOS Simulators for earlier versions.  Check and redownload the versions for earlier releases.


text:
Q: Maintain order when selecting values jquery Is there any functionality on the roadmap that will, when selecting values from the select, maintain order in the created list based on the order
  Basically, if the initial multiple select looks like this:
1. Option 1
2. Option 2
3. Option 3
4. Option 4

Then, if from the list, I select options in this order: 3, 1, 4, 2
The value pass should look like this:
Option 1
Option 2
Option 3
Option 4

any idea to maintain selected order of multi select

A: Is this what you want?
<select multiple>
  <option value="1">first</option>
  <option value="2">second</option>
  <option value="3">third</option>
  <option value="4">fourth</option>
</select>

$('select').on('change', function() {
  var orderedValues = $(this).val();
});


text:
Q: Book where planted berries make trees come to life that attack people As I randomly remembered parts of this, it's driving me crazy I don't remember it.
The book is the second in a series I believe.
It follows a boy from a remote town that appears to be looking for a way to save it from a drought or blight. As well as being accompanied be a girl from a nomadic tribe? I am hazy on that detail.
Now here's the most specific detail I remember. He is exploring ruins of an ancient city. It is hard to navigate because of overgrown brambles and trees. And in these ruins he discovers a bag of berries that he brings home and the plants flourish, providing more berries that sustain the town. Inside the ruins he also finds a small ornate statue of an owl.
But the berries turn out to knock out all those that ate them, and the trees come to life and attack the town. Revealing how the ancient city became overgrown.


text:
Q: Networking with two ASK-NCQ1338FA (Verizon 5G Gateway) and a TP-Link ER605 (as load balancer) The Setup:
I have two ASK-NCQ1338FA (Verizon Gateway Routers), a TP-Link ER605 (Only want use as a Load Balancer), and then a Netgear RAXE450 router. All the parts work fine, but a little weird.
When I pull out one of the ASK-NCQ1338FA ethernets from the WAN port of the ER605, the failover takes almost a minute to kick in, during that time its just no service. Any way to speed up the failover to the WAN that's still connected?


text:
Q: How to partition a keyed RDD into 2 partitions based on its key value There is an RDD with vehicles data. I am able to get key-value pair of that RDD keeping LIC_state as key for every record.
How can I partition that keyed RDD into 2 partitions keeping records with key SA in one partition and the rest in another partition

A: You could write and apply your custom partitioner that splits the data based on the key.
First define the partitioner logic
def partitionFunc(key):
    if key == "SA":
        return 0
    else
        return 1

in which key is the "LIC_state". And then apply it to your RDD:
partitionedRDD = keyedRDD.partitionBy(2, partitionFunc)

where keyedRDD is your key/value paired RDD.


text:
Q: On some websites, why doesn't Ctrl + Click work, but right-click > Open in new tab, does? On some websites Ctrl + clicking links opens them in the same tab... grrrr! Yet right-clicking > Open in new tab, does work.
It's frustrating - is there any way to make Ctrl + click work on all websites? Why doesn't this work on the occasional website? I.e. what's the technical reason?

A: Middle-clicking seems to work like a ctrl-click (as mentioned by Firelord in the comments).

A: It is because of JavaScript that captures your clicks and, because of that, interferes with your keyboard shortcuts. If you disable JavaScript then shortcuts should start to work again. You can test it by pressing CTRL+SHIFT+I (Developer tools), then clicking Settings (gear icon) and enabling option Disable JavaScript.

A: There's a Chrome extension called Command-Click Fix which fixes this annoying part of websites.
https://chrome.google.com/webstore/detail/command-click-fix/leklllfdadjjglhllebogdjfdipdjhhp


text:
Q: Is there a way to use bindings with an editable NSSecureTextFieldCell in an NSTableView? I have an NSTableView with several columns, one of which is set up to use an NSSecureTextFieldCell as its dataCell. I am using a properly configured NSArrayController to provide data to this table.
The problem is that my secure text field does not want to work. It shows an appropriate number of dots for the strings that it holds, but it is not editable! I am unable to make changes to the secure text.
Just to be sure, I did the same thing with a regular NSTextFieldCell, and everything works like a charm. I have the bindings set up properly, and the column is set to be editable.
I was able to find a reference to the same problem on Apple's developer mailing list, but the workaround posted there is from 2006.
Is there a fix for this particular problem?
or
Does anyone have a better workaround, perhaps something that still allows the use of bindings?

A: Works for me, at least on Snow Leopard. I haven't tried it on Leopard yet. Feel free to have a look and see if you can make it work (or confirm that it doesn't work for you).
(BTW, despite my unfortunate choice of name, it is the column that I bound, not the cell.)


text:
Q: Extract elements from List string built using c # I have this string

Dispatching System,proposal,to be
sent,main,2022-006,related,2022-017,related

that is composed of this c# code
List<string> value1 = new List<string>();
foreach (string item in Request.Form)
{
    if (item.Contains("ddl"))
    {
        value1.Add(Request.Form[item]);
    }
}
ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('value1:\\n" +
    string.Join(",", value1) + "');", true);

Using the code above the output is

Dispatching System,proposal,to be
sent,main,2022-006,related,2022-017,related

Now I need to extract from this string from element number 5 to all subsequent elements, that is

2022-006,related,2022-007,related

and storing a row for each string value in a database table, that is

t
q

2022-006
related

2022-017
related

Expected output
2022-006
related
2022-017
related

But the expected ouput now is empty...
This is my c# code
List<string> value1 = new List<string>();
foreach (string item in Request.Form)
{
    if (item.Contains("ddl"))
    {
        value1.Add(Request.Form[item]);
        List<string> value2 = item.Split(',').ToList();

        for (int i = 4; i < value2.Count; i++)
        {
            //Insert into db
            Response.Write(value2[i] + "
" + value2[i + 1] + "

");
            i++;
        }
    }
}

Thanks in advance for any help, really appreciated.
Solution
List<string> value1 = new List<string>();

foreach (string item in Request.Form)
{
    if (item.Contains("ddl"))
    {
        value1.Add(Request.Form[item]);
    }
}

var requestDLL = string.Join(",", value1);
var value2 = requestDLL.Split(',');

for (int i = 4; i < value2.Length; i++)
{
    //Insert into db
    Response.Write(value2[i] + "
" + value2[i + 1] + "

");
    i++;
}

Output
2022-006
related
2022-017
related

A: Here you can find the code that return the expected output  https://dotnetfiddle.net/8aBrZj
using System;

public class Program
{
    public static void Main()
    {
        var requestDLL = "Dispatching System,proposal,to be sent,main,2022-006,related,2022-017,related";

        var value2 = requestDLL.Split(',');

        for (int i = 4; i < value2.Length; i++)
        {
            //Insert into db
            Console.Write(value2[i] + "\n" + value2[i + 1] + "\n \n");
            i++;
        }
    }
}


text:
Q: Use a Factory to retrieve dependencies from database and construct a complex object I am currently using a factory to retrieve several objects from database and returning a complex object.
My question is, is this a valid usage for a factory?
I am using a legacy database which has no options for fanciness.
Here is a code example for demonstration purposes:
public class ComplexItem : IComplexItem
{
    public ComplexItem(Item item, List<ItemPart> itemParts, List<ItemComment> itemComments)
    {
        //Setter
    }
}

public class ComplexItemFactory : IComplexItemFactory
{
    private ItemRepository itemRepository;
    private ItemPartsRepository itemPartsRepository;
    private ItemCommentsRepository itemCommentsRepository;

    public ComplexItemFactory(ItemRepository itemRepository, ItemPartsRepository itemPartsRepository, ItemCommentsRepository itemCommentsRepository)
    {
        //Setter
    }

    public IComplexItem CreateComplexItem(ItemKey itemKey)
    {
        var item = itemRepository.Get(itemKey);
        var itemParts = itemPartsRepository.GetItemParts(itemKey);
        var itemCommentsRepository = itemCommentsRepository.GetItemComments(itemKey);

        return new ComplexItem(item, itemParts, itemCommentsRepository);
    }
}

A: Coming back to this question, it feels kind of silly.
Yes there is nothing wrong with this factory.
Today ORM's would solve this problem for you...


text:
Q: How to pass value into List in JavaBean? There is a JavaBean called TestBean.

*

*I want to pass some values into the List when I developed the java web. But I don't know how to do it.

*Generally, if only have List, we are able to use xxx.add() method (xxx is List<String> xxx = new ArrayList<String>()).

TestBean.java
public class TestBean {
    private String name;
    private String address;
    private List<String> options = new ArrayList<>();

    public TestBean(String name, String address) {
        this.name = name;
        this.address = address;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public List<String> getOption() {
        return options;
    }

    public void setOption(List<String> option) {
        this.options = option;
    }
}

A: Your bean looks more like a data object. Beans tend to be stateless or tied to a session or other scope. They may depend on other beans or hold data objects when scoped, but your code looks like a data object, something that might be persisted to a database, etc.
That said are you asking for something like:
public TestBean(String name, String address, List<String> options) {
    this.name = name;
    this.address = address;
    this.options.addAll(options);
}

OR simply
public TestBean(String name, String address, List<String> options) {
    this.name = name;
    this.address = address;
    this.options = options;
}

A: You can do like this:
1.Get List options property from TestBean.
2.Add elements to options.
3.Call the setOption() method and put options as the paremeter.
TestBean bean=new TestBean();
List<Sting> options=bean.getOption();
options.add("aaa");
options.add("bbb");
bean.setOption(options);

A: Create a List. Create a new TestBean object and use your setOption method.


text:
Q: Constructor syntax for Thread class Thread t = new Thread(new ThreadStart(Program1.ThreadMethod));

I want to know why we write in the constructor new ThreadStart(Program1.ThreadMethod).
Please explain.

A: To start a thread using an instance method for the thread procedure, use the instance variable and method name when you create the ThreadStart delegate. Beginning in version 2.0 of the .NET Framework, the explicit delegate is not required.


text:
Q: Is there anyway to make export path work on Shell I wrote a shell script called gola to install golang, and put it on folder /usr/local/bin
#!/usr/bin/env bash
curl -LO https://golang.org/dl/go1.16.3.linux-amd64.tar.gz
sudo tar -C /usr/local -zxf go1.16.3.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
echo -e "Installed" && exit 1

I run sudo gola, and installed golang successfully, but when I run go version, the command go can't be found, export PATH=$PATH:/usr/local/go/bin doesn't work. I think it might be because the script is running in a subshell and it doesn't work on its parent. I can add export PATH=$PATH:/usr/local/go/bin to bash profile, it will works. Besides, is there any other way if I just want it to take effect by running sudo gola?

A: There's no way to do this when running the script with sudo, because the sudo program itself runs as a subprocess of your shell (and the shell running the script runs as a subprocess of sudo), and subprocesses cannot affect parent processes' environments. (Note: export makes a variable export down to subprocesses, not up to parent processes.)
But since you're already running the tar command itself with sudo inside the script, why do you need to run the entire script with sudo? If you run it with source (or . if your shell doesn't support that), it'll run in the current shell, and the change to PATH will apply to the current shell.
But even that might not be what you really want, because it'll affect only the current shell. Next time you open a new one, you won't be able to use go until you change the PATH for the new shell instance. If you want future shells to be able to use go, you must add it to someplace like ~/.bash_profile.


text:
Q: Bootstrap 4 - Input group append with checkbox and label I am able to add the checkbox and label inside the input-group, though as seen in the image, the padding is off.

using pl-4 it's better, but not right.

      <%= ff.remove_nested_fields_link fa_icon('trash-alt', type: :solid, class: 'icon-trash') %>

  <%= ff.collection_select(:store_id, Store.all, :id, :label, {}, {class: "custom-select"}) %>

      <%= ff.check_box :manager, class: "form-check-input" %>
      <%= ff.label :manager, class: "form-check-label" %>

Any advice?

A: For Bootstrap v4.3.1 you can use the following ... form-check-input ml-0, form-check-label ml-3

        <input type="checkbox" class="form-check-input ml-0" id="exampleCheck1">
        Check me out

A: I tried using a form-check-inline layout inside the input-group-text. Check it out:

              <input type="radio" class="form-check-input">Option 2


text:
Q: How best to make a web app with multiple pages? I'm trying to make a multiplatform offline webapp using PhoneGap. I know my html and css, but I'm not altogether familiar with the full capabilities of JavaScript, and I've never made a webapp before, let alone tried to use phonegap to empower it.
Right now, I have the main index.html that phonegap sets up for you, but now I'm uncertain as to how to proceed. If I want a button to take the user to another page from the main page, should I make a second html file and literally link between them, or is this a lot more complex than that?
Also (get ready for a possibly epically stupid question from a total beginner):
Do web apps have to be online? I'm really not clear on whether they function like normal websites in which they need to be hosted on a server, or if they can be packaged up and downloaded just like normal native apps. Please help!
Thanks.
Oh, and btw, I'm working in Xcode with the phonegap addon thing....I'm trying to get it running on the iphone before I move on to android.

A: Although the other answer helped me at the time, I thought I would add a more complete answer now, five years later, to my own first StackOverflow question.
To start with, a "web app" is the same as a "website" in a technical sense, and yes, they have to be hosted on a server in order to be accessed through the browser...just like every website. The only distinction is that a web app is generally a more dynamic and complex sort of website, involving JavaScript and AJAX. It would be misleading to call a simple website like this one a "web app," whereas Facebook is definitely a web app. Basically all web apps are websites, but not all websites are quite exactly web apps.
However, it only has to be "online" if you want it to be accessible anywhere from a browser via http. If you're making a Cordova app like I was at the time, that's not relevant. If you only want to run an application locally, you can do so with a local server like Python's SimpleHTTPServer or the one webpack provides, or any other alternative, including a server you write yourself from scratch.
As for the primary question about having multiple pages, yes anchor elements like my link are the standard way of connecting pages. To link among your own pages, you would have multiple .html files, and you would create a link with an href like href="myOtherPage.html", where that file is contained in the same directory as the file for the page linking to it. Alternatively you could set up a single-page-app where JavaScript loads new page content without the use of anchor elements-- in that case multiple .html files are not needed. Frameworks like Angular and React are helpful for accomplishing that, but it's by no means necessary.

A: In a typical web app, most of the time you would just need to create a link as you would if you were creating a link on a website. Also, Web apps can be developed via a local environment (research Mamp/ or Wamp) depending on the dependencies in which your app require.


text:
Q: How to load blocktrail api in codeigniter i am trying to use Blocktrail api in my codeigniter project for payment integeration
in documentation it is written to load the library
use Blocktrail\SDK\BlocktrailSDK;

I wanted to know how to autoload this in my codeigniter project. I have already installed this sdk using composer
The screen shot of my project


text:
Q: trying to count vowels, consonants and spaces but ignoring other char's Here is my code, it works fine ( I think) but if I want to enter in a sentence with some other characters such as ". , * : ; "...etc then surely they would be counted as consonants.
Is there a way to shorten this without typing out all the characters that aren't vowels?
Also, I know I could use "ignoreCase()" instead of typing out all the capital versions of the vowels but realised after I typed them and am too stubborn to change :D
public void compute() {
    for (int i = 0; i < str.length(); i++) {
        if (str.charAt(i) == 'a' || str.charAt(i) == 'e' || str.charAt(i) == 'i' || str.charAt(i) == 'o' || str.charAt(i) == 'u' || str.charAt(i) == 'A'
                || str.charAt(i) == 'E' || str.charAt(i) == 'I' || str.charAt(i) == 'O' || str.charAt(i) == 'U') {
            vowels++;
        } else if (str.charAt(i) == ' ') {
            spaces++;
        } else {
            cons++;
        }
    }
}

A: You can make use of Character.isLetter method to check whether character is a valid letter or some special character. Here is what javadoc says for isLetter method:

public static boolean isLetter(char ch)
Determines if the specified character is a letter. A character is
  considered to be a letter if its general category type, provided by
  Character.getType(ch), is any of the following:

*

*UPPERCASE_LETTER

*LOWERCASE_LETTER

*TITLECASE_LETTER

*MODIFIER_LETTER

*OTHER_LETTER

  Not all letters have case. Many characters are letters but are neither
  uppercase nor lowercase nor titlecase.

A: The obvious alternative would be something like this:
String vowels = "aeiou";

and then:
if (vowels.contains(str.substring(i,i+1)){
    vowels++;
}

You could do sets of course, but what's the point?


text:
Q: Android - Out of Memory Exception with Glide Library I have a Listview with items which contain ImageView. Unfortunately I am getting an OME if I load more than 20 items. I am using the Glide library to load items into the ImageViews. My question is if there is another way to handle this than loading smaller images from my server?
Looking forward to nice answers!
EDIT:
 public View getView(final int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View rowView = inflater.inflate(R.layout.post_list_item, parent, false);
    back = (ImageView) rowView.findViewById(R.id.imageView3);
    filter = (ImageView) rowView.findViewById(R.id.imageView2);
    final RelativeLayout deleteContainer = (RelativeLayout) rowView.findViewById(R.id.deleteContainer);
    final ImageView deletAdd = (ImageView) rowView.findViewById(R.id.imageView1);
    deletAdd.setScaleX(0.5f);
    deletAdd.setScaleY(0.5f);
    View backDelete = (View) rowView.findViewById(R.id.View1);
    Glide.with(context).load(postList.get(position).getThumb()).diskCacheStrategy(DiskCacheStrategy.RESULT)
            .override(AppData.width, AppData.height / 6).centerCrop().into(back);
    TextView title = (TextView) rowView.findViewById(R.id.textView1);
    title.setTypeface(AppData.glogooregular);
    if (postList.get(position).getThumb() == null) {
        filter.setVisibility(View.GONE);
        title.setBackgroundColor(Color.parseColor("#FFFFFF"));
        title.setTextColor(Color.parseColor("#000000"));
        RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) title.getLayoutParams();
        params.setMargins(0, 0, 0, 0);
        title.setLayoutParams(params);
    } else {
        title.getLayoutParams().height = AppData.height / 6;
    }
    TextView date = (TextView) rowView.findViewById(R.id.textView2);
    TextView comments = (TextView) rowView.findViewById(R.id.textView3);
    title.setText(postList.get(position).getTitle());
    SimpleDateFormat month_date = new SimpleDateFormat("MMM");
    Calendar cal = DateToCalendar(new Date(Long.parseLong(postList.get(position).getTime()) * 1000));
    String month_name = month_date.format(new Date(cal.getTimeInMillis()));
    date.setText(cal.get(Calendar.DAY_OF_MONTH) + "." + month_name + " - " + cal.get(Calendar.HOUR_OF_DAY) + ":"
            + cal.get(Calendar.MINUTE) + " Uhr"); ...

This is my Code of the getView Method. I could get the bitmap from the Glide LIbery but how could i scall it down than and cache it efficiently?

A: Please post your adapter code so we can see where exactly is your problem.
Over the top of my head there are a few things you could do to make the loading and handling of bitmaps perform better, first of all i would suggest switching bitmap format to RGB_565 instead of the default ARGB_8888, it would take 50% less memory!
In addition i would try and cache images on memory since the adapter would call the loading function each time it request getView(unless you have an isLoaded flag or something), and last i would load the bitmap at the exact size of the ImageView so it doesn't take anymore pixels than needed.
Read this for deeper understanding of bitmap handling:
http://developer.android.com/training/displaying-bitmaps/index.html


text:
Q: Integrating nmap and WinPcap to PHP Application I've done my research on this an still cant find any solution. the closest i have seen so far is Any ideas on how to integrate with nmap programmatically? .
I am a php programmer and i'm currently building a network management system, I intend to embedd nmap and WinPcap to my php application, such that i can scan my network using both software using my application and have the information in my application application's database. can anyone shed some light on this? thank you.

A: Nmap doesn't currently have a defined IPC or RPC interface. Its API is defined by its command-line arguments and its XML output (the best, most complete machine-readable output option). To see how an application can use this "API," you can look at some existing applications that integrate with Nmap:

*

*Zenmap is Nmap's official graphical front-end. It is written in Python and is maintained by the Nmap development team, so you can count on it to be "correct."

*Rainmap is a web application for hosted Nmap scanning. Developed as part of Google Summer of Code with the Nmap dev team, it is also written in Python (Django). It should be a good reference for how to use Nmap in a multi-user web application environment.

*Metasploit uses Nmap and parses its output with Ruby (Nokogiri), storing relevant info in a database.

*PBNJ is a network monitor that compares Nmap scans. It is written in Perl.

In addition to all these, there are a few thousand "scan with Nmap from PHP" pages and questions on the Internet that can help with issues surrounding request timeouts, etc. Most of all, I must warn you not to accept arbitrary user input to the scan arguments, since it is trivial to trick Nmap into executing any OS commands (which is why Nmap should never be installed setuid).


text:
Q: chrome.filesystem: Rename a file and save it on the client's disk How could I do with chrome.filesystem to rename a file and save it. For example, if my file is named myfile.txt I would rename the myfile.html and save it without using the saveAs function. And if that's not possible, do I have a solution.
The problem is that I have to save the file on the client's disk. So for me to use the filesystem functions can not be a solution, I have not seen that chrome.filesystem API that allows.
Thank you in advance! I'm a little discouraged. I also watched the browserify aside to work around the problem, but I have not found how to do it.

A: To rename a file you must have the ability to create a new file on the user's filesystem. You can get this permission by asking the user to open the whole directory in which the project exists. Then you can create any file you want within that directory by calling getFile with { create: true } on the resulting DirectoryEntry.
Edit: See this example for duplicating files selected by the user. Instead of using fs.root as is done here you can use the result of chrome.fileSystem.chooseEntry as the DirectoryEntry in which the file is saved.


text:
Q: An exception throw has type `Nothing`? As stated here - Chapter 7 of Programming in Scala, Built-in Control Structures, 7.4 Exception handling with try expressions:

In Scala, throw is an expression that has a result type.
Technically, an exception throw has type Nothing. You can use a throw as an expression even though it will never actually evaluate to anything. This little bit of technical gymnastics might sound weird, but is frequently useful in cases like the previous example. One branch of an if computes a value, while the other throws an exception and computes Nothing. The type of the whole if expression is then the type of that branch which does compute something.

The example is:
val half =
  if (n % 2 == 0)
    n / 2
  else
    throw new RuntimeException("n must be even")

Then I went to Scala and try:
scala> val n = 1
n: Int = 1

scala> val half = if (n % 2 == 0) n / 2 else throw new RuntimeException("n must be even")
java.lang.RuntimeException: n must be even
  ... 29 elided

scala> half
<console>:12: error: not found: value half
       half
       ^

It is saying that half is not found. However, based on the book, I assume it should say it is defined and it is with type Nothing.
What's wrong here?

A:
It is saying that half is not found. However, based on the book, I
  assume it should say it is defined and it is with type Nothing.

If you re-read that paragraph, you'll see that the type of half shouldn't be Nothing, it should be Int:

The type of the whole if expression is then the type of that branch
  which does compute something.

The branch which does compute a value produces the type Int. You can prove this by defining half as a method and not a value:
scala> def half = if (n % 2 == 0) n / 2 else throw new RuntimeException("n must be even")
half: Int

If you actually want to see that throw has type Nothing, add it in your IDE and make it show the type:
val exception: Nothing = throw new RuntimeException("n must be even")

Regarding half, it isn't found because it's declaration throws an exception, which makes the REPL unable to bind a value to it.


text:
Q: ToolStrip with ToolStripDropDownButton inside looks weird I have two versions of a Windows Forms Application and can't figure for the life of me how to get a particular GUI behavior to be the same without copying the entire code (which is an obvious no-no).
Here is a visual comparison:

The left one is the one I want to fix so that it looks like the right one. Notice how the ToolStrip looks as if it contained an extra ToolStripDropDownButton, or some property or style I don't know about was set to make it look like that.
I've been diff'ing like crazy and couldn't find what differs. Any ideas?

A: Got it. In the left side case, the button was "overflowing". Its size was too large to fit the toolstrip and thus it was collapsed like that. After adjusting the button's size in the left side, all was good.
I found out what was going on after reading basic stuff about toolstrip controls here, in the "Using the CanOverflow and Overflow Properties" section.


text:
Q: Firebase "read" rules executing even when no document is found in a query result In my Firebase Firestore Rules, I have the following rule for 'courses' collection:
rules_version = '2'
service cloud.firestore {
  match /databases/{database}/documents {
    match /courses/{courseId} {
      allow read: if resource.data.userId == request.auth.uid;
    }
  }
}

The rules works ok if a read a single document using the firebase web client.
But when querying and the result is empty, for instance the following query:
const results = await app.firestore().collection('courses')
   .where('userId', '==', 'unexistingUserId').get();

then the rules fail, throwing an exception on the client side (Missing or insufficient permissions).
Running locally on the emulator, I found that the problem was that the read rule was being validated against a resource containing the query field, even if with the resource not existing:

As shown above, the resource.data.userId contains the "unexistingUserId" value.
To solve this, I had to change the rules by adding validations to check if the resource exists:
rules_version = '2'
service cloud.firestore {
  match /databases/{database}/documents {
    match /courses/{courseId} {
      allow read: if resource==null || resource.data==null || !('id' in resource) || resource.data.userId == request.auth.uid;
    }
  }
}

Now when querying for no results, the rule validates ok because the 'id' is not present in the request object:

So my questions are:

*

*Is this the expected behavior?

*Shouldn't the rules not even being validated if the query returns nothing?

*Is there a way to change this behavior to avoid adding those checks in all my rules?

A:
Is this the expected behavior?

Shouldn't the rules not even being validated if the query returns nothing?

This is the expected behavior.  What are you are observing is because of the fact that security rules are not filters.  Be sure to read and understand that linked documentation.
Queries work differently than single document get().  With a single document get(), the rules system doesn't have to worry about scaling up to match billions of documents, so it's perfectly reasonable to check the contents of the one document to see if it matches.  However, since queries can return 0 or more documents, the rules are considered differently.  They do not simply check each document that would result from a query.  That wouldn't scale at all for very large collections.
Rules work with queries by checking that the filters on the client's query match the constraints in the rule.  If you say that resource.data.userId == request.auth.uid, what you are expressing is that users may only ever try to query for documents where userId equals their own UID.  They are not allowed to even attempt to match any other document in a query.
The only query that would ever pass this rule would look more like this:
const results = await app.firestore()
    .collection('courses')
    .where('userId', '==', firebase.auth().currentUser)
    .get();

In this case, the filter:
.where('userId', '==', firebase.auth().currentUser)

Exactly matches the rule:
allow read: if resource.data.userId == request.auth.uid;

Any other query would be rejected immediately simply because it's trying to access documents that are known to violate the rule.


text:
Q: gulp livereload - Multiple filters I am using a gulp webserver in combination with a nodejs to test my api.
They are both within the same directory, so as soon as my mock-data changes, gulp performs a livereload.
I wanted to add filters to the livereload.
Adding my first filter worked just fine, but with two it doesn't reload ever.
gulp.task('webserver',['watch:js', 'watch:sass', 'watch:html'], function() {
  gulp.src('./')
    .pipe(server({
      defaultFile: "dist/app.component.html",
      livereload:  {
        enable: true,
        filter: function(fileName){
         if (!(fileName.match(/.git/) | fileName.match(/.nodejs_srv/))) {

                        return true;

                    } else {

                        return false;

                    }
      }},
      open: true
    }));
});

Edited filter function:
function(filePath, cb) {
          cb( !(/.git/.test(filePath)) );
      }}

I don't know how to add fitlers to this, newbe over here.

A: You droped the callback cb. I do not know livereload very well. But if it relies on a callback, you must call this callback.
gulp.task('webserver',['watch:js', 'watch:sass', 'watch:html'], function()
{
  gulp.src('./')
    .pipe(server({
      defaultFile: "dist/app.component.html",
      livereload:  {
        enable: true,
        filter: function(fileName, cb)
        {
           cb(!(fileName.match(/.git/) || fileName.match(/.nodejs_srv/)));
        }
      },
      open: true
    }));
});

I just typed in my example, no syntax check. Hopefully, it works out of the box.
The callback gets a boolean value as a parameter that indicates if the the file should be taken true or not false.

A: Alright, I found the solution myself.
It's
function(filePath, cb) {
          cb( !(/.git/.test(filePath)) &&
              !(/nodejs_srv/.test(filePath));
      }}


text:
Q: in django, how to allow users to log in using their twitter accounts I just want to use the social auth to help people login to my website, i do not want to make my own register app, so in my website's database, it only has a table contains 2 cols, there are uid and twitter-id.If a user has connected to my website, the table will contains his profile. I don't need to make more cols at the table. I think it is enough for me.
But how to check if a user is login or not ?
I can get the access token and session-id from twitter, but what should I do next?
if I get a session-id, how to keep it and verify the user at my website?

A: A contender to the more established auth apps are https://github.com/pennersr/django-allauth

A: Try django social auth, it has support for many social networks and auth providers.


text:
Q: A question on the rectangular region defined for a vector in $\mathbb{R}^N$ Let $K = (k_1,k_2,k_3,...k_N)$ be a vector in $\mathbb{R}^N$, consider the region  $S_K$ consisting of all vectors $L = (l_1,l_2,l_3,...l_N)$ such that, $|l_i| \le |k_i| \forall i \in \{1,2,3,...N\}$. My question is, given $K$, is there a name for the region $S_K$, used in standard literature? If so, any example reference would be appreciated.

A: An $N$-dimensional rectangular cuboid, or orthotope, or hyperrectangle...


text:
Q: jsf noSelectionLabel ln selectOneMenu How to provide an noSelectionLabel in selectOneMenu with converter?
Using noSelectionLabel in selectItem throus a NullPointerException in converter class.

A: Just check in converter if the incoming value is null and if so, then return immediately.
if (value == null) {
    return null;
}

// ...
return convertedValue;


text:
Q: Can't paste Password into Ubuntu Software Center Log-in Field When i click on the buy button in the software center it instructs me to login, however as i'm using Keepass for saving my passwords i would like to paste it in but it wont let me...
the same applies to gwibber when i try to input my facebook password.
it is possible to input manually but since i picked a long password this would take very long.
Unfortunately until now i couldn't find a solution other than just not logging in or stop using the password manager.
Does anyone have an idea?

A: I solved this problem by using keepassx instead of keepass.

A: If you tried pasting through the popup menu, well I'd say that is reasonable for a password field to have the Paste entry disabled. In some cases the keyboard shortcuts might work, so try Ctrl+V and Shift+Ins.

A: I also experience the scenario in Gwibber where I copy the username/password from Keepass but cannot paste into login fields using the mouse paste menu or ctrl + v. The workaround to this is to

*

*copy the login detail (user name or password) from within Keepass per usual

*switch to a text editor such as gedit

*check if the mouse paste menu or ctrl + v works there (on my system they do)

*highlight the pasted text in the text editor and copy (I use ctrl + c)

*switch to Gwibber's login screens and now paste the text using ctrl + v

*the copied text will now appear

I have applied this approach to several applications where my details would not paste directly out of Keepass. (including - if I recall correctly - the Ubuntu Software Center)


text:
Q: Why do I lose contents of my database after a heroku dyno restart? Anytime my app goes to sleep and comes back on, I lose data in my database
And I'm not storing any media, it's just form data (texts)... I built the app on strapi and I've followed all their guidelines but it keeps happening. I'd be happy if anyone can help

A: Local data (files, db) is cleared after a Dyno restart because the Heroku File System is ephemeral. A Dyno is restarted (at least) every 24hrs.
In your case Strapi uses SQLite where data is saved in a local file.
Strapi suggests to configure Postgres on Heroku, alternatively you can use an external DB storage service.

A: First of all:

*

*As you create content types with strapi it generates the code (= new files) for the according controllers/routes/services

*Heroku does not persist data after a restart

*After a restart strapi checks which content types exist in the code and deletes the tables of nonexisting types from the database.

Therefore, on Heroku you have to set up all your content types locally and connect to an external db (e.g. Heroku Postgres) but never strapi's default textfile based db.
Then push the generated files and finally deploy.
Thus, on Heroku you should always run in production mode. This way the option to alter content types is completely blocked and you will not run into the issue of data loss after a restart.


text:
Q: MSACCESS: truncated query with Distinct Currently, running the code down below. However as the field DDMProcess_Merged is a long text, when I use distinct, the input gets cut off. Before using distinct, the input does not get truncated. However, there will be repeats of the records which I do not want. To better visualise the issue, the tables are below.
SELECT DISTINCT DD_MASB.ProcessM_ID,
     CONCATRELATED("[DDM]","DD_MASB","ProcessM_ID = " & [ProcessM_ID]) AS DDMASB_Merged,
     CONCATRELATED("[DDM_Process]","DD_MASB","ProcessM_ID =" & [ProcessM_ID]) AS DDMProcess_Merged

FROM DD_MASB;

Is there any solution to solve this?
Original Table query (without distinct):

ProcessM_ID
DDMASB_Merged
DDMProcess_Merged

1
x
z

1
x
z

1
x
z

2
y
a


text:
Q: How to run an executable from a mounted drive? I have created an Eclipse Workspace on a mounted partition of my hard drive. I am able to successfully build the hello world program but when I try to execute the runnable I get the following error message:
Error starting process. Exec_tty error:Cannot run program
"/media/vineet/DEVDATA1/vinexpMount/Debug/vinExpeMount": Unknown
 reason Exec_tty error:Cannot run program
"/media/vineet/DEVDATA1/vinexpMount/Debug/vinExpeMount": Unknown
reason Exec_tty error:Cannot run program
"/media/vineet/DEVDATA1/vinexpMount/Debug/vinExpeMount": Unknown
 reason

Please tell what shall I do ? I have checked the permissions for the executable which is

-rw-r--r--

which means that I have not got the permission to execute.
but when I create a workspace in root partition, I get the execute permission by default. what Shall I do to get the same behaviour here?

A: This ought to be a comment, but it seems that I don't have the privilege to write any, so sorry in advance.
Have you tried to execute the mount command in terminal? This program produces output for every mount point in your system. At the end of every line in the output, the mount flags are listed in parentheses. Check if your mount point has noexec flag set.
If so, you can change it with the following command (for example assuming your drive is mounted in /mnt/cdrom):
sudo mount -o remount,exec /mnt/cdrom

If your mounted drive is a Windows partition (i.e. a partition formatted with NTFS filesystem), then you can mount it executable as described in this post.

A: You can use the Linux linker to run any file regardless of executable permissions and without changing the mount options like so:
/lib/ld-linux.so.2 /path/to/binary-file
or, on 64 bit systems:
/lib64/ld-linux-x86-64.so.2 /path/to/binary-file

A: My solution is remount it to another path:
$ sudo umount /dev/sdf
$ sudo mount -o exec,defaults,-default_permissions /dev/sdf ~/usbdrive

List all mounted drive:
$ cat /proc/mounts


text:
Q: C#/MEF don't work with [ImportingConstrutor] with default values I have more or less the same problem as in this question:
C#/MEF doesn't work with a base class without parameterless constructor
I understand the answer as well. MEF doesn't know a value for val so its not able to create an instance.
But I have no base ctor call and a default value for val:
[Export(typeof(IPrimitiveDecomposer))]
public class Prim : IPrimitiveDecomposer
{
    [ImportingConstructor]
    public Prim(int val=0)
    {//some code
    }

    public bool Match(Node node) {return true;}
}

The code compiles fine, but MEF doesn't seem to have an export for IPrimitiveDecomposer when I ask for it.
When I do the following all works fine:
[Export(typeof(IPrimitiveDecomposer))]
public class Prim : IPrimitiveDecomposer
{
    public Prim() : this(0)
    public Prim(int val=0)
    {//some code
    }

    public bool Match(Node node) {return true;}
}

thx for your help
Soko

A: Optional arguments in C# are a compile time "trick".  The constructor generated by your first code does not have a parameterless constructor.  Instead, it has a constructor which takes one integer, and which is decorated with attributes to provide the default value.  It's effectively like writing:
public Prim([Optional, DefaultParameterValue(0)] int val)
{

The C# compiler knows about these attributes, and will "fill in" the value at compile time when it finds a method or constructor requiring this information.
MEF does not look for these attributes.  It requires a default constructor, or a constructor where each of the arguments is provided by composed types.  Your first version fails in this case, so MEF can't construct the type.
Using two constructors, as you showed, is the correct way to handle this with MEF.


text:
Q: Proving that the union of two infinite disjoint sets with same cardinality is equipotent with either one This question is almost a duplicate to the question Q, but I would like to prove it in a more personalised manner.
The fact, that the individual sets, say $A$ and $B$ are countable, as well as infinite, ensures the existence of some bijective function $f: \mathbb{N} \rightarrow A$  and  $g: \mathbb{N} \rightarrow B$ .
Again, $A$ and $B$ being equipotent, there is some bijective function  $h: A \rightarrow B$.
Now, consider their union (keeping in mind that they are disjoint). Define a map $\phi: \mathbb{N} \rightarrow A \cup B $ such that,
$\phi(n)= a_{n/2} $ when $n$ is even; $b_{n+1/ 2}$ when $n$ is odd [ $A=\{a_n\}$ and $B=\{b_n\}$ (enumerability permits this) ] Evidently, this mapping is a bijection.
Now, we consider the composition $f^{-1} \phi: A \rightarrow A \cup B$ and  $g^{-1} \phi: B \rightarrow A \cup B$. Both of them are bijective. Furthermore, the equipotency between the sets $A$ and $B$ implies that their union is equipotent to either one of them.
We now use this to prove that $\mathbb{Q}$ and $\mathbb{Q}^+$ are of same cardinality.
We now split $\mathbb{Q}^*$ into $\mathbb{Q}^+$ and $\mathbb{Q}^-$ . Their elements are disjoint and both of them are equipotent. We use the previously proved proposition to deduce that $\mathbb{Q}^*$ is equipotent to $\mathbb{Q}^+$.

*

*Is the above proof correct?

*How do I extend the deduction to $\mathbb{Q}$ ?

A: I first want to note, that in your first comment where you suggest a bijection from $\{0/1,0/2,0/3,\dots\}$ is only correct if you regard $0/x$ as a syntactical object. If you refer to a classical fractional representation of a rational number, then $\{0/1,0/2,0/3,\dots\}=\{0\}$ which is most certainly not bijective with $\mathbb{N}$.

The proof that for countable disjoint $A,B$, there is a bijection between $A\cup B$ and $A,B$ respectively is fine. Let me add, that I think that the countable case is not really rich in terms of awaiting revelations, as a countable union of countable sets is again countable (as you showed for the case of a pair-union) and every countably infinite set is bijective with any other countably infinite set.
This is why I think there are many ways to arrive relatively immediate at your desired result of equipotency of $\mathbb{Q}$ and $\mathbb{Q}^+$:

*

*You may show that $\mathbb{Q}$ and $\mathbb{Q}^+$ are both countably infinite (e.g. via a diagonal argument a la Cantor), i.e. yielding bijections $f:\mathbb{N}\to\mathbb{Q}$ and $g:\mathbb{N}\to\mathbb{Q}^+$. Then $h:\mathbb{Q}\to\mathbb{Q}^+$, $q\to g(f^{-1}(q))$ may be checked by you to be bijective.

*You can proceed by splitting $\mathbb{Q}=\mathbb{Q}^-\cup(\mathbb{Q}^+\cup\{0\})$ or $\mathbb{Q}=(\mathbb{Q}^-\cup\{0\})\cup\mathbb{Q}^+$ and observe that they are both countably infinite and disjoint. Then you can apply your insight for pair-unions of disjoint countably infinite sets.

As I think these results are relatively immediate, to get a greater deal of new knowledge out of this question, maybe try as an exercise to generalize your results and the related insights as far as possible.


text:
Q: Why a  when I have  The <cite> html element is supposed to convey more semantic information than just using an <em>. But what is the core difference in usage and purpose of them?

A: <cite> goes around citations. <em> goes around emphasised text. They have totally different semantic meanings to things like search engines and screen readers.

A: It's easy to imagine a situation in which you want to typeset citations differently from emphasized text. This can be done easily using for instance style sheets thanks to the fact that the tags are different.