text:
Q: Modal dialog with dropdown list is not fading out right away after dismissal I've got an angular app and I integrated it with UI Bootstrap project. I'm using regular
The modal dialog with dropdown containing 750 records, when one of the items is selected and clicked "Ok" or "Cancel", the modal and the overlay fades out without any delay.
Here's the plunker:Modal dialog with 750 records
If the modal dialog with dropdown containing around 10k+ records, and one of the items is selected from the list. Clicking "Ok" or "Cancel" is not hiding the modal dialog right away, instead I'm having a 8-10 second delay on Chrome, I've not tested on IE yet.
Here's the plunker:Modal dialog with 10k+ records
Question: Why I'm having performance hit with more data?

A: You are slowing the whole entire browser down by grabbing the DOM by the neck and pouring 10,000 <option> nodes down its throat. You need to lazy load your data somehow. Ever noticed on sites like Twitter, Facebook, and others that when you scroll to the bottom of the page it will begin loading more records from the server? Good apps will start to garbage collect old records that have been scrolled up as well.
When you scroll through your Facebook news feed it's not loading all your friends post since 2007 into the browser all at the same time. Once a maximum number of posts exists in the DOM Facebook will start removing the oldest ones you scrolled up to make room for more and grab fresh posts from the server so you can continue scrolling. You can even see your browser scroll bar jump up as you scroll down because more posts are being added to the DOM.
No browser is going to be able to handle that much data. The browser is not a database. I'm amazed your plunker with 10k records is as performant as it is! Haha. A dropdown is not what you want to display that data. You're going to have to sit down and think of a better way to show that data to the user. My first thought is to provide a filterable list that initially contains the top 25 most selected options or something, then typing in a search field causes it to load a new list from the server that matches the search criteria. Only you will know what your users will actually want, but I assure you it's not a dropdown list with 10k+ options.
Example:

Notice how the browser scroll bar jumps up a bit when it gets to the bottom. Twitter gets to the bottom and then loads more data to scroll through. It will eventually start cleaning up data at the top of the page as well if I scroll far enough.
Modern browsers can handle a lot, but 10,000+ <option> nodes is pushing it overboard.

A: The browser can handle a large number of values in a dropdown list, but a dropdown list isn't meant for such a task. Not to mention the users will have a hard time selecting an appropriate value, even if you sort them alphabetically.
You would be much better off using an input text box instead of a dropdown.
jQueryUI has some nice autocomplete features that would improve not only the performance of your web application, but also make the user experience much more bearable. I would any day prefer to type out one of the 10,000 options provided to me than search for them in a dropdown using a mouse and select them.
Here's an example on jsfiddle with ~8.5k records for a performance test.

A: Let me quickly tell you few points:

*

*It is a usability bug to scroll through 10K records. Consider someone going through 10K options and selecting the one which they want. Not a good idea.

*Performance issue:

*

*If the options were rendered from a back-end in a traditional way (non-Angular way) then it would just take time to load but after that the performance won't be such an issue.

*Since, you are using AngularJS with ng-options, the options are populated in the front-end and you have all the data in Angular's scope. To perform, two-way binding, Angular always does a dirty-checking in each 'digest cycle' which loops through each and every data element in $scope and causes that delay.

Solution:

*

*Use Select2's "Loading Remote Data". Select2 is a jQuery based replacement for select boxes.

*Consider using the AngularUI's Select2 wrapper instead of directly using it.


text:
Q: webview not scrolling automatically in android In my webview app one of the webpage contains elements at the center position only.In order to make the webpage compatible to mobile display I need  the center part to fill the display by zooming.I used setInitialScale() and scrollTo() functions .But I am not getting what i need. please help me.The zooming is working .But it is not scrolling to the center part.It remains in the top-left that is blank space only.
AdminActivity.java
package com.example.admin;

import android.os.Bundle;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.graphics.Color;
import android.webkit.WebSettings.ZoomDensity;
import android.webkit.WebView;
import android.webkit.WebViewClient;

@SuppressWarnings("deprecation")
public class AdminActivity extends Activity {

private WebView webView;

@SuppressLint("SetJavaScriptEnabled")
@Override
public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_admin);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

        webView = (WebView)findViewById(R.id.webView4);
        webView.requestFocusFromTouch();

        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setUseWideViewPort(true);
        webView.getSettings().setLoadWithOverviewMode(true);
        webView.getSettings().setBuiltInZoomControls(true);

        webView.loadUrl("http://app.samworkshops.org/PasswordProtect.aspx");

        webView.setWebViewClient(new WebViewClient() {

            @Override
            public void onPageFinished(WebView view, String url) {

                webView.scrollTo(100,100);
                webView.setInitialScale(100);
            }

        });
    }

}

activity_admin.xml
<?xml version="1.0" encoding="utf-8"?>
<WebView  xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/webView4"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:windowSoftInputMode="adjustResize"
/>

A: WebView v = (WebView) findViewById(R.id.webview);
v.setVerticalScrollBarEnabled(true);
v.setHorizontalScrollBarEnabled(true);
That's it!

A: package com.example.admin;

import android.os.Bundle;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.graphics.Color;
import android.webkit.WebSettings.ZoomDensity;
import android.webkit.WebView;
import android.webkit.WebViewClient;

@SuppressWarnings("deprecation")
public class AdminActivity extends Activity {

private WebView webView;

@SuppressLint("SetJavaScriptEnabled")
@Override
public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_admin);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

        webView = (WebView)findViewById(R.id.webView4);
   // for scrollabale webview
        webView.setVerticalScrollBarEnabled(true);
        webView.setHorizontalScrollBarEnabled(true);
        webView.requestFocusFromTouch();

        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setUseWideViewPort(true);
        webView.getSettings().setLoadWithOverviewMode(true);
        webView.getSettings().setBuiltInZoomControls(true);

        webView.loadUrl("http://app.samworkshops.org/PasswordProtect.aspx");

        webView.setWebViewClient(new WebViewClient() {

            @Override
            public void onPageFinished(WebView view, String url) {

                webView.scrollTo(100,100);
                webView.setInitialScale(100);
            }

        });
    }

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to fit long text in a button? My button is fixed size height. I need it to be like the text on the left on my picture below. Now it's like on the right. I've tried every gravity option but no result. Is there a way to accomplish this?
http://i.imgur.com/blDVA1D.jpg

A: If wrap_content as height doesn't match your needs you probarbly have to change the textsize. Also singleLine = false might help...
Also android Button comes with a default padding so you should set i to 0.


text:
Q: Windows batch file to crop images in folder I have a lot of images in a folder. I want to crop all the images at specific coordinates and save the converted folder to sub-folder with the name of the file suffixed with crop. I am using ImageMagick command line option convert to crop single file with the help of below given command:
"C:\Program Files\ImageMagick-7.0.8-Q16\magick" convert -crop 60x40+525+240 "C:\temp\rose.png" "C:\temp\temp\rose-crop.png"

I want to do the same process for every file present in that folder and the converted file should follow the same naming convention. I tried this:
for /r %%i in (*) do "C:\Program Files\ImageMagick-7.0.8-Q16\magick" convert -crop 60x40+525+240 %%i %%i

But it is overriding the existing images. How can I achieve the desired result?

A: You can process a whole folder of images using the magick mogrify command in ImageMagick 7. Create a new empty folder for the output (or backup your input). Cd to the directory with your images, then
magick mogrify -path path_to/new_folder -format png -crop 60x40+525+240 +repage *.png

That will crop every png image in your current directory and place the cropped results in the new_folder directory. See https://imagemagick.org/Usage/basics/#mogrify
Supply your path for my placeholder path_to. Change to using Windows paths with \ rather than my unix syntax of /


text:
Q: Xcode 6.1.1 import localisations error "XLIFF id attribute missing" I recently exported XLIFF files using Xcode's Export for localisation tool. The files were translated and I then tried to import them but I keep getting the error "XLIFF id attribute missing". I thought maybe one of the translators messed up the file so as a test I re-exported the XLIFF file and tried to import them without making any changes to them and still got the error "XLIFF id attribute missing".
Any ideas whats going on here?

A: For me, this was related to this question: Xcode 6 localization. export .xliff file will cut the string when the string is like "this is sample \"text\""
My string file looked like this:
"some english \"text\"" = "some english \"text\""
Exported in the XLIFF, it looked like this:
<trans-unit id="">
    <target>some english \</target>
    <source>some english \</target>
    <note></note>
</trans-unit>

My translators faithfully translated it: (simulated)
<trans-unit id="">
    <target>some english \</target>
    <source>xyz abcdefg \</source>
    <note></note>
</trans-unit>

Upon attempting to import the translated XLIFF, I received the XLIFF id attribute missing error.
To fix this, I went into my strings file and changed the entry to this:
"some english 'text'" = "some english 'text'"
and the xliff...
<trans-unit id="some english 'text'">
    <target>some english 'text'</target>
    <source>xyz abcdefg</source>
    <note></note>
</trans-unit>

...and then imported, and it worked.  Obviously at this point the translation for that one string is wrong and needs to be redone, but at least the rest of the text imported.

Edit:
I've been looking for a solution to this.  I found that using curly quotes does export correctly, so the string: some english "text" produces the xliff:
<trans-unit id="some english "text"">
    <source>some english "text"</source>
</trans-unit>

That's the only way I know of to do this, currently.


text:
Q: Avoid dangling reference for reverse range-based for-loop implementation Background and Previous Search
I'm looking for an elegant way to reverse-iterate over a container (e.g. std::vector) using a range-based for-loop in C++14. Searching for a solution I found this Q/A. It basically tells me, that this is not part of the standard library and I have to use boost or implement an adapter myself. I don't want to use boost, so I'm looking for the best own implementation now.
Besides the proposals given in previously mentioned Q/A, I also found this implementation and this blog regarding this topic. Most of the implementations are quite similar and seem quite decent. However they all have a pitfall: As pointed out in this comment you might end up with a dangling reference if you call the reverse-adapter with a temporary object:
for (const auto& v : reverse_iterate(getContainer()))

Regarding the problem with a temporary object in range-based for-loop, this answer really helped my understanding. But what can we do to prevent a dangling reference?
My Solution
Based on this background I'm searching for an implementation that get's rid of this pitfall. In the following implementation I'm using an additional rvalue-reference rx_ to prolong the lifetime of my input parameter iff reverse_iterate is called with rvalue reference.
EDIT: Do not use this solution. It is wrong as pointed out in accepted solution.
template <typename T>
class reverse_range
{
  T &&rx_; // rvalue-reference to prolong livetime of temporary object
  T &x_; // reference to container

public:
  explicit reverse_range(T &x) : rx_(T{}), x_(x) {}
  explicit reverse_range(T &&rx) : rx_(std::move(rx)), x_(rx_) {}

  auto begin() const -> decltype(this->x_.rbegin())
  {
    return x_.rbegin();
  }
  auto end() const -> decltype(this->x_.rend())
  {
    return x_.rend();
  }
};

template <typename T>
reverse_range<T> reverse_iterate(T &x)
{
  return reverse_range<T>(x);
}
template <typename T>
reverse_range<T> reverse_iterate(T &&rx)
{
  return reverse_range<T>(std::move(rx));
}

Obviously we generate a little overhead of constructing an unused empty container object in the lvalue constructor, but I think that's not too bad. Besides one could probably get rid of this by providing two classes reverse_range_lvalue and reverse_range_rvalue, which each provide the implementation for one of the parameter types...
Questions
Would the above extension solve the dangling reference problem or do I miss something?
Do you have any hints on further problems regarding my code?
Are there better ideas to solve this problem in C++14 or any other (future) version?

A: That doesn't work.  Lifetime extension doesn't work in (that part of) constructors.  (It works in the body of the constructor, just not in the member initializer list).
template<class R>
struct backwards_t {
  R r;
  constexpr auto begin() const { using std::rbegin; return rbegin(r); }
  constexpr auto begin() { using std::rbegin; return rbegin(r); }
  constexpr auto end() const { using std::rend; return rend(r); }
  constexpr auto end() { using std::rend; return rend(r); }
};
// Do NOT, I repeat do NOT change this to `backwards_t<std::decay_t<R>>.
// This code is using forwarding references in a clever way.
template<class R>
constexpr backwards_t<R> backwards( R&& r ) { return {std::forward<R>(r)}; }

this does a move when passed an rvalue, and keeps a reference when passed an lvalue.
The trick is that for a forwarding reference T&&, if T&& is an lvalue then T is a reference, and if T&& is an rvalue then T is a value.  So we convert lvalues to references (and don't make a copy) while converting rvalues to values (and move the rvalue into said value).
for (const auto& v : backwards(getContainer()))

so that works.
In c++17 you can do a bit "better"; reference lifetime extension can apply to the content of structs if you do aggregate initialization.  But I'd advise against it; reference lifetime extension is fragile and dangerous when it breaks.
There is talk in c++20 or later to permit compilers to convert moves into expiring objects into elisions.  But I wouldn't bet on it working in an specific case.  I also think I saw a paper about marking up ctors and functions with their lifetime dependency information (ie, that the return value depends on the lifetime of an argument), permitting warnings/errors and maybe more generalized lifetime extension.
So this is a known problem.  But this is the best generally safe-ish way to solve this today.


text:
Q: How to tell whether a checkbox is checked? As most people know there are at least two (easy) ways to findout if a checkbox is checked.
($('#checkbox:checked').val() != undefined) OR ($('#checkbox').val() == 'on')
Which of these two methods is best? why?

A: I think that
$('#checkbox').is(':checked');

is the way to go.

A: If you're accessing the raw element, you should be able to use something like:
this.checked

But I don't know if there might be any cross-browser compatibility issues with this method.

A: Another way
if ($('#myCheckbox').attr("checked")) { .. }

Anyways...I don't think any one of these is necessarily better or worse. jQuery is designed to work across browsers so any one of them should work.  Not sure anybody has taken the time to actually benchmark them for performance or anything...just do what you feel is most readable to you.


text:
Q: Which process is responsible for managing process management? I was learning process management concept in operating system. Before that i came to know that processor can run one process at a time and to handle multiple processes we have process management.
At the very basic level process is just instance of program (code) and process management program is also code. Hence process management is itself a process.
So how come this process of process management program run along with other processes.
Note : I am assuming that CPU can only run single process at a time


text:
Q: What xp gains are affected by shrine of enlightenment? Does the shrine of enlightenment increase the xp gained from:

*

*+xp per kill items

*xp from bonuses (massacre, destruction etc.)

*xp from finishing quests

in addition to increasing the xp from kills made by my character?

A: After a little bit of research, the solution didn't turn out as I expected. First, here is how I tested it:

*

*For Quest-XP, I simply did the "Waiting for reinforcements" quest twice, on Nightmare Difficulty.

*For +XP per kill items, I rounded up Blood Clan Warriors with and without enlightement, as well as with and without +XP gear equipped

*For Massacre bonuses (I'm assuming that this is representative of other bonuses as well), I killed five Herald of Pestilence monsters and five Blood Clan Warriors with, and without enlightenment, as well as with, and without +XP gear two times to see the outcome.

The findings:

*

*None of the three things you listed had were influenced by +Enlightenment
This was weird. I was assuming that bonuses are not influenced, and that quests are not influenced, which turned out to be true. However, I assumed that +XP on items would influence it, but it did not. Specifically, the base XP I got on average from Blood Clan Warriors was exactly the same with and without +XP gear and Enlightenment on, meaning that it was the overall XP I got - the amount of +XP I got through my gear.
This means that the bonus XP seems to be calculated as:
totalXP = BaseXP + BaseXP * 0.25 + ItemXP
I think the reason they don't include Item bonus XP in the baseXP is that it would probably offer too much of an XP boost with high-level +experience helmet and gems on items, however this is speculation and something that only Blizzard can answer..


text: Q: What is the name of the circle theorem stating that any three non-colinear points define a unique circle? Can anyone tell if there is a name for the circle theorem which states that any three non-colinear points define a unique circle? Or how may I reference such statement. Perhaps I am too thorough about this?!


text:
Q: Error: Archive file cannot be size 0. FileFormatException Unhandled I was trying to insert a new slide into my presentation by following the https://msdn.microsoft.com/EN-US/library/office/cc850834.aspx
It throws me the error: Archive file cannot be size 0
My code:
string presentationFile=@"C:\Users\SS\Desktop\TestPresentation6.pptx";
public static void InsertNewSlide(string presentationFile, int position, string slideTitle)
{
    using (PresentationDocument presentationDocument = PresentationDocument.Open(presentationFile, true))
    {
       // Pass the source document and the position and title of the slide to be inserted to the next method.
       InsertNewSlide(presentationDocument, position, slideTitle);
    }
}

Am using open XML SDK 2.5. Could anyone help me in understanding what is this error indicates. I could not find any useful solution. Anybody had faced the same issue?
Appreciate your time!!
Thanks!!!


text:
Q: SVN Workingcopy over NFS Is there a way to boost svn performance when the working copy is running over NFS?
(*) It is required for it to be and the NFS mounted partition (/home).
I guess SVN client reads the whole tree looking for changes when commiting. I don't have an idea of what can make a checkout slow.

A: According to the Subversion FAQ:

Working copies can be stored on NFS (one common scenario is when your home directory is on a NFS server). On Linux NFS servers, due to the volume of renames used internally in Subversion when checking out files, some users have reported that 'subtree checking' should be disabled (it's enabled by default). Please see NFS Howto Server Guide and exports(5) for more information on how to disable subtree checking.

Checkout performance can be constrained by a few factors, but most likely in your case it's I/O to that NFS mount - unless you're saturating the network connection, or the server is undersized.

A: Use "nolock" option to mount. It is actually OS local lock, not NFS server side lock.
I got better performance from this option.

A: Checkout performance over NFS is abysmal, to the point that it becomes the major bottleneck, not the bandwidth to the Subversion server. rsvn by Bryce Denney and Wilson Snyder is a perl script that logs into the NFS server using ssh (assuming that is allowed) and runs the svn command remotely. In my tests it gives orders of magnitude faster performance. Excerpt from the man page:

NAME
rsvn - remote svn - run subversion commands on the file server if possible
SYNOPSIS
rsvn ANY_SVN_COMMAND
    rsvn update
    rsvn --test
DESCRIPTION
When possible, run the svn command on the file server where it does not have to wait for NFS. Otherwise run svn as usual. Some SVN commands will always run locally, either for "safety" or because there is no benefit of running on the file server (svn log).
The commands that will be sent to the file server by default are these (and their abbreviations):
add checkout cleanup diff merge resolved
revert status switch update

Why is commit not run remotely? Because it will either start an editor, which won't always work through noninteractive SSH, or you might use -m "FOO BAR" and the shell's quoting gets all screwed up. It would be good to figure out how to solve these problems, and add "commit" to the list.


text:
Q: How to use delegate in React Native? Is there a way of delegating in react native just like in swift/ios.. If we want to pass a information to a child class from parent class, we can do it by passing props. But what if we want to pass some information from the child class to parent class.
PS: No Redux or singleton approach.

A: Callbacks are common in React and could be used for such a thing.
// Child.js
export default class Child extends Component {

    componentDidMount() {
        this.props.onEvent({ type : "event" });
    }

    render() {
        return (
            <Text>I'm a child</Text>
        );
    }
}

// Parent.js
export default class Parent extends Component {

    const onChildEvent = (event) => {
        console.log(event); // { type : "event" }
    }

    render() {
        return (
            <Child onEvent={this.onChildEvent} />
        );
    }
}


text:
Q: Tapping links in iOS Safari shows a thick white border around element - how to get rid of it? Problem
On my site I see this super strange behaviour on any kind of linked elements (text, images, svg elements, table cells): when long tapping them in Safari on iOS, a thick white border appears before showing the link preview.

What I have tried so far
As it's only showing on iOS, I am a bit limited with debugging it, unfortunately.
I have tried to fix it using the following most recommended solutions with link tap in iOS Safari, but neither of them does solve the issue:
html {
    -webkit-tap-highlight-color: transparent;
}
a, a:visited, a img {
    -webkit-background-clip: content-box;
}
input, textarea, button, select, label, a {
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  -webkit-tap-highlight-color: transparent;
}

Solution ideas?
Does anybody know, or has an idea, how I can get rid of this border - or at least also make it appear "transparent"?
Much appreciated!

A: RESOLVED: seems like the thick white border is not the border, but related to the background color of the element / linked element. And it is controllable through the :active state.
Fixed by adding this to my CSS:
a:active {
    background-color: transparent;
}

Solution inspired by the answer here: https://stackoverflow.com/a/12686281/5750030


text:
Q: Can I use a list (or similar) of multiple date ranges for pre and post periods? In the documentation (https://google.github.io/CausalImpact/CausalImpact.html) for CasualImpact there is an example of setting pre and post periods of the treatment:
pre.period <- as.Date(c("2014-01-01", "2014-03-11"))
post.period <- as.Date(c("2014-03-12", "2014-04-10"))

Can I use a staggered vector (or similar) series of dates instead?
For example, if I want to measure the impact of TV advertising (TV Spend) on web transactions over the course of a year and that TV is live for the full months (for simplicity) of April (1st - 30th), July (1st - 31st), September (1st - 30th)and December (1st - 30th).
Can I make my pre period for analysis something like:
pre.period <- list(
          as.Date(c("2016-04-01", "2016-04-30")),
          as.Date(c("2016-07-01", "2016-07-31")),
          as.Date(c("2016-09-01", "2016-09-30")),
          as.Date(c("2016-12-01", "2016-12-31"))
          )

And then post.period the inverse of this for the year 2016? If yes, how can I pass r causalimpact the pairs of date ranges for each instance of treatment (TV spend)?


text:
Q: arc.js installation in OpenLayers I have project developed in Angular 5 with Node.js . Now in my project I want to have flight animation connections and used the example of OpenLayers called 'Flight Animation'. The problem is that there is a library called 'arc.js' used in example which I could not import it. I installed the library using 'npm install --save arc' but still 'arc' is not recognized. My code is :

import { ElementRef, Injectable, OnInit } from '@angular/core';
    import { MatSnackBar } from '@angular/material';

    import Map from 'ol/map';
    import View from 'ol/view';
    import Proj from 'ol/proj';

//Layers
    import TileLayer from 'ol/layer/tile';
    import LayerVector from 'ol/layer/vector';
    import SourceVector from 'ol/source/vector';
    import GeoJSON from 'ol/format/GeoJSON';
    import Feature from 'ol/feature';

//Image WMS
    import Image from 'ol/layer/Image';
    import ImageWMS from 'ol/source/ImageWMS';
    import WMSGetFeatureInfo from 'ol/format/WMSGetFeatureInfo';
    import TileImage from 'ol/source/tileimage';

//Popup
    import Overlay from 'ol/Overlay';
    import arc from 'arc/arc.js';
//OpenLayers Styles
    import Style from 'ol/style/style';
    import Stroke from 'ol/style/stroke';
    import Fill from 'ol/style/fill';
    import Text from 'ol/style/text';
    import Circle from 'ol/style/circle';
    import Icon from 'ol/style/icon';

//Graphic Types
    import Geometry from 'ol/geom/geometry';
    import Point from 'ol/geom/point';
    import MultiPoint from 'ol/geom/multipoint';
    import MultiPolygon from 'ol/geom/multipolygon';
    import Extent from 'ol/extent';

//Cluster
    import Cluster from 'ol/source/cluster';

//HeatMap
    import Heatmap from 'ol/layer/Heatmap';
    import KML from 'ol/format/kml';

//BaseMaps
    import OSM from 'ol/source/OSM';
    import BingMaps from 'ol/source/BingMaps';

//OpenLayers Interaction
    import olInteraction from 'ol/interaction';
    import InteractionMouseWheelZoom from 'ol/interaction/mousewheelzoom';

//WKT
import Wkt from 'ol/format/wkt';

//Loading Strategy
    import loadingstrategy from 'ol/loadingstrategy';

//Animation
    import Easing from 'ol/easing';

    import LineString from 'ol/geom/linestring';

    import Stamen from 'ol/source/stamen';

//Control ?
    import Control from 'ol/control';
    import { LayersService } from '../layer-service/layers.service';
    import { environment } from '../../environments/environment';
    import { Http, URLSearchParams, Headers } from '@angular/http';
    import { headersToString } from 'selenium-webdriver/http';
    import { NavbarService } from '../navbar-service/navbar.service';
    import { LayerType } from '../enums/layer-type.enum';
    import { UtilService } from '../util-service/util.service';
    import { RequestService } from '../request-service/request.service';
    import { OverlayComponent } from '../overlay/overlay.component';
    lineAnimation(){

           var style = new Style({
             stroke: new Stroke({
        color: '#EAE911',
        width: 2
      })
    });

    var flightsSource;
    var addLater = function (feature, timeout) {
      window.setTimeout(function () {
        feature.set('start', new Date().getTime());
        flightsSource.addFeature(feature);
      }, timeout);
    };
    var pointsPerMs = 0.1;
    var animateFlights = function (event) {
      var vectorContext = event.vectorContext;
      var frameState = event.frameState;
      vectorContext.setStyle(style);
      var features = flightsSource.getFeatures();
      for (var i = 0; i < features.length; i++) {
        var feature = features[i];
        if (!feature.get('finished')) {
          // only draw the lines for which the animation has not finished yet
          var coords = feature.getGeometry().getCoordinates();
          var elapsedTime = frameState.time - feature.get('start');
          var elapsedPoints = elapsedTime * pointsPerMs;

          if (elapsedPoints >= coords.length) {
            feature.set('finished', true);
          }
          var maxIndex = Math.min(elapsedPoints, coords.length);
          var currentLine = new LineString(coords.slice(0, maxIndex));

          // directly draw the line with the vector context
          vectorContext.drawGeometry(currentLine);
        }
      }
      // tell OpenLayers to continue the animation
      this.Map.render();
    };
    flightsSource = new SourceVector({
      wrapX: false,
      attributions: 'Flight data by ' +
        'OpenFlights,',
      loader: function () {
        var url =
    'https://openlayers.org/en/v4.6.5/examples/data/openflights/flights.json';
        fetch(url).then(function (response) {
          return response.json();
        }).then(function (json) {
          var flightsData = json.flights;
          for (var i = 0; i < flightsData.length; i++) {
            var flight = flightsData[i];
            var from = flight[0];
            var to = flight[1];
            // create an arc circle between the two locations
            var arcGenerator = new arc.GreatCircle(
              { x: from[1], y: from[0] },
              { x: to[1], y: to[0] });

            var arcLine = arcGenerator.Arc(100, { offset: 10 });
            if (arcLine.geometries.length === 1) {
              var line = new LineString(arcLine.geometries[0].coords);
              line.transform(Proj.get('EPSG:4326'), Proj.get('EPSG:3857'));

              var feature = new Feature({
                geometry: line,
                finished: false
              });
              // add the feature with a delay so that the animation
              // for all features does not start at the same time
              addLater(feature, i * 50);
            }
          }
          this.Map.on('postcompose', animateFlights);
        });
      }
    });
    var flightsLayer = new LayerVector({
      source: flightsSource,
      style: function (feature) {
        // if the animation is still active for a feature, do not
        // render the feature with the layer style
        if (feature.get('finished')) {
          return style;
        } else {
          return null;
        }
      }
    });
    this.map.addLayer(flightsLayer);
    }

I get the error in 'var arcGenerator = new arc.GreatCircle('

A: You may want to "browserified" the bundle is was developped for Node.js and Browser support but not for import syntax.
git clone https://github.com/springmeyer/arc.js.git
cd arc.js
npm install
npm install browserify
./node_modules/.bin/browserify arc.js --standalone arc > arc-browserified.js

You can also use one of Turf packages e.g line-arc that does the same as "arc.js" and it works well with Webpack/import


text:
Q: Best way to animate in Java? I'm currently using an animation engine I designed that takes objects of type Drawable and adds them to a List.  Drawable is an interface that has one method:
public void draw(Graphics2D g2d);

The extending animation manager iterates through this list and calls the draw() method on every object, passing the Graphics2D object obtained from the Swing component.
This method seemed to work well at first, but as I feared, it seems to be unable to handle multiple objects in the long run.
With merely two Drawables registered, both drawing images on screen, I'm seeing a bit of flashing after 30-60 seconds.
Is there a way to optimize this method?  It currently calls upon the AWT thread (invokeLater) to handle all of the tasks.  Concurrent drawing isn't really an option as this nearly always causes issues in Swing/AWT, in large part due to the fact that Graphics isn't synchronized.
If this just simply is a bad way of animating, what is a better method when you have multiple objects that all need things rendered with their own specific variables cough game cough?
Any help would be appreciated.  Thanks!
EDIT:
I can't use repaint() beacuse my engine already calls the AWT thread to paint stuff.  If I call invokeLater from the AWT thread, the image never gets painted for some reason.
I should also add that I'm using a system of ticks and fps.  60 ticks @ 120 fps.
Each tick updates the game logic, while each frame render calls draw on the frame manager.
Is this a bad idea?  Should I just use FPS and not ticks?

A: I think it would be more appropriate to override paintComponent(Graphics g) and regularly call the repaint method on the JPanel or whatever you're drawing on with a Timer.  Your problems may be due to to you trying to draw and then Swing doing it's own draw.
public class Main {
public static void main(String[] args) {
    JFrame frame = new JFrame();
    JPanel panel = new JPanel() {
        public void paintComponent(Graphics g) {
            //draw here
        }
    };
    panel.setPreferredSize(800, 600);
    frame.add(panel);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true)

    new Timer(16, new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            panel.repaint();
        }
    }).start();
}
}


text:
Q: Tokenize with colon using std::tr1::regex I'm working on a quasi-SCPI command parser and I want to split a string based on colons, ignoring quoted strings. I want to get an empty string if there is no text between colons.
If I use this regex expression in EditPad Pro 7.2.2, it does exactly what I want.
(([^:\"']|\"[^\"]\"|'[^']')+)?
As an example, using this data string:
:foo:::bar:baz
I get 6 hits: [empty],foo,[empty],[empty],bar,baz
So far, so good. However, in my code, using std::tr1::regex, I'm getting 9 hits with the same data string. It seems like I'm getting an extra empty hit after each non-empty hit.
void RICommandState::InitRawCommandEnum(const std::string& full_command)
{
    // Split string by colons, but ignore text within quotes.
    static const std::tr1::regex split_by_colon("(([^:\"']|\"[^\"]*\"|'[^']*')+)?");

    raw_command_list.clear();
    raw_command_index = 0;

    DebugPrintf(ZONE_REMOTE, (TEXT("InitRawCommandEnum FULL '%S'"), full_command.c_str()));

    const std::tr1::sregex_token_iterator end;
    for (std::tr1::sregex_token_iterator it(full_command.begin(),
                                            full_command.end(),
                                            split_by_colon);
         it != end;
         it++)
    {
        raw_command_list.push_back(*it);
        const std::string temp(*it);
        DebugPrintf(ZONE_REMOTE, (TEXT("InitRawCommandEnum '%S'"), temp.c_str()));
    }

    DebugPrintf(ZONE_REMOTE, (TEXT("InitRawCommandEnum hits = %d"), raw_command_list.size()));
}

And here is my output:
InitRawCommandEnum FULL ':foo:::bar:baz'
InitRawCommandEnum ''
InitRawCommandEnum 'foo'
InitRawCommandEnum ''
InitRawCommandEnum ''
InitRawCommandEnum ''
InitRawCommandEnum 'bar'
InitRawCommandEnum ''
InitRawCommandEnum 'baz'
InitRawCommandEnum ''
InitRawCommandEnum hits = 9

The most important question is how can I get my regex search to yield one (and only one) hit for every token delimited by a colon? Is the problem with my search expression?
Or maybe I'm misinterpreting the results? Do the empty strings after the non-empty strings have a special meaning? If so, what? And if that's the case, then is the correct solution to simply ignore them?
As a side question, I'm deeply curious why my code is behaving differently than EditPad Pro. EditPad is a useful test environment for experimenting with regular expressions, and it would be nice to know what the gotchas are.
Thanks!

A: It's still not clear to me what the meaning of the empty strings are, but I was able to work around them by ignoring them. I track the position of the hits within the search string and only process results that are farther along in the string.
Here's my code, without modification. Note that my regex search expression is slightly different, but that's not critical to the answer.
void RICommandState::InitRawCommandEnum(const std::string& full_command)
{
    // Split string by colons, but ignore text within quotes.
    static const std::tr1::regex split_by_colon("(?:[^:\"']|\"[^\"]*\"|'[^']*')*");

    raw_command_list.clear();
    raw_command_index = 0;

    std::tr1::sregex_iterator::difference_type minPosition = 0;
    const std::tr1::sregex_iterator end;
    for (std::tr1::sregex_iterator it(full_command.begin(),
                                      full_command.end(),
                                      split_by_colon);
         it != end;
         it++)
    {
        if (it->position() >= minPosition)
        {
            raw_command_list.push_back(it->str());
            minPosition = it->position() + it->length() + 1;
        }
    }
}


text:
Q: How I Return sid1 sid2 PAIRS SQL The name of the table is Catlog
Catlog (sid, pid, cost)

sid,pid,cost= int
I need to return pairs of sid1 sid2  when sid1 > sid2  by cost
sid pid cost
1    1   555
2    2   222
3    3   333
4    4   444

result

sid1 sid2
1      4
2      1

A: You can do something like:
    SELECT c1.sid AS sid1, c2.sid AS sid2 FROM Catlog c1, Catlog c2...
But I don't have details to define the whole query (the link between c1 and c2). Please describe what is sid and what is pid (and cost). Which is primary key, etc.


text:
Q: Declaring a variable gives an error, makes me think there's something else I'm missing I have a function in C that compiles fine until I add another case to my switch statement and declare a variable.
Here's the function
void evaluate(int num_inputs) {
struct gate *ptr = gatehead;
while (ptr->next != NULL) {
    switch (ptr->kind) {
        case 0:
            if (get_input_value(ptr->params[0]) && get_input_value(ptr->params[1])) {
                write_to_output(true, ptr->output);
            } else {
                write_to_output(false, ptr->output);
            }
            break;
        case 1:
            if (get_input_value(ptr->params[0]) || get_input_value(ptr->params[1])) {
                write_to_output(true, ptr->output);
            } else {
                write_to_output(false, ptr->output);
            }
            break;
        case 2:
            if (!(get_input_value(ptr->params[0]) && get_input_value(ptr->params[1]))) {
                write_to_output(true, ptr->output);
            } else {
                write_to_output(false, ptr->output);
            }
            break;
        case 3:
            if (!(get_input_value(ptr->params[0])) && !(get_input_value(ptr->params[1]))) {
                write_to_output(true, ptr->output);
            } else {
                write_to_output(false, ptr->output);
            }
            break;
        case 4:
            if ((get_input_value(ptr->params[0]) || get_input_value(ptr->params[1])) && !(get_input_value(ptr->params[0]) && get_input_value(ptr->params[1]))) {
                write_to_output(true, ptr->output);
            } else {
                write_to_output(false, ptr->output);
            }
            break;
        case 5:
            if (get_input_value(ptr->params[0])) {
                write_to_output(false, ptr->output);
            } else {
                write_to_output(true, ptr->output);
            }
            break;
        case 6:
            if (get_input_value(ptr->params[0])) {
                write_to_output(true, ptr->output);
            } else {
                write_to_output(false, ptr->output);
            }
            break;
        case 7:
            char* d = "DECODER";
            printf("%s", d);
            break;
    }
    ptr = ptr->next;
}

}
If I comment out case 7, everything works fine. Even keeping the print and break compiles, but declaring the char* causes the error "expected expression"

A: The problem is that the case 7: label is immediately followed by a variable declaration.
    case 7:
        char* d = "DECODER";

A label can only be applied to a statement, and a declaration is not considered a statement.  You can get around this by adding an empty statement before the case label:
    case 7:
        ;
        char* d = "DECODER";


text:
Q: не могу сделать авторизацию с яндекс диском есть код пишет не авторизован

{"message":"Не авторизован.","description":"Unauthorized","error":"UnauthorizedError"}

делаю все следующим образом через curl

$curl = curl_init();
$authorization = "Authorization: Bearer AQAAAAAaQCuCAAQq1jq7m_Тwq0HJnUBAhzdZINg"; // не могу понять куда эту перемнную  подстваить
curl_setopt($curl, CURLOPT_URL, "https://cloud-api.yandex.net:443/v1/disk");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
echo $result;

или так но пишет тоже самое

<?php
$curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "https://cloud-api.yandex.net:443/v1/disk?access_token=AQAAAAAaQCuCAAQq1jq7m_Тwq0HJnUBAhzdZINg");добавляю токе curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($curl);//выполняется сам курл curl_close($curl); print $result;

A: сделал нужно использовать массив

<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
$curl = curl_init();
$headers = array(
    'Content-type: application/xml',
    'Authorization: AQAAAAAaQCuCAAQq1jq7m_Тwq0HJnUBAhzdZINg',
);
curl_setopt($curl, CURLOPT_URL, "https://cloud-api.yandex.net:443/v1/disk");
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
echo $result;

нужно просто записать в массив

$headers = array(
    'Content-type: application/xml',
    'Authorization: AQAAAAAaQCuCAAQq1jq7m_Тwq0HJnUBAhzdZINg',
)


text:
Q: WHen consuming a web service using c# no data is returned i've got a webservice that is running on my local iis. Now i am trying to consume this webservice from a windows application.
I've added loggin in the web service that i am sure it is actually returning the data and it is.
But when i try and retreive it from my application it returns an empty datatable.
Any suggestions It actually breaks at where you get the datarow sins there are no data in the dattaable.?
PayM8Service payM8Service = new PayM8Service();

      localhost.PayM8DataSet.PayM8DetailsGetDataTable payM8DetailsGetDataTable = payM8Service.GetPayM8Details(999999999, "631023012");
      localhost.PayM8DataSet.PayM8DetailsGetRow row = (localhost.PayM8DataSet.PayM8DetailsGetRow)payM8DetailsGetDataTable.Rows[0];

      decimal asd = row.Arrears;
      decimal asda = row.Balance;

A: The DataTable, DataRow, DataView, and DataViewManager objects cannot be serialized and cannot be returned from an XML Web service. To return less than a complete DataSet, you must copy the data that you want to return to a new DataSet.
http://support.microsoft.com/kb/306134


text:
Q: Error in Spring : Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/mvc] I'm getting this error in spring mvc framework :
Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/mvc]
any advice ?

A: Make sure you have put the correct version of schema in your xml.
Also make sure that the same version jar file is included in your application.
If you are using SpringSourceToolSuit or have Spring plugin installed in your eclipse then you should be able to create the Spring configuration file with having correct schema defination in it by default.


text:
Q: Why is this create table sql query giving me the error "#1071 - Specified key was too long; max key length is 767 bytes" CREATE TABLE IF NOT EXISTS members_table (
     `id` int(10) NOT NULL AUTO_INCREMENT,
     `customerNumber` varchar(10) DEFAULT NULL,
     `firstName` varchar(64) NOT NULL,
     `lastName` varchar(64) NOT NULL,
     `address` varchar(64) DEFAULT NULL,
     `city` varchar(32) DEFAULT NULL,
     `state` varchar(2) DEFAULT NULL,
     `country` varchar(2) DEFAULT NULL,
     `zipCode` varchar(5) NOT NULL,
     `phoneNumber` varchar(12) DEFAULT NULL,
     `emailAddress` varchar(200) NOT NULL,
     `dateOfBirth` varchar(10) DEFAULT NULL,
     `subscribe` tinyint(1) DEFAULT NULL,
     `password` varchar(34) DEFAULT NULL,
     `resetKey` varchar(34) DEFAULT NULL,
     `joinDate` datetime  NOT NULL,
     `active` tinyint(1) DEFAULT NULL,
     `deleted` tinyint(1) DEFAULT NULL,
     PRIMARY KEY (`id`),
     UNIQUE KEY `emailAddress` (`emailAddress`)
    ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

A: According to this question:

MySQL assumes 3 bytes per utf8 character. 255 characters is the maximum index size you can specify per column, because 256x3=768, which breaks the 767 byte limit.

Since you specified utf8mb4 collation, MySQL assumes 4 bytes per character. From MySQL docs:

The utf8mb4 character set uses a maximum of four bytes per character.

Your emailAddress field is 200 characters long at maximum thus the key length would be 800 bytes while error explicitly says the limit is 767 bytes.

A: MySQL assumes worst case for the number of bytes per character in the string. For the MySQL 'utf8' encoding, that's 3 bytes per character since that encoding doesn't allow characters beyond U+FFFF. For the MySQL 'utf8mb4' encoding, it's 4 bytes per character, since that's what MySQL calls actual UTF-8.
Use utf8 instead of utf8mb4
Try this
CREATE TABLE IF NOT EXISTS members_table (
 `id` int(10) NOT NULL AUTO_INCREMENT,
 `customerNumber` varchar(10) DEFAULT NULL,
 `firstName` varchar(64) NOT NULL,
 `lastName` varchar(64) NOT NULL,
 `address` varchar(64) DEFAULT NULL,
 `city` varchar(32) DEFAULT NULL,
 `state` varchar(2) DEFAULT NULL,
 `country` varchar(2) DEFAULT NULL,
 `zipCode` varchar(5) NOT NULL,
 `phoneNumber` varchar(12) DEFAULT NULL,
 `emailAddress` varchar(200) NOT NULL,
 `dateOfBirth` varchar(10) DEFAULT NULL,
 `subscribe` tinyint(1) DEFAULT NULL,
 `password` varchar(34) DEFAULT NULL,
 `resetKey` varchar(34) DEFAULT NULL,
 `joinDate` datetime  NOT NULL,
 `active` tinyint(1) DEFAULT NULL,
 `deleted` tinyint(1) DEFAULT NULL,
 PRIMARY KEY (`id`),
 UNIQUE KEY `emailAddress` (`emailAddress`)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;


text:
Q: Unit Testing .cpp How-To Alright. I have done screen scraping program in c++. Now how do i unit test a .cpp?
where do i get started?

A: There are several Unit testing frameworks which can help you test your code.
Check out:
Google Test (Google C++ Testing Framework) which can be found at http://code.google.com/p/googletest/
and Google Mock (Google C++ Mocking Framework) at http://code.google.com/p/googlemock/ which will help you check your application's flow by creating mock objects for your classes.
(you should read about Mock objects at http://en.wikipedia.org/wiki/Mock_object)
If the GoogleTest framework doesn't fit your needs, You have another great alternative called CxxTest ( http://cxxtest.tigris.org/ ).
Good luck!
Tal.

A: Essentially, what you need to do is take the module/class you want to test and isolate it from the rest of the system, simulate (fake) all of its interactions with any external classes/API's, and verify that it did what it's supposed to do.
Typically you do this simulation using "mock objects".  You contrive behavior of the mock objects to exercise different operating conditions for your System (module/class) Under Test (SUT).  You could use an existing mock object framework, or you could simply "roll your own" mock objects, by creating objects or functions that implement all of the interfaces your SUT uses.
You'll have to figure out how you can inject your mock objects into your SUT.  For example if your SUT had a member variable object instance, perhaps you could make a subclass of the SUT and add a method "SetMemberObj(aMockInstance)" to install the mock object.  If your SUT uses global functions, perhaps you can create functions with identical signatures, and NOT link your test app with the .lib that contains the real functions, so that your SUT will call into the fake ones instead.
You'll also have to decide how you can verify the SUT's behavior; in a simple case maybe you could check the return code of a method, whereas in a more complicated situation you'll want to query your mock objects to see how they were invoked by the SUT.
You may also be challenged to figure out how to actually invoke your SUT.  What I typically do is make a console .exe that instantiates and drives the SUT in various ways, indicating any errors via stdout and/or return codes.  A unit testing framework can be very helpful for this, but isn't entirely necessary.

A: CppUnit is the C++ equivalent of JUnit for unit testing.

A: There are a lot of C++ unit testing frameworks available so it can be rather daunting to choose one.  Here is a very good series of blog posts that evaluate several frameworks and contains lots of examples of C++ unit testing in action.

A: Here are instructional videos demonstrating test-driven development in C++: http://www.vimeo.com/album/254486


text:
Q: Inheriting CSS from existing styles. Extjs4 Sandbox I have managed to embed my extjs4 panel inside an existing  extjs3 application.
I want to inherit the existing css colour schemes for panel headers etc.
But my extjs4 components are 'sandboxed', therefore using the .x4-* namespace for css.
How can:
my-styles.css

.x4-tab { some-stuff }

inherit from:
existing-styles.css

.x-tab { foo: #FFF }

Is this possible? cheers

A: You can grab all the existing css rules that have '.x-' in the selector and create new rules using '.x4-'.
var newRules = [];
Ext.Object.each(Ext.util.CSS.getRules(), function(selector, rule) {
    if (/\.x-/.test(selector)) {
        newRules.push(rule.cssText.replace(/\.x-/g, '.x4-');
    }
});

Ext.util.CSS.createStyleSheet(newRules.join(' '))

A: While this is technically possible to do, the results would not actually make sense unless you manually go through each component and override the classes to have the correct css references if they even exist (and you would have to create others manually).  This is because Extjs 4 does not work the same way in a technical sense for css namespacing and classes as Extjs 3.  You could manually change all the css classes the components are using by overriding their component classes, but this is just not worth the time.  What you are trying to do can not be done without a huge amount of effort, and it is just not worth it.


text:
Q: Temperature sensing with NTC circuit I am reading through this document by TI on designing a temperature sensing circuit with an NTC thermistor. I'm having some trouble understanding the design steps though. Here are some snippets from the application note: -

They state that they want the op-amp to operate in the linear region which I guess means that they don't want the op-amp output voltage to exceed the supply voltage (saturation). For that, they need a certain value of \$R_1 \$ to limit the input voltage. However, in their calculation they don't take the supply voltage into account at all, but only use the min and max value of the thermistor.
My question is how can they neglect the op-amp's supply voltages when calculating \$R_1 \$? And also, why do they calculate it like this \$R_1 = \sqrt{R_{NTC,max}\cdot R_{NTC,min}} \$?
Why is it not, for example, \$R_1 = \frac{R_{NTC,max}+R_{NTC,min}}{2} \$?

A: The supply voltage is in the formula for calculating the op-amp output voltage, so it is not left out.
But as the NTC and the fixed resistor use the op-amp supply and ground for the voltage divider, all it is needed to know is that the divider output will be within the supply voltages.
The R1 value is calculated with a geometric mean instead of arithmetic mean, because it will result into a value that maximizes the divider output voltage swing based on the NTC resistor range. The R1 value that maximizes the voltage swing does not depend on supply voltage, it maximizes it for any supply voltage.
The values for NTC resistor at 25 and 50 degrees is used because that is the range defined in the design specs that the circuit must operate. There is no point using the full NTC range of values at say 0 and 100 degrees.


text:
Q: implementing a background process responding to the client in an atmosphere+netty/jetty application We have a requirement to to support 10k+ users, where every user initiate a request and waits for a response from the server (the response can take as long as 20-30 seconds to arrive). it is only one request from the client, and after a long processing by the server, a response will be transmitted and then the connection will disconnect.
in the background, the server will do some DB search and wait for other background processes to notify on completion before responding to the client.
after doing some research i figured out we will need to use something like the atmosphere framework to support websockets/sse event/long polling along with an asynchronous server like netty (=> nettosphere) or jetty.
As for my experience - mostly Java EE world and Tomcat server.
my questions are:

*

*what will be easier to implement in regard to my experience and our requirement: atmosphere + netty or atmoshphere+jetty? which one can scale better, has an easier learning curve and easier to implement other java technologies?

*how do u implement in atmosphere a response that is sent only to the originating client and not broadcast to the rest of the clients? (all the examples i found are broadcast).

*how can i implement in netty (or jetty) when using the atmosphere framework our response? i.e., the client send a request, after it is received in the server some background processes are run, and when they finish i need to locate the connection and transmit the response. is that achievable?

A: Some thoughts:

*

*At 10k+ users, with 20-30 second response latency, you likely hit file descriptor limits if using just 1 network interface.  Consider a solution that uses multiple network interfaces.

*Your description of your request/response can be handled entirely with standard Servlet 3.0, standard HTTP/1.1, Async request handling, and large timeouts.

*If your clients are web browsers, and you don't start sending a response from the server until the 20-30 second window, you might hit browser idle timeouts.

*Atmosphere and Cometd do the same things, supporting long duration connections, with connection technique fallbacks, and with logical channel APIs.

A: I believe the AKKA framework will handle this sort of need. I am looking at using it to handle scaling issues possibly with a RabbitMQ to help off load work to potentially other servers that may be added later to scale as needed.


text:
Q: avoiding UITapGestureRecognizer in button? I am using UITapGestureRecognizer for double tap.When I double tab on UIButton , it works.but i want to avoid it? any built in method?

A: You can stop the UITapGestureRecognizer from cancelling other events (such as the tap on your button) by setting the following boolean:
[tapRecognizer setCancelsTouchesInView:NO];

A: I recommend watching Session 120 of the WWDC10 videos. It is free, and shows you how to avoid unwanted events. There's a lot of useful information in these videos, and best of all, they're free.


text:
Q: What versions of SSMS have an Express edition? I know all the SQL Server versions from 2005 to 2014 have an express edition. This question is specifically about SSMS. There was an SSMS Express 2005, 2008, and 2008 R2, but I haven't found any later version.

A: The SSMSE was different in what it can manage as documented here.
Now you can use SSMS (SQL Server Management Studio) as a seperate download - SSMS or SQL server 2014 express - SSMSE that will manage all editions of sql server.
Aaron has a really good explanation here with screenshots :-)

Express version of Management Studio, since 2012 Service Pack 1, has been a fully functional product with absolutely no differences


text:
Q: nhibernate many to many deletes I have 2 classes that have a many to many relationship.
What i'd like to happen is that whenever i delete one side ONLY the association records will be deleted with no concern which side i delete.
simplified model:
classes:
class Qualification
{
     IList<ProfessionalListing> ProfessionalListings
}

class ProfessionalListing
{
     IList<Qualification> Qualifications

     void AddQualification(Qualification qualification)
     {
        Qualifications.Add(qualification);
        qualification.ProfessionalListings.Add(this);
     }
}

fluent automapping with overrides:
void Override(AutoMapping<Qualification> mapping)
{
     mapping.HasManyToMany(x => x.ProfessionalListings).Inverse();
}

void Override(AutoMapping<ProfessionalListing> mapping)
{
    mapping.HasManyToMany(x => x.Qualifications).Not.LazyLoad();
}

I'm trying various combinations of cascade and inverse settings but can never get there.
If i have no cascades and no inverse i get duplicated entities in my collections.
Setting inverse on one side makes the duplication go away but when i try to delete a qualification i get a 'deleted object would be re-saved by cascade'.
How do i do this?
Should i be responsible for clearing the associations of each object i delete?

A: The many-to-many table is actually the persistent form of the lists (ProfessionalListings and Qualifications). When you delete one of the objects, it is still in the list of the other, isn't it?
You can't expect from NHibernate that it updates your list. For instance, if you delete a Qualification in the database, it is still in the list Qualifications, because you didn't remove it there. NHibernate doesn't (and shouldn't be allowed to) update your list.
ProfessionalListings is the inverse list, this means it is only loaded, but not stored. You need at least to update the Qualifications list when a Qualification is deleted. This is regular consistency within your class model which is managed by the business logic.

A: If you need to delete a connected object, you can configure AllDeleteOrphan cascade setting. Then if you remove object from association it will be removed


text:
Q: javascript : Transform not working why doesn't this transformation occur on mozilla/ie but it does for webkit browsers using the following code?
I have tested the code below on the following browsers/version:

*

*Firefox: 29

*Chrome: 34

*IE: 11

Code :
var text = document.getElementById('text');

transform = "scale3d(2,2,0) " + "translate3d(20px, 0, 0) ";

$('#text').hover(function (){
    text.style.transform = transform;
    text.style.webkitTransform = transform;
    text.style.msTransform = transform;
});

I have based my code on this (W3Schools) link which confirms the browser compatibility.
I created a fiddle to exemplify this issue http://jsfiddle.net/3fxf6/

A: This works for me in all browsers (that support transform):
JSFiddle
And I made it pure JS:
var text = document.getElementById('text'),
    transform = "scale3d(2,2,1) translate3d(20px, 0, 0)";

text.onmouseover = function(){
    text.style.transform = transform;
    text.style.webkitTransform = transform;
    text.style.msTransform = transform;
}

It didn't work because you were setting the scale of z to 0, making it disappear. It needs to be 1 to work on Firefox, but gives same result in all browsers.
Also you didn't need to include jQuery just to do a hover effect, you can just use onmouseover on text to get the same result, without having to include a bulky library.


text:
Q: Resolve internet address (IP) as running apps see them currently (vs. external name server) Sometimes, I need to see the actual IPv4 address of web sites I open in Safari.
Now, there are two terminal commands, host and dig, which I could use for that.
But these commands are not always telling my the actual IP address that the Mac apps, such as Safari, use. Examples for when they show a different IP address:

*

*I've added the address to the Mac's /etc/hosts file.

*The IP address has recently changed and the Mac apps still use the previous one it has cached.

So, is there a tool that tells me the IP address that's currently known to OS X instead of the address the external name server reports?

A: It appears I made wrong assumptions about DNS caching. However, I was right on the /etc/hosts file, in that the host command ignores it, while apps running on the Mac do not ignore it by default.
So, I've made a very simple program that uses one of the Mac OS functions to resolve the host name into an IP address. This way, changes to the hosts file will be seen by this program, as they're seen by any other Mac app.
The program, including Xcode project, can be downloaded here.


text:
Q: ${a_n}$ series of Fibonacci numbers. $f(x)=\sum_{0}^{\infty}a_nx^n$, show that in the convergence radius: $f(x)= \frac{1}{1-x-x^2}$ I'd really like your help with this following problem:
Let ${a_n}$ be a Fibonacci series $a_1=a_0=1$ and $a_{n+2}=a_n+a_{n+1}$ for every $n \geq 0$.
Let $f(x)=\sum_{0}^{\infty}a_nx^n$, I need to find the radius of convergence and to prove that in the range of this radius $f(x)= \frac{1}{1-x-x^2}$.
we know that the convergence radius $R=\lim_{n\to \infty} |\frac {a_n}{a_{n+1}}| $, How can I apply it in this case?
Any direction to prove that $f(x)$ is as requested?
Thanks alot!

A: As for the question about radius of convergence, I'll write the comments by Javaman:
As $\dfrac{a_{n+1}}{a_n} \to \phi$, where $\phi=\dfrac{1+\sqrt 5}{2}$, we see that the limit superior coincides with the limit.
$$\limsup \dfrac{a_{n+1}}{a_n}=\lim \dfrac{a_{n+1}}{a_n}=\phi$$ which gives you the radius of convergence.
Loosely, this is how generating functions work:
Note that we have, $a_n=a_{n-1}+a_{n-2},~~ n\ge2$
$$\begin{align*} f(x) & = \sum _{n=0}^ \infty {a_n x^n} \&=1+a_1x+\sum_{n=2}^\infty(a_{n-1}+a_{n-2})x^n\\&=1+a_1x+\sum_{n=2}^\infty{a_{n-1}x^n+\sum_{n=2}^\infty}a_{n-2}x^n\\&=1+a_1x+x\sum_{n-1=1}^\infty{a_{n-1}x^{n-1}}+x^2\sum_{n-2=0}^\infty{a_{n-2}x^{n-2}}\\&=1+x+x(f(x)-1)+x^2f(x) ~~~\text{as $a_1=1$}\\&=1+xf(x)+x^2f(x)\end{align*}$$
But, as for rigour, I am looking forward to enlightening comments!

A: You can find the radius of convergence by noting the well-known identity:
$$
\lim_{n \to \infty} \frac{a_{n+1}}{a_n} = \varphi,
$$
where $\varphi = \frac{\sqrt{5}+1}{2}$ is the golden ratio.
Once you know the radius of convergence, to find the partial sum $S_N$, just write:
$$\begin{align}
S_N := \sum_{n=0}^N a_n x^n &= 1 +x + \sum_{n =2}^N a_n x^n
\\
&= 1+x + \sum_{n=2}^N(a_{n-2} + a_{n-1})x^n
\\
&= 1+ x + x^2\sum_{n=2}^N a_{n-2}x^{n-2} + x\sum_{n=2}^Na_{n-1} x^{n-1}
\\
&= 1 + x + x^2 \sum_{n=0}^{N-2} a_n x^n + x \cdot \sum_{n=1}^{N-1} a_n x^n
\\
&= 1 + x + x^2 S_{N-2} + x\sum_{n=0}^{N-1} a_n x^n - x
\\
&= 1 + x^2 S_{N-2} + x S_{N-1}.
\end{align}$$
Since $S_N = a_Nx^N + S_{N-1} = a_Nx^N + a_{N-1}x^{N-1} + S_{N-2}$, we arrive at
$$
S_N = 1 + x^2 (S_N - a_N x^N - a_{N-1}x^{N-1}) + x(S_N - a_Nx^N)
$$
Solving for $S_N$ gives
$$
S_N = \frac{1 - a_Nx^{N+2} - a_{N-1}x^{N+1} - a_Nx^{N+1}}{1 - x - x^2}.
$$
Finally, taking the limit $\lim_{N \to \infty} S_N$ gives the answer as the terms with powers of $x$ in the numerator go to zero (since the original sum under question converges).


text:
Q: Uploadify basic demo page not working on IE10 All browsers apart from IE are working nicely with Uploadify in my project.
So just going to the demo page in IE10 :
http://www.uploadify.com/demos/
I see that for IE the upload button is not properly changed to its Uploadify upload button.
On F12 debug, under console I can see the following error:
SEC7111: HTTPS security is compromised by https://gw079.lphbs.com/ConvivaCommunicationProxy.html
Does anyone know if this is causing the problem, and how I might fix it?
Flash plugin is displaying right for other sites.
I have 'reinstalled' IE10 without fixing the issue, and other browsers work fine on this demo page for me. Another guy in the office doesn't have the error in IE10, all works for him.

A: I removed this line from my site and it worked fine w/o having to edit any of my Uploadifive code
<meta http-equiv="X-UA-Compatible" content="IE=8" />

A: Basically Uploadify work with FlashPlayer,latest browser are pre installed with it.But browser like IE8,IE10 should install separately.you should download adobe flash player Activex for internet explorer and install it link


text:
Q: fill.gaps() in R does not fill all the gaps in my data I have a tibble with two columns:
library(tibble)
data <- tibble(yearweek = c("2020 W25", "2020 W33"),
               qty = c(100, 150))

I need to add all the week since 2015 W53 until the current week, so I use
data <- data %>%
    fill_gaps(qty = 0,
              .start = yearweek("2016-01-01"),
              .end = yearweek(Sys.time()),
              .full = TRUE)

The data produced are not what I need because it still have gaps in the yearweek value (it fills like a week every 8).
What did I miss? Is there any options of the fill_gaps() that I miss to do what I want?
EDIT I think the cause of the behaviour is that a clear full index of the yearweek index is missing and the command does not get the full time range. So is there a way to use a full vector of the index value to fill the tibble?

A: Adding a W34 to the data results in no gaps.
Adding a W35 to the data results in alternate weeks.
(It seems to be calculating implied missing weeks based on the smallest time-step in the data.)
library(tidyverse)
library(tsibble)

# Fill gaps gives consecutive weeks with W34
data <- tibble(
  yearweek = c("2020 W25", "2020 W33", "2020 W34"),
  qty = c(100, 150, 200)
)

data %>%
  mutate(yearweek = yearweek(yearweek)) %>%
  tsibble() %>%
  fill_gaps(
    qty = 0,
    .start = yearweek("2015 W53"),
    .end = yearweek(Sys.time()),
    .full = TRUE
  )
#> Using `yearweek` as index variable.
#> # A tsibble: 341 x 2 [1W]
#>    yearweek   qty
#>      <week> <dbl>
#>  1 2015 W53     0
#>  2 2016 W01     0
#>  3 2016 W02     0
#>  4 2016 W03     0
#>  5 2016 W04     0
#>  6 2016 W05     0
#>  7 2016 W06     0
#>  8 2016 W07     0
#>  9 2016 W08     0
#> 10 2016 W09     0
#> # … with 331 more rows

# Fill gaps gives alternate weeks with W35
data <- tibble(
  yearweek = c("2020 W25", "2020 W33", "2020 W35"),
  qty = c(100, 150, 200)
)

data %>%
  mutate(yearweek = yearweek(yearweek)) %>%
  tsibble() %>%
  fill_gaps(
    qty = 0,
    .start = yearweek("2015 W53"),
    .end = yearweek(Sys.time()),
    .full = TRUE
  )
#> Using `yearweek` as index variable.
#> # A tsibble: 174 x 2 [2W]
#>    yearweek   qty
#>      <week> <dbl>
#>  1 2015 W53     0
#>  2 2016 W02     0
#>  3 2016 W04     0
#>  4 2016 W06     0
#>  5 2016 W08     0
#>  6 2016 W10     0
#>  7 2016 W12     0
#>  8 2016 W14     0
#>  9 2016 W16     0
#> 10 2016 W18     0
#> # … with 164 more rows

Created on 2022-07-07 by the reprex package (v2.0.1)


text:
Q: Printf output on godbolt using xtensa compiler? Is there some way to produce output in godbolt for the Xtensa compiler?
This
#include <cstdio>

int main()
{
    printf("Hello World!");
}

generates an asm call to printf, but nothing is displayed.


text:
Q: how to fix "no network security specified, using platform default" in android studio? I am trying to make a database via 000webhost.com. I keep getting this message showing in the event log whenever I run the app from android studio and it does not insert any record into the database when I click the register button. Does anyone know how to solve this problem? Thanks in advance.
My Register.php contains the following code:-
<?php
    $con = mysqli_connect("mysql10.000webhost.com", "id385292_dbusername", "contre@777", "id385292_dbname");

    $name = $_POST["name"];
    $age = $_POST["age"];
    $username = $_POST["username"];
    $password = $_POST["password"];
    $statement = mysqli_prepare($con, "INSERT INTO user (name, username, age, password) VALUES (?, ?, ?, ?)");
    mysqli_stmt_bind_param($statement, "siss", $name, $username, $age, $password);
    mysqli_stmt_execute($statement);

    $response = array();
    $response["success"] = true;

    echo json_encode($response);
?>

My RegisterActivity.java contains:-
package com.example.admin.loginregister;

import android.content.Intent;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.toolbox.Volley;

import org.json.JSONException;
import org.json.JSONObject;

public class RegisterActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        final EditText etAge = (EditText) findViewById(R.id.etAge);
        final EditText etName = (EditText) findViewById(R.id.etName);
        final EditText etUserName = (EditText) findViewById(R.id.etUserName);
        final EditText etPassword = (EditText) findViewById(R.id.etPassword);

        final Button bRegister = (Button) findViewById(R.id.bLogin);

        bRegister.setOnClickListener(new View.OnClickListener() {
            @Override
                    public void onClick(View v) {
                final String name = etName.getText().toString();
                final String username = etUserName.getText().toString();
                final String password = etPassword.getText().toString();
                final int age = Integer.parseInt(etAge.getText().toString());

                Response.Listener<String> responseListener = new Response.Listener<String>() {

                    @Override
                    public void onResponse(String response) {
                        try {
                            JSONObject jsonResponse = new JSONObject(response);
                            boolean success = jsonResponse.getBoolean("success");

                            if (success) {
                                Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);
                                RegisterActivity.this.startActivity(intent);
                            } else {
                                AlertDialog.Builder builder = new AlertDialog.Builder(RegisterActivity.this);
                                builder.setMessage("Registration Failed")
                                        .setNegativeButton("Retry",null)
                                        .create()
                                        .show();
                            }
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                    }
                };
                    RegisterRequest registerRequest = new RegisterRequest(name, username, age, password, responseListener);
                    RequestQueue queue = Volley.newRequestQueue(RegisterActivity.this);
                    queue.add(registerRequest);

            }
        });

    }
}

My RegisterRequest.java contains:-
package com.example.admin.loginregister;

import com.android.volley.toolbox.StringRequest;
import java.util.HashMap;
import java.util.Map;
import com.android.volley.Response;

public class RegisterRequest extends StringRequest {
    private static final String REGISTER_REQUEST_URL="https://myandroid47.000webhostapp.com/Register.php";
    private Map<String, String> params;

    public RegisterRequest(String name,String username,int age,String password,Response.Listener<String> listener){
        super(Method.POST,REGISTER_REQUEST_URL,listener,null);
        params = new HashMap<>();
        params.put("name",name);
        params.put("username",username);
        params.put("password",password);
        params.put("age",age + ""); //We need to add string to convert age i.e int to String.
    }

    @Override
    public Map<String, String> getParams() {
        return params;
    }
}


text:
Q: Program UITextField to go to next line when 'Return' is pressed? I have a UITextField that it set up with autocapitalization, correction, etc., those type of modifiers. I also have a custom toolbar above the keyboard with a "done" button for closing the keyboard.
However, I need the user to be able to enter "returns" in their text for formatting purposes. I have the following code which triggers when the "return" key is pressed:
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    return NO;
}

However, in this case the return key closes the keyboard. Can someone please tell me how to change this code snippet to instead add a blank line to the growing text the user is entering upon clicking "return"?
Thanks!

A: UITextField does not support multiline text very well.  To support multiline text you probably want to use UITextView


text:
Q: Fastest way of bitwise AND between two arrays on iPhone? I have two image blocks stored as 1D arrays and have do the following bitwise AND operations among the elements of them.
int compare(unsigned char *a, int a_pitch,
            unsigned char *b, int b_pitch, int a_lenx, int a_leny)
{
    int overlap =0 ;

    for(int y=0; y<a_leny; y++)
        for(int x=0; x<a_lenx; x++)
        {
            if(a[x + y * a_pitch] & b[x+y*b_pitch])
                overlap++ ;
        }
    return overlap ;
}

Actually, I have to do this job about 220,000 times, so it becomes very slow on iphone devices.
How could I accelerate this job on iPhone ?
I heard that NEON could be useful, but I'm not really familiar with it. In addition it seems that NEON doesn't have bitwise AND...

A: Option 1 - Work in the native width of your platform (it's faster to fetch 32-bits into a register and then do operations on that register than it is to fetch and compare data one byte at a time):
int compare(unsigned char *a, int a_pitch,
            unsigned char *b, int b_pitch, int a_lenx, int a_leny)
{
    int overlap = 0;
    uint32_t* a_int = (uint32_t*)a;
    uint32_t* b_int = (uint32_t*)b;

    a_leny = a_leny / 4;
    a_lenx = a_lenx / 4;
    a_pitch = a_pitch / 4;
    b_pitch = b_pitch / 4;

    for(int y=0; y<a_leny_int; y++)
        for(int x=0; x<a_lenx_int; x++)
        {
            uint32_t aVal = a_int[x + y * a_pitch_int];
            uint32_t bVal = b_int[x+y*b_pitch_int];
            if (aVal & 0xFF) & (bVal & 0xFF)
                overlap++;
            if ((aVal >> 8) & 0xFF) & ((bVal >> 8) & 0xFF)
                overlap++;
            if ((aVal >> 16) & 0xFF) & ((bVal >> 16) & 0xFF)
                overlap++;
            if ((aVal >> 24) & 0xFF) & ((bVal >> 24) & 0xFF)
                overlap++;
        }
    return overlap ;
}

Option 2 - Use a heuristic to get an approximate result using fewer calculations (a good approach if the absolute difference between 101 overlaps and 100 overlaps is not important to your application):
int compare(unsigned char *a, int a_pitch,
            unsigned char *b, int b_pitch, int a_lenx, int a_leny)
{
    int overlap =0 ;

    for(int y=0; y<a_leny; y+= 10)
        for(int x=0; x<a_lenx; x+= 10)
        {
            //we compare 1% of all the pixels, and use that as the result
            if(a[x + y * a_pitch] & b[x+y*b_pitch])
                overlap++ ;
        }
    return overlap * 100;
}

Option 3 - Rewrite your function in inline assembly code.  You're on your own for this one.

A: Your code is Rambo for the CPU - its worst nightmare :

*

*byte access. Like aroth mentioned, ARM is VERY slow reading bytes from memory

*random access. Two absolutely unnecessary multiply/add operations in addition to the already steep performance penalty by its nature.

Simply put, everything is wrong that can be wrong.
Don't call me rude. Let me be your angel instead.
First, I'll provide you a working NEON version. Then an optimized C version showing you exactly what you did wrong.
Just give me some time. I have to go to bed right now, and I have an important meeting tomorrow.
Why don't you learn ARM assembly? It's much easier and useful than x86 assembly.
It will also improve your C programming capabilities by a huge step.
Strongly recommended
cya
==============================================================================
Ok, here is an optimized version written in C with ARM assembly in mind.
Please note that both the pitches AND a_lenx have to be multiples of 4. Otherwise, it won't work properly.
There isn't much room left for optimizations with ARM assembly upon this version. (NEON is a different story - coming soon)
Take a careful look at how to handle variable declarations, loop, memory access, and AND operations.
And make sure that this function runs in ARM mode and not Thumb for best results.
unsigned int compare(unsigned int *a, unsigned int a_pitch,
            unsigned int *b, unsigned int b_pitch, unsigned int a_lenx, unsigned int a_leny)
{
    unsigned int overlap =0;
    unsigned int a_gap = (a_pitch - a_lenx)>>2;
    unsigned int b_gap = (b_pitch - a_lenx)>>2;
    unsigned int aval, bval, xcount;

    do
    {
        xcount = (a_lenx>>2);
        do
        {
            aval = *a++;
            // ldr      aval, [a], #4
            bval = *b++;
            // ldr      bavl, [b], #4
            aval &= bval;
            // and      aval, aval, bval

            if (aval & 0x000000ff) overlap += 1;
            // tst      aval, #0x000000ff
            // addne    overlap, overlap, #1
            if (aval & 0x0000ff00) overlap += 1;
            // tst      aval, #0x0000ff00
            // addne    overlap, overlap, #1
            if (aval & 0x00ff0000) overlap += 1;
            // tst      aval, #0x00ff0000
            // addne    overlap, overlap, #1
            if (aval & 0xff000000) overlap += 1;
            // tst      aval, #0xff000000
            // addne    overlap, overlap, #1
        } while (--xcount);

        a += a_gap;
        b += b_gap;
    } while (--a_leny);

    return overlap;
}

A: First of all, why the double loop? You can do it with a single loop and a couple of pointers.
Also, you don't need to calculate x+y*pitch for every single pixel; just increment two pointers by one. Incrementing by one is a lot faster than x+y*pitch.
Why exactly do you need to perform this operation? I would make sure there are no high-level optimizations/changes available before looking into a low-level solution like NEON.


text:
Q: org.apache.coyote.http11.AbstractHttp11Processor.process Error parsing HTTP request header 24-Oct-2013 21:53:05.288 INFO [http-apr-8443-exec-3] org.apache.coyote.http11.AbstractHttp11Processor.process Error parsing HTTP request header
 Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
24-Oct-2013 21:53:05.288 INFO [http-apr-8443-exec-4] org.apache.coyote.http11.AbstractHttp11Processor.process Error parsing HTTP request header
 Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
I am getting the above error when using HTTPS configuration in Tomcat 8.0 0r Tomcat 7.
Please help. My tomcat HTTPS configuration goes like this.....
  <Connector
   className="org.apache.coyote.tomcat4.CoyoteConnector"
   port="8443"
   enableLookups="false"
   acceptCount="10"
   connectionTimeout="60000"
    scheme="https" secure="true" >
 <Factory
   className="org.apache.coyote.tomcat4.CoyoteServerSocketFactory"
          clientAuth="false" protocol="TLS"
          keystoreFile="D:\Samplekey.key" keystorePass="PASSWORD" />
 </Connector>

A: Your configuration is from Tomcat 4 but the error message has to be from at least Tomcat 7. The chances of Tomcat 4 SSL configuration working in Tomcat 7 are zero. Follow the Tomcat docs and correctly configure SSL for which ever version of Tomcat you are using.


text:
Q: Spring Data Mongo - Update multiple records I need to update multiple records. I cannot perform bulk update query by criteria, because we have a rule that for each db change we have to send a message to message broker. Therefore, I will need to update entities one by one.
I use Spring Data Repository. I can do it either by making pageable requests and updating elements in pages.
https://www.baeldung.com/spring-data-repositories
@Service
class MyEntityService {
    MyEntityRepository myEntityRepository; // extends PagingAndSortingRepository<MyEntity, ObjectId>

    updateMultipleEntities(UpdateRules updateRules) {
        Criteria criteria = buildCriteria(updateRules);
        long totalrecords = myEntityRepository.count(criteria);
        long totalUpdateCound = 0;

        // LET US ASSUME THAT NUMBER OF RECORDS DOES NOT CHANGE

        while (totalUpdateCound < totalrecords) {
            Page page = myEntityRepository.findAll(buildPageble(totalUpdateCound, criteria));
            processElementsFromPage(page);
        }
    }
}

Another solution is to stream all elements an update them. It looks easier.
@Service
class MyEntityService {
    MyEntityRepository myEntityRepository; // extends CrudRepository<MyEntity, ObjectId>

    updateMultipleEntities(UpdateRules updateRules) {
        Criteria criteria = buildCriteria(updateRules);

        // LET US ASSUME THAT NUMBER OF RECORDS DOES NOT CHANGE
        myEntityRepository.streamAll(criteria).forEach(element -> processElement(element, updateRules));

    }
}

Are there drawbacks with solution that uses streamAll(criteria)? As I understand, it would be useful to use pageable requests if I need to have pagination on the UI.  However, how about my case where I need to process elements one by one.
Update
http://knes1.github.io/blog/2015/2015-10-19-streaming-mysql-results-using-java8-streams-and-spring-data.html
Example why streaming results can improve performance. However, it shows only read-only cases.


text:
Q: Back Button to tableView I have a karaoke app . On the first screen are all the songs. There are menu button for categories. If "Classic Music" button is selected the content of the first screen is changed.
In the moment when I select a cell, a new view is presented with a back button .
My problem is : when i press back button , in the first screen are all songs , even if before there was only classic music , and i don't want this.
This is the method for back action:
- (IBAction)back:(id)sender {
    ViewController *xyz=[[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"first"];
    [self presentViewController:xyz animated:YES completion:^(void)
     {

     }];
}

And this is the implementation for first view :
-(void)viewDidLoad {

    categoryArray =[[NSMutableArray alloc]init];
    categoryArray = [allKeys valueForKey:@"category" ];

    feeds=[[NSMutableArray alloc]init];
    feeds=[allKeys valueForKey:@"feed_api"];

   if ([stories count] == 0) {
        for (int i=0; i<[feeds count]; i++) {
            NSString * path =[feeds objectAtIndex:i];
            [self parseXMLFileAtURL:path];

        }
       .............
    }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    if (tableView.tag==0) {

    TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
    }
    // Set up the cell
    int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1];

    cell.title.text=[[stories objectAtIndex: indexPath.row] objectForKey: @"title"];
   NSString * aux=[[stories objectAtIndex: indexPath.row] objectForKey: @"url"];
    NSString *   videoHTML =[NSString stringWithFormat: @"<iframe type=\"text/html\" width=\"100\" height=\"80\" src=\"%@\" frameborder=\"0\"></iframe>",aux] ;
    [cell.WEB loadHTMLString:videoHTML baseURL:nil];

    cell.title.numberOfLines=6;
    return cell;}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    if (!tableView.tag==0) {
        int row =indexPath.row;
        if (row==0) {
            self.title1.text=@"All Songs";
            [stories removeAllObjects];
            [self parse];
        }else
        {
        self.title1.text=[categoryArray objectAtIndex:indexPath.row-1];
        [stories removeAllObjects];
        NSString * path =[feeds objectAtIndex:indexPath.row-1];
        [self parseXMLFileAtURL:path];}
        i=0;
        [self showMenu:nil];//sender should be settingsButton;
    }

- (void)parseXMLFileAtURL:(NSString *)URL
{
    //stories = [[NSMutableArray alloc] init];

    //you must then convert the path to a proper NSURL or it won't work
    NSURL *xmlURL = [NSURL URLWithString:URL];

    // here, for some reason you have to use NSClassFromString when trying to alloc NSXMLParser, otherwise you will get an object not found error
    // this may be necessary only for the toolchain
    rssParser = [[NSXMLParser alloc] initWithContentsOfURL:xmlURL];

    // Set self as the delegate of the parser so that it will receive the parser delegate methods callbacks.
    [rssParser setDelegate:self];

    // Depending on the XML document you're parsing, you may want to enable these features of NSXMLParser.
    [rssParser setShouldProcessNamespaces:NO];
    [rssParser setShouldReportNamespacePrefixes:NO];
    [rssParser setShouldResolveExternalEntities:NO];

    [rssParser parse];

}

- (void)parserDidEndDocument:(NSXMLParser *)parser {

    NSLog(@"all done!");
    NSLog(@"stories array has %d items", [stories count]);
    if (self.tableView.tag==0) {
        [self.tableView reloadData];

    }
}

A: Yo are making a new view controller every time you press back, you should embed your mainViewController in a navigation controller. This way you can go forward pushing view controllers and backward popping them.


text:
Q: Where is parallel gc is used? Can anyone answer me,please, where is parallel gc usually is used?
I am reading article:
http://blog.takipi.com/garbage-collectors-serial-vs-parallel-vs-cms-vs-the-g1-and-whats-new-in-java-8/
And there is "The parallel collector is best suited for apps that can tolerate application pauses and are trying to optimize for lower CPU overhead caused by the collector".
But which exact examples can be in this case?
Thanks.

A: Almost all applications can cope with short pauses. Rather than asking what applications can cope with a pause, you should really be asking what applications cannot cope with a pause.
Applications that can't cope with a pause are ones that have to directly interact with the real world and have to do so in real time. Machines and robots are the best example of this. For instance, you don't want the ABS on a car to be paused for a garbage collection when you slam on your brakes in an emergency.
Having said that, a typical example of an application that can cope with a pause is a desktop application. That extra fraction of a second it takes to display a menu or respond to a button click is likely to go unnoticed by the user.


text:
Q: Poor gaming performance with hyper-v installed in windows 8 I am getting very poor gaming performance on my Windows 8 host OS with Hyper-V installed but no guest machines running.
For example World of Tanks reports 60-70 FPS without Hyper-V installed and 4-14 FPS with it installed. A similar, dramatic, hit is observed in several other games so the issue is not WoT specific.
To make the point clear, I am not trying to run games in a virtual machine. I don't even have a VM running while observing this effect. I simply have the Hyper-V feature installed.
My system specs:
AMD Phenom II 965 (3.4 GHz)
AMD Radeon 6950 2GB (XFX Double D HD-695X-CDFC)
16GB DDR3 1333
AMD 790GX chipset Mainboard (Gigabyte GA-MA790GPT-UD3H)
I have tried every AMD driver from 12.8 to the current 12.11beta8, virtualization is enabled in the BIOS settings, the onboard 3300HD video device is disabled in BIOS and I have read the MSDN blog entry here regarding a similar issue in Server 2008 that was resolved in 2008 R2 (and hopefully not regressed in Win 8).
I'd like to be able to use Hyper-V for development and testing at home (I am a sysadmin/software developer professionally). If, however, I can't also use my home system for entertainment I'll have to scrap those plans.
I should note that I'm aware that Hyper-V is a Type 1 hypervisor in which the management/host OS runs within the virtualization environment. I realize that there will be at least some level of performance hit but I'd rather experience the "minimal" hit that most sources allude to rather than the "severe" hit that I'm currently able to observe and measure.

A: If I were you, I would consider using vmware or virtualbox.
I use virtualbox myself and don't have any performance issues when playing games. I have even left a vm running and not noticed a difference. Granted I have lots of RAM and a good processor.

A: As far as I can see there should only be a minimal performance reduction if you enable Hyper-V. If found this thread in the MSFT forum.
This is because of that you Windows 8 is then running also on Hyper-V as you can see here.


text:
Q: How to use ionic elements in certain component of existing project? We have a project running with React + Material UI, now there is a request to render a certain component(use ComponentA below) by using Ionic(It's not a reasonable requirement however I only discuss from technical perspective here).
From Ionic offical documentation, I did below

*

*install the @ionic/react and @ionic/react-router package

*including below css in root component
/* Core CSS required for Ionic components to work properly */
import '@ionic/react/css/core.css';
/* Basic CSS for apps built with Ionic */
import '@ionic/react/css/normalize.css';
import '@ionic/react/css/structure.css';
import '@ionic/react/css/typography.css';
/* Optional CSS utils that can be commented out */
import '@ionic/react/css/padding.css';
import '@ionic/react/css/float-elements.css';
import '@ionic/react/css/text-alignment.css';
import '@ionic/react/css/text-transformation.css';
import '@ionic/react/css/flex-utils.css';
import '@ionic/react/css/display.css';

*invoke setupIonicReact() in root component

*replace material UI element with ionic element in ComponentA
But it does not work - blank page, and I have to comment out below line
import '@ionic/react/css/structure.css';

Now I can see ionic elements displayed however css styles not applied they look more like html input, button and etc.
I realise there is something wrong however I could not figure out what's the root cause, after searching a while I decide to move step 2)& 3) into that ComponentA. But, new problem coming - setupIonicReact() can not be invoked inside the component, I looked into it and it's pretty simply
export const setupIonicReact = (config: IonicConfig = {}) => {
  /**
   * By default Ionic Framework hides elements that
   * are not hydrated, but in the CE build there is no
   * hydration.
   * TODO FW-2797: Remove when all integrations have been
   * migrated to CE build.
   */
  if (typeof (document as any) !== 'undefined') {
    document.documentElement.classList.add('ion-ce');
  }

  initialize({
    ...config
  });

so, I make a simple change - like below
<div className="ion-ce">
  <ComponentA />
</div>

now, my chrome keeps loading and there is a blank page alway.
So, I want to stop now and ask for hep, at least to know is it possible using ionic inside a existing project with only certain component?


text:
Q: Assert an array reduces to true In one of the tests, we need to assert that one of the 3 elements is present. Currently we are doing it using the protractor.promise.all() and Array.reduce():
var title = element(by.id("title")),
    summary = element(by.id("summary")),
    description = element(by.id("description"));

protractor.promise.all([
    title.isPresent(),
    summary.isPresent(),
    description.isPresent()
]).then(function (arrExists) {
    expect(arrExists.reduce(function(a,b) { return a || b; })).toBe(true);
});

Is there a better way to solve it with Jasmine without resolving the promises explicitly? Would we need a custom matcher or it is possible to solve with the built-in matchers?

A: You could simply get all the elements with a single selector and assert that the count is superior to zero:
var title_summary_description = element.all(by.css("#title, #summary, #description"));
expect(title_summary_description.count()).toBeGreaterThan(0);

A: Check this:
let EC = protractor.ExpectedConditions;

let title = EC.visibilityOf($("#title")),
    summary = EC.visibilityOf($("#summary")),
    description = EC.visibilityOf($("#description"));

expect(EC.or(title, summary, description)() ).toBeTruthy('Title or summary or description should be visible on the page')

Notice that i am executing function that ExpectedCondition returns - so i am getting result of that function(Promise that will be resolved to boolean) instead of function.
You can use .presenceOf() if you need it instead .visibilityOf()
http://www.protractortest.org/#/api?view=ExpectedConditions.prototype.or