text:
Q: How to view a SVG-symbol-file with GeoTools, before choosing it for the map layer? I'm creating a list of all SVG symbols I have in a library. When I define a Style for a e.g point layer I'm selecting a SVG file from this list.
I would like to display the symbol in a e.g Frame when I click on the symbol, to see if it is the right one before I create the style for the layer. Apache batik can't handle SVGs with parameters "fill="param(fill)", just hard coded.
I wounder, since GeoTools can handle this together with Style, is there a simple way in GeoTools just to draw a SVG symbol in e.g a Frame?
If so, how?

A: It's a bit complicated to do, but it can be done. The best example is in GeoServer's org.geoserver.wms.legendgraphic.BufferedImageLegendGraphicBuilder. This first creates a sample feature and then calls StyledShapePainter (in GeoTools) to draw that feature onto a Graphics2D that you can then display.

A: First I create a temporary Style from all the inputs and an empty BufferedImage, then I send it SymViewer who draws a feature in a JPanel.
import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import org.geotools.map.legend.Drawer;
import org.geotools.styling.Style;
import org.locationtech.jts.geom.LineString;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.geom.Polygon;
import org.opengis.feature.simple.SimpleFeature;
import javax.swing.border.LineBorder;
import java.awt.SystemColor;

public class SymViewer extends JFrame {
   private static final long serialVersionUID = 1L;
   private JPanel contentPane;
   /**
   * Create the frame.
   */
   public SymViewer(BufferedImage img, Style style, String title, String titleExtra, String geoType) {
       setBackground(SystemColor.text);
       setTitle(title + " " + titleExtra);
       BufferedImage image = drawSymbolic(img, style, geoType);
       setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       setBounds(0, 0, 439, 266);
       contentPane = new JPanel();
       contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
       setContentPane(contentPane);
       contentPane.setLayout(null);
       JPanel panel = new JPanel() {
          private static final long serialVersionUID = 1L;
          @Override
          protected void paintComponent(Graphics g) {
             super.paintComponent(g);
             g.drawImage(image, 0, 0, null);
          }
       };
       panel.setBorder(new LineBorder(new Color(0, 0, 0)));
       panel.setBounds(0, 0, 434, 261);
       panel.setBackground(SystemColor.menu);
       contentPane.add(panel);
    }

  private BufferedImage drawSymbolic(BufferedImage img, Style style, String geoType) {
      Drawer drawer =  Drawer.create();
      SimpleFeature feature = null;
          if (geoType.contains("Line")){
            LineString line = drawer.line(new int[] { 15, 15, 400, 20, 15, 200 });
            feature = drawer.feature(line);
          }
          else if(geoType.contains("Polygon")) {
            Polygon  p = drawer.polygon(new int[] { 15, 15, 400, 5, 400, 200, 15, 200, 15, 15  });
            feature = drawer.feature(p);
          }
          else if(geoType.contains("Point")) {
            Point p = drawer.point(216, 130);
            feature = drawer.feature(p);
          }
          if(feature != null) {
              drawer.drawDirect(img, feature, style);
              return img;
          }
          return null;
      }
  }

There is one problem: If I create e.g. a polygon style which I want to fill with a PNG image. It will not be filled in my SymViewer (just a grey filled area). Im my map it will be correctly filled with the PNG image. I create the style in exactly the same way from a SLD-file. What could be wrong?
SLD file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<sld:StyledLayerDescriptor
    xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
    xmlns="http://www.opengis.net/sld"
    xmlns:sld="http://www.opengis.net/sld"
    xmlns:ogc="http://www.opengis.net/ogc"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    version="1.0.0">
  <sld:NamedLayer>
    <sld:Name>Graphic fill</sld:Name>
    <sld:UserStyle>
      <sld:Title>Graphic fill</sld:Title>
      <sld:FeatureTypeStyle>
        <sld:Rule>
          <sld:PolygonSymbolizer>
            <sld:Fill>
              <sld:GraphicFill>
                <sld:Graphic>
                  <sld:ExternalGraphic>
                    <sld:OnlineResource
                      xlink:type="simple"
                      xlink:href="magnus.png" />
                    <sld:Format>image/png</sld:Format>
                  </sld:ExternalGraphic>
                <sld:Size>93</sld:Size>
                </sld:Graphic>
              </sld:GraphicFill>
            </sld:Fill>
          </sld:PolygonSymbolizer>
        </sld:Rule>
      </sld:FeatureTypeStyle>
    </sld:UserStyle>
  </sld:NamedLayer>
</sld:StyledLayerDescriptor>


text:
Q: Optimizing mariabb/mysql queries as a DBA I'm maintaining a database that's used by a bespoke software application that has some performance issues. On of the worst offenders is query (3) below, and I'd like to, if possible, optimize the execution plan from the database side, since asking the developers to change anything tends to be costly and take quite a while.
(1) This query is fast, using indexes:
explain
select game.id from games.game where home = 573368 and active = 1
union
select game.id from games.game where guest=573368 and active = 1
union
select game.id from games.game, games.gamegroup where gamegroup.game=game.id and gamegroup.team=573368 and active=1;
+------+--------------+--------------+--------+----------------+---------+---------+----------------------+------+-------------+
| id   | select_type  | table        | type   | possible_keys  | key     | key_len | ref                  | rows | Extra       |
+------+--------------+--------------+--------+----------------+---------+---------+----------------------+------+-------------+
|    1 | PRIMARY      | game         | ref    | active,home    | home    | 5       | const                |   10 | Using where |
|    2 | UNION        | game         | ref    | active,guest   | guest   | 5       | const                |   10 | Using where |
|    3 | UNION        | gamegroup    | ref    | game,team      | team    | 5       | const                |    1 | Using where |
|    3 | UNION        | game         | eq_ref | PRIMARY,active | PRIMARY | 4       | games.gamegroup.game |    1 | Using where |
| NULL | UNION RESULT | <union1,2,3> | ALL    | NULL           | NULL    | NULL    | NULL                 | NULL |             |
+------+--------------+--------------+--------+----------------+---------+---------+----------------------+------+-------------+

(2) Taking the results of this into a second query is fast as well:
explain
select * from games.game where id in (3661383, 3661488, 3661543, 3661598, 3661668, 3661718, 3661743, 3661808, 3661868, 3661893, 3661393, 3661443, 3661483, 3661483, 3661533, 3661578, 3661623, 3661658, 3661763, 3661818, 3661878);
+------+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
| id   | select_type | table | type  | possible_keys | key     | key_len | ref  | rows | Extra       |
+------+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
|    1 | SIMPLE      | game  | range | PRIMARY       | PRIMARY | 4       | NULL |   20 | Using where |
+------+-------------+-------+-------+---------------+---------+---------+------+------+-------------+

(3) However, plugging the first query into the second as a subselect results in a full table scan (FTS) and is accordingly slow:
explain
select * from games.game where id in (
    select game.id from games.game where home = 573368 and active = 1
    union
    select game.id from games.game where guest=573368 and active = 1
    union
    select game.id from games.game, games.gamegroup where gamegroup.game=game.id and gamegroup.team=573368 and active=1
);
+------+--------------------+--------------+--------+----------------------+---------+---------+-------+--------+-------------+
| id   | select_type        | table        | type   | possible_keys        | key     | key_len | ref   | rows   | Extra       |
+------+--------------------+--------------+--------+----------------------+---------+---------+-------+--------+-------------+
|    1 | PRIMARY            | game         | ALL    | NULL                 | NULL    | NULL    | NULL  | 917603 | Using where |
|    2 | DEPENDENT SUBQUERY | game         | eq_ref | PRIMARY,active,home  | PRIMARY | 4       | func  |      1 | Using where |
|    3 | DEPENDENT UNION    | game         | eq_ref | PRIMARY,active,guest | PRIMARY | 4       | func  |      1 | Using where |
|    4 | DEPENDENT UNION    | gamegroup    | ref    | game,team            | team    | 5       | const |      1 |             |
|    4 | DEPENDENT UNION    | game         | eq_ref | PRIMARY              | PRIMARY | 4       | func  |      1 | Using where |
| NULL | UNION RESULT       | <union2,3,4> | ALL    | NULL                 | NULL    | NULL    | NULL  |   NULL |             |
+------+--------------------+--------------+--------+----------------------+---------+---------+-------+--------+-------------+

(4) Nesting another subselect which does effectively nothing except giving the thing a name avoids the FTS, making the query fast again:
explain
select * from games.game where id in (
    select  * from (
        select game.id from games.game where home = 573368 and active = 1
        union
        select game.id from games.game where guest=573368 and active = 1
        union
        select game.id from games.game, games.gamegroup where gamegroup.game=game.id and gamegroup.team=573368 and active=1
    ) as uni
);
+------+--------------+--------------+--------+----------------+---------+---------+----------------------+------+-------------+
| id   | select_type  | table        | type   | possible_keys  | key     | key_len | ref                  | rows | Extra       |
+------+--------------+--------------+--------+----------------+---------+---------+----------------------+------+-------------+
|    1 | PRIMARY      | <subquery2>  | ALL    | distinct_key   | NULL    | NULL    | NULL                 |   21 |             |
|    1 | PRIMARY      | game         | eq_ref | PRIMARY        | PRIMARY | 4       | uni.id               |    1 |             |
|    2 | MATERIALIZED | <derived3>   | ALL    | NULL           | NULL    | NULL    | NULL                 |   21 |             |
|    3 | DERIVED      | game         | ref    | active,home    | home    | 5       | const                |   10 | Using where |
|    4 | UNION        | game         | ref    | active,guest   | guest   | 5       | const                |   10 | Using where |
|    5 | UNION        | gamegroup    | ref    | game,team      | team    | 5       | const                |    1 | Using where |
|    5 | UNION        | game         | eq_ref | PRIMARY,active | PRIMARY | 4       | games.gamegroup.game |    1 | Using where |
| NULL | UNION RESULT | <union3,4,5> | ALL    | NULL           | NULL    | NULL    | NULL                 | NULL |             |
+------+--------------+--------------+--------+----------------+---------+---------+----------------------+------+-------------+

Unfortunately, the application, which isn't easy to get changed, uses query (3).
Are there any steps that can be taken from the DBA side to nudge the execution plan of (3) into the direction of (4)?
I did read https://dev.mysql.com/doc/refman/5.7/en/optimizer-hints.html, which needs the application to pass hints through, and https://dev.mysql.com/doc/refman/5.7/en/switchable-optimizations.html, which seems to affect all queries on a global basis. However, I'd like to give the DB a hint just for this query. Is there any way, in mysql/mariadb, to do that? Or is there another workaround?

As requested in a comment, here are the table definitions:
CREATE TABLE `game` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `no` int(11) NOT NULL DEFAULT 0,
  `class` int(11) NOT NULL DEFAULT 0,
  `dt` datetime DEFAULT NULL,
  `gdate` char(8) NOT NULL DEFAULT '',
  `sgdate` int(11) DEFAULT NULL,
  `gtime` char(5) DEFAULT NULL,
  `gymnasium` int(11) DEFAULT NULL,
  `ogymnasium` int(11) DEFAULT NULL,
  `resp` int(11) DEFAULT NULL,
  `oresp` int(11) DEFAULT NULL,
  `home` int(11) DEFAULT NULL,
  `guest` int(11) DEFAULT NULL,
  `hgoals` int(11) DEFAULT NULL,
  `ggoals` int(11) DEFAULT NULL,
  `hgoals1` int(11) DEFAULT NULL,
  `ggoals1` int(11) DEFAULT NULL,
  `hpoints` int(11) DEFAULT NULL,
  `gpoints` int(11) DEFAULT NULL,
  `admin` int(11) NOT NULL DEFAULT 0,
  `period` int(11) NOT NULL DEFAULT 0,
  `comment` char(30) DEFAULT NULL,
  `mdt` datetime DEFAULT NULL,
  `user` int(11) DEFAULT NULL,
  `disposer` int(11) DEFAULT NULL,
  `disposer_org` int(11) DEFAULT NULL,
  `sms` int(11) DEFAULT NULL,
  `sms2check` smallint(6) DEFAULT NULL,
  `active` int(11) DEFAULT NULL,
  `req` int(11) DEFAULT NULL,
  `reqtype` int(11) DEFAULT NULL,
  `groupsort` int(11) DEFAULT NULL,
  `round` int(11) DEFAULT 0,
  `editstatus` int(11) DEFAULT 0,
  `ti_err` smallint(6) DEFAULT NULL,
  `refereeinfo_a` int(11) DEFAULT NULL,
  `refereeinfo_b` int(11) DEFAULT NULL,
  `ref_a_adrnr` int(11) DEFAULT NULL,
  `ref_b_adrnr` int(11) DEFAULT NULL,
  `ref_org` int(11) DEFAULT 0,
  `ref_costs` float DEFAULT NULL,
  `ref_sealed` int(11) DEFAULT NULL,
  `sealed` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `gdate` (`gdate`),
  KEY `class` (`class`),
  KEY `period` (`period`),
  KEY `sgdate` (`sgdate`),
  KEY `active` (`active`),
  KEY `dt` (`dt`),
  KEY `admin` (`admin`),
  KEY `sms2check` (`sms2check`),
  KEY `gymnasium` (`gymnasium`),
  KEY `home` (`home`),
  KEY `guest` (`guest`),
  KEY `groupsort` (`groupsort`),
  KEY `resp` (`resp`)
) ENGINE=InnoDB AUTO_INCREMENT=3796577 DEFAULT CHARSET=latin1

CREATE TABLE `gamegroup` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `game` int(11) DEFAULT NULL,
  `team` int(11) DEFAULT NULL,
  `sort` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `game` (`game`),
  KEY `team` (`team`)
) ENGINE=InnoDB AUTO_INCREMENT=46302 DEFAULT CHARSET=latin1

A: Add composite keys:
games:  INDEX(home, active, id)
games:  INDEX(guest, active, id)
gamegroup:  INDEX(team, game)

Shrink the data:
INT always takes 4 bytes.  TINYINT UNSIGNED takes 1 bytes and is probably more than adequate for period, active etc.
If gamegroup is a many-to-many mapping between teams and games, you probably don't need id.  Instead:
CREATE TABLE `gamegroup` (
  `game` int(11) DEFAULT NULL,
  `team` int(11) DEFAULT NULL,
  `sort` int(11) DEFAULT NULL,
  PRIMARY KEY (team, game),
  KEY         (game, team)
) ENGINE=InnoDB AUTO_INCREMENT=46302 DEFAULT CHARSET=latin1

Formulation 5:
select g.*
    FROM (
        select game.id from games.game where home = 573368 and active = 1
        union
        select game.id from games.game where guest=573368 and active = 1
        union
        select game.id
            FROM games.game
            JOIN games.gamegroup
            where gamegroup.game = game.id
              and gamegroup.team=573368
              and active=1
         ) as uni
    JOIN game AS g  USING(id)
);

This effectively does '1', then '2'.
UNION ALL is usually faster than UNION DISTINCT (which is what UNION means).  But you can get dups.
IN ( SELECT ... ) should be avoided -- there  are many cases (especially in older MySQL versions) where it performs terribly.
More tips: http://mysql.rjweb.org/doc.php/index_cookbook_mysql
Even better  Provide a Stored Procedure that 573368 as an argument and delivers the result set using whatever is deemed the optimal formulation.  They will prefer doing CALL instead of typing all that lengthy query.  That may get them to change their code.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Message Logging - Storing Heroku Rails App in AWS Buckets I have an app hosted on Heroku, and I'm looking to log the application messages directly to AWS buckets. My understanding is that doing this by accessing the file for every message is going to be very costly (plus the network overhead), so I'm wondering if anyone has experience/strategy to get this to work without incurring a large cost.
    I'm hoping to set it up so that I can rotate the logs by day.
Thanks in advance!

A: It will be much easier for you to just add specific addon for logging on Heroku. Have a look at some options https://elements.heroku.com/addons. You can set log rotation there and you don't have to configure anything or write any code.


text:
Q: Bing maps, how to scale map? How to scale map to show all pushpins in the map at one time?
I use "Bing Maps AJAX Control, Version 7.0".
Thank you!

A: There is a method called LocationRect that can be used for this. Here is an example from MSDN :
function init(){
// Load the map
var map = new Microsoft.Maps.Map(
    document.getElementById("myMap"),
    {
        credentials: "YOUR-BING-KEY",
        mapTypeId: Microsoft.Maps.MapTypeId.road
    }
);

// Some sample pins
var locs = [];
var loc1 = new Microsoft.Maps.Location(-10, 0);
var pin1 = new Microsoft.Maps.Pushpin(loc1 , {text: '1'});

var loc2 = new Microsoft.Maps.Location(0, 10);
var pin2 = new Microsoft.Maps.Pushpin(loc2, {text: '2'});

var loc3 = new Microsoft.Maps.Location(10, 0);
var pin3 = new Microsoft.Maps.Pushpin(loc3, {text: '3'});

var loc4 = new Microsoft.Maps.Location(20, -20);
var pin4 = new Microsoft.Maps.Pushpin(loc4, {text: '4'});

locs.push(loc1);
locs.push(loc2);
locs.push(loc3);
locs.push(loc4);

map.entities.push(pin1);
map.entities.push(pin2);
map.entities.push(pin3);
map.entities.push(pin4);
var bestview = Microsoft.Maps.LocationRect.fromLocations(locs);
map.setView({bounds:bestview });

}


text:
Q: Place element at bottom of the visible part of the document element I would like to place a popup at the bottom of the visible part of an Html document, even if I scroll down?
The html document does not fit in the window so I have to scroll down to view it all. And each time I scroll, the visible part is varies. So how can I get the coordinates of the bottom of the currently visible part?
Any help will be appreciated.
Regards,
Horace

A: Did you try position: fixed on your CSS? It's supposed to position elements relative to the viewport as you want. Something like this:
#myelement {
    position: fixed;
    bottom: 0;
}

A: You can use the CSS style position: fixed; to position the element relative to the view port (window area).
Example:
<div style="position:fixed;left:100px;bottom:0;width:100px;height:50p;">
  Bottom
</div>

Note: Some really old browsers (e.g. Internet Explorer 6) doesn't support position: fixed. If you need to support those, you would need to use Javascript to get the size of the window, and use position: absolute to place the element, and catch the scroll event so that you can move the element to keep it visible.


text:
Q: Apply style to particular children nodes of p-tree, in primeng Let me start with demonstration example: StackBlitz primeng p-tree.
I am using primeng to create a poll & answers kind of structure using p-tree.
So i have a herarchy like :  Participants --> Polls  --> Questions --> Answers
Every Questions have answer options.
Array of list of nodes and childrens is as follows:
"label": "Bollywood",
    "children": [
     {
        "label": "Do you prefer hollywood? [single]",
        "children": [
          {
            "label": "Yes",
            "selected": false
          },
          {
            "label": "No",
            "selected": true
          }
         ]
       }
     ]

I have added selected value to each of the children of answer options, so that for true values we can apply css to disthinigh among other options.
Screenshot below for current scenario:

I just want to highlight the options from the answers for which selected value is true.  Purely looking with prospective of primeng p-tree control, i am curios to know how we can provide styiling to tree nodes. Please help me out, it will be grateful if you can go through the stackblitz example mentioned above.
Thank you.

A: You can achieve this by using type of node in p-tree please go through documentation of Tree Templating.
But first you need to modify your tree-account.json file or do some mapping to add type in your json. Adding a Stackblitz for same.
Here I changed selected items font color as green.


text:
Q: Symfony 2 value on Enitty field I made a form with Symfony 2, my problem is that the entity fields doesn't show the value from the database, the other fields on the form are compiled well and the data I pass to the form contains the right value.
The code in form type is:
->add('nazione', 'entity', array(
                'class' => 'CRIPatentiBundle:Nazioni',
                'property' => 'nomeEsteso',
                )
             )

the twig code is:
{{ form_widget(form.nazione) }}

the dump of the array shows the right value in the database
-nazione: 102

But the select in html shows the first value, not the one is specified and the value property of the select item is 102


text:
Q: how to add a react date picker no hooks I am working on a react project trying to add a react date picker using npm react-datepicker. I am using this.state and handleChange(e). how do I add a date picker on my react app without using hooks?

A: here is sample of the connection, in App component, its old way of doing date picker using in reactjs,
your imports are,
import React, { Component } from 'react';
import DatePicker from 'react-datepicker';

and application would be,
class App extends Component {

  constructor (props) {
    super(props)
    this.state = {
      startDate: new Date()
    };
    this.handleChange = this.handleChange.bind(this);
    this.onFormSubmit = this.onFormSubmit.bind(this);
  }

  handleChange(date) {
    this.setState({
      startDate: date
    })
  }

  onFormSubmit(e) {
    e.preventDefault();
    console.log(this.state.startDate)
  }

  render() {
    return (
      <form onSubmit={ this.onFormSubmit }>
        <div className="form-group">
          <DatePicker
              selected={ this.state.startDate }
              onChange={ this.handleChange }
              name="startDate"
              dateFormat="MM/dd/yyyy"
          />
          <button className="btn btn-primary">Show Date</button>
        </div>
      </form>
    );
  }

}

export default App;


text:
Q: Ignoring escape characters in perl my %result = "\\path\tfolder\file.txt";

How can I ignore the \t escape sequence without prepending a '\'. Is there something like:
my %result = r"\\path\tfolder\file.txt";

The above doesn't work.

A: Single quotes process two escape sequences: \\ and \', so you would have to double the leading double-backslash but not the others:
my $result = '\\\\server\toppath\files';

To get what you want, you could use a here-document at the cost of some syntactic bulk.
chomp(my $result = <<'EOPath');
\\server\toppath\files
EOPath

Note the change of sigil from % to $ because a string is a scalar, and hashes are for associations.


text:
Q: XRDP same user multiple session I'm trying to make XRDP work with multiple sessions on my linux mint server.
Right now, i can connect only if there are no other session running on the system (I had to disable autologin).
I don't know why, but with the Raspberry it just works by default the way I want: when I connect to XRDP, a new session is created for every client. When another client connects to the same server with the same user, a new session is created.
I tried to change the Policy setting in the /etc/xrdp/sesman.ini file from Default  to UBDC but nothing changed.
It's the first question I post, so I ask you to be really patient with me and ask me the files you may need to understand the situation.
I swear I searched all the internet but found nothing that helped. I just know it can be done 'cause my Raspberry does it for some odd reason.
Thank you :)

A: Does XRDP in your server run with '--nodaemon' option?
If so you will restart xrdp without '--nodaemon' option, then XRDP works well as you want.
My server (CentOS 8) has the same problem and I was troubled.
I try to run xrdp without '--nodaemon' option, then I could connect with multiple sessions.
So run xrdp deamon without '--nodaemon' at Linux startup.
CentOS8 sample
$ sudo sed -i "s/ --nodaemon//" /usr/lib/systemd/system/xrdp.service

$ sudo dnf systemctl restart xrdp

ref but japanese : XRDPの1ユーザマルチセッションの有効化


text:
Q: Preloader and progress bar do not run after upload to server I'm using Flash Builder 4.5 to build a flash game. Everything is ok when I test in localhost. When I upload swf files to server, I use FILE MANAGER in host server to access the swf.
For example:
http://mysite.info:2222/CMD_FILE_MANAGER/domains/mysite.info/public_html/flash/Main.swf

All of them run normally from 1% to 100%, but when I access the swf in URL for example    http://mysite.info/flash/Main.swf then the preloader and progress bar always do not run, but the swf still loads.
However, when I upload files to free swf host like megaswf,  preloader and progress bar run normally.
I don't know how to find the solution for this problem. Please, help me!


text:
Q: Javascript: map function appending to an object I have a map function which is iterating a response i received from backend. I'm iterating the response as 'tab' like the code below, what i want to do is to insert 'tab.name' as an key inside the object MyObject
my code:
var MyObject = {}

response.data.rows.map(tab => {
     MyObject = {
        ...MyObject,
        tab.name
     }
})

What i expect is that my object MyObject has every keys and values with the name of tab, e.g:
{
   name1: name1,
   name2: name2,
   name3: name3
}

The problem is that i can not use tab.name inside object

A: You could use collectjs, goes good..
Anyway if you want to have the keys just do a foreach

let response = [
  {name: 'name1', age: '22'},
  {name: 'name2', age: '25'},
  {name: 'name3', age: '2'},
]

var MyObject = {}

response.forEach(tab => {
     MyObject[tab.name] = tab.name
})

console.log(MyObject)

A: If you really want to use .map(), you could use to create an array of arrays, where each sub-array has a length of 2, and holds the given value at each index.
Then you can use Object.fromEntries() to add the properties from that array structure.

var response = {data:{rows:[{name:"foo"}, {name:"bar"}, {name:"baz"}]}};

var key_val_props = response.data.rows.map(({name}) => [name, name]);

var MyObject = Object.fromEntries(key_val_props);

console.log(MyObject);

A: Theres no need to copy the object just do
MyObject[tab.name] = tab.name;

I'd also avoid using .map since it will be returning the new reference which I dont think that is what you want.


text:
Q: Why won't 'twoways' in plm produce fixed effects for group as well as time? When I do the two ways model in the plm package, my understanding is that it should have fixed effects for group and time, but when I manually look at the fixed effects it only produces fixed effects for the group variable. For example, using the canned data in the plm package:
> data("Produc", package = "plm")
> zz <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp,
            data = Produc, index = c("state","year"),model='pooling')
> qq <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp,
            data = Produc, index = c("state","year"),model='within',effects='twoways')
> length(fixef(zz))
Error in fixef.plm(zz) : fixef is relevant only for within models
> length(fixef(qq))
[1] 48
> length(unique(Produc$state))+length(unique(Produc$year))
[1] 65

My expectation is that the last two lines should be equal, i.e. that there should be year and state fixed effects. Why are they different?

A: This is explained in the help for fixef, use ?fixef to view it:
For a two-ways model, fixef's default behaviour is to output the group ("individual") fixed effects. If you want the time fixed effects, use fixef(your_model, effect = "time").
Picking up your example, take heed you do not estimate a two-way fixed effects model as the argument is called effect rather than effects (with a s). So use:
qq <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp,
          data = Produc, index = c("state","year"), model ="within", effect = "twoways")
length(fixef(qq)) # 48
length(fixef(qq, effect = "time")) # 17

You can check with summary(qq) which model you estimated as the first line of its output will tell you the model: "Twoways effects Random Effect Model" in this case.


text:
Q: Javascript image slideshow - mouseover I am having a hard time searching for the answer to my problem.  Mainly because I have no idea how to ask it in a google/yahoo search.
My site:  http://www.wbsnightout.com/sidekick
On the right side I have three sponsor ad div's with images rotating.  Each image has a title and is a clickable link.  The only problem is, is that when you mouse over the image, the LINK and TITLE for the image BEHIND the shown image comes up.  When I click on it, it takes me to the wrong link, because it's the link for the image behind it.
Here is an example of my HTML:

This is pulled dynamically using php and mysql.
I have this before my closing body tag within a script tag
  initImageGallery('sponsor1', 5000);

And my javascript file can be found:  http://www.wbsnightout.com/sidekick/js/slideshow.js
I don't know much about javascript so I just used I script that I found online.
If you can answer or point me to a discussion or tutorial, that would be great!
Thanks,

A: You need to put this  (add 'z-index:9999;' to .advertiseSlides img in css


text:
Q: Parse Cloud Code Setting Relation On User Class I have an issue with not getting some cloud code to run in Parse. Currently, I pass an objectId of another user who I want to set a review for. In client side, I am saving the review, and capturing that object. I pass that as well up to cloud code. Both show up there, but I cannot figure out the right way to set the relation on this user and apply that review that was created. Code snip is below. Any help would be appreciated before I bang my head against a wall.
Parse.Cloud.define("addReview", async (request, response) => {
   let { userObjId, reviewObj } = request.params;

   const query = new Parse.Query(Parse.User);

   //get the user object to post review of
   try{
      let object = await query.get(userObjId, {useMasterKey: true});
      console.log(object);
      console.log("running");
      object.set('Reviews', new Parse.Object(reviewObj));
      object.save(null, { useMasterKey: true })
      return ("saved relation and updated reviews");
   } catch (err){
      throw new Error(err.message)
   }
});

A: I assume

*

*reviewObj is the review object, the user recently created.

*and in your User class, you got a to-many-relation to Review class, named 'Reviews'.

First I'd suggest to name your user object user instead of object, to make it clearer what you're dealing with and make your code easier to understand.
Since you said, the review object is already successfully saved on server side, I'd recommend to transmit only the reviewId in your request.

To add an object to a relation, you first need to get the relation property of your user object:
const reviewsRelation = user.relation('Reviews');
Then to add the object to the relation just call:
reviewsRelation.add(user);
In total, your snippet should look like this:
Parse.Cloud.define("addReview", async (request, response) => {
   let { userObjId, reviewObjId } = request.params;

   const userQuery = new Parse.Query(Parse.User);
   const reviewQuery = new Parse.Query(Parse.Review);

   //get the user object to post review of
   try{
      let user = await userQuery.get(userObjId, {useMasterKey: true});
      let review = await reviewQuery.get(reviewObjId, {useMasterKey: true});
      console.log(user);
      console.log("running");
      const reviewsRelation = user.relation('Reviews');
      reviewsRelation.add(review);
      user.save(null, { useMasterKey: true })
      return ("saved relation and updated reviews");
   } catch (err){
      throw new Error(err.message)
   }
});


text:
Q: PNG upload error - allocated memory size error I'm trying to upload an image into an application I'm creating. The .png image occupies about 190KB in the file system and the resolution is 2000px wide and 1667 px in height. I have set the memory limit for PHP for 32MB.
But when I try to upload this .png image which I believe a lot of the people using my application will do, I'm getting the following error
Allowed memory size of 33554432 bytes exhausted (tried to allocate 13336000 bytes)

Now when I calculated these into say MB I understood that it read
Allowed memory size of 32MB exhausted ( tried to allocate 12.71MB )

So what I don't understand is how come a file which shows a size of 190KB on the file system end up taking up so much memory space? Is it something about how .png files are handled in memory which I don't know about?
Here is the code
private function optimise_image($source_path, $destination_path){
    list($source_image_width, $source_image_height, $source_image_type) = getimagesize($source_path);
    //Using this source path, we'll create a memory instance of the image for processing
    $source_image_ratio = $source_image_width/$source_image_height;
    switch ($source_image_type) {
        case IMAGETYPE_GIF:
            $source_gd_image = imagecreatefromgif($source_path);
            break;
        case IMAGETYPE_JPEG:
            $source_gd_image = imagecreatefromjpeg($source_path);
            break;
        case IMAGETYPE_PNG:
            $source_gd_image = imagecreatefrompng($source_path);
            break;
    }

The error is occuring in imagecreatefrompng(). I load the image here to reduce it's resolution and to set it's quality to optimise storage and bandwidth on viewing.
Upon investigating a bit further, I found that the file is being uploaded and the size of the file on the server is again 190KB. So the piece of code you're seeing is where it's trying to pick up the file again for processing. Before this there's no where in the process where the file is being loaded into memory once and then left there without being destroyed ( which I thought was what would have been happening )
If there is any more information you may require, do ask I and I shall try and answer accordingly.
Thanks in advance :)

A: image-width x image-height x 4 bytes (32bit) per pixel is needed just for the  imagecreatefrompng / imagecreatefromjpeg
So that's roughly 12MB in your case
That leaves just 20MB for the GD lib and other PHP processes.


text:
Q: Binomial Congruence Modulo a Prime Let $p$ be a prime and $a, b$ natural numbers such that $1 \leq b \leq a$. I am trying to prove that $$\binom{ap}{bp} \equiv \binom{a}{b} \pmod p.$$
Furthermore, I have been tasked with proving that a stronger version of this holds: $$\binom{ap}{bp}\equiv \binom{a}{b} \pmod{p^2}.$$
I need an elementary proof of this (Lucas's theorem is out of the question).
I've been trying to prove the first inequality using the equivalence $(1 + x)^{ap} \equiv (1 + x)^p \pmod p,$ where $x$ is an integer. I've tried to expand $(1+x)^{ap}$ and $(1 + x)^p$ using the binomial theorem and then match coefficients, but I haven't been able to get the result doing this. How can I prove this first congruence (and the second one)?
Thanks.

A: Claim: $$\dbinom{pa}{pb} \equiv \dbinom{a}b \pmod {p^2}$$
Proof:
$$(x+1)^{pa} = (x^p+1+pQ(x))^a$$ for some polynomial $Q$ by the binomial theorem. Then we have
$$(x+1)^{pa} = (x^p+1)^a+a(x^p+1)^{a-1}pQ(x)+p^2f(x)$$ for a polynomial $f$.
This gives
$$(x+1)^{pa} \equiv (x^p+1)^a+a(x^p+1)^{a-1}+pQ(x) \pmod {p^2}.$$
Since $pQ(x) = (x+1)^p-1-x^p$, substitution gives
$$(x+1)^{pa} \equiv (x^p+1)^a+a(x^p+1)^{a-1}((x+1)^p-1-x^p)$$
$$ \equiv (x^p+1)^a+a(x^p+1)^{a-1}(x+1)^p-a(x^p+1)^{a-1}-x^pa(x^p+1)^{a-1}. \pmod {p^2}$$
Now by a simple counting argument, the coefficient of $x^{pb} \pmod {p^2}$ termwise is
$$\dbinom{a}b + a\left(\dbinom{a-1}b+\dbinom{a-1}{b-1}\right)-a\dbinom{a-1}{b}-a \dbinom{a-1}{b-1} \equiv \dbinom{a}b \pmod {p^2}$$
as desired.
It's pretty cool to see that the terms conspire like that at the end. I think a similar proof would also work for $p^3$. I remember seeing a combinatorial proof for the $p^3$ case somewhere... I can possibly retrieve it if anyone wants me to.

A: A standard combinatorial proof goes like this. Arrange $pa$ elements in $a$ rows of $p$ elements each. We want to mark $pb$ elements out of those, for which there are $\binom{pa}{pb}$ ways.
Case $1$. We mark $b$ entire rows of $p$ elements each. This accounts for $\binom{a}{b}$ choices.
Case $2$. The $pb$ marked elements don't fill at least $1$ of the rows in which they are located. Moreover, because the total number of chosen elements is divisible by $p$, there cannot be exactly $1$ such row, so there is at least $2$ such rows. Choose any row in which some, but not all, of the elements are marked. Rotate the marks in such a row as if on a cylinder. In other words, if marked elements are in columns $c_1<\dots<c_k$, with $1\le c_1\le c_k\le p$ and $1\le k\le p-1$, then consider choices $(c_1+i\!\!\!\mod\!\!p,\dots,c_k+i\!\!\!\mod\!\!p)$ for $i=0,1,\dots,p-1$. Because $p$ is prime and $0<k<p$, the rotation period is $p$. Declare two markings equivalent if one can be obtained from the other by mark rotation as described above. Then the number of elements in each equivalence class in Case $2$ is divisible by $p^2$, since at least $2$ rows can be rotated independently with period $p$. Thus, the number of markings in Case $2$ is divisible by $p^2$.


text:
Q: Find sequences of digits in long integers efficiently Is it possible to find a defined sequence in an integer without converting it to a string?
That is, is it possible to do some form of pattern matching directly on integers.
I have not thought of one but I keeping thinking there should be a mathematical way of doing this. That's not to say it is more efficient.
(edit) I actually what numbers that don't contain the sequences of digits I am looking for.
The integers will be large, at least 289 digits. The sequences to find could be anything, "123", "5"(there is a five), "66666"
I am interested in a general solution but if you would like to help with the acutal problem I am trying to sovle keep reading.
More specifically I am looking for repeating digits of length 4 ie 1324322223313 "2222".
I am staring with integers because I will be incrementing though consecutive integers unless I get to an integer with 4 length repeat then I would skip to the the next integer without the repeat. Also I don't what integers with digit larger that 4 ie 12322135 (it has a 5) would be excluded.
The problem might also be stated as.
Find all integers in the z = range(x,y) such that z[a] does not contain any repeating digits of length 4 and a digit larger than 4. The range(x,y) may be very large
(Edit) in response to the comment, Yes I would actually like to generate a list, the problem I have is that I am not sure how I could make a generator that satisfies all the conditions I have. Maybe I should think about this more, I agree it would be simpler, but it might be similar to a generator for prime numbers, there is no such generator.

A: You can use this class to have your generator of digits :-)
import math

class DecimalIndexing:
    def __init__(self, n):
        self.n = n
    def __len__(self):
        return int(math.floor(math.log10(self.n)+1))
    def __getitem__(self, i):
        if isinstance(i, slice):
            return [self[x] for x in range(i.start, i.stop, i.step or 1)]
        else:
            return (self.n/(10**i))%10
    def __iter__(self):
        for i in xrange(len(self)):
            yield self[i]

you can use it like this:
di = DecimalIndexing(31415927)
for i in xrange(len(di)):
    if di[i:i+4] == [9,5,1,4]:
        print "found"

or like this:
for i in xrange(len(di)):
    if di[i:i+3] == [di[i]]*3:
        print "group of three equal digits at," i

or like this:
if 5 in di:
    print "has a five"

or like this:
if any(x > 5 in di):
    print "some digit was greater than five"

etc.
Keep in mind that the digits indices are "reversed", i.e. read from right to left.

A: A list of digits is pretty simple.
# given n, a long integer
digits = []
while n != 0:
    digits.append( n%10 )
    n //= 10
digits.reverse()

You can then do your pattern matching on this list of digits.  Is that what you're looking for?

A: You can make an iterator with the digits ordered from left to right this way
>>> import math
>>> number = int(123456789012345678901)
>>> #Get the maximum power of 10 using a logarithm
>>> max_digit = int(math.log10(number))
>>> range_pow = xrange(max_digit, 0, -1)
>>> # pot is an iterator with 1000, 100, 10, 1...
>>> pot = ( 10**x for x in range_pow)
>>> #Get the digits one by one on an iterator
>>> digits = ( (number/x)%10 for x in pot )
>>> l = list(digits)
>>> print l
[1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 0L]

Then you can check if the sequence is present... I'm looking for a easy way to do that through the iterator, something like a state machine to parse the result, but I'm not sure if there's a built-in way to do it without making a list or making the finite state machine by yourself...
You can go with something like this, but I think it will kill the performance (compared with a finite state parsing done on low level over the iterator) as you need to build the list, not working directly with iterator:
>>> print l
[1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 0L]
>>> find = [1,2,3]
>>> lf = len(find)
>>> for i in xrange(len(l)):
...     if find == l[i:i+lf]:
...          print 'Found!', i
Found! 1
Found! 11

Edited:
I've come with a more iterative way to do things... The digits parameter could be
refined to create a list from a number, if necessary.
import math
from itertools import count

def find_digits_in_number(digits, number):
    #Get the maximum power of 10 using a logarithm
    max_digit = int(math.log10(number))
    range_pow = xrange(max_digit, -1, -1)
    # pot is an iterator with 1000, 100, 10, 1...
    pot = (10 ** x for x in range_pow)
    #Get the digits one by one on an iterator
    dig = ((number / x) % 10 for x in pot)

    #Current will store a moving windows with the
    #size of the digits length to check if present
    current = []
    for i in digits:
        current.append(next(dig))

    digits = list(digits)

    founds = []
    #The basic loop is this...
    #for digit, i in zip(dig, count()):
    #    if current == digits:
    #        founds.append(i)
    #    current.pop(0)
    #    current.append(digit)

    #But it can also be optimized like this list comprehension,
    #while it's much less readable
    [ (founds.append(i) if current == digits else None,\
      current.pop(0), current.append(digit)) \
      for digit, i in zip(dig, count()) ]

    #Check last posibility, with the last values
    if current == digits:
        founds.append(i + 1)

    return founds

if __name__ == '__main__':
    assert find_digits_in_number((3, 4, 5), 123456789012345678901) == [2, 12]
    assert find_digits_in_number((3, 4), 123456789034) == [2, 10]

A: Maybe you want to take a look here: Cyclic Numbers; they also have an algorithm to build a cyclic number.
This can be useful too: Cycle detection

A: @Fortran gives a great solution, it is very versatile.
I asked a modified version of this question on mathoverflow.net, They didn't seem to like the question, but I got a great answer. It answers a slightly different question but useful for my application.
To test if the digits 4444 are in 35344442345321456754 and assuming I know where I what to look for them then this is a nice solution and obvious once you see it.
(35344442345321456754 / 10**13) % 10**4 == 4444


text:
Q: How to delete a corrupted file? I make a backup disk with bad sectors on Ubuntu.
Some files are not copied and do not give a full backup.
I want to remove them, but get the error:
rm: can not remove [file]: Input / output error

I can not stop the server. How can I remove the bad file is to continue backing up without stopping?

A: You should use tar with an exclude pattern to skip all problematic files.
tar -X file_with_list_of_files_to_skip cfz backup.tgz folder_to_backup

You can populate the file_with_list_of_files_to_skip with the cleaned up output of a filesystem checking utility.

A: You can run cmd-prompt as an administrator, then run chkdsk /X /f C: (C: can be changed to the file starting thingy). And it will auto recover :)


text:
Q: Perfmon Total Counters: 32-Bit Wrap Around? For counters in Windows Server 2008 R2 that count the total (instead of rate) at what number do they wrap around to zero? In this particular case I am interested in \Web Service(_Total)\Total Get Requests. Are they always maybe 32bit or 64bit. Or maybe it depends on if it is a 32bit or 64bit OS (in this case, R2 so has to be 64)?

A: It's a 32bit unsigned Integer.
Reference: Win32_PerformattedData_W3SVC_WebService -> TotalGetRequests

A: Normally it will be an unsigned 32 bit (on 32-bit system) so 2^32 = 4294967296. So the range is 0-4294967295.


text:
Q: Cycle over windows of the same application with keyboard shortcut - GNOME 3 Using Alt + TAB for cycling over the opened windows doesn't cycle over the different windows of the same application.
For example, I've got some terminals opened, and pressing the key Alt + TAB
groups the windows so I cannot cycle between recent windows of the same application easily. Then I have to use the mouse to do so.

Is there any way to change this so I can change rapidly over windows of the same application?

A: From gnome tweaks select extensions, there's an "Alternatetab" extension which I guess is pre-installed but is off. Switch it to on.


text:
Q: Same Time Web Service Access Testing I want to test my web service if a number of clients access it at the same time, not even a 0.01e-1000 millisecond difference (if it is even feasible).
How do you create such test that would access the web service at the same time? And if possible, how would you know that the clients access the service at the same time?
I am not sure if using a BackgroundWorker will execute them at the same time.
bgw.DoWork += DoWorkEventHandler(AccessServiceWithMockClient1);
bgw.DoWork += DoWorkEventHandler(AccessServiceWithMockClient2);
bgw.RunWorkerAsync();

I think it will execute the first one (AccessServiceWithMockClient1), I'm just not sure because I can't check who's accessing the service.
And of course, I think threading wouldn't work because I might have a code like this inside the other thread method.
AccessServiceWithMockClient1();
AccessServiceWithMockClient2();

Which obviously would execute the first one. But I'm not that sure, I might just not that knowledgeable about threading.

A: It sounds to me like you're looking for a load testing tool which can simulate multiple simultaneous users.  If you have apache installed you can use apache bench http://httpd.apache.org/docs/2.0/programs/ab.html, which in my experience is very easy to run tests.  For Microsoft-specific tools, this question has some answers: https://serverfault.com/questions/917/what-are-good-load-testing-tools-for-iis-7-web-applications.


text:
Q: Javascript awaiting the entire synchronous loop For performance purposes, I want to run a for loop without awaiting the code inside, but there's another function that I want to execute only after everything in the for loop is done. Here's an example:
function waitForThis() {
  for (let i = 0; i < 10; i++) {
    downloadImage() // I don't want to wait for this
  }
}

waitForThis() // I want to wait for all 10 images to be downloaded
runAfter() // Run this after all downloadImage() have completed

If I add await in front of downloadImage(), I wouldn't be able to download an image until the previous one is finished, so I want to do it synchronously. Any ideas?


text:
Q: Confidence Intervals of a Given Width I'm working through some questions on confidence intervals. My answer doesn't match the book, but the book's answer was a number I had a few steps before the end.

I have ten numbers which are a random sample from a normal
  distribution with standard deviation $\sigma = 135$. The sample mean
  is $1008$.
If a $C\%$ confidence interval has width $100$, what is $C$?

What I've done:
The sample mean is $1008$, so a confidence interval of width $100$ would be $[958,1058].$ I first tried to convert these limits into $z$-scores.
The CLT tells us that the sample means will be distributed normally with standard deviation
$$\frac{\sigma}{\sqrt{n}} = \frac{135}{\sqrt{10}}$$
I used the general formula $X= \mu + \sigma Z$ on the upper-limit $\bar{X} = 1058$ to give
$$Z=\frac{50\sqrt{10}}{135} \approx 1.1712$$
To find $C$, I need to find $P(-1.1712 \le Z \le 1.1712)$.
Using the tables I get $P(Z \le 1.1712) = 0.8792$, which gives
$$P(-1.1712 \le Z \le 1.1712) = 0.7585$$
I would conclude that a $76\%$ confidence interval would have width of $100$. However, the textbook says it's an $88\%$ confidence interval.
As you can see, I got $P(Z \le 1.1712) \approx 0.88$.
It feels like the solutions have missed out the last step.
Any help would be appreciated.


text:
Q: Differences in iterating over Linked Lists I know that iterating through a LinkedList using
for(int i = 0; i < list.size(); i++){
  Item item = list.get(i);
}

to get the single objects has bad performance as each call of .get(i) iterates from the beginning of the list up to i.
The correct way would be using an Iterator. So far so good.
But what about this style:
for(Item item : list){
  // item is already here
}

Does this have the same performance like using Iterators? How does this work internally?

A:
Does this have the same performance like using Iterators?

Yes. Both variants generate the same bytecode. The following byte code was generated from a for-each-loop, but when using an iterator in the loop it looks exactly the same:
for(Object o : list) {
}

  44: aload_1
  45: invokevirtual #30                 // Method java/util/LinkedList.iterator:()Ljava/util/Iterator;
  48: astore_3
  49: goto          59
  52: aload_3
  53: invokeinterface #34,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
  58: astore_2
  59: aload_3
  60: invokeinterface #40,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
  65: ifne          52

How does this work internally?

In case of non-arrays, the for-each-loop uses Iterators internally. See the byte code above - all the methods are invoked which would also be invoked when using an Iterator.
See also The For-Each Loop and How does the Java 'for each' loop work? for some additional information.

A: The foreach loop uses the Iterable interface. It calls iterator() and than iterates with the iterator.
A special handling is used for arrays.

A: One difference is for each loop is use when you don't want to change the size of the list. because it uses iterators which become invalidate after resize of the list.Whereas it's not a case in normal for loop.But the standard loop make a call to size function each time which make it less efficient then for each. To get the same performance of both you need to put the constant value like 10,15,..etc in condition of standard loop.

*

*For Each -- Read only mode

*Standard For -- Read Write Both
Specific to the Question : the standard for loop is really inefficient because you have to traverse the list each time you call the get from the beginning.This is more problematic then the call of size


text:
Q: Ordering the second column lower on mobile I have a form with the following 2-column layout.  It displays well on a desktop browser.  For this example, each letter/number combo is an input field:
col-md-6    col-md-6
   A1   |      B1
   A2   |      B2

   A3   |      B3
   A4   |      B4
   A5   |

   A6   |      B6

I separated the input fields by rows.  For example, input fields A1 and B1 are both in one row.  A3, B3, A4, B4, and A5 are also in one row.  I did this so that I wouldn't have to measure and impose a height on B3 and B4 to keep the spacing aligned between columns.
However, when I resize to a mobile browser, I want all the B values to fall under the A values like so:
  col-xs-12
   A1
   A2

   A3
   A4
   A5

   A6

   B1
   B2

   B3
   B4

   B6

I've looked at several different methods involving push and pull, but I can't seem to find a CSS-only solution.  There are about 80 input fields on the page. I also tried to measure heights but this is proving to be a clunky way to do it since the fields change frequently and I need to re-test the display on numerous browsers.
Any clever solutions?
UPDATE:
Here's a working example of two rows for brevity, as requested in the comments:

        <form:input path="firstName" type="text" class="form-control"/>

        <form:input path="coFirstName" type="text" class="form-control"/>

         <form:input path="lastName" type="text" class="form-control"/>

         <form:input path="coLastName" type="text" class="form-control"/>

A:

.lg-spacer {
  visibility: hidden;
}
@media (max-width: 767px) {
  .lg-spacer {
    display: none;
  }

}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

        <input path="firstName" type="text" class="form-control" placeholder="a1" />

        <input path="lastName" type="text" class="form-control" placeholder="a2" />

        <input path="firstName" type="text" class="form-control" placeholder="a3" />

        <input path="lastName" type="text" class="form-control" placeholder="a4" />

        <input path="firstName" type="text" class="form-control" placeholder="a5" />

        <input path="lastName" type="text" class="form-control" placeholder="a6" />

        <input path="firstName" type="text" class="form-control" placeholder="b1" />

        <input path="lastName" type="text" class="form-control" placeholder="b2" />

        <input path="firstName" type="text" class="form-control" placeholder="b3" />

        <input path="firstName" type="text" class="form-control" placeholder="b4" />

        <input type="text" class="form-control" disabled />

        <input path="lastName" type="text" class="form-control" placeholder="b6" />

If you can't change the markup (it's generated by some plugin, etc...) it can be done using flexbox.


text:
Q: RSSelectionMenu dismiss popup window I am using RSSelectionMenu as an alert to show a list of dates.
But the window will only dismiss when something is selected.
How can I dismiss the popup with either a Done button or by clicking outside the window.
this is the code I am using for the window from the Github site.
// or specify alert button title
selectionMenu.show(style: .alert(title: "Select", action: "Done", height: nil), from: self)

Thank you very much.


text:
Q: Jquery - How to set mouseleave event to an after() generating div? I use the function below to enlarge a div from the center. Cause the jQuery generating elements can't be access by jQuery again so I put onmouseout attribute to the generated
.But it occurs that when I move my mouse into the child elements of the div, the onmouseout event is triggered and that is not what I want.
So, how can I fix it or is there any other way to do the same effect?
shows = $(".shows");
shows.bind('mouseenter', function() {
    enlargeCenter($(this), 1.8, 'bigger');
});

function enlargeCenter(des, ratio, nclass) {
    var oWidth  = des.width();
    var oHeight = des.height();
    var nHeight = oHeight * ratio;
    var nWidth  = oWidth * ratio;
    var left    = des.position().left;
    var top     = des.position().top;
    left        = (oWidth - nWidth) / 2 - oWidth;
    top         = (oHeight - nHeight) /2;

    des.after("
" + des.html() + "
");
    $("." + nclass).css({
        'width': nWidth,
        'height': nHeight,
        'left': left,
        'top': top
    });
}

here are the css codes
.shows, .bigger {
    float:left;
width:200px;
height:250px;
position: relative;
left:0;
top:0;
border:1px #ccc solid;
background: RGB(245,245,245);
overflow:hidden;
}

.bigger {
border:0;
background: white;
box-shadow: #ccc 0 0 5px;
-moz-box-shadow: #ccc 0 0 5px;
-ms-box-shadow: #ccc 0 0 5px;
-webkit-box-shadow: #ccc 0 0 5px;
}

HTML

odfelakjfelkavjekvaelkfjjjj

If you move your mouse in that
 the onmouseout event will be triggered and the bigger div will be remove.

A: The mouseout event triggers as soon as your mouse leaves that target element or enters a child element.  IE has a proprietary mouseleave event that only gets triggered when the mouse leaves the target element entirely.  jQuery simulates this with the mouseleave function.  I tried the following change and it I think it will do what you want:
...
des.after("
" + des.html() + "
");
    $("." + nclass).css({
        'width': nWidth,
        'height': nHeight,
        'left': left,
        'top': top
    }).mouseleave(function(){$(this).remove()});
...

A: Since I don't have anything to see, I'm guessing this might solve your problem,
Change your mouseenter event from,
shows.bind('mouseenter', function() {
    enlargeCenter($(this), 1.8, 'bigger');
});

to this,
shows.bind('mouseenter', function(evt) {
    evt.stopPropagation();
    enlargeCenter($(this), 1.8, 'bigger');
});


text:
Q: how to improve the display for a large form in this situation? I made a large form, which has many elements. I use javascript(jquery) to make this form have a step-by-step effect. The problem is that, when the page is loading and before the javascript behavior is triggered, the form shows in a mess and all of its element are shown. Any ideas of improving this?

A: A common term for this behavior is "flash of unstyled content" (which will be useful when searching for solutions). Technically your content has been styled (assuming the page is structured and parsed correctly), but your JavaScript is applying additional style rules and it doesn't do that until the page is loaded.
One technique I regularly use is to set elements to display:none until I am ready to work with them. This isn't always practical, as sometimes the element must be visible and/or have a display box for a particular piece of code to work.
See this article for ideas.

A: Group all the form elements in a hidden div (style would be display:none) and have a "loading" message show.
When the document has finished loading, trigger some kind of "startup" function using
$(document).ready(function() {
  //unhide the form here
})


text:
Q: connect to dynamic server I want to develop and application in vb6+(vb6 upwards) in winxp+ (windows xp upwards). The client has to connect or reconnect to a server application.
How do i connect to the server whose ip is dynamic?

A: By having the server tell your client about its IP, for example by using one of many dynamic DNS services to give it a domain name, or by using a server of your own with a known address to store the IP address of your dynamic server.

A: With the help of broadcasting or preferrably multicasting the server's ip address in form of UDP datagram packets over network and join the client with the multicast group; client could know the address of the server. And thus could connect


text:
Q: How can I write a method that receives, processes and returns a 2D char array in C++ normally I'm a Java guy and I'm trying to write a method that receives, processes and returns a 2D char array in C++.
I tried this:
char[][] updateMatrix(char (&matrix)[3][3])
{
 matrix [1][2] = 'x';

 return matrix
}

int main()
{
 char matrix[3][3] = {   {1,2,3},
                         {4,5,6},
                         {7,8,9} };

 matrix = updateMatrix(matrix);
}

but I'm not sure if it´s the "right" way to hand over this 2D Array and how I can return it to override the current matrix. (casting solutions are also welcome)

A: The syntax to return a reference to an array is a bit funky in C++. Long story short the signature of your function should look like this:
char (&updateMatrix(char (&matrix)[3][3]))[3][3];

Demo
The reason why you'll hardly ever see this written in C++ is because when you pass something by reference, you don't need to return it; instead you'd simply modify it in place (it will be an in/out parameter).
A case where such a thing is useful is when you need to chain operations, and you prefer the resulting syntax e.g. inverse(transpose(matrix)). If you go with returning the (reference to the) array, it's always simpler to create a typedef and remove some of the clutter:
using mat3x3 = char[3][3];

mat3x3& updateMatrix(mat3x3& matrix)
{
    matrix [1][2] = 'x';

    return matrix;
}

Demo


text:
Q: If i call a method inside its Class it works. Calling it from out the class causes a crash When I do this my app crashes without any error.
footballScores = [[FootBallScores alloc] init];
[footballScores initStuff];

I call this from my viewDidLoad of my view controller.
But if i comment out
footballScores = [[FootBallScores alloc] init];
//[footballScores initStuff];

And move the method call initStuff into the init method inside the class FootballScores it all works perfectly.
So it seems for some reason called initStuff from outside the class is causing my app to crash.
Anybody able to educate me as to why this happens?
Many Thanks,
Code
EDITS
-(void) init
{
//[self initStuff];
}

- (void)initStuff // Was - (void)awakeFromNib
{
NSLog(@" init called");
appDelegate = (FootballRadioAppDelegate *)[[UIApplication sharedApplication]
delegate];
responseData = [[NSMutableData data] retain];
baseURL = [[NSURL
URLWithString:@"http://footballmatchcentre.timesonlinesport.co.uk/ifb2009/league.asp?
league=EPL"] retain];
NSURLRequest *request = [NSURLRequest requestWithURL:baseURL];
[[[NSURLConnection alloc] initWithRequest:request delegate:self] autorelease];
}

The body of init gets commented out to test the call from outside the class and i uncomment it to test if it works by getting called from within the class.

A: Your -init method should return self, of type id, instead of void. It should attribute [super init] to self. A standard -init implementation would be:
- (id)init {
    self = [super init];
    if (self != nil) {
        // initialisation code
    }
    return self;
}

Then you can have a -(void)initStuff method and send [self initStuff] inside that if block that tests whether self != nil.


text:
Q: JavaFX PrintAPI wrong PaperSource I'm using the JavaFx Print-Dialog to customize the print job. All properties will be stored in the PrinterJob#JobSettings variable, but when I receive the paper source from the jobSetting the paper source is always the default.
How can I get the paper source that I set?
Here is a short example:
public class PrinterPaperSourceTest extends Application {
    public static void main(String[] args) {
        launch( args );
    }

    @Override
    public void start(Stage primaryStage) {
        primaryStage.setTitle("Printer");
        Button btn = new Button();
        btn.setText("Show Printer Settings ");
        btn.setOnAction( new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                PrinterJob job = PrinterJob.createPrinterJob(Printer.getDefaultPrinter());
                job.showPageSetupDialog(null);
                Alert alert = new Alert(AlertType.INFORMATION);
                PaperSource paperSource = job.getJobSettings().getPaperSource();
                alert.setContentText("PaperSource: " + paperSource.getName());
                alert.show();
            }
        });

        StackPane root = new StackPane();
        root.getChildren().add(btn);
        primaryStage.setScene(new Scene(root, 300, 250));
        primaryStage.show();
    }
}

A: Printing API appeared in fx8.0. And it can print nodes. You can create printer job with javafx.print.PrinterJob class. But it prints only region that fits to a printed page, and not the one that you on a screen. So you need to make your node fit page(scale, translate, etc) by hands.
You can use this code. Hope it will help you.
/**
 * Prints the current page displayed within the internal browser, not necessarily the {@link #presentationProperty()}.
 * If no printers are installed on the system, an awareness is displayed.
 */
public final void print() {
    final PrinterJob job = PrinterJob.createPrinterJob();

    if (job != null) {
        if (job.showPrintDialog(null)) {
            if(this.getPresentation().getArchive() != null) {
                final String extension = ".".concat(this.getPresentation().getArchiveExtension());
                final int indexOfExtension = this.getPresentation().getArchive().getName().indexOf(extension);
                final String jobName = this.getPresentation().getArchive().getName().substring(0, indexOfExtension);
                job.getJobSettings().setJobName(jobName);
            }

            job.getJobSettings().setPrintQuality(PrintQuality.HIGH);
            job.getJobSettings().setPageLayout(job.getPrinter().createPageLayout(Paper.A4, PageOrientation.LANDSCAPE, 0, 0, 0, 0));

            this.internalBrowser.getEngine().print(job);
            job.endJob();
        } else {
            job.cancelJob();
        }
    } else {
        DialogHelper.showError("No printer", "There is no printer installed on your system.");
    }
}

Resource Link:

*

*javafx.print.PrinterJob examples

*Introduction by Example: JavaFX 8 Printing

A: I don't have an answer but I will try to explain why it happens and why it will not be easy to fix. This behavior seems to be influenced by Internet Printing Protocol (IPP) specifications and is caused by the way IPP is implemented by Java Print Service API (to which JavaFX print jobs delegate). Below is a fragment from Oracle's tech note that explains limitations of manually setting the paper source (https://docs.oracle.com/javase/8/docs/technotes/guides/jps/spec/attributes.fm5.html):

Media is the IPP attribute that identifies the medium on which to print. The Media attribute is an important attribute to understand, but is relatively complex.
The Java Print Service API defines three subclasses of the abstract class Media to reflect the overloaded Media attribute in the IPP specification: MediaSizeName, MediaName and MediaTray. All the Media subclasses have the Media category, for which each subclass defines different standard attribute values. […]
The value of the Media attribute is always a String, but because the attribute is overloaded, its value determines the type of media to which the attribute refers. For example, the IPP pre-defined set of attribute values include the values "a4" and "top-tray". If Media is set to the value "a4" then the Media attribute refers to the size of paper, but if Media is set to "top-tray" then the Media attribute refers to the paper source. […]
In most cases, applications will use either MediaSizeName or MediaTray. The MediaSizeName class enumerates the media by size. The MediaTray class enumerates the paper trays on a printer, which usually include a main tray and a manual feed tray. The IPP 1.1 specification does not provide for specifying both the media size and the media tray at the same time, which means, for example, that an application cannot request size A4 paper from the manual tray. A future revision of the IPP specification might provide for a way to request more than one type of media at a time, in which case the JPS API will most likely be enhanced to implement this change.

So, MediaTray (or paper source) is not an independent parameter and cannot be set if the Media attribute is already defined by one of the other two ways (MediaSizeName or MediaName). This is exactly what happens with page setup dialogs.
J2DPrinterJob class (from com.sun.prism.j2d.print package) contains the dialog code and updates print job settings (I found this by debugging your application). Below is the method from this class that updates the paper source setting from the dialog.
private void updatePaperSource() {
    Media m = (Media)printReqAttrSet.get(Media.class);
    if (m instanceof MediaTray) {
        PaperSource s = j2dPrinter.getPaperSource((MediaTray)m);
        if (s != null) {
            settings.setPaperSource(s);
        }
    }
}

I tested different scenarios and the result was the same: by the time updatePaperSource() starts execution the Media attribute is already defined as MediaSizeName type. So the statements in the if branches are never executed and that's why the paper source is not updated.
I suspect that paper type or paper size have priority over paper source and because the page setup dialog always defines paper type (there is no 'Automatic' option), it overloads the selection of paper source to avoid attribute conflict. This essentially makes this option useless.
It may be a bug in JDK or an intentional design decision. In any case, I don't see an easy way to solve this problem staying within JavaFX considering that it comes from private methods in Java's internal API.

A: After a lot of searching I have found a way to print to a different tray with javafx and this was the first place I looked so I figured here would be the best spot to post my solution it may vary with different tray names mine was Tray 2 it will also print out all trays that are available
private void printImage(Node node) {
    PrinterJob job = PrinterJob.createPrinterJob();
    if (job != null) {
        JobSettings js = job.getJobSettings();
        PaperSource papersource = js.getPaperSource();
        System.out.println("PaperSource=" + papersource);
        PrinterAttributes pa = printer.getPrinterAttributes();
        Set<PaperSource> s = pa.getSupportedPaperSources();
        System.out.println("# of papersources=" + s.size());
        if (s != null) {
            for (PaperSource newPaperSource : s) {
                System.out.println("newpapersource= " + newPaperSource);

                //Here is where you would put the tray name that is appropriate
                //in the contains section
                if(newPaperSource.toString().contains("Tray 2"))
                    js.setPaperSource(newPaperSource);
            }
        }
        job.getJobSettings().setJobName("Whatever You want");
        ObjectProperty<PaperSource> sources = job.getJobSettings().paperSourceProperty();
        System.out.println(sources.toString());
        boolean success = job.printPage(node);
        if (success) {
            System.out.println("PRINTING FINISHED");
            job.endJob();
            //Stage mainStage = (Stage) root.getScene().getWindow();
            //mainStage.close();
        }
    }
}

Here's My output:
PaperSource=Paper source : Automatic
# of papersources=6
newpapersource= Paper source :
newpapersource= Paper source :  Manual Feed in Tray 1
newpapersource= Paper source :  Printer auto select
newpapersource= Paper source :  Tray 1
newpapersource= Paper source :  Tray 2
newpapersource= Paper source : Form-Source
ObjectProperty [bean:  Collation = UNCOLLATED
 Copies = 1
 Sides = ONE_SIDED
 JobName = Whatever
 Page ranges = null
 Print color = COLOR
 Print quality = NORMAL
 Print resolution = Feed res=600dpi. Cross Feed res=600dpi.
 Paper source = Paper source :  Tray 2
 Page layout = Paper=Paper: Letter size=8.5x11.0 INCH Orient=PORTRAIT leftMargin=54.0 rightMargin=54.0 topMargin=54.0 bottomMargin=54.0, name: paperSource, value: Paper source :  Tray 2]
PRINTING FINISHED


text:
Q: Shaky wireless with Asus PCI-N10 It worked out of the box in my other PC and it did work during install but right now, sometimes it works fine and sometimes the connection is awefully slow even though reception is really good  and I can't do anything that requires an internet connection. No additional driver suggested. Is there any tests I can run?

A: Try Issuing the Following Commands in a Terminal:
sudo modprobe -r iwlwifi

and
sudo modprobe iwlwifi 11n_disable=1

The First Command Will Turn Off the Wireless Service.
Thee Second will Restart it with the N Wireless Disabled
This is because there is a bug in Intel Wireless Cards that Makes it preform very slow when connected to wireless N Networks


text:
Q: How to use resources from ResourceManager in WPF binding Is there any good tutorial on how to use ResourceManager in WPF binding ? I know how to use it with the GetString function to retrieve a specific resource, but I also would like to use in in binding.
something like
<TextBlock Text="{Binding Resource.EnterName}"/>

thanks

A: A binding would not do much except getting the value once as the resources do not provide any notifications as far as i know. You can get the values using x:Static, e.g.:
<TextBlock xmlns:prop="clr-namespace:AppAssemblyName.Properties"
           Text="{x:Static prop:Resources.ResourceName}"/>

(The resource's accessors need to be set to public)


text:
Q: Could Ruby on Rails have been created in another language? Could Ruby on Rails have been created in another language like PHP, or are there some functions in the Ruby language that make the difference?

A: Rails makes heavy use of Ruby's ability to dynamically add classes and methods—there are implementations of similar frameworks in other languages, see Grails as an example. Other languages that provide a dynamic class runtime could be used, such as Smalltalk or Objective-C. In fact, Rails has a lot of similarities to the earlier, Objective-C (and Java) based WebObjects web application framework.

A: There aren't many things that one could do in Ruby more than in other languages - certainly Python is pretty similar in general and since Rails was released many other languages have implemented a railsalike framework from direct ports to tools like ASP.Net MVC.
What was different about Rails when it came out was the conceptual jump that lead to a framework that did so much of the basic legwork for you but left everything easily changed and kept out of your way once it was working. That kind of thinking is something that you might expect to come from the Ruby community because Ruby itself is designed to be very developer-friendly. It was that philosophy extended to web development that was the foundation for the Rails platform.


text:
Q: How to use alloca to allocate C function pointers? C is a mystery all the time!
I am implementing a work-crew thread execution model in which I am trying to use alloca as a faster memory allocation option. I have a strange segmentation fault while trying to execute code via function pointers stored on the stack using alloca.
Here's a tooth-pick code which results in a similar segmentation fault:
#include <stdlib.h>
#include <stdio.h>

typedef void* (*foo)(void*);

typedef struct task
{
    foo f;
} task;

void *blah(void* v)
{
    printf("addr:%p\n", &v);
    return v;
}

int main()
{
    void *queue[10];

    task *t = (task*) alloca (sizeof(task));
    // No null check, excuse me!
    t->f = blah;

    queue[0] = (void*)t;
    char string[10] = "Bingo!";
    char *c = &string[0];

    task *tnew = (task*)&queue[0];
    tnew->f((void*)c);

    return 0;
}

When I execute the above code I get a segmentation fault at the tnew->f() line.
GDB backtrace did not help me much.
Kindly explain the error in the above code.. I am using alloca for the first time.
Thank you very much!

A: Change this line:
task* tnew = (task*)&queue[0];

to
task* tnew = (task*)queue[0];

Because queue[0] is already a pointer; you don't need to take the address of it.  You have the same issue inside blah.  Your printf won't crash, but it will print out the address of the pointer, not the value of the pointer, which probably isn't what you want.

A: Maybe you might also want to pass the parameter "v"?
t->f = blah; // BAD

t->f = blah (SOMETHING); // Better...


text:
Q: How do you do a load test for a Shopify app? I have a technical question regarding Shopify app load testing. My app adds an alternate product page to different stores and there is an api endpoint used by the end customers.
How do you do load testing to see how many customers can be served?
How do you simulate the loads generated by different stores?
I was trying to use apache benchmark but I can only test a store with it. Also, I don't have many test stores. Let's say there are several hundred stores using my app now. I just can't create so many stores

A: I am asking a similar question to this for myself. I used this in-dept guide to help me select the right tool, and I ended up going for Locust.io as my Shopify app is implemented in Python and I felt keeping all my tools in the same code base has some value (and also it seems like a really good tool for the purpose).
To answer your question about multiple stores, you will have to generate dummy test stores in your app's database (stores that don't exist in Shopify but does exist in your database). Then you script your load test to access those stores.
For example if your app has 3 endpoints; GET /alternate_product_page, POST  /alternate_product_page and GET /some_resource, then you would set up a HttpUser class in Locust that exercises those endpoints as per normal usage, then start locust with that test load for each store id in your database.
The thing I have not figured out yet is how I can spoof authentication towards shopify during testing. I guess we will have to simply disable authentication altogether during testing.


text:
Q: Как оптимизировать сет в буферный массив? Есть вопрос по оптимизации кода.
Цель понять как уменьшить объем кода в Example 1, без значительного уменьшения  производительности.
Branchmark
Setup:
let data1={line:new Float32Array(50000)}
let data2={line:new Float32Array(50000)}

function setBuffer(name, figure_num, data_p){

  let num = 5 * figure_num
  let buffer_array = data1[name]
  for (let i = 0, l = data_p.length; i < l; i++) {
    buffer_array[num + i] = data_p[i];
  }
}

Example 1:
let pt1=[1,2]
let pt2=[3,4]
let status=5
for(let i=0;i<10000;i++){
  let buffer_array = data2['line']
  let num = 5*i;
  buffer_array[num+0] = pt1[0];
  buffer_array[num+1] = pt1[1];
  buffer_array[num+2] = pt2[0];
  buffer_array[num+3] = pt2[1];
  buffer_array[num+4] = status;

}

Example 2:
let pt1=[1,2]
let pt2=[3,4]
let status=5

for(let i=0;i<10000;i++){
  setBuffer('line', i, [pt1[0],pt1[1],pt2[0],pt2[1],status])
}

A:

let pt1=[1,2]
let pt2=[3,4]
let status=5
let N = 5; // 10000
const data2 = {
 line: new Float32Array(5*N),
};
for(let i=0;i<N;i++){
  data2.line.set([pt1[0],pt1[1],pt2[0],pt2[1],status], 5 * i);
}
console.log(data2)

Хотя, при записи сэмпла в 5 элементов TypedArray.set вряд ли что-то выиграет у прямого доступа)
Мне кажется, если это стало действительно узким местом в вашем приложении, стоит посмотреть на какой-нибудь WebAssembly или, если дело происходит не в браузере, то на другой высокопроизводительный инструмент =)


text:
Q: Why sometimes order of return value by a function varies in python? I wrote a simple function to retrieve three outputs from a string. When I want to use the returned value in other functions the order changes.
For example:
def parsetrack2(trackstr):

    cardnumber, date = trackstr.split('=')
    expiryyear = date[0:2]
    expirymonth = date[2:4]

    return{cardnumber,expiryyear,expirymonth}

When I want to pass the cardnumber and expiryyear to another function, sometimes order changes and other times it is right? Why is that?
How should I change it to prevent that variation?

A: That happens because you are returning a dictionaire instead of a list / tuple. (dicts do not save the order of the elements, while lists / tuples does)
Just change the :
return{cardnumber,epxiryyear,epxirymonth}

to:
return(cardnumber,epxiryyear,epxirymonth)

Then the result order will remain the same.

A: This:
{item_1, item_2, ...}

is actually a set literal (not a dict). A set is an unordered collection of items with no repeats. Therefore, the order of the items returned is random. Instead do this
def func():
    return 1, 2, 3

>>> a, b, c = func()
>>> a
1
>>> b
2
>>> c
3


text:
Q: How to configure WCF with transport security behind a load balancer I have a WCF service that will be configured to use transport security with a certificate. The service will sit behind a load balancer (F5).
The service certificate will be installed on the load balancer which will terminate the SSL session. I understand how to configure this---my question is whether or not I will be able to authenticate the client using the client certificate. Is this possible, or do I have to choose between client certificate authentication or load balancing?


text:
Q: Continuity of a nonlinear operator on fractional-order Sobolev spaces Let $N\colon \mathrm{H}^s(\mathbb{R}) \to (\mathrm{H}^s(\mathbb{R}))^*$, where $s > \frac{1}{2}$, be an operator given by $N(u) = \langle u^p, \cdot \rangle_{\mathrm{L}^2(\mathbb{R})}$ for a fixed integer $p \geq 2$. Recall that $\mathrm{H}^s(\mathbb{R}) = \big \{f \in L^2(\mathbb{R}) : \xi \mapsto\left(1+ |\xi|^2 \right )^{\frac{s}{2}}\mathscr{F}f(\xi) \in L^2(\mathbb{R}) \big \}$.
(Note: $N$ is well-defined by the fractional-order Sobolev embedding theorem: $\mathrm{H}^s(\mathbb{R}) \hookrightarrow \mathrm{BC}(\mathbb{R})$ for $s > \frac{1}{2}$, where $\mathrm{BC}(\mathbb{R})$ is the space of bounded and continuous functions $\mathbb{R} \to \mathbb{C}$.)
Is $N$ continuous on $\mathrm{H}^s(\mathbb{R})$ or continuous when restricted to some open ball $B_R(0) \subset \mathrm{H}^s(\mathbb{R})$?
I suspect some results on composition operators on Sobolev spaces might be useful, but have not found an applicable version.

A: You are essentially asking whether the map $u\mapsto u^p$ is continuous from $H^s$ to $H^s$. Yes, it is. For $s>1/2$ the Sobolev space $H^s(\mathbb{R})$ is an algebra:
$$
\|u v\|_s \le C\|u\|_s\|v\|_s
$$
This implies that the multiplication map $(u,v)\mapsto uv$ is continuous, since on every ball it is  Lipschitz in each argument separately.
For $p\ge 2$, the multiplication map $(u_1,\dots,u_p)\mapsto u_1\cdots u_p$  is continuous from $H^s\times\cdots\times H^s$ to $H^s$, because it can be written as the composition of $p-1$ binary multiplications.  Restricting to the diagonal $u_1=\cdots u_p$ shows that $u\mapsto u^p$ is continuous.


text:
Q: What will be the output, if we print a string that contains "%s" in it? I'd like to know what the result would be if we print a string that contains "%s" in its content?
I tried printing it as "hi%s".
char *ptr="hi%s";
printf(ptr);

I expected the output to be as "hi".
but i got it as "hi hi%s".

"hi hi%s"

A: Your program invokes undefined behaviour.
Your code is equivalent to
 printf("hi%s");

where %s is a conversion specifier and it expects an argument to be supplied.
Quoting C11, chapter §7.21.6.1

[...] If there are insufficient arguments for the format, the behavior is
  undefined. [....]

Suggestion: If you just have to print a string, without a need of any conversion (formatting), you can use puts().

A: You're not "printing a string which has %s in its content". You're passing such a string as the format string to printf, and by doing so without a matching argument for the format field, your program has undefined behavior. The first argument to printf is not a string you want to print. It's a format string that controls how the remaining arguments are interpreted/converted, and which can also contain literal text to merge them into.
"Printing a string which has %s in its content" (where ptr points to that string, as in your question) can be accomplished by printf("%s", ptr) or puts(ptr).

A: There will be undefined behavior.:)
This part of the string literal %s is considered by the function as a format specifier.
From the C Standard (7.21.6.1 The fprintf function)

*... If there are insufficient arguments for the format, the behavior is
  undefined.

If you want to output the string "hi%s" as is you should define the literal like "hi%%s".
Here is a demonstrative program
#include <stdio.h>

int main(void)
{
    char *ptr = "hi%%s";

    printf( ptr );

    return 0;
}

Its output is
hi%s

A: As specified in other answered, a undefined behavior will occur.
What the undefined behavior means in this context:
 When printf receives a string with n number of format specifiers (such as %s) it is going to expect n number of parameters to be passed to the function in addition to the string. So, when you have a statement like this printf("hi%s"), the function will behave as if you passed a parameter (in this case the second parameter should be a char *) even though there is not. The function is just going to get the next value on the stack which is some junk value in this case. Then the function will deference this junk value and will treat it as a buffer of characters. The reasons why this behavour is undefined is there is no telling what the junk value on the stack could be.
Possible Outcomes

*

*The junk value on the stack is 0 -> Segmentation fault when junk value is dereferenced.

*The junk value on the stack happens to be a valid memory address ->  The bytes at the memory location will keep getting inserted into the string (appended to "hi" in this case) until either a byte of value 0 is encountered or a segmentation fault occurs.

*The junk value on the stack is not 0 but is not a valid memory location -> Segmentation fault when junk value is dereferenced.

Producing the same situation
The below portion of code is a very similar situation to printf("hi%s")
void foo() {
   char * myJunkValue;  // Since not a global/static variable, this is not guaranteed to be 0
   printf(myJunkValue); // Undefined behavior
}

A: As other answered have mentioned, what you're doing invokes undefined behavior because you're calling printf without enough arguments for the given format specifier.  In your case you got junk output, but your program could have just as easily crashed.
To expand on this, code that looks like this:
printf(ptr);

Is almost always wrong.  If the string that ptr points to can be controlled by the user in any way, you open yourself up to a format string vulnerability.  The user could supply a specially crafted string using %s, %x, etc. that could dump the contents of memory and expose sensitive data, or a string using %n that could write to memory and allow an attacker to take over your program.
Many static analyzers will throw a warning if the first argument to printf is not a string constant for this reason.


text:
Q: Cannot save property group to product in django-lfs I already create properties and add them to property group.Then I assign to my new product.But django show me
TypeError at /manage/update-product-properties/1
save() got an unexpected keyword argument 'using'

A: Yeah, as you point out in your comment to your OP, the problem went away by using a different version of Django. using is part of the machinery for multi-database support in Django 1.2


text:
Q: Outlook Event Edit and save option click- event handler to trigger in my add-ins In outlook event Edit - save option click ,i want to trigger this event in my outlook add-ins , any specific event handler is available for this save option click
I want this trigger for edited event data for updating this in salesforce , so i want this trigger on click the save button
In this case attendee and date and time  edit triggers available but , In this some case user after the edit may be discard the edit ,so i am unable to use this event handlers
I want this trigger on save button click
Any thoughts about this please share
Note : My outlook add-ins developed using javascript language
Thanks in Advance
Attached screenshot here

A: There is no UI-less function or event for that. Event based activation is described in the Configure your Outlook add-in for event-based activation article.


text:
Q: how to create custome actionbar for an activity working on application in which i need a custom action bar try appcompat_v7 also
but did not work for me any idea.
my code is
private class ExampleAction extends AbstractAction {

        public ExampleAction() {
            super(R.drawable.ic_title_export_default);
        }

        @Override
        public void performAction(View view) {
            Toast.makeText(OtherActivity.this, "Example action",
                    Toast.LENGTH_SHORT).show();
        }

    }
    //use for signle action how to use for multiactions

how to call to call actionbar for any view

A: This question is already solve and same like this try this link hope it help you
private class ExampleAction extends AbstractAction {

        public ExampleAction() {
            super(R.drawable.ic_title_export_default);
        }

        @Override
        public void performAction(View view) {
            Toast.makeText(OtherActivity.this, "Example action",
                    Toast.LENGTH_SHORT).show();
        }

    }
    //use for signle action how to use for multiactions
       ActionBar actionBar = (ActionBar) findViewById(R.id.actionbar);
       actionBar.addAction(new ExampleAction());

A: I think you need to go with Android's Toolbar which is replacement of ActionBar introduced in Android 5.0 and it also has backward compatibility. Check below links.
https://developer.android.com/reference/android/widget/Toolbar.html
http://javatechig.com/android/android-lollipop-toolbar-example
http://blog.xamarin.com/android-tips-hello-material-design-v7-appcompat/

A: You can design custom actionBar like this:
ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#2B1C27")));

    LayoutInflater inflater = LayoutInflater.from(this);
    View v = inflater.inflate(R.layout.titleview_2, null);

    TextView actionbar_title = (TextView)v.findViewById(R.id.actionbar_title);
    actionbar_title.setTypeface(youcanset your font here also.);

    actionBar.setCustomView(v);

and in xml file try something like this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:id="@+id/actionBar"
android:paddingTop="7dp"
android:orientation="horizontal"
android:background="#9B66AB">

<TextView
    android:id="@+id/actionbar_title"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal|center_vertical"
    android:gravity="center_horizontal|center_vertical"
    android:padding="8dp"
    android:text="@string/appTitle"
    android:textSize="20sp"
    android:textColor="#FFFFFF"
    android:layout_centerVertical="true"
    android:layout_toEndOf="@+id/imageView"
    android:layout_toRightOf="@+id/imageView" />

<ImageView
    android:layout_width="40dp"
    android:layout_height="wrap_content"
    android:id="@+id/imageView"
    android:background="@mipmap/logo"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_alignBottom="@+id/actionbar_title" />

Hope it helps ... :)

A: I will suggest you to Use toolbar to customize Action bar, have a look at these links.
this tutorial 1 tutorial 2
and here is a simple Project


text:
Q: How to migrate app.config settings used by an MSTest project to .NET 5 I'm migrating an ASP.NET Web API solution that uses the .NET Framework 4.6.1 to ASP.NET Core 5 / .NET Framework 5. Besides the Web API project there is an MSTest based testing project that shares the connection string information with the Web API project. This looks as follows:
The Web API project has a Web.config file containing the following code:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <connectionStrings configSource="bin\ConnectionInfo.config" />
  ...
</configuration>

The MSTest based project has an App.config file containing the following code:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
  </startup>
  <connectionStrings configSource="ConnectionInfo.config"/>
</configuration>

Hence, both of the above files reference ConnectionInfo.config which contains the actual connection string and looks as follows:
<connectionStrings>
  <add name="MyConnectionString" connectionString="the connection string" />
</connectionStrings>

That setup ensures that I have a single point where I need to change the connection string to point the application to another database.
Eventually, I retrieve the connection string in the test database and pass it to my DatabaseManager which provides functionality to create and reset the database:
string connectionString = ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString;
_databaseManager = new DatabaseManager(connectionString);

Now, after migrating the Web API project to ASP.NET Core 5 the Web.config is replaced with an appsettings.json file. There's one such file for every environment and each contains the connection string for that environment.
Is there a way to share the corresponding connection string with the test project somehow? I don't want to load the appsettings.json manually in that project but hope for a built-in mechanism. Is there anything that might help?

A: You can use the existing app.config to hold connection string like those in .NET Framework in .NET 5.0 by adding nuget package of System.Configuration.ConfigurationManager to the unit test project, and use the ConfigurationManager.ConnectionStrings as before in .NET Framework.
The latest stable version is v5.0.0.
See also the nuget page https://www.nuget.org/packages/System.Configuration.ConfigurationManager/5.0.0
and the docs:
https://learn.microsoft.com/en-us/dotnet/api/system.configuration.configurationmanager.connectionstrings?view=windowsdesktop-5.0
One thing is to be sure, the System.Configuration.ConfigurationManager nuget package is mostly Windows specific, and in the docs it is included as part of "Windows Desktop" of .NET 5.0, not the full cross platform of .NET 5.0.

A: In order to read the connection string stored in the main project's appsettings.json from the test project I added the NuGet package Microsoft.Extensions.Configuration.Json to it.
Then, I ensured that the appsettings.json file is copied to the output directory by the main project which can be done as follows in the .csproj file:
<ItemGroup>
  <None Include="appsettings.Development.json">
    <CopyToOutputDirectory>Always</CopyToOutputDirectory>
  </None>
  <None Include="appsettings.json">
    <CopyToOutputDirectory>Always</CopyToOutputDirectory>
  </None>
</ItemGroup>

Finally, in the test project I obtain the connection string by reading the appsettings.json file as follows:
protected static readonly string _connectionString = new ConfigurationBuilder()
  .SetBasePath(AppContext.BaseDirectory)
  .AddJsonFile("appsettings.json", false, true)
  .Build()
  .GetConnectionString("ConnectionStringKeyName");