text:
Q: Django: import-export && Grappelli I was using Django import-export app and now I want to add Grappelli in order to improve the Admin interface. I'm getting an error related to the templates. Any suggestion to get them work together?
Error:
Environment:

Request Method: GET
Request URL: http://localhost:8000/admin/db_personal/personalinstituto/

Django Version: 1.7c1
Python Version: 2.7.8
Installed Applications:
('grappelli',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'import_export',
 'db_personal')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware')

Template error:
In template C:\Gestion AI2\web_nueva\templates\admin\change_list.html, error at line 1
   maximum recursion depth exceeded in __instancecheck__
   1 :  {% extends "admin/change_list.html" %}

   2 :

   3 : {# Original template renders object-tools only when has_add_permission is True. #}

   4 : {# This hack allows sub templates to add to object-tools #}

   5 : {% block object-tools %}

   6 :

   7 :     {% block object-tools-items %}

   8 :       {% if has_add_permission %}

   9 :         {{ block.super }}

   10 :       {% endif %}

   11 :     {% endblock %}

A: Well, i think your problem is not in the template script but the extend.
Your template tries to extend itself.

templates\admin\change_list.html, error at line 1  1 :  {% extends
  "admin/change_list.html" %}

admin/change_list.html refers to the basic django template change_list. It seems that your django-import-export change_list template has the same path. Your change_list template from django-import-export should be in
template/admin/import_export/change_list.html

A: I use them together fine. I had to change this in admin/includes_grappelli/header.html :
-                    {% url admin:password_change as password_change_url %}
+                    {% url 'admin:password_change' as password_change_url %}

-                    {% url admin:logout as logout_url %}
+                    {% url 'admin:logout' as logout_url %}

-                {% url test-index as testindexurl %}
+                {% url 'test-index' as testindexurl %}

-                {% url django-admindocs-docroot as docsroot %}
+                {% url 'django-admindocs-docroot' as docsroot %}

And call it with ImportExportActionModelAdmin to avoid CSS problems.
from import_export.admin import ImportExportActionModelAdmin

class MyModelAdmin(ImportExportActionModelAdmin):
    """
    Admin class for MyModel model
    """
    form = MyModelAdminForm

    list_display = ()
    ordering = []

    resource_class = MyModelResource

Hope it helps...

A: I've just gone through the same problem and here's a more step-by-step approach.
Create a directory in your project for the import_export templates and add a html file for the change_list_import template.
myproj
├── myproj
│   ├──url.py
│   ├──settings.py
├── manage.py
├── db_personal #myapp
│   ├── admin.py
│   ├── models.py
|   ├── viewss.py
├── templates
|   ├── admin
|   |   ├── import_export
|   |   |   ├── change_list_import.html
├── dashboard.py

Next, copy the following code in this template html file. Note that it needs to extend the grappelli changelist template, hence the reference to the location of this template:
{% extends "C:/Python27/lib/site-packages/grappelli/templates/admin/change_list.html" %}
{% load i18n %}

{% block object-tools-items %}

{% trans "Import" %}

   {{ block.super }}
{% endblock %}

A:
grappelli needs to be before import_export within INSTALLED_APPS.

Quoting from
https://django-grappelli.readthedocs.io/en/latest/thirdparty.html


text:
Q: visual c++ 2005 x64? Could somebody please point me at the download link for Visual C++ 2005 Express x64 (AKA Visual Studio 8) before I am sectioned under the mental health act?
If I want any GCC point release from the last 10 years I can get it in under 30 seconds from a single page. Microsoft's website is a nightmare beyond imagining. Even Google can't get me what I'm looking for. Hours of my life have now disappeared. Please don't post a link to an article from Microsoft about this because I have read them all. I've been through pages which link to other pages, which then loop back on themselves, or point to dead links, or purport to offer a download but which actually link back to marketing material and stock photographs of people laughing at computer screens.
Thanks

A: There is not a separate package for installing Visual C++ 2005 Express Edition -- or any of the Visual Studio 2005 products -- on x64.
In order to target x64 in VS2005, I'm sorry to say, I'm going to give you this link: How to: Configure Visual C++ Projects to Target 64-Bit Platforms

A: Try the last one here Microsoft Windows SDK Update for Windows Vista and .NET Framework 3.0.
That will give you Visual C++ 2005 SP1.

A: If you just want the 64-bit compiler (no IDE) then you can download it as part of the Windows Vista SDK.

redpajama_set_name: RedPajamaStackExchange


text:
Q: onActivityResult do not fire if launch mode of activity is singleInstance I have an Activity which is basically my main activity and its launch mode is single instance. But because of singleInstance, the onActivityResult() callback does not fire. And if  I change the launch mode in my manifest file to any other mode it works fine.
Can you explain why this callback is not working?

A: I believe that the problem is that singleInstance doesn't let the callee activity to exist in the same task as the caller, hence it can't return the value to the caller.
Consider using singleTask instead:
singleTask

The system creates the activity at the
  root of a new task and routes the
  intent to it. However, if an instance
  of the activity already exists, the
  system routes the intent to existing
  instance through a call to its
  onNewIntent() method, rather than
  creating a new one.

singleInstance

Same as "singleTask", except that the
  system doesn't launch any other
  activities into the task holding the
  instance. The activity is always the
  single and only member of its task.

http://developer.android.com/guide/topics/manifest/activity-element.html

A: If an activity is singleInstance, it will be the only one in the task so it always be the top of the task. So when you call startActivityForResult it will fire the callback method immediately.

A: A "singleInstance" activity,  permits no other activities to be part of its task. It's the only activity in the task. If it starts another activity, that activity is assigned to a different task. The activity is always the single and only member of its task.
I think onActivityResult will not work with singleInstance

A: You can't use singleInstance or singleTask with startActivityForResult method.
Standard mode or singleTop launch mode will fix the problem.

A: Android Source Code
Check "ActivityStarter.computeLaunchingTaskFlags()" method:
            } else if (mSourceRecord.launchMode == LAUNCH_SINGLE_INSTANCE) {
            // The original activity who is starting us is running as a single
            // instance...  this new activity it is starting must go on its
            // own task.
            mLaunchFlags |= FLAG_ACTIVITY_NEW_TASK;

That's the reason why NEW_TASK flag is added when your original activity with single instance launch mode.
More Source Code
Check  "ActivityStarter.sendNewTaskResultRequestIfNeeded()" method:
        if (sourceStack != null && (mLaunchFlags & FLAG_ACTIVITY_NEW_TASK) != 0) {
        // For whatever reason this activity is being launched into a new task...
        // yet the caller has requested a result back.  Well, that is pretty messed up,
        // so instead immediately send back a cancel and let the new task continue launched
        // as normal without a dependency on its originator.
        Slog.w(TAG, "Activity is launching as a new task, so cancelling activity result.");
        sourceStack.sendActivityResultLocked(-1 /* callingUid */, mStartActivity.resultTo,
                mStartActivity.resultWho, mStartActivity.requestCode, RESULT_CANCELED,
                null /* data */);

That's the reason why FLAG_ACTIVITY_NEW_TASK always immediately return RESULT_CANCELED.

A: An example of my application can benefit someone:

*

*In the manifest file, my settings are:

<application android:launchMode="singleTask"...>

*

*I use one java class, only as a launcher(it does not show Activity). In the manifest, it is set to:

<activity android:launchMode="singleTop" ...>

*

*Also, other Activities are set the same:

<activity android:launchMode="singleTop" ...>
When a user sends an application to the background, by clicking on the application icon or restoring the application from the background, the last started Activity is returned unchanged, even though they were all started with startActivityForResult() from launcher.


text:
Q: Unable to load pmml file using pypmml on Windows. Getting FileNotFoundError: [WinError 2] The system cannot find the file specified I tried to install and use pypmml library to open and score a pmml file. I'm using jupyter notebook on Windows. When I'm running this code - model = Model.load('single_iris_dectree.xml'), I'm getting below error. But if I try to run it on Mac, it's running absolutely fine. Is there another way to load and score pmml file?
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-11-00bc89b72cd3> in <module>
----> 1 a = Model.load(p)

C:\ProgramData\Anaconda3\lib\site-packages\pypmml\model.py in load(cls, f)
    227             # Check if a file path
    228             if os.path.exists(model_content):
--> 229                 model = cls.fromFile(model_content)
    230             else:
    231                 model = cls.fromString(model_content)

C:\ProgramData\Anaconda3\lib\site-packages\pypmml\model.py in fromFile(cls, name)
    183     def fromFile(cls, name):
    184         """Load a model from PMML file with given pathname"""
--> 185         pc = PMMLContext.getOrCreate()
    186         try:
    187             java_model = pc._jvm.org.pmml4s.model.Model.fromFile(name)

........
C:\ProgramData\Anaconda3\lib\site-packages\py4j\java_gateway.py in launch_gateway(port, jarpath, classpath, javaopts, die_on_exit, redirect_stdout, redirect_stderr, daemonize_redirect, java_path, create_new_process_group, enable_auth, cwd, return_proc)
    326
    327     proc = Popen(command, stdout=PIPE, stdin=PIPE, stderr=stderr,
--> 328                  cwd=kwargs.get('cwd',None), **popen_kwargs)
    329
    330     # Determine which port the server started on (needed to support

C:\ProgramData\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
    798                                 c2pread, c2pwrite,
    799                                 errread, errwrite,
--> 800                                 restore_signals, start_new_session)
    801         except:
    802             # Cleanup if the child failed starting.

C:\ProgramData\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
   1205                                          env,
   1206                                          os.fspath(cwd) if cwd is not None else None,
-> 1207                                          startupinfo)
   1208             finally:
   1209                 # Child is launched. Close the parent's copy of those pipe

FileNotFoundError: [WinError 2] The system cannot find the file specified


text:
Q: Adaptive (multibitrate) streaming for Android Is it possible to perform adaptive (multibitrate) streaming onto an Android device? If yes, how to do that?

A: If you have 4.0 or 3.2 you just use access the adaptive stream as you would any other video. Literally.
It's a HTTP access.
So if you use as a data source //mywebsite/video1.mp4 you woulduse as a data source the equivalent //mywebsite/video1.m3u8.  Now, I'm not including any discussion on how you create your streaming file but only how you would access it.
All the magic happens within the client (ex: mediaplayer, videoview) supported on 4.0 and 3.2.  For the record, you may be able to access and run streaming segments (.m3u8 files) on earlier versions of Android because the manufactures have sometimes played around with the code.  But I haven't found any that actually adapt.  They usually stick to the first segment they run or default to the lower bitrate segment in the bunch and stay there regardless of bitrate.


text:
Q: mutiple curve fitting in binary images I have a binary image which contains 0s and 1s only. There are few trend lines in the image as shown below, is there any way to extract those lines from the image?

A: Yes, one way to extract the lines would be to use a RANSAC
algorithm iteratively.
It identifies the points that are close to a model function and
then removes them from the image. This allows to extract
a separate line in the next iteration.
Use y = a x + b as model function (where x and
y are the image coordinates and a should come out as close to
−1).
An implementation would work roughly as follows:

*

*Convert the image to a representation that allows you to treat
it as a set S of points where the value is 1 (in the
simplest case, a list or set of (x, y) tuples).

*Pick one point (x0, y0) from S
randomly and determine b0 such that
y0 = −x0 + b0
(i.e., draw a line with slope
a0 = −1 through the chosen
point).

*Find all points (x, y) in S that are "close" to the
line
y = a0 x + b0
and add them to a new set L.
(For example by using the condition
|a0 x + b0 − y| < t
for some threshold value t. Given that the lines in the
image are vertically spaced by about 85, t = 20 might be
a good choice.)

*Repeat steps 2 and 3 several times and remember the value for
b0 where L contained the most points.

*Refine a0 and b0, e.g. by doing
a least-squares fit of the model function to all points in
L, to obtain final values a and b (this step is
optional, you could just use a0 and
b0 directly). Now you have found one line.

*Remove all points in L from S.

*Repeat from step 2 as many times as needed to find all lines
in the image.  At the end there are only "noise" points left
in S.


text:
Q: weird tableview behavior when cell is selected My tableview has a weird behavior when a cell is selected but this behavior is not seen always. When a cell has been selected some cells which are below the selected cell moves. These two gifs will show you the behavior in the two cases when it is shown and when it doesn't appear.
this is the
tableview without weird behavior and this is the tableview with the weird behavior
and this is my code :
  func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell : UserTableViewCell = (tableView.dequeueReusableCell(withIdentifier: "userCell") as? UserTableViewCell)!
    if(self.firebaseUsers.count != 0){
    cell.influentBackgroudView.layer.cornerRadius=10
        let url = URL.init(string:  String().loadCorrectUrl(url:firebaseUsers[indexPath.row].image))
        cell.influentImageView.contentMode = .scaleAspectFit
        cell.influentImageView!.sd_setImage(with: url!, placeholderImage: UIImage.init(named: "placeholder"),options: [.continueInBackground,.progressiveDownload], completed: { (image, error, cacheType, imageURL) in
            if (error != nil) {
                cell.influentImageView!.image = UIImage(named: "placeholder")
            } else {
                cell.influentImageView.contentMode = .scaleAspectFill
                cell.influentImageView.image = image
            }

        })
        cell.influentImageView.layer.cornerRadius=10
        cell.influentImageView.layer.masksToBounds = true
        cell.influentNameLabel.text=" " + firebaseUsers[indexPath.row].name + " "
        cell.influentNameLabel.adjustsFontSizeToFitWidth = true
        cell.influentNameLabel.textAlignment = .center
        if(selectedCellIndex==indexPath ){
        cell.influentBackgroudView.isHidden=false
            }
        else{
            cell.influentBackgroudView.isHidden=true
            }
    cell.selectionStyle = .none
    }

    return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        let previousIndex=selectedCellIndex
        selectedCellIndex=indexPath
        if(previousIndex==selectedCellIndex){
            let nextVC = storyboard?.instantiateViewController(withIdentifier: "VisitedProfileViewController") as! VisitedProfileViewController
            nextVC.passedUser = firebaseUsers[selectedCellIndex!.row]
            navigationController?.pushViewController(nextVC, animated: true)
        }
        if(previousIndex==nil){
            tableView.reloadRows(at: [indexPath], with:.none)
        }
        else{
            if(previousIndex != indexPath){
                tableView.reloadRows(at: [indexPath,previousIndex!], with: .none)
            }
            else {
                tableView.reloadRows(at: [indexPath], with: .none)

                }
        }
}

thank you guys for your help!

A: As identified from the comments the issue you are facing is produced by calling reloadRows when you press a cell with conjunction of incorrect estimated row heights. So either reloading needs to be removed or estimated height corrected. The first solution is already covered in an answer provided by A. Amini.
Since many of such anomalies are related to estimated row height it still makes sense to improve it.
For simple static row heights you can either implement a delegate method for instance
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
    return indexPath.row == 0 ? 44.0 : 200.0
}

where the values are exactly the same as in your heightForRowAt method. Or if all rows have same hight you can remove this delegate method but set the heights directly in some initialization method like:
override func viewDidLoad() {
    super.viewDidLoad()

    tableView.rowHeight = 200
    tableView.estimatedRowHeight = tableView.rowHeight
}

When more complicated cells are introduced and automatic cell height is used we usually use a height cache of cells. It means we need to save height of a cell when it disappears so we may use it later. All heights are saved in a dictionary of type [IndexPath: CGFloat]. A very simple implementation should look like this:
private var cellHeightCache: [IndexPath: CGFloat] = [IndexPath: CGFloat]()

func tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath) {
    cellHeightCache[indexPath] = cell.bounds.height
}

func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
    return cellHeightCache[indexPath] ?? UITableView.automaticDimension
}

In some cases extra work is needed like clearing the cache when table view is reloaded.
The reason why this is happening is because table view will not reload cells around the cells you currently see but rather check the content offset and compute which cells you were supposed to be seeing. So any call to reload may make the table view jump or animate cells due to wrong estimated row height.

A: The main problem was you're reloading tableView after "each" selection.
Try this code out and let me know if you need more help.
class MyTableViewClass: UITableViewController {
    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "userCell" as! UserTableViewCell

        if !self.firebaseUsers.isEmpty {

            cell.influentBackgroudView.layer.cornerRadius = 10
            cell.influentImageView.contentMode = .scaleAspectFit

            let url = URL(string: firebaseUsers[indexPath.row].image)

            cell.influentImageView!.sd_setImage(with: url!, placeholderImage: UIImage(named: "placeholder"),options: [.continueInBackground,.progressiveDownload], completed: { (image, error, cacheType, imageURL) in
                if error != nil {
                    cell.influentImageView.contentMode = .scaleAspectFill
                }
            })

            cell.influentImageView.layer.cornerRadius=10
            cell.influentImageView.layer.masksToBounds = true
            cell.influentNameLabel.text = " \(firebaseUsers[indexPath.row].name) "
            cell.influentNameLabel.adjustsFontSizeToFitWidth = true
            cell.influentNameLabel.textAlignment = .center

            cell.selectionStyle = .none
        }

        return cell
    }

    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        let nextVC = storyboard?.instantiateViewController(withIdentifier: "VisitedProfileViewController") as! VisitedProfileViewController
        nextVC.passedUser = firebaseUsers[indexPath.row]
        navigationController?.pushViewController(nextVC, animated: true)
    }
}

class UserTableViewCell: UITableViewCell {

    override var isSelected: Bool {
        didSet {
            if isSelected {
                // Selected behavior, like change Background to blue
            } else {
                // Deselected behavior, change Background to clear
            }
        }
    }
}


text:
Q: Why does this function fail to sort an array properly? I'm using Google Apps Script to read a bunch of files in a Google Drive folder into an array, which all start with "Week #", where # is a number from 1 to 54. I then want to sort this array. Problem is, the string-based sort doesn't give me the result I want.
I know that Google Apps Script, like JavaScript, uses an alphabetical sorting method, so I would expect "Week 1..." to end up next to "Week 10..." instead of "Week 2...". Based on this answer, I wrote the sorter function below that I thought would deal with that problem. Basically I grab the first number from the title and use that to compare, so when looking between "Week 1..." and "Week 10..." it will just compare the numbers 1 and 10.
function sorter(a, b) {
  var aNum = a.replace("Week ", "");
  aNum = aNum.substr(0, aNum.indexOf(' '));
  var bNum = b.replace("Week ", "");
  bNum = bNum.substr(0, bNum.indexOf(' '));
  if (aNum < bNum) return -1;
  if (aNum > bNum) return 1;
  return 0;
}

function myFunction() {
  var folder = DriveApp.getFolderById('18xeGSgRQ9nAc19qn_KCScbMmixZY0agU');
  var query = "title contains 'Week '";
  var search = folder.searchFiles(query);
  var filelist = [];

  while (search.hasNext()) {
    var file = search.next();
    filename = file.getName();
    if (filename.startsWith('Week ')) {
      filelist.push(filename);
    }
  }

  filelist.sort(sorter);
  for (var i=0; i<filelist.length; i++) {
    Logger.log(filelist[i]);
  }
}

Problem is, this doesn't sort as expected. I've looped through the array and added everything to the Logger, and this is what it looks like ...
[20-12-20 15:22:02:556 PST] Week 1 (Dec 30 - Jan 5)
[20-12-20 15:22:02:558 PST] Week 10 (Mar 2 - Mar 8)
[20-12-20 15:22:02:559 PST] Week 11 (Mar 9 - Mar 15)
[20-12-20 15:22:02:560 PST] Week 12 (Mar 16 - Mar 22)
[20-12-20 15:22:02:562 PST] Week 13 (Mar 23 - Mar 29)
[20-12-20 15:22:02:563 PST] Week 14 (Mar 30 - Apr 5)
[20-12-20 15:22:02:564 PST] Week 15 (Apr 6 - Apr 12)
[20-12-20 15:22:02:566 PST] Week 17 (Apr 20 - Apr 26)
[20-12-20 15:22:02:567 PST] Week 18 (Apr 27 - May 3)
[20-12-20 15:22:02:569 PST] Week 2 (Jan 6 - Jan 12)
[20-12-20 15:22:02:571 PST] Week 20 (May 11 - May 17)
[20-12-20 15:22:02:573 PST] Week 22 (May 25 - Jun 1)
[20-12-20 15:22:02:575 PST] Week 23 (Jun 1 - Jun 7)
[20-12-20 15:22:02:578 PST] Week 25 (Jun 15 - Jun 21)
[20-12-20 15:22:02:579 PST] Week 26 (Jun 22 - Jun 28)

... And so on.
I've stepped through the debugger, and it's definitely grabbing the number from the file names correctly ... is there a reason why the sort function isn't properly sorting?


text:
Q: How to get part of a linestring that is less than 300 meters apart from another linestring? I've two linestrings Line1,Line2. I'm trying to get the part of Line1 that is 300m apart from line2.
line1 = "LINESTRING(72.863221 18.782499,72.863736 18.770147,72.882275 18.756169,72.881417 18.750805,72.878842 18.736987,72.874379 18.709512,72.860989 18.679593,72.864422 18.653897)"
line2 = "LINESTRING(72.883133 18.780793,72.882103 18.760314,72.862534 18.716422,72.860474 18.683577)"

I used the ST_DWithin function but it returns the whole linestring if the distance is lesser than 300 meters. Here's my query:
road2 = "ST_GeographyFromText('SRID=4326;%s')"%line1
road4 = "ST_GeographyFromText('SRID=4326;%s')"%line2
cur.execute("SELECT ST_AsText(road1) from %s as road1,%s as road2
            where ST_DWithin(road1,road2,500)"%(road2,road4))
res = cur.fetchall()
print res

Can anyone tell me what I'm doing wrong ?

A: You can use a combination of ST_Intersection/ ST_Buffer and ST_DWITHIN:
DROP TABLE IF EXISTS LINES;
CREATE TABLE LINES(gid serial, geom geometry(LINESTRING,4326));
INSERT INTO LINES (geom) VALUES(
(ST_SETSRID(ST_GEOMFROMTEXT('LINESTRING(72.863221 18.782499,72.863736 18.770147,72.882275 18.756169,72.881417 18.750805,72.878842 18.736987,72.874379 18.709512,72.860989 18.679593,72.864422 18.653897)'),4326))),
(
(ST_SETSRID(ST_GEOMFROMTEXT('LINESTRING(72.883133 18.780793,72.882103 18.760314,72.862534 18.716422,72.860474 18.683577)'),4326))
);

-- visualizing Buffer
INSERT INTO LINES (geom) VALUES(
(
SELECT ST_Transform(ST_Exteriorring(ST_Buffer(ST_Transform(geom,32643),300)),4326) from LINES where gid=2)
);

-- Intersection

DROP TABLE IF EXISTS Intersection;

CREATE TABLE Intersection(gid serial, geom geometry(MULTILINESTRING,4326));

INSERT INTO Intersection (geom) VALUES(

(
select
    st_transform(
      st_intersection(
        line1.geom,
        st_buffer(ST_Transform(line2.geom,32643),300))
      ,
      4326) as geom

from
  (SELECT ST_Transform(geom,32643) as geom from lines where gid=1) as line1,
  (SELECT ST_Transform(geom,32643) as geom from lines where gid=2) as line2

where
  st_dwithin(line1.geom, line2.geom, 300)
 )
  );


text:
Q: Concentration of centered variable, based on un-centered moments and tails For a random variable $X$ and positive integers $m,k$ the tail bound is:
$$P(|X|>t) \le \exp(- m t^{2/m} )$$
And for any $k\in\mathbb{N}^{+}$ the moments are given by:
$$E X^{2k+1} = 0$$
$$E X^{2k} \le   (k)^{m k}$$
If we center $X^2$ by $Y:=X^2 - E(X^2)$ , what can be said about the lower its tails?
$P(|Y|\ge t) = P(|X^2-E(X^2)|\ge t)$?
For the special case that $m=1$ and $m=2$, the tail bound implies that $X$ is sub-Gaussian and sub-exponential respectively, and one can use its machinery to derive some bounds. But I'm not sure what is the best way to derive the tail bounds for this case.
More context: this is a followup question on this MO question. As you can see, the answer derives the tail bound and moment bound mentioned here (discarding some constants). I thought there must be enough information in the moments to prove something about the tails of centered variable, which is why I didn't give the full context (I could be wrong thought?!)


text:
Q: Doctrine select between two coords How to merge?
$collection = $this->em->getRepository('User')->createQueryBuilder('u');
$collection = $collection->where('u.user IN (:followers)');

and
 $collection->addSelect(
     '(3959 * acos(cos(radians(' . 47.2146561 . '))' .
     '* cos(radians(p.latitude))' .
     '* cos(radians(p.longitude)' .
     '- radians(' . 38.920443 . '))' .
     '+ sin(radians(' . 47.2146561 . '))' .
     '* sin(radians(p.latitude)))) as distance' )->where('p.user = :user');

A: I'm not sure that's what you want to do, but my guess is you want to join a position table and add a select like follows:
$collection = $this->em->getRepository('User')->createQueryBuilder('u');
$collection->join('u.position', 'p')
           ->where('u.user IN (:followers)')
           ->addSelect(
        '(3959 * acos(cos(radians('.47.2146561.')) * cos(radians(p.latitude)) * cos(radians(p.longitude) - radians('.38.920443.')) + sin(radians('.47.2146561.')) * sin(radians(p.latitude)))) as distance'
    )

I hope this helps.
However There is still something I could not understand in your code. Why do you use concatenation with hard coded values?
If the aim is to have variables instead, then you made the right choice.
Please provide a bit more information the next time you ask (like the position table)


text:
Q: Not receiving Bluetooth events when adding/removing devices on Windows I am trying to create a Bluetooth manager type class. The class will search through all paired and unpaired Bluetooth devices that are whitelisted in my application, and add them to an internal list of devices.
I do this using the following code:
_deviceWatcher = DeviceInformation.CreateWatcher(_selector,
                     null, DeviceInformationKind.AssociationEndpoint);

as well as by subscribing to the following events:
_deviceWatcher.Added += _deviceWatcher_Added;
_deviceWatcher.Removed += _deviceWatcher_Removed;
_deviceWatcher.EnumerationCompleted += _deviceWatcher_EnumerationCompleted;

If a Bluetooth device I have whitelisted is on, the device watcher finds the device. But if I turn the device off, I never get a "removed" event.
If the device is off and I wait to receive the "enumeration complete" event, and then turn on the device, I never get the "added" event.
I tried the Microsoft-supplied sample ("DeviceEnumerationAndPairing") but that sample acts the same.
If I keep my program running and open up the Bluetooth settings, as shown below:

then it works as expected and I get the "update" and "removed" events when turning off and powering off the device.
Do I need to activate some sort of scanning routine to be able to detect Bluetooth devices that are available, and if so, how would I do that?

A:
An app must subscribe to all of the added, removed, and updated events to be notified when there are device additions, removals or updates. If an app handles only the added event, it will not receive an update if a device is added to the system after the initial device enumeration completes.

For more info, see Remark of DeviceInformation.CreateWatcher.
According to the document, we should be able to add the added, removed and updated events of the DeviceWatcher. When I close the device, the removed event will be fired.
Please note, when the device has paired that if you close it, the Removed event will not be fired. Also it will not be removed in the Bluetooth settings.


text:
Q: Menu not displaying in chrome with polymer 2.0 I am new to polymer framework. I am using polymer 2.0.0-rc.3 and latest version of chrome. But below code is not displaying menus.Only "Hello World" is printed in browser. The developer tools console does not show any error.
Below is the code
test-app.html
<link rel="import" href="../bower_components/polymer/polymer-element.html">
<link rel="import" href="../bower_components/paper-menu/paper-menu.html">
<link rel="import" href="../bower_components/paper-toolbar/paper-toolbar.html">
<link rel="import" href="../bower_components/paper-item/paper-item.html">

<dom-module id="test-app">
  <template>

Hello World

   <paper-toolbar>

        <paper-menu>
          <paper-item>Inbox</paper-item>
          <paper-item>Starred</paper-item>
          <paper-item>Sent mail</paper-item>
          <paper-item>Drafts</paper-item>
        </paper-menu>

     </paper-toolbar>
   </template>

</dom-module>

index.html
<!doctype html>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
  <title>test</title>
  <link rel="import" href="src/test-app.html" async>

  <test-app unresolved>test</test-app>

bower.json
"polymer": "polymer/polymer#^2.0.0-rc.3",
"app-layout": "polymerelements/app-layout#^0.10.7",
"app-route": "polymerelements/app-route#^0.9.3",
"iron-flex-layout": "polymerelements/iron-flex-layout#^1.3.2",
"iron-form": "polymerelements/iron-form#^1.1.4",
"iron-icon": "polymerelements/iron-icon#^1.0.12",
"iron-pages": "polymerelements/iron-pages#^1.0.8",
"iron-selector": "polymerelements/iron-selector#^1.5.2",
"paper-icon-button": "polymerelements/paper-icon-button#^1.1.4",
"paper-spinner": "polymerelements/paper-spinner#^1.2.1",
"iron-media-query": "polymerelements/iron-media-query#^1.0.8",
"paper-menu": "polymerelements/paper-menu#^1.2.2",
"paper-item": "polymerelements/paper-item#^1.2.1",
"paper-toolbar": "polymerelements/paper-toolbar#^1.1.7"

Does any body have any idea about error? Any guide as how can I debug it to find error?

A: paper-menu has been deprecated in Polymer 2. As this comment says:

This element is deprecated in favor of paper-listbox, which has been ported already to Polymer 2.0.


text:
Q: Path issue in Swift framework binary The situation:
I am inheriting a project built in Swift 2 over the previous year by engineers who left the company before I joined.
The project consists of two frameworks with dependencies on Stephen Celis' SQLite.Swift framework, which need to be distributed to Business Units all over the world as binary files rather than private Cocoapod repositories, because of corporate policies.
The issue
Any framework I compile (whether ours or Stephen Celis') contains hardcoded paths of the form /Users/myaccount/Library/Developer/Xcode/DerivedData/Untitled-cbiuymbtgddcooadzhacxrxlrtfd/Build/Intermediates/SQLite.build/Debug-iphonesimulator/SQLite iOS.build/Objects-normal/i     386/SQLite.swiftmodule^@/Users/myaccount/Documents/SQLite.swift-master/SQLite/Core/ where I'd expect @rpath based ones. (The example here being SQLite.swift).
I have been looking for a way to tell Xcode (Version 7.3.1, 7D1014) to use relative paths in the binary but couldn't figure it out. Where is my approach wrong?

A: I started a Code-Level Support Ticket, but Apple close-and-refund'ed it on the grounds that "Distributing binary Swift frameworks remains unsupported in Xcode 8.".
I'm afraid that for now, this objective remains out of my reach.


text:
Q: Automatically submit form with first option (PHP) I have a project in which I must do something like this:
when a user's page loads, he gets a personalized select box (with some options generated by PHP for him) and then, when he changes the option, I must change the rest of the content (on the same page).
for example, let the select box for a kind of user be:

*

*Main content

*Tools

Now, my idea was to have a
<form action="processing.php">
<select name="choice" onChange="submit();"> etc. which should pass the user's choice to processing.php. The problem is, I want the first option to be automatically selected and the content for that option to appear when the page loads - somehow like the first option to be automatically submitted.
Also, different kind of users should get different options, and I thought I can use a single page to process these requests. Is this achievable?
Can you please help me with an idea on how to submit that form automatically with the first generated option? Thank you.

A: You can use the onChange Event of the selection. In the handler you can then do the redirect
   let sel = document.getElementById('yourselect');
   let form = document.getElementById('yourform');
   sel.onchange = function() {
      form.submit()
   }

A: You can easily bind the select change with Javascript. Here is the example with jQuery:

$('#mySelect').on('change', function(){
   // Do your staff
   $('#myForm').submit();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form id="myForm">
<select id="mySelect" method="post" action="processing.php" name="select_name">
<option value="">Select One</option>
  <option value="http://google.com">Google</option>
  </select>
</form>


text:
Q: Is there a Linux C API call to query a mounted filesystem to see if it is read-only? First, a little background information to provide some motivation for this question:  I've got a program that runs on a headless Linux server and reads/writes files on several removable external hard drives, each of which is formatted with ext4 filesystem.  Very occasionally, the filesystem metadata on one of these drives gets corrupted for whatever reason (ext4 journalling notwithstanding), which can cause the ext4 filesystem drive to detect a problem and remount the partition as read-only, presumably as a precaution against cascading errors corrupting the drive further.
Okay, fair enough; but what I'd like to do now is add a function to my program that can detect when the drive is in this remounted-read-only state, so that it can pro-actively notify the user that his drive is in trouble.
My question is, what is an elegant/supported way to query a filesystem to find out if it is mounted read-only?
Attempting to write a file to the filesystem isn't good enough, because that could fail for other reasons, and also because I don't want to write to the filesystem if I don't have to.
My program could fopen("/proc/mounts", "r") and parse the lines of text that it generates (grepping for the "rw," token on the line corresponding to my partition), and I will if I have to, but that solution seems a bit hacky (too much like screen-scraping, liable to break if the text format ever changes).
So, is there some lightweight/purpose-built Linux system call that I could use that would tell me whether a given filesystem mount point (e.g. "/dev/sda1") is currently mounted read-only?  It seems like stat() might be able to do it, but I can't see how.

A: The getmntent() family should meet your needs.

NAME
getmntent,  setmntent, addmntent, endmntent, hasmntopt, getmntent_r -
         get filesystem descriptor file entry
SYNOPSIS
   #include <stdio.h>
   #include <mntent.h>

   FILE *setmntent(const char *filename, const char *type);

   struct mntent *getmntent(FILE *stream);

   int addmntent(FILE *stream, const struct mntent *mnt);

   int endmntent(FILE *streamp);

   char *hasmntopt(const struct mntent *mnt, const char *opt);

   /* GNU extension */
   #include <mntent.h>

   struct mntent *getmntent_r(FILE *streamp, struct mntent *mntbuf,
                              char *buf, int buflen);

DESCRIPTION
These routines are used to access the filesystem description file
  /etc/fstab and the mounted filesystem description file /etc/mtab.
The setmntent() function opens the filesystem description file
  filename and returns a file pointer which can be used by getmntent().
  The argument type is the type of access required and can take the same
  values as the mode argument of fopen(3).
The getmntent() function reads the next line of the filesystem
  description file from stream and returns a pointer to a structure
  containing the broken out fields from a line in the file.  The pointer
  points to a static area of memory which is overwritten by subsequent
  calls to getmntent().
The addmntent() function adds the mntent structure mnt to the end of
  the open stream.
The endmntent() function closes the stream associated with the
  filesystem description file.
The hasmntopt() function scans the mnt_opts field (see below) of the
  mntent structure mnt for a substring that matches opt.  See
  and mount(8) for valid mount options.
The reentrant getmntent_r() function is similar to getmntent(), but
  stores the struct mount in the provided *mntbuf and stores the strings
  pointed to by the entries in that struct in the provided array buf of
  size buflen.
The mntent structure is defined in  as follows:
       struct mntent {
           char *mnt_fsname;   /* name of mounted filesystem */
           char *mnt_dir;      /* filesystem path prefix */
           char *mnt_type;     /* mount type (see mntent.h) */
           char *mnt_opts;     /* mount options (see mntent.h) */
           int   mnt_freq;     /* dump frequency in days */
           int   mnt_passno;   /* pass number on parallel fsck */
       };

...

A: The easiest way to check that the filesystem of an open file for writing has become mounted read-only is to check the errno variable for EROFS error.
If you don't have the possibility of having a writable directory or file in that filesystem, you cannot get a portable way of checking if the filesystem has become read only (more if it has become so due to device errors)
Another way is to ask the administrator to check, or try to read the /proc/mounts file yourself.  But this is linux specific only.


text:
Q: use variables in "document.Form1.checkbox.checked == true" in
    document.Form1.checkbox.checked == true

can i substitute Form1 and checkbox by javascript variables??
    var a= checkbox;
    var b= Form1;
    document.b.a.checked == true

A: You can do it like this:
var form = 'Form1';
var field = 'checkbox';

document[form][field].checked == true

Also you can give ID for that checkbox and then use it.
document.getElementById('checkbox1').checked == true


text:
Q: Adding notification of USB (add/remove) in JNI (OSX) - Fails I used the following code:
How to know when a HID USB/Bluetooth device is connected in Cocoa?
and added it to my jni library. Notification methods never gets called.
Then I tested the code in a small app (without in java / mostly C code). I works all good.
My guess is that Java is preventing the notification to take place.
Any ideas on what I can do ?

A: I believe this is because no run loop is being run in the Java/JNI environment.
Take a look at how javahidapi is implemented, specifically how it creates a separate thread to run hid_runloop_thread(), which then calls CFRunLoopRunInMode() until it returns a finished/cancelled status.
Note that run loops are thread-specific, so you need to do your CFRunLoopAddSource () and IOServiceAddMatchingNotification() calls from the same thread before calling CFRunLoopRunInMode().


text:
Q: How to handle file upload chunks on the server (Plupload/Spring MVC)? On our client, it is possible to be uploading large files. We want to use chunking to reduce the size of the requests. We are using Plupload, so it's easy to send up the files in chunks. However, I'm not sure how to handle the chunks. We are using Spring MVC on the server, and I current have the following for my controller method: uploadMedia(@RequestBody MultipartFile file) where MultipartFile is org.springframework.web.multipart.MultipartFile. This works just fine when not doing chunking. When I turn on the chunking on the client side, it still gets into this method just fine, but I don't see anything on the file that gets passed in that identifies what file the chunk is a part of. Hopefully I'm just missing something.
It seems like this is a common workflow, but I can't seem to find any good examples of how this is done on the server side. A solution with just Spring would be great, but if another library is needed, that is fine too. I looked some at Apache Commons FileUpload, but I couldn't find anything about chunking on there. Any help with this would be great. Thanks.

A: I debugged through this some more and added a HttpServletRequest to my controller method to see if there was anything available in there. I found that the request I received was a org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest which has a field called multipartParameters which is just a HashMap. I found that this map had keys of name, chunks, and chunk. So, I decided to try the following as my signature:
uploadMedia(@RequestBody MultipartFile file, @RequestParam String name, @RequestParam int chunks, @RequestParam int chunk)

Sure enough, those @RequestParam parameters got populated with the name of the file, the number of chunks, and the chunk number (zero-based) respectively. Having this information with each request will make it pretty easy to assemble the chunks into the final file.
One thing to know also, is that if the file does not need to be chunked (the file size is less than the chunk size), the chunks and chunk parameters are not sent up. So, my final signature ended up looking like this:
uploadMedia(@RequestBody MultipartFile file, @RequestParam String name, @RequestParam(required=false, defaultValue="-1") int chunks, @RequestParam(required=false, defaultValue="-1") int chunk)

Then I can check for -1 to see if I need to worry about chunking at all.
So, in the controller method itself I have something like this:
Media media = new Media();
//set stuff on my Media object for storing info about the file in the DB
//....
if (chunks > 0 && chunk > 0)
{
    //Need to append the bytes in this chunk
    mediaRepository.appendBytes(media, file.getBytes());
    if (chunk == chunks - 1)
    {
        //last chunk, upload is done
        onUploadFinished(media);
    }
}
else
{
    //Write out the first set of bytes
    mediaRepository.saveBytes(media, file.getBytes());
    if (chunks <= 0)
    {
        //no chunks were needed, all the bytes have been written out, upload is done
        onUploadFinished(media);
    }
}


text:
Q: Qwt - replot does not clear current plot This is my first question here and I believe that I havent seen anyone else asking for this specific problem but what I'm currently dealing with is a qwt plot that doesn't want to replot.
What I want to do: Call the replot() method to clear my current plot.
My problem: When calling replot() does not clear my current plot and my plots are drawn on top of eachother.
Here is a link to an image of my problem
As can be seen in the image, the new curves are drawn on top of the existing ones and this is what I want to solve.
Here is some of my code: (let me know if I missed some parts)
plot.cpp
#include "plot.h"
#include <qwt_plot.h>
#include <qwt_plot_grid.h>
#include <qwt_plot_layout.h>
#include <qwt_plot_canvas.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_directpainter.h>
#include <qwt_curve_fitter.h>
#include <qwt_painter.h>

class CurveData: public QwtArraySeriesData<QPointF>
{
public:
    CurveData()
    {
    }

    virtual QRectF boundingRect() const
    {
        if ( d_boundingRect.width() < 0.0 )
            d_boundingRect = qwtBoundingRect( *this );

        return d_boundingRect;
    }

    inline void append( const QPointF &point )
    {
        d_samples += point;
    }

    void clear()
    {
        d_samples.clear();
        d_samples.squeeze();
        d_boundingRect = QRectF( 0.0, 0.0, -1.0, -1.0 );
    }
};

Plot::Plot( QWidget *parent ):
    QwtPlot( parent )
{
    d_directPainter = new QwtPlotDirectPainter(this);

    setAutoReplot(false);

    setAxisScale(QwtPlot::yLeft, 0.014,0.016);
    setAxisScale(QwtPlot::xBottom, 0, 1000);

    d_curve = new QwtPlotCurve();
    d_curve->setData(new CurveData());

    d_curve->attach(this);
}

void Plot::AppendPoint(const QPointF &point)
{
    CurveData *data = static_cast<CurveData *>(d_curve->data());
    data->append(point);
}

void Plot::DrawCurveSegment()
{
    CurveData *data = static_cast<CurveData *>(d_curve->data());

    d_directPainter->drawSeries(d_curve, data->size()-11, data->size()-1);
}

void Plot::ClearPlot()
{
    CurveData *data = static_cast<CurveData *>(d_curve->data());
    data->clear();

    QwtPlot::replot();
}

mainwindow.cpp
MainWindow::MainWindow(QWidget *parent):
    QWidget( parent )
{
    d_plot = new Plot();
    counter = 0;
    loopCounter = 0;

// ... //

}

void MainWindow::timerEvent(QTimerEvent *) {
    if (counter>0 && counter%1000==0)
    {
        d_plot->ClearPlot();
        d_plot->replot();
        loopCounter++;
        qDebug()<<"clear!";
    }

    for (int ii=0; ii<10;ii++)
    {
        double y = someArray[counter];
        double x = (double)counter-((double)loopCounter*1000);

        counter++;
        d_plot->AppendPoint(QPointF(x,y));
    }
    d_plot->DrawCurveSegment();
}

Would very much appreciate if someone can see what I'm doing wrong.
Best regards!

A: I solved the problem by changing the clearPlot method to the following:
void Plot::ClearPlot()
{
    CurveData *data = static_cast<CurveData *>(d_curve->data());
    data->clear();

    QwtPlot::replot();
    QwtPlot::repaint();
}

A: You can also do this:
QwtPlot::detachItems(QwtPlotItem::Rtti_PlotItem, true);


text:
Q: Override default convention for DisplayNameFor() I have lots of property names with PascalCase names.
For example:
public string ProposalNotes { get; set; }

I am after overriding the default Html.DisplayNameFor() method to automatically split the property names to "Proposal Notes" without having to add the display attributes as below:
[Display(Name = "Proposal Notes")]

I want the DisplayName attributes to still work when I need to override this new convention. For example when I have property names like "PgCodeInst" to "Institution Code".
Is there any way of doing this?
I remember a tutorial on how to do something similar but cannot find it.

A: It's certainly possible, but I just went digging through the source a bit, and I think you're going to find it far more trouble than it's worth. There's multiple classes you'd have to derive from and override methods on, and then you'd have to wire in all your custom stuff in place of the built-ins.
Adding the Display attribute is not really all that much of a burden, and frankly is a bit more explicit in its intention, which is always a good thing. However, if you're dead-set against using it, you might instead consider using a library like Humanizer and just doing something like:
@nameof(Model.ProposalNotes).Titleize();

FWIW, you'd need to add the using statement to your view (@using Humanizer), but you can do that just once in _ViewImports.cshtml.
Also, depending on what you actually want the display name for, you can always just create a custom tag helper. For example, to automatically do this with labels, you can simply inherit from LabelTagHelper (or create your own) and use you own custom logic  for determining the display name to show there, instead of worrying about changing the behavior of something like DisplayNameFor. You can also create a custom tag helper to just output the titleized name as above:
public class TitleizeTagHelper : TagHelper
{
    const string ForAttributeName = "asp-for";

    [HtmlAttributeName(ForAttributeName)]
    public ModelExpression For { get; set; }

    public override void Process(TagHelperContext context, TagHelperOutput output)
    {
        output.TagName = "span";
        output.SetContent(For.Name.Titleize());
    }
}

Then:
<titleize asp-for="ProposalNotes" />

That's a bit of overkill for something so simple, admittedly, but you could beef it up by stealing the logic from LabelTagHelper to support custom display names, as well, if the attribute is actually applied.


text:
Q: What does python slicing syntax [o:,:] mean Just a small and probably very simple question. Someone gave me the following line of code:
im = axs[0,i].pcolormesh(imgX[o:,:], imgY[o:,:], img.mean(-1)[o:,:], cmap='Greys')

I know ":" means everything in that column or row (or array depth, depending on how you look at it). But what does "o:" mean?

A: The following is not related to the usage, but shows how the operation "is parsed".

class X:
   def __getitem__(self, index):
       return index

X()[:,:]
>> (slice(None,None,None), slice(None,None,None))

And with different values for clarity:
X()[0, 1:, 3:4, 5:6:7]
>> (0, slice(1,None,None), slice(3,4,None), slice(5,6,7))

So, with that in mind img[o:,:] is like img[o:, :] is like
img.__getitem__( (slice(o,None,None), slice(None,None,None)) )

A: o is a variable like any other (but with a very bad name, as it can be confused with a zero).
[o:, :] means "all the elements from the first axis starting in the element o, and all in the second axis. In your particular case, the image will show only the rows from o to the bottom.
I want to add that in this case, you are getting a view, i.e., a reference to the original array, so the data is not actually copied.


text:
Q: SSH Agent Forwarding on AWS NAT Gateway I know that it's possible to configure SSH Agent forwarding on Bastion Instance and NAT Instance. Is it possible to do this on NAT Gateway as well?

A: NAT Gateway is a managed service - AWS will not provide console or any other access to server. It responsible only to perform Network Address Translation (NAT). To reach instance in NATed subnets you will need to create a separate bastion host in external segment.


text:
Q: Exporting integers as an image in Java How can I export an array of three colour values (0-255), (0-255), (0-255) as an image in Java? I have a 3-D array where the first the first two dimensions define the pixel and the third dimension, containing three elements, has the three RGB values.

A: Try String 2D array and parse it later back to a int,
E.g. if your pixel '0,0' is the color '25,25,25'
pixel [0] [0] = "25,25,25"
and then use String.split(",") to split the String into rr,gg,bb


text:
Q: I'm having trouble with math terminology, when is it appropriate to say "mapping" or "maps to"? For example, in a homework assignment I need to prove that a metric space $M$ is isometric to itself. If I say that $M$ maps to $M$ is that the same as saying that theres a function that takes elements from $M$ and I get a result in $M$? Or what is the "literal" meaning behind saying "map/maps/mapping".

A: It is essentially what you say. To be precise, you need to find a function $f$ that maps $M$ to $M$ and is isometric. There isn't really much more to it: a map is a functional relationship between two spaces (domain and range/codomain). It is used interchangeably as in "$f$ maps $M$ to $M$", "$f$ is a map from $M$ to $M$", or "$f$ is a function mapping $M$ to $M$".

A: "Map" is not a precise word; if someone said that $M$ "maps to" $N$ it is safe to assume that there exists some function $f: M\to N$, but without more information it is hard to say anything more specific about $f$, although depending on the context it might mean that $f$ is a homeomorphism, diffeomorphism, isomorphism, etc.
In any case I would recommend writing "$f$ maps $M$ to $N$" over "$M$ maps to $N$," as the former has far more currency than the latter.


text:
Q: WebView blocking pop up windows? I'm using WebView to browse pesopay.com and it works properly, except when I pressed the submit button. Using internet browsers like Google Chrome will show a pop up window, it confirms the information you filled. But in my Android WebView nothing happened when I pressed the submit button. I think because WebView is not enabled to display a pop up window.
Can anyone point me what is wrong?
Here is my activity:
public class PaymentActivity extends Activity {

String amount1;
    @SuppressLint("SetJavaScriptEnabled")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.payment);

         Bundle extras = getIntent().getExtras();
            if(extras !=null)
            {
                amount1 = extras.getString("amount1");

            }

        WebView web = (WebView) findViewById(R.id.web1);
        web.getSettings().setJavaScriptEnabled(true);
        web.loadUrl("javascript:window.onload = function(){setValue(\""+ amount1 +"\");};");
        web.loadUrl("file:///android_asset/www/index.html");
    }
}

My web page:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

        <form method="POST" name="frmPayment" action="https://test.pesopay.com/b2cDemo/eng/payment/payForm.jsp">

            Order Reference No. (your reference number for every transaction that has transpired):
            <input type="text" id="orderRefId" name="orderRef" value="Test-001"/>

            Amount:
            <input type="text" name="amount" id="amount" value=""/>

            Currency Code - "608" for Philippine Peso, "840" for US Dollar:
            <input type="text" name="currCode" value="608"/>

            Language:
            <input type="text" name="lang" value="E"/>

            Merchant ID (the merchant identification number that was issued to you - merchant IDs between test account and live account are not the same):
            <input type="text" name="merchantId" value="18056869"/>

            Redirect to a URL upon failed transaction:
            <input type="text" name="failUrl" value="http://www.yahoo.com?flag=failed"/>

            Redirect to a URL upon successful transaction:
            <input type="text" name="successUrl" value="http://www.google.com?flag=success"/>

            Redirect to a URL upon canceled transaction:
            <input type="text" name="cancelUrl" value="http://www.altavista.com?flag=cancel"/>

            Type of payment (normal sales or authorized i.e. hold payment):
            <input type="text" name="payType" value="N"/>

            Payment Method - Change to "ALL" for all the activated payment methods in the account, Change to "BancNet" for BancNet debit card payments only, Change to "GCASH" for GCash mobile payments only, Change to "CC" for credit card payments only:
            <input type="text" name="payMethod" value="ALL"/>

            Remark:
            <input type="text" name="remark" value="Asiapay Test"/>

        <input type="submit" value="Submit">

        </form>

A: If i am getting right , you need to use JavaScriptInterface  for calling JavaScript function from Android.
Check this link which may help you :
http://www.codeproject.com/Articles/392603/Android-addJavaScriptInterface
Or check some websettings :
http://developer.android.com/reference/android/webkit/WebSettings.html#setSupportMultipleWindows%28boolean
try to put this code in onCreate()
        webView.getSettings().setPluginsEnabled(true);
        webView.getSettings().setAllowFileAccess(true);
        webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);

A: The function which is responsible for dialogs in Webview is onJsAlert of WebChromeClient.
Here is sample code
  public class MyWebChromeClient extends WebChromeClient {
    @Override
    public boolean onJsAlert(WebView view, String url, String message, JsResult jsResult) {
        // you can create your own dialog here or just return true for no pop up.
        return true;
    }
}

and add this to your webview:
MyWebChromeClient myWebChromeClient = new MyWebChromeClient();
webView.setWebChromeClient(myWebChromeClient);


text:
Q: What is the difference between the dimension of a group and the dimension of its representation? I'm reading the following post to learn about QCD interactions:
Why are 3 colors used in QCD?
However, I can't seem to grasp the conceptual difference between the dimension of a group and the dimension of its representation. The information I found uses representation theory formalism that I don't quite understand yet.
What is the difference in the definition of the dimension of a group and its representation? And in particular, why does $SU(N)$ symmetry corresponds to $N^2-1$ conserved charges?

A: Diracology's answer is correct in that this is the standard usage of the term "dimension of a representation", but I am guessing that you may be confused simply because there is another plausible meaning the phrase might have, but does not, in the literature.
Recall that a representation $\rho:\mathfrak{G}\to\mathrm{End}(V)$ is a homomorphism between a Lie group $\mathfrak{G}$ and the group $\mathrm{End}(V)$ of linear, homogeneous endomorphisms on a vector space $V$. Example: $\mathfrak{G}$ is often the Lorentz or Poincaré group and $V$ the separable, infinite dimensional Hilbert space of the states of a quantum system and we seek $\rho$ that tells us what unitary transformation our quantum state space undergoes when Poincaré transformations are imparted to the rest frame of the quantum system.
The dimension of this representation is, as discussed in Diracology's answer, $\aleph_0$. Or, in slightly different examples, it could be some finite number: the same as the dimension of the quantum state space in question: the dimension of the vector space $V$.
However, we always demand that $\rho$ should be smooth, so that the group of endomorphisms $\mathfrak{H} = \mathrm{Im}(\rho)\subseteq\mathrm{End}(V)\subseteq GL(V)$ at the pointy end of the homomorphism $\rho$ is also a Lie group. Accordingly, because $\rho$ is a homomorphism, $\mathfrak{H}$'s dimension as a Lie group must be equal to or smaller than that of the original Lie group. This is the second plausible meaning of dimension here, but it is not standard usage to call this number the dimension of the representation. This latter dimension depends on the kernel of the homomorphism. If the kernel is discrete, then $\mathfrak{G}$ is a cover of  $\mathfrak{H}$ and the two groups have the same dimension. If the kernel is itself a Lie group, then the $\mathfrak{H}$'s dimension is less than that of $\mathfrak{G}$ such that $\dim(\mathfrak{G})=\dim(\mathfrak{H}) + \dim(\ker(\rho))$.

A: An illustrative example.
The group $SU(2)$ is 3-dimensional.   It's generated by the three Pauli matrices.
$$\sigma_x = \left(\begin{matrix}0&1\\ 1 & 0\end{matrix}\right) \qquad \sigma_y =  \left(\begin{matrix}0&i\\ -i & 0\end{matrix}\right)\qquad  \sigma_z = \left(\begin{matrix}1&0\\ 0 & -1\end{matrix}\right)$$
These matrices act by multiplication on a $2$-dimensional vector space, the standard representation of $SU(2)$.  The dimension of this representation is $2$.

A: The dimension of a Lie group is given equivalently by the dimension of its corresponding manifold, the dimension of its associated Lie algebra or the number of group generators.
On the other hand to understand what the dimension of a (linear) representation is we shall understand what a linear representation means. Group elements are abstract in the sense that they are defined by the way they act on certain objects. For example, the rotation group in three dimensions is given by operators that rotate three dimensional vectors. Given a linear representation, the group elements are appropriately mapped into linear operators which act on a linear space. The dimension of this linear space is the dimension of the representation. Recalling that linear operators acting on a linear space can be written as $n$x$n$ matrices, then we see that the dimension of the corresponding representation is $n$. The Lie algebra representation is also defined in the same way and this actually induces the group representation since group elements can be obtained by the exponentiation of the algebra.
In particular, the group $SU(N)$ has dimension $N^2-1$, since it has $N^2-1$ generators, and among others it has the so-called defining and adjoint representations which have dimensions $N$ and $N^2-1$, respectively. This is because the group $SU(N)$ can be defined as the set of $N$x$N$ unitary matrices with unit determinant and the adjoint representation of the algebra uses the algebra itself as the linear space for the representation.


text:
Q: Is it possible to define global variables in postgresql I am using postgresql 9.4 and while writing functions I want to use self-defined error_codes (int). However I may want to change the exact numeric values later.
For instance
-1 means USER_NOT_FOUND.
-2 means USER_DOES_NOT_HAVE_PERMISSION.
I can define these in a table codes_table(code_name::text, code_value::integer) and use them in functions as follows
(SELECT codes_table.code_value FROM codes_table WHERE codes_table.code_name = 'USER_NOT_FOUND')

Is there another way for this. Maybe global variables?

A: You can use this
CREATE OR REPLACE FUNCTION globals.maxCities()
  RETURNS integer AS
  $$SELECT 100 $$ LANGUAGE sql IMMUTABLE;

.. and directly use globals.maxCities() in the code.

A: Postgres does not have global variables.
However you can define custom configuration parameters.
To keep things clear define your own parameters with a given prefix, say glb.
This simple function will make it easier to place the parameter in queries:
create or replace function glb(code text)
returns integer language sql as $$
    select current_setting('glb.' || code)::integer;
$$;

set glb.user_not_found to -1;
set glb.user_does_not_have_permission to -2;

select glb('user_not_found'), glb('user_does_not_have_permission');

User-defined parameters are local in the session, therefore the parameters should be defined at the beginning of each session.

A: Building on @klin's answer, there are a couple of ways to persist a configuration parameter beyond the current session. Note that these require superuser privieges.
To set a value for all connections to a particular database:
ALTER DATABASE db SET abc.xyz = 1;

You can also set a server-wide value using the ALTER SYSTEM command, added in 9.4. It only seems to work for user-defined parameters if they have already been SET in your current session. Note also that this requires a configuration reload to take effect.
SET abc.xyz = 1;
ALTER SYSTEM SET abc.xyz = 1;
SELECT pg_reload_conf();

Pre-9.4, you can accomplish the same thing by adding the parameter to your server's postgresql.conf file. In 9.1 and earlier, you also need to register a custom variable class.

A: You can use a trick and declare your variables as a 1-row CTE, which you then CROSS JOIN to the rest. See example:
WITH
variables AS (
    SELECT 'value1'::TEXT AS var1, 10::INT AS var2
)
SELECT t.*, v.*
FROM
    my_table AS t
    CROSS JOIN variables AS v
WHERE t.random_int_column = var2;

A: Postgresql does not support global variables on the DB level. Why not add it:
CREATE TABLE global_variables (
  key text not null PRIMARY KEY
  value text
);

INSERT INTO global_variables (key, value) VALUES ('error_code_for_spaceship_engine', '404');

If different types may be the values, consider JSON to be the type for value, but then deserialization code is required for each type.

A: Note that if you work with database-level settings, as in @nick-barnes his answer, these will be set as session defaults when the user connects to that database, but can be overridden for that session (or a transaction).
If you wish to enforce a database setting, you can do so by going directly to the pg_db_role_setting system catalog, as done by this function from my pg_safer_settings extension (copied here with my explicit permission ):
create function pg_db_setting(pg_setting_name$ text, pg_role$ regrole = 0)
    returns text
    stable
--    security definer
    return (
        select
            regexp_replace(expanded_settings.raw_setting, E'^[^=]+=', '')
        from
            pg_catalog.pg_db_role_setting
        inner join
            pg_catalog.pg_database
            on pg_database.oid = pg_db_role_setting.setdatabase
        cross join lateral
            unnest(pg_db_role_setting.setconfig) as expanded_settings(raw_setting)
        where
            pg_database.datname = current_database()
            and pg_db_role_setting.setrole = coalesce(
                pg_role$,
                0  -- 0 means "not role-specific"
            )
            and expanded_settings.raw_setting like pg_setting_name$ || '=%'
        limit 1
    );

Here's an example to illustrate the difference between the semantics of the pg_catalog.current_setting() function and my pg_db_role_setting() function:
CREATE DATABASE mydb;
CONNECT TO mydb
CREATE ROLE myrole;
ALTER DATABASE mydb
    SET app.settings.bla = 1::text;
ALTER ROLE myrole
    IN DATABASE mydb
    SET app.settings.bla = 2::text;
SET ROLE myrole;
SET app.settings.bla TO 3::text;
SELECT current_setting('app.settings.bla', true);  -- '3'
SELECT pg_db_role_setting('app.settings.bla');  -- '1'
SELECT pg_db_role_setting('app.settings.bla', current_user);  -- '2'

Another common pattern is to store settings as IMMUTABLE functions or in a table. If you store them in a table, do me a favor and store them as columns, not rows. My pg_safer_settings extension features a pg_safer_settings_table which combines these 2 paradigms, by allowing you to store your settings as columns, and automatically maintaining a current_<col_name>() function for each of these columns. (The current_ prefix is configurable.)


text:
Q: How do I prevent my touchpad from initialising? I run Ubuntu 16.04 on an HP Pavilion.  My touchpad is faulty and keeps making my cursor flick up and down.  I fix this by going into the terminal and typing "xinput set-prop 13 "Device Enabled" 0", but it is tedious to do this every time.  Is there a way please of changing the initialisation of my computer so that the touchpad does not get switched on in the first place?  I hardly ever use it.
Thanks for this reply, Bollix47.  To use your first solution I think I'd need to do this every time I use my computer, which I'm trying to avoid.  Your second solution looks better.  Would you please tell me how to write a bash file and to incorporate it in autostart?  I've never done this before.

A: I've used gnome-tweak-tool to disable my touchpad.  Under Keyboard & Mouse click on the drop down menu next to Click Method and select None.
Another method I've used, that is dependent on having the synaptics driver installed (Synaptics TouchPad driver for X.Org server), is to create a simple bash file that you can run manually or automatically using autostart:
#!/bin/bash
synclient TouchpadOff=1


text:
Q: How doing a datediff between current and next date? I want to do a datediff between two columns as explain in the example:
 date 1    date 2
 date 1.1  date 2.1
 date 1.2  date 2.2
 date 1.3  date 2.3
 date 1.4  date 2.4

I want to do datediff (date 2.1,date 1.2), datediff (date 2.2,date 1.3)? datediff (date 2.3,date 1.4) ...
Doing the difference between the current of date 2 et the next of date 1.
Any help please?

A: You can use lag() or lead() . . . it is hard to tell which direction.  But something like this:
select t.*,
       datediff(day,
                lag(end_date) over (order by start_date),
                start_date
               ) as dates_between
from t;


text:
Q: Character set reverse search I have a set of strings (well, filenames, but that detail I can handle myself) that I want to convert to UTF-8. However, by trying the obvious candidates I'm not able to do the conversion successfully, except that it must be a 8-bit character set. So I'm asking, is there some kind of "reverse character set search" utility? I.e. I can provide as input that the character with decimal 138 should map to the unicode symbol "ä" (U+00E4), and the tool would spit out a list of character sets.

A: Answering myself, I sort of brute-forced it with something like
for c in $(convmv --list); do echo -n "$c: "; convmv -f $c -t utf8 SOMEFILENAME_WITH_NON_UTF8_CHARS 2>/dev/null; done

In this case it turned out the encoding was 'MacRoman', which apparently was some pre-OSX encoding used by Apple.


text:
Q: [react-native]update RN to 0.43.3 build failed when I update RN from 0.41 to 0.43.3,I suffered a crazy problem, if I run gradlew assembleRelease, the apk build failed, but when I add option --debug, the apk build successful, it should be the problem of progurad, but i cannot fix it, any help is appreciated:
-gradlew assembleRelease
...
Loading dependency graph, done.easeJsAndAssets
warning: the transform cache was reset.
bundle: start
bundle: finish
bundle: Writing bundle output to:xxx\android\app\build\intermediates\assets\release\index.android.bundle
bundle: Done writing bundle output
bundle: Copying 5 asset files
bundle: Done copying assets

FAILURE: Build failed with an exception.

* What went wrong:
Unable to process incoming event 'ProgressComplete ' (ProgressCompleteEvent)

if I run gradlew assembleRelease --debug
-gradlew assembleRelease --debug
...
[LIFECYCLE] [org.gradle.BuildResultLogger] BUILD SUCCESSFUL

run gradlew assembleRelease --info or --stacktrace all failed, no warning messages show.
When i build apk use android studio,it shows:
    Initializing...
Note: the configuration refers to the unknown class 'com.facebook.react.uimanager.UIProp'
Note: the configuration refers to the unknown class 'sun.misc.Unsafe'
Note: the configuration refers to the unknown class 'android.text'
Note: com.facebook.common.webp.WebpSupportStatus: can't find dynamically referenced class com.facebook.webpsupport.WebpBitmapFactoryImpl
Note: com.facebook.imagepipeline.animated.factory.AnimatedFactoryProvider: can't find dynamically referenced class com.facebook.imagepipeline.animated.factory.AnimatedFactoryImplSupport
Note: com.facebook.imagepipeline.animated.factory.AnimatedFactoryProvider: can't find dynamically referenced class com.facebook.imagepipeline.animated.factory.AnimatedFactoryImpl
Note: com.facebook.imagepipeline.nativecode.WebpTranscoderFactory: can't find dynamically referenced class com.facebook.imagepipeline.nativecode.WebpTranscoderImpl
Note: okhttp3.internal.platform.AndroidPlatform: can't find dynamically referenced class com.android.org.conscrypt.SSLParametersImpl
Note: okhttp3.internal.platform.AndroidPlatform: can't find dynamically referenced class org.apache.harmony.xnet.provider.jsse.SSLParametersImpl
Note: okhttp3.internal.platform.Platform: can't find dynamically referenced class sun.security.ssl.SSLContextImpl
Note: com.facebook.react.views.textinput.ReactTextInputManager accesses a declared field 'mCursorDrawable' dynamically
Note: the configuration keeps the entry point 'com.facebook.drawee.drawable.ForwardingDrawable { void setTransformCallback(com.facebook.drawee.drawable.TransformCallback); }', but not the descriptor class 'com.facebook.drawee.drawable.TransformCallback'
Note: the configuration keeps the entry point 'com.facebook.drawee.view.DraweeView { void setHierarchy(com.facebook.drawee.interfaces.DraweeHierarchy); }', but not the descriptor class 'com.facebook.drawee.interfaces.DraweeHierarchy'
Note: the configuration keeps the entry point 'com.facebook.drawee.view.DraweeView { void setController(com.facebook.drawee.interfaces.DraweeController); }', but not the descriptor class 'com.facebook.drawee.interfaces.DraweeController'
Note: the configuration keeps the entry point 'com.facebook.drawee.view.GenericDraweeView { GenericDraweeView(android.content.Context,com.facebook.drawee.generic.GenericDraweeHierarchy); }', but not the descriptor class 'com.facebook.drawee.generic.GenericDraweeHierarchy'
Note: the configuration keeps the entry point 'com.facebook.imagepipeline.request.ImageRequest { ImageRequest(com.facebook.imagepipeline.request.ImageRequestBuilder); }', but not the descriptor class 'com.facebook.imagepipeline.request.ImageRequestBuilder'
Note: the configuration keeps the entry point 'com.facebook.react.animated.EventAnimationDriver { EventAnimationDriver(java.util.List,com.facebook.react.animated.ValueAnimatedNode); }', but not the descriptor class 'com.facebook.react.animated.ValueAnimatedNode'
Note: the configuration keeps the entry point 'com.facebook.react.bridge.ModuleSpec { ModuleSpec(java.lang.Class,javax.inject.Provider); }', but not the descriptor class 'javax.inject.Provider'
Note: the configuration keeps the entry point 'com.facebook.react.cxxbridge.ModuleHolder { ModuleHolder(java.lang.String,boolean,boolean,boolean,javax.inject.Provider); }', but not the descriptor class 'javax.inject.Provider'
Note: the configuration keeps the entry point 'com.facebook.react.flat.FlatShadowNode { void collectState(com.facebook.react.flat.StateBuilder,float,float,float,float,float,float,float,float); }', but not the descriptor class 'com.facebook.react.flat.StateBuilder'
Note: the configuration keeps the entry point 'com.facebook.react.flat.FlatShadowNode { void setNodeRegion(com.facebook.react.flat.NodeRegion); }', but not the descriptor class 'com.facebook.react.flat.NodeRegion'
Note: the configuration keeps the entry point 'com.facebook.react.flat.FlatTextShadowNode { void performCollectAttachDetachListeners(com.facebook.react.flat.StateBuilder); }', but not the descriptor class 'com.facebook.react.flat.StateBuilder'
Note: the configuration keeps the entry point 'com.facebook.react.flat.FlatUIViewOperationQueue$DetachAllChildrenFromViews { FlatUIViewOperationQueue$DetachAllChildrenFromViews(com.facebook.react.flat.FlatUIViewOperationQueue); }', but not the descriptor class 'com.facebook.react.flat.FlatUIViewOperationQueue'
Note: the configuration keeps the entry point 'com.facebook.react.flat.FlatUIViewOperationQueue$ViewManagerCommand { FlatUIViewOperationQueue$ViewManagerCommand(com.facebook.react.flat.FlatUIViewOperationQueue,int,int,com.facebook.react.bridge.ReadableArray); }', but not the descriptor class 'com.facebook.react.flat.FlatUIViewOperationQueue'
Note: the configuration keeps the entry point 'com.facebook.react.flat.FlatViewManager { void setBackgroundColor(com.facebook.react.flat.FlatViewGroup,int); }', but not the descriptor class 'com.facebook.react.flat.FlatViewGroup'
Note: the configuration keeps the entry point 'com.facebook.react.flat.FlatViewManager { void removeAllViews(com.facebook.react.flat.FlatViewGroup); }', but not the descriptor class 'com.facebook.react.flat.FlatViewGroup'
Note: the configuration keeps the entry point 'com.facebook.react.flat.RCTImageViewManager { RCTImageViewManager(com.facebook.drawee.controller.AbstractDraweeControllerBuilder,java.lang.Object); }', but not the descriptor class 'com.facebook.drawee.controller.AbstractDraweeControllerBuilder'
Note: the configuration keeps the entry point 'com.facebook.react.flat.RCTImageViewManager { void removeAllViews(com.facebook.react.flat.FlatViewGroup); }', but not the descriptor class 'com.facebook.react.flat.FlatViewGroup'
Note: the configuration keeps the entry point 'com.facebook.react.flat.RCTImageViewManager { void setBackgroundColor(com.facebook.react.flat.FlatViewGroup,int); }', but not the descriptor class 'com.facebook.react.flat.FlatViewGroup'
Note: the configuration keeps the entry point 'com.facebook.react.flat.RCTTextInput { long measure(com.facebook.yoga.YogaNodeAPI,float,com.facebook.yoga.YogaMeasureMode,float,com.facebook.yoga.YogaMeasureMode); }', but not the descriptor class 'com.facebook.yoga.YogaNodeAPI'
Note: the configuration keeps the entry point 'com.facebook.react.flat.RCTTextManager { void removeAllViews(com.facebook.react.flat.FlatViewGroup); }', but not the descriptor class 'com.facebook.react.flat.FlatViewGroup'
Note: the configuration keeps the entry point 'com.facebook.react.flat.RCTTextManager { void setBackgroundColor(com.facebook.react.flat.FlatViewGroup,int); }', but not the descriptor class 'com.facebook.react.flat.FlatViewGroup'
Note: the configuration keeps the entry point 'com.facebook.react.flat.RCTViewManager { void setHotspot(com.facebook.react.flat.FlatViewGroup,com.facebook.react.bridge.ReadableMap); }', but not the descriptor class 'com.facebook.react.flat.FlatViewGroup'
Note: the configuration keeps the entry point 'com.facebook.react.flat.RCTViewManager { void receiveCommand(com.facebook.react.flat.FlatViewGroup,int,com.facebook.react.bridge.ReadableArray); }', but not the descriptor class 'com.facebook.react.flat.FlatViewGroup'
Note: the configuration keeps the entry point 'com.facebook.react.flat.RCTViewManager { void setNeedsOffscreenAlphaCompositing(com.facebook.react.flat.FlatViewGroup,boolean); }', but not the descriptor class 'com.facebook.react.flat.FlatViewGroup'
Note: the configuration keeps the entry point 'com.facebook.react.flat.RCTViewManager { void setPointerEvents(com.facebook.react.flat.FlatViewGroup,java.lang.String); }', but not the descriptor class 'com.facebook.react.flat.FlatViewGroup'
Note: the configuration keeps the entry point 'com.facebook.react.flat.RCTViewManager { void setRemoveClippedSubviews(com.facebook.react.flat.FlatViewGroup,boolean); }', but not the descriptor class 'com.facebook.react.flat.FlatViewGroup'
Note: the configuration keeps the entry point 'com.facebook.react.flat.RCTViewManager { void setHitSlop(com.facebook.react.flat.FlatViewGroup,com.facebook.react.bridge.ReadableMap); }', but not the descriptor class 'com.facebook.react.flat.FlatViewGroup'
Note: the configuration keeps the entry point 'com.facebook.react.flat.RCTViewManager { void removeAllViews(com.facebook.react.flat.FlatViewGroup); }', but not the descriptor class 'com.facebook.react.flat.FlatViewGroup'
Note: the configuration keeps the entry point 'com.facebook.react.flat.RCTViewManager { void setBackgroundColor(com.facebook.react.flat.FlatViewGroup,int); }', but not the descriptor class 'com.facebook.react.flat.FlatViewGroup'
Note: the configuration keeps the entry point 'com.facebook.react.flat.RCTVirtualText { void performCollectAttachDetachListeners(com.facebook.react.flat.StateBuilder); }', but not the descriptor class 'com.facebook.react.flat.StateBuilder'
Note: the configuration keeps the entry point 'com.facebook.react.modules.core.Timing { com.facebook.react.modules.core.Timing$IdleCallbackRunnable access$1202(com.facebook.react.modules.core.Timing,com.facebook.react.modules.core.Timing$IdleCallbackRunnable); }', but not the descriptor class 'com.facebook.react.modules.core.Timing$IdleCallbackRunnable'
Note: the configuration keeps the entry point 'com.facebook.react.modules.dialog.AlertFragment { AlertFragment(com.facebook.react.modules.dialog.DialogModule$AlertFragmentListener,android.os.Bundle); }', but not the descriptor class 'com.facebook.react.modules.dialog.DialogModule$AlertFragmentListener'
Note: the configuration keeps the entry point 'com.facebook.react.modules.dialog.SupportAlertFragment { SupportAlertFragment(com.facebook.react.modules.dialog.DialogModule$AlertFragmentListener,android.os.Bundle); }', but not the descriptor class 'com.facebook.react.modules.dialog.DialogModule$AlertFragmentListener'
Note: the configuration keeps the entry point 'com.facebook.react.modules.fresco.FrescoModule { FrescoModule(com.facebook.react.bridge.ReactApplicationContext,com.facebook.imagepipeline.core.ImagePipelineConfig); }', but not the descriptor class 'com.facebook.imagepipeline.core.ImagePipelineConfig'
Note: the configuration keeps the entry point 'com.facebook.react.modules.fresco.ReactNetworkImageRequest { com.facebook.react.modules.fresco.ReactNetworkImageRequest fromBuilderWithHeaders(com.facebook.imagepipeline.request.ImageRequestBuilder,com.facebook.react.bridge.ReadableMap); }', but not the descriptor class 'com.facebook.imagepipeline.request.ImageRequestBuilder'
Note: the configuration keeps the entry point 'com.facebook.react.modules.fresco.ReactNetworkImageRequest { ReactNetworkImageRequest(com.facebook.imagepipeline.request.ImageRequestBuilder,com.facebook.react.bridge.ReadableMap); }', but not the descriptor class 'com.facebook.imagepipeline.request.ImageRequestBuilder'
Note: the configuration keeps the entry point 'com.facebook.react.modules.fresco.SystraceRequestListener { void onRequestStart(com.facebook.imagepipeline.request.ImageRequest,java.lang.Object,java.lang.String,boolean); }', but not the descriptor class 'com.facebook.imagepipeline.request.ImageRequest'
Note: the configuration keeps the entry point 'com.facebook.react.modules.fresco.SystraceRequestListener { void onRequestSuccess(com.facebook.imagepipeline.request.ImageRequest,java.lang.String,boolean); }', but not the descriptor class 'com.facebook.imagepipeline.request.ImageRequest'
Note: the configuration keeps the entry point 'com.facebook.react.modules.fresco.SystraceRequestListener { void onRequestFailure(com.facebook.imagepipeline.request.ImageRequest,java.lang.String,java.lang.Throwable,boolean); }', but not the descriptor class 'com.facebook.imagepipeline.request.ImageRequest'
Note: the configuration keeps the entry point 'com.facebook.react.modules.image.ImageLoaderModule { void registerRequest(int,com.facebook.datasource.DataSource); }', but not the descriptor class 'com.facebook.datasource.DataSource'
Note: the configuration keeps the entry point 'com.facebook.react.shell.MainPackageConfig$Builder { com.facebook.react.shell.MainPackageConfig$Builder setFrescoConfig(com.facebook.imagepipeline.core.ImagePipelineConfig); }', but not the descriptor class 'com.facebook.imagepipeline.core.ImagePipelineConfig'
Note: the configuration keeps the entry point 'com.facebook.react.uimanager.NativeViewHierarchyManager { void manageChildren(int,int[],com.facebook.react.uimanager.ViewAtIndex[],int[]); }', but not the descriptor class 'com.facebook.react.uimanager.ViewAtIndex'
Note: the configuration keeps the entry point 'com.facebook.react.uimanager.NativeViewHierarchyOptimizer { NativeViewHierarchyOptimizer(com.facebook.react.uimanager.UIViewOperationQueue,com.facebook.react.uimanager.ShadowNodeRegistry); }', but not the descriptor class 'com.facebook.react.uimanager.ShadowNodeRegistry'
Note: the configuration keeps the entry point 'com.facebook.react.uimanager.NativeViewHierarchyOptimizer { void handleManageChildren(com.facebook.react.uimanager.ReactShadowNode,int[],int[],com.facebook.react.uimanager.ViewAtIndex[],int[]); }', but not the descriptor class 'com.facebook.react.uimanager.ViewAtIndex'
Note: the configuration keeps the entry point 'com.facebook.react.uimanager.UIViewOperationQueue { void enqueueManageChildren(int,int[],com.facebook.react.uimanager.ViewAtIndex[],int[]); }', but not the descriptor class 'com.facebook.react.uimanager.ViewAtIndex'
Note: the configuration keeps the entry point 'com.facebook.react.views.drawer.ReactDrawerLayoutManager { void addEventEmitters(com.facebook.react.uimanager.ThemedReactContext,com.facebook.react.views.drawer.ReactDrawerLayout); }', but not the descriptor class 'com.facebook.react.views.drawer.ReactDrawerLayout'
Note: the configuration keeps the entry point 'com.facebook.react.views.drawer.ReactDrawerLayoutManager { void setDrawerPosition(com.facebook.react.views.drawer.ReactDrawerLayout,int); }', but not the descriptor class 'com.facebook.react.views.drawer.ReactDrawerLayout'
Note: the configuration keeps the entry point 'com.facebook.react.views.drawer.ReactDrawerLayoutManager { void getDrawerWidth(com.facebook.react.views.drawer.ReactDrawerLayout,float); }', but not the descriptor class 'com.facebook.react.views.drawer.ReactDrawerLayout'
Note: the configuration keeps the entry point 'com.facebook.react.views.drawer.ReactDrawerLayoutManager { void setDrawerLockMode(com.facebook.react.views.drawer.ReactDrawerLayout,java.lang.String); }', but not the descriptor class 'com.facebook.react.views.drawer.ReactDrawerLayout'
Note: the configuration keeps the entry point 'com.facebook.react.views.drawer.ReactDrawerLayoutManager { void setElevation(com.facebook.react.views.drawer.ReactDrawerLayout,float); }', but not the descriptor class 'com.facebook.react.views.drawer.ReactDrawerLayout'
Note: the configuration keeps the entry point 'com.facebook.react.views.drawer.ReactDrawerLayoutManager { void receiveCommand(com.facebook.react.views.drawer.ReactDrawerLayout,int,com.facebook.react.bridge.ReadableArray); }', but not the descriptor class 'com.facebook.react.views.drawer.ReactDrawerLayout'
Note: the configuration keeps the entry point 'com.facebook.react.views.drawer.ReactDrawerLayoutManager { void addView(com.facebook.react.views.drawer.ReactDrawerLayout,android.view.View,int); }', but not the descriptor class 'com.facebook.react.views.drawer.ReactDrawerLayout'
Note: the configuration keeps the entry point 'com.facebook.react.views.image.ReactImageManager { ReactImageManager(com.facebook.drawee.controller.AbstractDraweeControllerBuilder,java.lang.Object); }', but not the descriptor class 'com.facebook.drawee.controller.AbstractDraweeControllerBuilder'
Note: the configuration keeps the entry point 'com.facebook.react.views.image.ReactImageView { ReactImageView(android.content.Context,com.facebook.drawee.controller.AbstractDraweeControllerBuilder,java.lang.Object); }', but not the descriptor class 'com.facebook.drawee.controller.AbstractDraweeControllerBuilder'
Note: the configuration keeps the entry point 'com.facebook.react.views.image.ReactImageView { void setScaleType(com.facebook.drawee.drawable.ScalingUtils$ScaleType); }', but not the descriptor class 'com.facebook.drawee.drawable.ScalingUtils$ScaleType'
Note: the configuration keeps the entry point 'com.facebook.react.views.image.ReactImageView { void setControllerListener(com.facebook.drawee.controller.ControllerListener); }', but not the descriptor class 'com.facebook.drawee.controller.ControllerListener'
Note: the configuration keeps the entry point 'com.facebook.react.views.progressbar.ProgressBarShadowNode { long measure(com.facebook.yoga.YogaNodeAPI,float,com.facebook.yoga.YogaMeasureMode,float,com.facebook.yoga.YogaMeasureMode); }', but not the descriptor class 'com.facebook.yoga.YogaNodeAPI'
Note: the configuration keeps the entry point 'com.facebook.react.views.progressbar.ReactProgressBarViewManager { void setStyle(com.facebook.react.views.progressbar.ProgressBarContainerView,java.lang.String); }', but not the descriptor class 'com.facebook.react.views.progressbar.ProgressBarContainerView'
Note: the configuration keeps the entry point 'com.facebook.react.views.progressbar.ReactProgressBarViewManager { void setColor(com.facebook.react.views.progressbar.ProgressBarContainerView,java.lang.Integer); }', but not the descriptor class 'com.facebook.react.views.progressbar.ProgressBarContainerView'
Note: the configuration keeps the entry point 'com.facebook.react.views.progressbar.ReactProgressBarViewManager { void setIndeterminate(com.facebook.react.views.progressbar.ProgressBarContainerView,boolean); }', but not the descriptor class 'com.facebook.react.views.progressbar.ProgressBarContainerView'
Note: the configuration keeps the entry point 'com.facebook.react.views.progressbar.ReactProgressBarViewManager { void setProgress(com.facebook.react.views.progressbar.ProgressBarContainerView,double); }', but not the descriptor class 'com.facebook.react.views.progressbar.ProgressBarContainerView'
Note: the configuration keeps the entry point 'com.facebook.react.views.progressbar.ReactProgressBarViewManager { void setAnimating(com.facebook.react.views.progressbar.ProgressBarContainerView,boolean); }', but not the descriptor class 'com.facebook.react.views.progressbar.ProgressBarContainerView'
Note: the configuration keeps the entry point 'com.facebook.react.views.progressbar.ReactProgressBarViewManager { void updateExtraData(com.facebook.react.views.progressbar.ProgressBarContainerView,java.lang.Object); }', but not the descriptor class 'com.facebook.react.views.progressbar.ProgressBarContainerView'
Note: the configuration keeps the entry point 'com.facebook.react.views.progressbar.ReactProgressBarViewManager { void onAfterUpdateTransaction(com.facebook.react.views.progressbar.ProgressBarContainerView); }', but not the descriptor class 'com.facebook.react.views.progressbar.ProgressBarContainerView'
Note: the configuration keeps the entry point 'com.facebook.react.views.switchview.ReactSwitchManager { void setEnabled(com.facebook.react.views.switchview.ReactSwitch,boolean); }', but not the descriptor class 'com.facebook.react.views.switchview.ReactSwitch'
Note: the configuration keeps the entry point 'com.facebook.react.views.switchview.ReactSwitchManager { void setOn(com.facebook.react.views.switchview.ReactSwitch,boolean); }', but not the descriptor class 'com.facebook.react.views.switchview.ReactSwitch'
Note: the configuration keeps the entry point 'com.facebook.react.views.switchview.ReactSwitchManager { void setThumbTintColor(com.facebook.react.views.switchview.ReactSwitch,java.lang.Integer); }', but not the descriptor class 'com.facebook.react.views.switchview.ReactSwitch'
Note: the configuration keeps the entry point 'com.facebook.react.views.switchview.ReactSwitchManager { void setTrackTintColor(com.facebook.react.views.switchview.ReactSwitch,java.lang.Integer); }', but not the descriptor class 'com.facebook.react.views.switchview.ReactSwitch'
Note: the configuration keeps the entry point 'com.facebook.react.views.switchview.ReactSwitchManager { void addEventEmitters(com.facebook.react.uimanager.ThemedReactContext,com.facebook.react.views.switchview.ReactSwitch); }', but not the descriptor class 'com.facebook.react.views.switchview.ReactSwitch'
Note: the configuration keeps the entry point 'com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageShadowNode { FrescoBasedReactTextInlineImageShadowNode(com.facebook.drawee.controller.AbstractDraweeControllerBuilder,java.lang.Object); }', but not the descriptor class 'com.facebook.drawee.controller.AbstractDraweeControllerBuilder'
Note: the configuration keeps the entry point 'com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageSpan { FrescoBasedReactTextInlineImageSpan(android.content.res.Resources,int,int,android.net.Uri,com.facebook.react.bridge.ReadableMap,com.facebook.drawee.controller.AbstractDraweeControllerBuilder,java.lang.Object); }', but not the descriptor class 'com.facebook.drawee.controller.AbstractDraweeControllerBuilder'
Note: the configuration keeps the entry point 'com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager { FrescoBasedReactTextInlineImageViewManager(com.facebook.drawee.controller.AbstractDraweeControllerBuilder,java.lang.Object); }', but not the descriptor class 'com.facebook.drawee.controller.AbstractDraweeControllerBuilder'
Note: the configuration keeps the entry point 'com.facebook.react.views.textinput.ReactEditText { void setSelectionWatcher(com.facebook.react.views.textinput.SelectionWatcher); }', but not the descriptor class 'com.facebook.react.views.textinput.SelectionWatcher'
Note: the configuration keeps the entry point 'com.facebook.react.views.textinput.ReactTextInputShadowNode { long measure(com.facebook.yoga.YogaNodeAPI,float,com.facebook.yoga.YogaMeasureMode,float,com.facebook.yoga.YogaMeasureMode); }', but not the descriptor class 'com.facebook.yoga.YogaNodeAPI'
Note: the configuration keeps the entry point 'com.facebook.react.views.toolbar.DrawableWithIntrinsicSize { DrawableWithIntrinsicSize(android.graphics.drawable.Drawable,com.facebook.imagepipeline.image.ImageInfo); }', but not the descriptor class 'com.facebook.imagepipeline.image.ImageInfo'
Note: the configuration keeps the entry point 'com.facebook.yoga.YogaBaselineFunction { float baseline(com.facebook.yoga.YogaNodeAPI,float,float); }', but not the descriptor class 'com.facebook.yoga.YogaNodeAPI'
Note: the configuration keeps the entry point 'com.facebook.yoga.YogaMeasureFunction { long measure(com.facebook.yoga.YogaNodeAPI,float,com.facebook.yoga.YogaMeasureMode,float,com.facebook.yoga.YogaMeasureMode); }', but not the descriptor class 'com.facebook.yoga.YogaNodeAPI'
Note: the configuration keeps the entry point 'com.imagepicker.ImagePickerModule { void putExtraFileInfo(java.lang.String,com.imagepicker.ResponseHelper); }', but not the descriptor class 'com.imagepicker.ResponseHelper'
Note: there were 3 references to unknown classes.
      You should check your configuration for typos.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
Note: there were 78 unkept descriptor classes in kept class members.
      You should consider explicitly keeping the mentioned classes
      (using '-keep').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#descriptorclass)
Note: there were 7 unresolved dynamic references to classes or interfaces.
      You should check if you need to specify additional program jars.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
Note: there were 1 accesses to class members by means of introspection.
      You should consider explicitly keeping the mentioned class members
      (using '-keep' or '-keepclassmembers').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclassmember)

how to modify my proguard file?


text:
Q: Offline Message Rating Whenever I sign out of Bloodborne or play offline, I notice my messages ratings never seem to change. Does this mean other players can only see my messages if I am actively playing online?

A: Yes, your messages only appear to other players, who are within your level range, while you are playing online. This is probably for a couple reasons:

*

*The notes you've made are tied to your character and they can vary
from character to character. For instance, I have five character
profiles and have written different notes with each and only the
notes for that character are visible to other players when I'm
playing as that character.

*There is a limit to the number of notes you can have active at one
time. Your newer notes will overwrite your older notes (unless
you've "protected" the note from being deleted in this manner, then
only unprotected ones will be overwritten with your newer notes). If
all your notes were always loaded then you'd excede this limit.


text:
Q: unique random number generation I'm looking for way to generate unique random numbers based on current time using java.
I'm a c++ programmer and in c++ I usually seed the Random with time so at each specific moment I can get a unique random number and it works like this :
sRand((time)Null);
x=Rand();

In java I found that I can use the same method by seeding the random number with time like this:
Random rand = new Random(System.currentTimeMillis());

Here is the problem I have used all the methods I found over the internet for generating a random number in java but none of them were truly random and they ranged from negative to positive numbers.
For example:
Random rand = new Random(System.currentTimeMillis());
int x=rand.nextInt(); // or long or float ...

What I get is a series of not truly random numbers and the result is really different than in C++.
I just want to know what the best way to do this in java is, some like or very close to TAC number generation.

A: Java's and C++ random numbers are both pseudorandom. Of course the algorithms are different, so the results are different too.
If you would like a random number generator that is strong enough to use for cryptography, you can use SecureRandom: its interface is less intuitive, and it consumes more CPU, but the quality of its output is much higher than of a regular PRNG of Java,

A: If you want to generate a random number, the simplest way is to use new Random().nextInt(), perhaps wrapping it in Math.abs() to avoid negatives.  If what you need is a unique number, you can use UUID.randomUUID().