text:
Q: AB Testing / Experimentation: ratio estimator based on parameter estimates of a regression model Assume we run an experiment / AB test, hence we have a treatment $D$, exogenous covariates $X$ and outcome variable $Y$.
A standard regression estimator then identifies the treatment effect $\tau$ as a difference of means:
$$
    E[Y|X, D = 1] - E[Y|X, D = 0]  = \tau.
$$
In AB testing instead, the object of interest if often a ratio estimator
$$
  \frac{E[Y|X, D = 1]}{E[Y|X, D = 0]} -1
$$
which can be interpreted as the performance change of the treatment in per cent.
Is there a way to compute such a ratio estimator based on estimates from a standard regression routine (e.g. outputlm() in R, or reg in Stata) and without making any additional distributional assumptions?
One solution would be to run a log-regression, e.g. lm(log(Y) ~ X + D), which should approximate the ratio estimator for "small enough" effects. But using logs is of course unattractive if $Y$ contains many zeros.
Thanks for your help!

A: After fitting the model, you can simply make two predictions of the conditional mean, one for $D=1$ and one for $D=0$ and take their ratio:
$$\frac{\hat{E}[Y|X,D=1]}{\hat{E}[Y|X,D=0]}-1$$
But note that this ratio depends on the values of $X$, different from the additive effect estimate. And of course it does: You are running a linear additive model to estimtate the treatment effect. This is different from the log-model you mentioned, which is in essence a multiplicative model. Here, the effect of $D$ in terms of percentage is constant over all values of $X$.
So you can only estimate a marginal effect of the treatment in terms of percentage increase for a particular $X$, which you should choose wisely for the substantive question at hand.
Note that to get an estimate of the uncertainty for the estimated effect on the ratio scale, you will also need the standard error of both point predictions.


text:
Q: Responsive layouts with min-width, width%, no easy way to avoid gaps? I have a simple responsive webpage that can run in two columns, with css for each div being
.half {
  width: 45%;
  min-width: 300px;
  float: left;
}

For wide screens each div column gets half the width, for narrower screens the columns compress until they reach 300px, and then they wrap.  Basically works OK.
However, when the screen is 400px wide (say) the columns are still compressed to 300px.  (Because half of  400px is 200px, so min-width of 300px takes priority.  But in this case I would want it to be the full 400px as there are no other columns to its right.)
Is there a easy way to stop that?
There are new flex-box options, but I need to run on the public web, lots of browsers and phones.  Something that polishes for newer and works for older is OK.  I do not want to add JavaScript just to do this.
I think that the answer is a simple NO, not possible.  But I would appreciate confirmation that I have not missed something.
(There are a number of similar questions already but none that I could find that address this simple case specifically.)
(Edited to address confusion in comments.)

A: I assume you are wanting to implement a media-query to specify new rules once a window is less than a specific width. Therefore, you could do something like:
// Override styles for elements once the element is less than a specified width
@media only screen and (max-width: 400px) {
    // If window is less than 400px, apply new styles. ie: width takes full width
    .half {
         width: 100%;
    }
}

Which will make the .half class 100% width once the device/window is 400px or less.
Example of media-query provided by misterManSam: JS Bin

A: As per my understanding you need like this:
.half {
  width: 100%;
  min-width: 300px;
  max-width: 500px;/*define max-width as you wish*/
  float: left;
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: limsup of average smaller than limsup I have read this solution, but I could not understand it.
It has shown $$\sigma_n\leqslant  \frac 1n\sum_{j=1}^ks_j+\sup_{l\geqslant k}s_l,$$ but how does it go to $$\sup(\sigma_n)\leqslant \frac 1n\sum_{j=1}^ks_j+\sup_{l\geqslant k}s_l$$
I have thought of regarding the RHS as upper bound of $\sigma_n$, but I am not sure about this, since RHS varies as $n$ changes.
The writer wrote "take on both sides the limsup when $n \to \infty$", but I could not understand it. Please help.

A: First I will copy the relevant part of the answer you are talking about so that we have some context:

Fix an integer $k$. Let $n\geqslant k$. Then
  $$\sigma_n=\frac 1n\sum_{j=1}^ks_j+\frac 1n\sum_{j=k+1}^ns_j\leqslant \frac 1n\sum_{j=1}^ks_j+\sup_{l\geqslant k}s_l.$$
  Now take on both sides the limsup when $\color{red}{n\to +\infty}$: we get the wanted result.

I would slightly change the formulation and the conclusion. (I think we need to add one more step to finish the conclusion. But I might have missed something obvious. Or maybe Davide considered the missing step easy and left it for the reader.)
So we have the inequality
$$\sigma_n \le \frac 1n\sum_{j=1}^ks_j+\sup_{l\ge k}s_l.$$
This equality is true for any $n\ge k$.
If we take limit superior w.r.t. $n$ on both sides we get
$$\limsup_{n\to\infty} \sigma_n \le \sup_{l\ge k}s_l.$$
(Since the first term on the RHS converges to zero for $n\to\infty$ and the second one does not depend on $n$.)
Now the above inequality is true for arbitrary $k$. So we also have
$$\limsup_{n\to\infty} \sigma_n \le \lim_{k\to\infty} \sup_{l\ge k}s_l = \limsup_{k\to\infty} s_k.$$

A: Here's a simple solution:
Let $x^{*}_k = \sup_{k \geq n} \{x_n\}$. Then, $$x^{*}_k \to \limsup_{n \to \infty} \{x_n\}.$$
By a simple fact, a convergent sequence's averages converge to the same limit, so $$\sigma_n^{*} = \frac{1}{n} \sum_{j=1}^{n} x^{*}_j \to \limsup_{n \to \infty} \{x_n\}$$ as well. Now since $\sigma_n \leq \sigma^{*}_n$, the result follows.


text:
Q: VSCode intellisense not work when you click "Tab" Can someone help me with my problem?
HOW do I fix this EMMET VSCode so that when I write "log" and click " tab "I get" intellisense " and can select a variable?
On the video in the first version of the error, "intellisense" is missing. Then in the video, the second version of "intellisense" appears. I don't want to write every time to the manual console.log(), but if I press "Tab", "intellisense" doesn't appear automatically, I have to press CTRL + Space.
Don't ask me to manually press CTRL + Space every time, I want to know how to do everything automatically?
Here is an example in the video

A: When I write log and press TAB I get console.log(<text Focus is here>) as a result.
If I immediately start writing the name of the variable st.. then intellisense does not appear. The video clearly shows this.


text:
Q: Code First: Is there a command to show what database I am pointing to? When doing a database-update in the package manager console, you can add -verbose and it will tell you, among other things, what database (server, database name, etc) it is executing the update against.
While that's handy, I'd like to know ahead of time what database I'm going to update. I've looked for, but can't find a command that just tells me what database I'm pointing to.
Does such a command exist?
(I mean, I know I can just look in the config files. So, I guess I'm just being lazy.  But when I have an update all ready to go and I'm in the console, it's a bit annoying to have to go hunt down the proper config file(s) and make sure I'm on the right DB.)

A: It will use the database for the web.config that you have set as the startup project and will run the migrations of the target project that you have selected in the package manager console.  And as you probably already know, it uses the connection string name that has been specified in the constructor for the DbContext associated with your code-first migrations.
My suggestion, if you are paranoid, would be to use the update-database parameters to ensure that it is using the configuration that you expect, rather than relying on them to be automatically inferred.

-StartUpProjectName string
Specifies the configuration file to use for named connection strings. If omitted, the specified project's
configuration file is used.
-ProjectName
Specifies the configuration file to use for named connection strings.
If omitted, the specified project's configuration file is used.
-ConnectionStringName
Specifies the name of a connection string to use from the application's >configuration file.


text:
Q: How to replace RDD type of [String] with values of RDD type [String, Int] Sorry for the confusion in the initial question. Here is a questions with the reproducible example:
I have an rdd of [String] and I have a rdd of [String, Long]. I would like to have an rdd of [Long] based on the match of String of second with String of first. Example:
//Create RDD
val textFile = sc.parallelize(Array("Spark can also be used for compute intensive tasks",
      "This code estimates pi by throwing darts at a circle"))
// tokenize, result: RDD[(String)]
val words = textFile.flatMap(line => line.split(" "))
// create index of distinct words, result:  RDD[(String,Long)]
val indexWords = words.distinct().zipWithIndex()

As a result, I would like to have an RDD with indexes of words instead of words in "Spark can also be used for compute intensive tasks".
Sorry again and thanks

A: If I understand you correctly, you're interested in the indices of works that also appear in Spark can also be used for compute intensive tasks.
If so - here are two versions with identical outputs but different performance characteristics:
val lookupWords: Seq[String] = "Spark can also be used for compute intensive tasks".split(" ")

// option 1 - use join:
val lookupWordsRdd: RDD[(String, String)] = sc.parallelize(lookupWords).keyBy(w => w)
val result1: RDD[Long] = indexWords.join(lookupWordsRdd).map { case (key, (index, _)) => index }

// option 2 - assuming list of lookup words is short, you can use a non-distributed version of it
val result2: RDD[Long] = indexWords.collect { case (key, index) if lookupWords.contains(key) => index }

The first option creates a second RDD with the words whose indices we're interested in, uses keyBy to transform it into a PairRDD (with key == value!), joins it with your indexWords RDD and then maps to get the index only.
The second option should only be used if the list of "interesting words" is known not to be too large - so we can keep it as a list (and not RDD), and let Spark serialize it and send to workers for each task to use. We then use collect(f: PartialFunction[T, U]) which applies this partial function to get a "filter" and a "map" at once - we only return a value if the words exists in the list, and if so - we return the index.

A: I was getting an error of SPARK-5063 and given this answer, I found the solution to my problem:
//broadcast `indexWords`
val bcIndexWords = sc.broadcast(indexWords.collectAsMap)
// select `value` of `indexWords` given `key`
val result = textFile.map{arr => arr.split(" ").map(elem => bcIndexWords.value(elem))}
result.first()
res373: Array[Long] = Array(3, 7, 14, 6, 17, 15, 0, 12)


text:
Q: Jolt spec to transform an array of elements into objects with ids Jolt is new to me and I have been struggling with this issue till the point where I created this post.
I want to turn this:
{
    "Properties": [{
        "Id": "property1",
        "Values": ["randomValue1", "randomValue2"]
    }, {
        "Id": "property2",
        "Values": "randomValue3"
    }, {
        "Id": "property3",
        "Values": "randomValue4"
    }]
}

into this
{
    "Properties": [{
        "Id": "property1",
        "Values": "randomValue1"
    },{
        "Id": "property1",
        "Values": "randomValue2"
    }, {
        "Id": "property2",
        "Values": "randomValue3"
    }, {
        "Id": "property3",
        "Values": "randomValue4"
    }]
}

The values for each property can be 1 value or an array of an unknown amount of values.
I changed the following json into what is seen in the first json already:
{
    "Properties": {
        "property1": ["randomValue1", "randomValue1"],
        "property2": ["randomValue3"],
        "property3": ["randomValue4"]
    }
}

Spec:
[{
    "operation": "shift",
    "spec": {
        "Properties": {
            "*": {
                "*": "Properties[#2].Values",
                "$": "Properties[#2].Id"
            }
        }
    }
}]

Property names on RHS are generic and the number of values for a property can differ as well.
Thank you in advanced for taking the time to assist me.

A: check if this helps:
[
  {
    "operation": "cardinality",
    "spec": {
      "Properties": {
        "*": {
          // normalize values to always be a list
          "Values": "MANY"
        }
      }
    }
  },
  {
    "operation": "shift",
    "spec": {
      "Properties": {
        "*": {
          "Values": {
            "*": {
              // create arrays with values and ids
              "@": "Values",
              "@(2,Id)": "Id"
            }
          }
        }
      }
    }
  },
  {
    "operation": "shift",
    "spec": {
      "Values": {
        "*": {
          // create the final list joining ids and values at the indexes you want
          "@": "Properties[&1].Values",
          "@(2,Id[#1])": "Properties[&1].Id"
        }
      }
    }
  }
]


text:
Q: Can't delete white space in a substring thorugh regular expression in python 3x My string is Some garbage 13245 65798 username@hostname.com and others garbage texts.
I want to separate 13245 65798 , username and hostname.com through regular expression.
I use search function but i face a problem with a white space.
When i try to separates this 13245 65798 substring then a extra white space stay after separate.
My code
>>> m =  re.search('(\d[\s\d]+)([\w]+)@([\w.]+)','Some garbage 13245 65798 username@hostname.com and others garbage texts.')

Output
>>> m.groups()
('13245 65798 ', 'username', 'hostname.com')
             ^

Here it the extra white space.
How can i remove that space ?

A: m =  re.search('(\d+(?:\s*\d+)*)\s*([\w]+)@([\w.]+)','Some garbage 13245 65798 username@hostname.com and others garbage texts.')

This should do it for you.See demo.
https://regex101.com/r/hE4jH0/14


text:
Q: Maven: Resolving Duplicate Dependencies I'm developing an application that will be used internally at our company. In order for it to interop with our other internal systems I have to use some maven dependencies that we use internally, but this is causing some issues with using some external 3rd party dependencies that I also need.
So essentially my pom looks like this:
<dependencies>
    <dependency>
        internal-framework-artifact
    </dependency>

    <dependency>
        necessary-third-party-artifact
    </dependency>
</dependencies>

I've come to find that both of these dependencies have the apache's commons-collections as one of their own dependencies (among a large number of others, but we'll just keep it at one for this question's simplicity).
If I place exclusion rules on both of them for the commons-collections pom I can compile the project, but my resulting jar won't have access to either version of commons-collections and will just result in a java.lang.NoClassDefFoundError exception. Removing the exclusion rule on either of them just results in a mvn compiler error:

[WARNING] Rule 2: org.apache.maven.plugins.enforcer.BanDuplicateClasses failed with message:
  Duplicate classes found:

I've been looking through various so q/a's and I can't really seem to find something that's 100% relevant to my situation. I'm really at a loss as to how to resolve this. Am I missing something really obvious?

A: I've never actually used the maven-shade-plugin for shading, but I think this is the exact use case it was designed for.
Create a new project that uses the maven-shade-plugin (see: http://maven.apache.org/plugins/maven-shade-plugin/) to produce an uber-jar version of internal-framework-artifact which contains that classes in internal-framework-artifact and all its dependencies.  Configure the plugin so that it relocates all the classes that are also dependencies of necessary-third-party-artifact to some non-conflicting package names.  This new project should produce a .jar with a different name, something like internal-framework-artifact-with-dependencies.
Now modify your original pom so that it is dependent on internal-framework-artifact-with-dependencies instead, and it should work.


text: Q: Retrieving achievement image url from itunes connect/game center I would like to post achievement success on facebook with presentShareDialogWithParams method with the achievement image. But I need an url to the image to be able to post it, so is there a way to get the achievement image url from itunes connect? It works to copy the url from itunes connect manually but I don´t want to save all image url for every achievement.


text:
Q: Ideal choice for a view which recognizes taps and can change its text/label? This question is for the iOS development platform.
I am looking for something that will have some text on it and will recognize taps. Once tapped, it will do some stuff and change the text on itself. (It will be a part of a game like app).
At first I considered using a UIButton with a custom image. But on trying to change the text on it, I realized that it is read-only.
Then I considered using a UILabel, but it didn't suit my use as, at a later stage, I would like to make the View have a custom shape with an outline.
Right now, I am considering adding a generic UIView and add a Label as a subView to it. (Can I give the UIView a custom shape?)
Please can someone point out a better solution or if I am wrong above.

A: For creating custom shaped objects use UIbezierPath. Through UIbezierPath we can create custom shaped UIViews. Touch inside those views can handle adding gestures to that views.
Sample:-
UIBezierPath* path = [UIBezierPath bezierPath];
[path moveToPoint:CGPointMake(0, 0)];
[path addLineToPoint:CGPointMake(view.frame.size.width, 0)];
[path addLineToPoint:CGPointMake(view.frame.size.width, [self headerBackGroundView].frame.size.height)];
[path addLineToPoint:CGPointMake(self.frame.size.width, self.frame.size.height)];

[path setLineWidth:1.0];

[[UIColor lightGrayColor] setStroke];

[path stroke];

A: As Desdenova said, his solution worked for me.
UIButton's title isn't read only. You can use setTitle:forState: method.


text:
Q: Getting pixel color from a full screen directx game in C So I'm trying to get the pixel color of the mouse position from a game called "Gunz"...
As far as I know, Gunz works on DirectX.
I tried to make it work on window mode using GDI, I got the pixel colors,
But when I use the full screen DirectX I only get white, example:
Red: 255
Green: 255
Blue: 255

Here's my code -
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>

int main(int argc, char** argv)
{

FARPROC pGetPixel;

HINSTANCE _hGDI = LoadLibrary("gdi32.dll");

while(1) {

if(_hGDI){
    pGetPixel = GetProcAddress(_hGDI, "GetPixel");
    HDC _hdc = GetDC(NULL);

if(_hdc){
    POINT _cursor;
    GetCursorPos(&_cursor);
    COLORREF _color = (*pGetPixel) (_hdc, _cursor.x, _cursor.y);
    int _red = GetRValue(_color);
    int _green = GetGValue(_color);
    int _blue = GetBValue(_color);

    printf("Cursor Pos: X: %d, Y: %d.\n", _cursor.x, _cursor.y);
    printf("Red: %d\n", _red);
    printf("Green: %d\n", _green);
    printf("Blue: %d\n", _blue);
    }
}
Sleep(1000);
}

FreeLibrary(_hGDI);

return 0;

}


text:
Q: Not able to open database file in SQLite manager plugin for eclipse? I downloaded the jar file and placed it in /plugins directory. Restarted eclipse as asked for eclipse to load new plugin. Opened file explorer and navigated to /package.name/databases/file.db but not able to open it in the plugin. It appears unclickable. What to do here? Check screenshot.

A: As from your Screenshot it is clear that your database doesn't have an extension currently.
Therefore it is not allowing to open the database file but if you can see here
You can delete the database from here using the "-" option delete both the database and .journal file.
Add .db extension where you are creating the ordersManager database and run the application again.(Remeber to create the database)
when you will again come to DDMS to see your database and click on ordersManager.db file the icon which i have circled will become enabled then click on it and you will be able to read data.
Also you can pull the database from device and use something like SQLLiteBrowser

A: Here are thr few useful links :
1) Link 1
2) Link 2
The mistake that you are doing is that you didn't mention the ".db" extension with your db name. Delete your previous db and name a new db with .db extention i.e. "Sample.db" try it i hope it will solve your problem.

A: From the emulator unistall the app.
Then in the code, when you create the database, name it with extension.
For e.g. if your database name is MyDB, then write it as MyDB.db
This will enable the Open File Icon on sqlite manager on eclipse.

A: You have to mark the database like you did in your screenshot but then you have to click the database icon in the top
also its better to place the plugin in the dropin folder because you haven't loaded it by a url

A: Try this download SQLite3 manager from this http://sqlitemanager.en.softonic.com/ . And install it.And pull your database (i.e. file.db ) from DDMS to now location and try to open it with using Sqlite3 manager.
And you will be able to see your database contents.
I think this is what you want.

A: Try this..

*

*Download the Android Sqlite Manager here.

*Add it to your eclipse > dropins Directory.

*Restart eclipse and go to DDMS.

*Select .db file in DDMS Perspective

*click Sqlite Manger icon.
Now you're able to open the .db file.


text:
Q: Javascript: Rewrite youtube iframe related links urls i embedded a youtube video on my website.  how can i rewrite the related urls to example.com/watch of youtube.com/watch?  I guess with Javascript .
I did read Change YouTube iframe src with jQuery
thank you, ill be sure to +1 your answer.


text:
Q: How to attach an event handler to an EnvDTE.Window I can open a new browser window in Visual Studio and open an url in it with the following snippet of code. The last line sets the title of this window to "newTitle". However, once the window is finished loading, the caption is updated to reflect the content of the URL. I like to attach an event handler to the window or to the embedded object, but I do not know how to do that.
var dte2 = Package.GetGlobalService(typeof(SDTE)) as DTE2;
var window = dte2.ItemOperations.Navigate(url, EnvDTE.vsNavigateOptions.vsNavigateOptionsNewWindow);
window.Caption = "newTitle";

What have I tried:

*

*Check if the object inside the window is of type vsWindowKindWebBrowser and cast that object to WebBrowser. But window.Object cannot be cast to WebBrowser; wb1 is null.
var wb1 = window.Object as System.Windows.Forms.WebBrowser;
wb1.DocumentCompleted += (o, e) => { window.Caption = "newTitle"; };

*Used the approach listed here: How to Get List of Open Web Pages in Visual Studio Using EnvDTE. wb2 is not null but the object inside is disposed, thus also of no use.
var wb2 = new VisualStudioWebBrowser(window.Object);
wb2.DocumentCompleted += (o, e) => { window.Caption = "newTitle"; };

*Asked this question on MSDN, see here, but no useful answer.
Question: How to attach an event handler to an EnvDTE.Window such that I can listen for the event that the page is finished loading?


text:
Q: Two-column layout not in proper flow - sidebar should be secondary For the main page of our site we have a main intro content area and a right sidebar.
I wanted the main content text to "wrap" around the right-hand sidebar when the main content extends beyond the sidebar's height (which itself extends based on content).
Below is the css and markup I used to accomplish this (My apologies in advance for the Lorum ipsum, I am using this to show how the main content text "wraps" around the right sidebar):
#container { width:100%; position:relative; padding:0; }
#maintext {}
#sidebar { float:right; width:200px }

Secondary

Secondary

Secondary

More important intro text appearing AFTER sidebar in HTML flow: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas  bibendum pharetra est eu aliquet. In lacinia est non augue egestas, nec  sodales felis euismod. Curabitur lacus enim, egestas quis pharetra non,  molestie ut nisi.

Cras eleifend, ante non elementum rhoncus, odio metus  dapibus quam, eget aliquam risus odio et lorem. Suspendisse euismod urna  cursus ligula commodo ultrices. Integer vulputate ante eu lectus  consequat mattis. Donec tristique massa at lectus viverra congue.  Maecenas elementum justo vel pretium pulvinar. Phasellus at tortor  metus. Quisque at ligula metus. Nulla euismod ipsum sit amet ullamcorper  sollicitudin. Sed accumsan libero vitae magna fermentum aliquam. Nunc  nec nisi diam. Morbi iaculis bibendum rhoncus. Pellentesque sagittis  bibendum felis in gravida.

Fiddle for the above: http://jsfiddle.net/Ezbd9/1/
The problem with this markup is that the sidebar appears contextually BEFORE the main content. I tried moving the #sidebar div so that it follows the #maintext div, but the result was that the sidebar simply appears below the main content, floating to the right all by itself. As seen here: http://jsfiddle.net/Fct8F/1/
Initially I didn't worry about this, but considering SEO and also my new responsive design to my site I am trying to find a way to get this same text wrapping effect but in proper flow (i.e. Main Content followed by Sidebar).
In short, I want to get the same visual result as the above code, but with the #maintext div BEFORE the #sidebar div in the HTML.


text:
Q: How can I load website content (link, size)? I'm using pig for data preparation, and I faced a problem which seems easy but I can't deal with: Website crawling.
I need to load website content (link, size, page size) on pig, how can I do it? Is that possible?


text:
Q: Ubuntu / DigitalOcean - Unable to fetch packages to install git on a fresh install Just started with a fresh install of Ubuntu 14.04 on my digitalocean droplet and I'm trying to install git.
My first attempt failed to install some packages -
root@Jedi:~# sudo apt-get install git-all
...
...
E: Failed to fetch http://mirrors.digitalocean.com/ubuntu/pool/main/g/gcc-4.8/libgomp1_4.8.4-2ubuntu1~14.04.1_amd64.deb  404  Not Found [IP: 95.85.0.50 80]

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

So I took the suggestion above and re-ran it with --fix-missing hoping that would fix it. No luck - still missing the package mentioned below.
What exactly is the package it's attempting to install and why is it failing on a fesh OS image? Running which git returns nothing, which tells me it's not installed.
Thanks!
root@Jedi:~# sudo apt-get install git-all --fix-missing
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  acl apache2 apache2-bin apache2-data at-spi2-core colord cvs cvsps
  dconf-gsettings-backend dconf-service emacs emacs24 emacs24-bin-common
  emacs24-common emacs24-common-non-dfsg emacsen-common fgetty fontconfig
  fontconfig-config fonts-dejavu-core gconf-service gconf-service-backend
  gconf2-common ghostscript git git-arch git-bzr git-cvs git-daemon-run
  git-doc git-el git-email git-gui git-man git-mediawiki git-svn gitk gitweb
  gsfonts hicolor-icon-theme imagemagick-common libapr1 libaprutil1
  libaprutil1-dbd-sqlite3 libaprutil1-ldap libasound2 libasound2-data
  libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data libatspi2.0-0
  libauthen-sasl-perl libavahi-client3 libavahi-common-data libavahi-common3
  libcairo-gobject2 libcairo2 libclass-factory-util-perl libclass-load-perl
  libclass-singleton-perl libcolord1 libcolorhug1 libcommon-sense-perl
  libcroco3 libcups2 libcupsfilters1 libcupsimage2 libdata-optlist-perl
  libdatetime-format-builder-perl libdatetime-format-iso8601-perl
  libdatetime-format-strptime-perl libdatetime-locale-perl libdatetime-perl
  libdatetime-timezone-perl libdatrie1 libdbd-sqlite3-perl libdbi-perl
  libdconf1 libdigest-hmac-perl libdrm-intel1 libdrm-nouveau2 libdrm-radeon1
  libemail-valid-perl libencode-locale-perl liberror-perl libexif12
  libfftw3-double3 libfile-listing-perl libfont-afm-perl libfontconfig1
  libfontenc1 libgconf-2-4 libgd3 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common
  libgif4 libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libgomp1 libgphoto2-6
  libgphoto2-l10n libgphoto2-port10 libgraphite2-3 libgs9 libgs9-common
  libgtk-3-0 libgtk-3-bin libgtk-3-common libgudev-1.0-0 libgusb2
  libharfbuzz0b libhtml-form-perl libhtml-format-perl libhtml-parser-perl
  libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl
  libhttp-daemon-perl libhttp-date-perl libhttp-message-perl
  libhttp-negotiate-perl libice6 libieee1284-3 libijs-0.35 libio-html-perl
  libio-socket-inet6-perl libio-socket-ssl-perl libjasper1 libjbig0
  libjbig2dec0 libjpeg-turbo8 libjpeg8 libjs-jquery libjson-perl
  libjson-xs-perl liblcms2-2 liblist-moreutils-perl libllvm3.4 liblqr-1-0
  libltdl7 liblwp-mediatypes-perl liblwp-protocol-https-perl libm17n-0
  libmagickcore5 libmagickwand5 libmailtools-perl libmediawiki-api-perl
  libmodule-implementation-perl libmodule-runtime-perl libnet-dns-perl
  libnet-domain-tld-perl libnet-http-perl libnet-ip-perl libnet-smtp-ssl-perl
  libnet-ssleay-perl libotf0 libpackage-stash-perl libpackage-stash-xs-perl
  libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpaper-utils
  libpaper1 libparams-classify-perl libparams-util-perl
  libparams-validate-perl libpciaccess0 libpixman-1-0 librsvg2-2
  librsvg2-common libsane libsane-common libserf-1-1 libsm6 libsocket6-perl
  libsub-install-perl libsvn-perl libsvn1 libtcl8.6 libterm-readkey-perl
  libthai-data libthai0 libtiff5 libtk8.6 libtry-tiny-perl libtxc-dxtn-s2tc0
  liburi-perl libutempter0 libv4l-0 libv4lconvert0 libvpx1 libwayland-client0
  libwayland-cursor0 libwww-perl libwww-robotrules-perl libx11-xcb1 libxaw7
  libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-render0
  libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcomposite1 libxcursor1
  libxdamage1 libxfixes3 libxft2 libxi6 libxinerama1 libxkbcommon0 libxmu6
  libxpm4 libxrandr2 libxrender1 libxshmfence1 libxss1 libxt6 libxtst6 libxv1
  libxxf86dga1 libxxf86vm1 libyaml-libyaml-perl libyaml-perl m17n-contrib
  m17n-db poppler-data python-bzrlib python-crypto python-dbus python-dbus-dev
  python-gi python-httplib2 python-keyring python-launchpadlib
  python-lazr.restfulclient python-lazr.uri python-paramiko
  python-secretstorage python-simplejson python-wadllib runit ssl-cert tcl
  tcl8.6 tk tk8.6 tla tla-doc x11-common x11-utils xbitmaps xterm
Suggested packages:
  apache2-doc apache2-suexec-pristine apache2-suexec-custom apache2-utils mksh
  rcs emacs24-el ghostscript-x hpijs bzr aspell mediawiki subversion httpd-cgi
  libcgi-fast-perl libasound2-plugins alsa-utils libgssapi-perl cups-common
  libclone-perl libmldbm-perl libnet-daemon-perl libplrpc-perl
  libsql-statement-perl libfftw3-bin libfftw3-dev libgd-tools libglide3
  gphoto2 gtkam fonts-droid gvfs libdata-dump-perl libjasper-runtime
  javascript-common liblcms2-utils libcrypt-ssleay-perl m17n-docs
  libmagickcore5-extra ttf-baekmuk ttf-arphic-gbsn00lp ttf-arphic-bsmi00lp
  ttf-arphic-gkai00mp ttf-arphic-bkai00mp libscalar-number-perl librsvg2-bin
  avahi-daemon hplip hpoj libsane-extras sane-utils libauthen-ntlm-perl
  libyaml-shell-perl poppler-utils fonts-japanese-mincho fonts-ipafont-mincho
  fonts-japanese-gothic fonts-ipafont-gothic fonts-arphic-ukai
  fonts-arphic-uming fonts-unfonts-core python-bzrlib-dbg python-bzrlib.tests
  python-gpgme python-kerberos python-pycurl xdg-utils python-crypto-dbg
  python-crypto-doc python-dbus-doc python-dbus-dbg python-gi-cairo
  gir1.2-gnomekeyring-1.0 python-gdata python-keyczar python-kde4
  python-testresources gnome-keyring python-secretstorage-doc socklog-run
  openssl-blacklist tcl-tclreadline ssh mesa-utils xfonts-cyrillic
The following NEW packages will be installed:
  acl apache2 apache2-bin apache2-data at-spi2-core colord cvs cvsps
  dconf-gsettings-backend dconf-service emacs emacs24 emacs24-bin-common
  emacs24-common emacs24-common-non-dfsg emacsen-common fgetty fontconfig
  fontconfig-config fonts-dejavu-core gconf-service gconf-service-backend
  gconf2-common ghostscript git git-all git-arch git-bzr git-cvs
  git-daemon-run git-doc git-el git-email git-gui git-man git-mediawiki
  git-svn gitk gitweb gsfonts hicolor-icon-theme imagemagick-common libapr1
  libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libasound2
  libasound2-data libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data libatspi2.0-0
  libauthen-sasl-perl libavahi-client3 libavahi-common-data libavahi-common3
  libcairo-gobject2 libcairo2 libclass-factory-util-perl libclass-load-perl
  libclass-singleton-perl libcolord1 libcolorhug1 libcommon-sense-perl
  libcroco3 libcups2 libcupsfilters1 libcupsimage2 libdata-optlist-perl
  libdatetime-format-builder-perl libdatetime-format-iso8601-perl
  libdatetime-format-strptime-perl libdatetime-locale-perl libdatetime-perl
  libdatetime-timezone-perl libdatrie1 libdbd-sqlite3-perl libdbi-perl
  libdconf1 libdigest-hmac-perl libdrm-intel1 libdrm-nouveau2 libdrm-radeon1
  libemail-valid-perl libencode-locale-perl liberror-perl libexif12
  libfftw3-double3 libfile-listing-perl libfont-afm-perl libfontconfig1
  libfontenc1 libgconf-2-4 libgd3 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common
  libgif4 libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libgomp1 libgphoto2-6
  libgphoto2-l10n libgphoto2-port10 libgraphite2-3 libgs9 libgs9-common
  libgtk-3-0 libgtk-3-bin libgtk-3-common libgudev-1.0-0 libgusb2
  libharfbuzz0b libhtml-form-perl libhtml-format-perl libhtml-parser-perl
  libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl
  libhttp-daemon-perl libhttp-date-perl libhttp-message-perl
  libhttp-negotiate-perl libice6 libieee1284-3 libijs-0.35 libio-html-perl
  libio-socket-inet6-perl libio-socket-ssl-perl libjasper1 libjbig0
  libjbig2dec0 libjpeg-turbo8 libjpeg8 libjs-jquery libjson-perl
  libjson-xs-perl liblcms2-2 liblist-moreutils-perl libllvm3.4 liblqr-1-0
  libltdl7 liblwp-mediatypes-perl liblwp-protocol-https-perl libm17n-0
  libmagickcore5 libmagickwand5 libmailtools-perl libmediawiki-api-perl
  libmodule-implementation-perl libmodule-runtime-perl libnet-dns-perl
  libnet-domain-tld-perl libnet-http-perl libnet-ip-perl libnet-smtp-ssl-perl
  libnet-ssleay-perl libotf0 libpackage-stash-perl libpackage-stash-xs-perl
  libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpaper-utils
  libpaper1 libparams-classify-perl libparams-util-perl
  libparams-validate-perl libpciaccess0 libpixman-1-0 librsvg2-2
  librsvg2-common libsane libsane-common libserf-1-1 libsm6 libsocket6-perl
  libsub-install-perl libsvn-perl libsvn1 libtcl8.6 libterm-readkey-perl
  libthai-data libthai0 libtiff5 libtk8.6 libtry-tiny-perl libtxc-dxtn-s2tc0
  liburi-perl libutempter0 libv4l-0 libv4lconvert0 libvpx1 libwayland-client0
  libwayland-cursor0 libwww-perl libwww-robotrules-perl libx11-xcb1 libxaw7
  libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-render0
  libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcomposite1 libxcursor1
  libxdamage1 libxfixes3 libxft2 libxi6 libxinerama1 libxkbcommon0 libxmu6
  libxpm4 libxrandr2 libxrender1 libxshmfence1 libxss1 libxt6 libxtst6 libxv1
  libxxf86dga1 libxxf86vm1 libyaml-libyaml-perl libyaml-perl m17n-contrib
  m17n-db poppler-data python-bzrlib python-crypto python-dbus python-dbus-dev
  python-gi python-httplib2 python-keyring python-launchpadlib
  python-lazr.restfulclient python-lazr.uri python-paramiko
  python-secretstorage python-simplejson python-wadllib runit ssl-cert tcl
  tcl8.6 tk tk8.6 tla tla-doc x11-common x11-utils xbitmaps xterm
0 upgraded, 257 newly installed, 0 to remove and 0 not upgraded.
Need to get 23.1 kB/81.3 MB of archives.
After this operation, 365 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Err http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main libgomp1 amd64 4.8.4-2ubuntu1~14.04.1
  404  Not Found [IP: 95.85.0.50 80]
Unable to correct missing packages.
E: Failed to fetch http://mirrors.digitalocean.com/ubuntu/pool/main/g/gcc-4.8/libgomp1_4.8.4-2ubuntu1~14.04.1_amd64.deb  404  Not Found [IP: 95.85.0.50 80]

E: Aborting install.

A: Hmmm... I literally ran the same original command again
sudo apt-get install git-all

and it magically worked
Sigh... un-reproducable errors are the worst kind -_-

A: Sometime, forcing a full refresh can help:
sudo apt-get clean
cd /var/lib/apt
sudo mv lists lists.old
sudo mkdir -p lists/partial
sudo apt-get clean
sudo apt-get update

A: *

*Be root.

*Run
apt-get update
apt-get upgrade

*Run
apt-get install git

... and everything will be found.
(sigh – "me too" had the same error, because I had forgotten to update and upgrade ...)


text:
Q: How do I access and set the value of a LiveData Object from ROOM to a single View I have already sent an instance of a user data object to a local ROOM database to cache some data included in the Firebase sign in flow on loginFragment.kt
val firebaseUser = FirebaseAuth.getInstance().currentUser
        firebaseUser?.let {
            // here we get access to some of the data provided by firebase auth and pass it to a new user table in the local db
            //this should avoid having to call this data again later on for the profile.
            val uid = firebaseUser.uid
            val userName = firebaseUser.displayName.toString()
            val email = firebaseUser.email.toString()
            val photoUrl = firebaseUser.photoUrl.toString()
            val emailVerified = firebaseUser.isEmailVerified
            val userEntity = UserEntity(0,uid,userName,"Not Set","Not Set",0,0, email,photoUrl,emailVerified)
            viewModel.insertNewUser(userEntity)

        }

Now I'd like to access this data from the object via 1 query in my DAO.
@Query("SELECT * FROM user_local_data_table LIMIT 1")
 fun getUserDataLive(): LiveData<UserEntity>

Then we return the live data in the repo
    val getUserDataLive:LiveData<UserEntity> = userDatabaseDAO.getUserDataLive()

This is where I get stuck. Not sure where to go from here to get this data into the view model. Im using view binding in the xml text views bound to the read only properties in my view model
  val userEntity: LiveData<UserEntity>
    get()= _userEntity
val userId: LiveData<String>
    get() = _userId
val userName : LiveData<String>
    get() = _userName
val userFirstName : LiveData<String>
    get() = _userFirstName
val userLastName : LiveData<String>
    get() = _userLastName
val score : LiveData<Double>
    get() = _score
val userEmail : LiveData<String>
    get() = _userEmail
val emailVerified : LiveData<Boolean>
    get() = _emailVerified

And I also have the fields here but this is also part of where I am stuck.
    private var _userEntity = MutableLiveData<UserEntity>()
private val _userId : MutableLiveData<String> by lazy { MutableLiveData<String>() }
private val _userName : MutableLiveData<String> by lazy { MutableLiveData<String>() }
private val _userFirstName : MutableLiveData<String> by lazy { MutableLiveData<String>() }
private val _userEmail : MutableLiveData<String> by lazy { MutableLiveData<String>() }
private val _userLastName : MutableLiveData<String> by lazy { MutableLiveData<String>() }
private val _emailVerified : MutableLiveData<Boolean> by lazy { MutableLiveData<Boolean>() }
private var _score = MutableLiveData<Double>()

Is it possible to access the data from the LiveData userEntity that is passed from the database into the repository? I was hinted at using map but feel like there must be a more simple way to present these few data sets into a view with text views waiting for that data.
I should note I've been stuck on this for a few days and almost want to just write a query for each column in the user table. Though that would be a lot of code. All the examples I see return a LiveData list or flow for a recycler view, I just need one objects data if that makes any sense.
Or should I just make a recycler view with 1 object in it? Seems counterintuitive.
Example of the lab i am following:
Android Room with a View - Java
Learn advanced coroutines with Kotlin Flow and LiveData

A: I ended up using transformation.map in the repo and using the domain model to observe changes.
in my repo:
 val userList:LiveData<List<User>> = Transformations.map(database.userDao.getUserListLive(1)){
    Log.i(logTag,"Return list of live user data limit 1 id of current user ")

    it.asDomainModel()
}


text:
Q: Edit item in DataGrid not updated using MVVM with Caliburn Micro I have a GridViewModel with a DataGrid which is bound to a BindableCollection of CalibrationPoints.
The grid contains 4 columns: No, Start, Stop and EstimatedCalibrationTime.
The user is able to edit the values directly in the DataGrid.
When value in column Start is edited, the value in column EstimatedCalibrationTime needs to be recalculated.
When value in column Stop is edited, the value in column Start needs to be recalculated.
I am facing 2 problems that i really do not know how to solve:

*

*how to know what column is edited?

*how to update the DataGrid with the new calculated values?

public class CalibrationPoint
    {
        public int No { get; set; }
        public int Start { get; set; }
        public int Stop { get; set; }
        public double EstimatedCalibrationTime { get; set; }
    }

    public class GridViewModel : Screen
    {
        public BindableCollection<CalibrationPoint> CalibrationPoints { get; }

        private CalibrationPoint selectedCalibrationPoint;
        public CalibrationPoint SelectedCalibrationPoint
        {
            get => selectedCalibrationPoint;
            set
            {
                selectedCalibrationPoint = value;
                NotifyOfPropertyChange(() => SelectedCalibrationPoint);
            }
        }

        public GridViewModel()
        {
            CalibrationPoints = new BindableCollection<CalibrationPoint>();

            CalibrationPoints.Add(new CalibrationPoint() { No = 1, Start = 1, Stop = 2, EstimatedCalibrationTime = CalculateCalibrationTime(1, 2) });
            CalibrationPoints.Add(new CalibrationPoint() { No = 2, Start = 3, Stop = 5, EstimatedCalibrationTime = CalculateCalibrationTime(3, 5) });
            CalibrationPoints.Add(new CalibrationPoint() { No = 3, Start = 6, Stop = 8, EstimatedCalibrationTime = CalculateCalibrationTime(6, 8) });
        }

        private double CalculateCalibrationTime(int start, int stop)
        {
            var time = (start * 0.7) + (stop * 1.2);
            return time;
        }
    }

Window x:Class="Wpf_DataGridTest.Views.GridView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Wpf_DataGridTest.Views"
        mc:Ignorable="d"
        Title="GridView" Height="300" Width="400">
    <Grid>
        <DataGrid Grid.Column="1"
                ItemsSource="{Binding CalibrationPoints, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
                AutoGenerateColumns="False"
                SelectedItem="{Binding Path=SelectedCalibrationPoint, Mode=TwoWay}"
                IsSynchronizedWithCurrentItem="True"
                CanUserAddRows="False"
                CanUserDeleteRows="False"
                CanUserReorderColumns="False"
                CanUserSortColumns="False">
            <DataGrid.Columns>
                <DataGridTextColumn Header="no" Width="*" Binding="{Binding No}" IsReadOnly="True"/>
                <DataGridTextColumn Header="start"
                                        Width="2*"
                                        Binding="{Binding Start}">
                </DataGridTextColumn>
                <DataGridTextColumn Header="stop"
                                        Width="2*"
                                        Binding="{Binding Stop}"/>

                <DataGridTextColumn Header="estimated
calibration
time(s)"
                                        Width="3*"
                                        Binding="{Binding EstimatedCalibrationTime}"
                                        IsReadOnly="True"/>
            </DataGrid.Columns>
        </DataGrid>
    </Grid>
</Window>

A: When you tab out a field you edited in the datagrid, that value will transfer via the magic of binding to your viewmodel property.
You have a CalibrationPoint viewmodel per row.
Therefore an edited value will transfer to the matching CalibrationPoint instance.
That value will be set on your property.  You have default empty setters there but you're not forced to work that way.
One option would be to call logic in your setter(s).  Write a method does your calculation. Call it from the setter.
Like is described here:
https://social.technet.microsoft.com/wiki/contents/articles/30564.wpf-uneventful-mvvm.aspx#Change_of_Variable
That covers 1)
Moving on from there to 2) you need to implement inotifypropertychanged on your viewmodel and raise property changed with the name of any field which is changing as a parameter. The view then re gets the value from the viewmodel for that property.
That seems to be covered here:
https://doc.postsharp.net/inotifypropertychanged-caliburnmicro

A: I wrapped the CalibrationPoint model into a CalibrationPointViewModel to be able to perform calculations in the setters as Andy suggested. Now the DataGrid is updated and everything works!
No changes to xaml necessary.
Final viewmodel code:
public class CalibrationPoint
{
    public int No { get; set; }
    public int Start { get; set; }
    public int Stop { get; set; }
    public double EstimatedCalibrationTime { get; set; }
}

public class CalibrationPointViewModel : PropertyChangedBase
{
    private CalibrationCalculator calibrationCalculator;

    public CalibrationPointViewModel()
    {
        calibrationCalculator = new CalibrationCalculator();
    }

    public int No { get; set; }

    private int start;

    public int Start
    {
        get { return start; }
        set
        {
            start = value;
            NotifyOfPropertyChange(() => Start);
            NotifyOfPropertyChange(() => EstimatedCalibrationTime);
        }
    }

    private int stop;

    public int Stop
    {
        get { return stop; }
        set
        {
            stop = value;
            Start = calibrationCalculator.CalculateStart(value);
            NotifyOfPropertyChange(() => Stop);
            NotifyOfPropertyChange(() => EstimatedCalibrationTime);
        }
    }

    private double estimatedCalibrationTime;

    public double EstimatedCalibrationTime
    {
        get
        {
            estimatedCalibrationTime = calibrationCalculator.CalculateCalibrationTime(Start, Stop);
                return estimatedCalibrationTime;
        }
        set
        {
            estimatedCalibrationTime = value;
            NotifyOfPropertyChange(() => EstimatedCalibrationTime);
        }
    }
}

public class CalibrationCalculator
{
    public double CalculateCalibrationTime(int start, int stop)
    {
        var time = (start * 0.7) + (stop * 1.2);
        return time;
    }

    public int CalculateStart(int stop)
    {
        return stop - 1;
    }
}

public class GridViewModel : Screen
{
    public BindableCollection<CalibrationPointViewModel> CalibrationPoints { get; }

    private CalibrationPointViewModel selectedCalibrationPoint;
    public CalibrationPointViewModel SelectedCalibrationPoint
    {
        get => selectedCalibrationPoint;
        set
        {
            selectedCalibrationPoint = value;
            NotifyOfPropertyChange(() => SelectedCalibrationPoint);
        }
    }

    public GridViewModel()
    {
        CalibrationPoints = new BindableCollection<CalibrationPointViewModel>();

        CalibrationPoints.Add(new CalibrationPointViewModel() { No = 1, Start = 1, Stop = 2 });
        CalibrationPoints.Add(new CalibrationPointViewModel() { No = 2, Start = 3, Stop = 5 });
        CalibrationPoints.Add(new CalibrationPointViewModel() { No = 3, Start = 6, Stop = 8 });
    }
}


text:
Q: is my sql query prone to sql injection or other attacks I was using some sql statements in views in a web app developed using playframework.I have the following java function
public static void search(String word){
   String trimword = word.trim();
   String pattern = "%"+trimword+"%";
   String query="select distinct item from Item item where item.name like :pattern";
   List<Item> items = Item.find(query).bind("pattern", pattern).fetch();
   ...
}

The 'word' is a string entered by user through a text input field in a web page form..Can the above be misused by an evil person to do nasty things to my db?I tried various combinations of user input like 'SomeItem or '1'='1' etc but nothing unexpected happened..But my knowledge of sql is minimal ..If anyone can point out any vulnerabilities in this and suggest improvements/safeguards ,it would be helpful

A: Your query is not prone to sql injection. As a general rule use bind variables on everything but table names and column names, which you can't use bind variables for.
So, vunerable
select distinct item from item where name like '&pattern'

impossible,
select distinct item from :item where name like = 'buggy'

okay
select distinct item from item where name like :pattern

EDIT @JNK, you'll have to assume that I've coded the oracle connections correctly as execute() runs to about 80 lines.
>>> import oracle
>>> db = oracle.OracleConnection('schema/pw@server')
>>> db.connect()
>>> SQL = """ select 1 from feed_logs where file_id = :file_id"""
>>> bind_vars = { 'file_id' : '1; delete from feed_logs'}
>>> db.DBCursor.execute(SQL, bind_vars=bind_vars)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
cx_Oracle.NotSupportedError: Variable_TypeByValue(): unhandled data type dict
>>>

A: The .bind("pattern", pattern) prevents SQL Injection attacks.  Thus your query is not prone to an SQL Injection attack.
Also, your code appending the % values is similar to a user entering the %. The bind() method will handle both the same way.


text:
Q: AJAX errors on Primefaces page I am trying to emulate the Primefaces Showcase to have a result set that uses filtering and a row expansion.  I get errors whenever I try either one.  The page loads without errors.  In the code example, I have stripped the filtering to isolate the issue.  It appears that any time an AJAX request is triggered it will give an error.  The error is triggered when trying to use the row expansion as that uses an AJAX call to fetch the expanded row.
We are using Primefaces 8.0 on IBM Rad local server (Eclipse).  Result set is pulled from DB2 using Hibernate and that part works.
Please help by suggesting why the AJAX fails everytime?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">
<h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</h:head>
<h:body>
    <ui:composition template="/template/maintemplate.xhtml">
        <ui:define name="title">Search Results</ui:define>
        <ui:define name="content">
            <h:form id="formId">
        #{searchResultsBean.init}
            <p:dataTable id="parameterList" var="data"
                value="#{searchResultsBean.parameterList}">
                <p:column style="width:16px">
                    <p:rowToggler />
                </p:column>
                <p:column value="#{data.companyId}" >
                    <f:facet name="header">
                        <h:outputText value="Company ID" />
                    </f:facet>
                    <h:outputText value="#{data.companyId}" />
                </p:column>
                <p:column value="#{data.companyName}" >
                    <f:facet name="header">
                        <h:outputText value="Company Name" />
                    </f:facet>
                    <h:outputText value="#{data.companyName}" />
                </p:column>
                <p:column value="#{data.alertNumber}">
                    <f:facet name="header">
                        <h:outputText value="Alert Number" />
                    </f:facet>
                    <h:outputText value="#{data.alertNumber}" />
                </p:column>
                <p:column value="#{data.comment}">
                    <f:facet name="header">
                        <h:outputText value="Comment" />
                    </f:facet>
                    <h:outputText value="#{data.comment}" />
                </p:column>
                <p:rowExpansion>
                    <p:panelGrid columns="2" columnClasses="label,value"
                        style="width:300px">
                        <h:outputText value="Company ID" />
                        <h:outputText value="#{data.companyId}" />

                        <h:outputText value="Company Name" />
                        <h:outputText value="#{data.companyName}" />

                        <h:outputText value="Alert #" />
                        <h:outputText value="#{data.alertNumber}" />

                        <h:outputText value="Alert Description" />
                        <h:outputText value="$#{data.alertNumber}" />
                    </p:panelGrid>
                </p:rowExpansion>
            </p:dataTable>
        </h:form>
    </ui:define>
</ui:composition>
</h:body>

</html>

Error received in console:
ReferenceError: ajaxWaitCursorOn is not defined

Specific error in primefaces generated javascript:
$(function(){PrimeFaces.cw("AjaxStatus","widget_j_id878804506_56ad391e",{id:"j_id878804506_56ad391e",delay:0,start:function(){ajaxWaitCursorOn()},success:function(){ajaxWaitCursorOff()}});});

Note 1:  We tried changing it to use @Inject instead of calling the init method and got the same result.
Note 2:  We verified that jQuery is loaded using a simple alert in the console.

A: The issue was this line above:  template="/template/maintemplate.xhtml
It was loading a template file. We didn't make this, but copied it from another project.  The template file had this line in for some reason:  <p:ajaxStatus onstart="ajaxWaitCursorOn()" onsuccess="ajaxWaitCursorOff()" />
I am not sure if this answer provides value to anyone except for this:  Check your template files if you have any.


text:
Q: Compactness theorem, propositional calculus Please help me with this problem.
Prove that if $\land \Phi \models \lor \Psi$ (both $\Phi$ and $\Psi$ infinite) then there exist $\phi_1,...,\phi_n$ from $\Phi$ and $\psi_1,...,\psi_m$ from $\Psi$ such that $\phi_1\land...\land \phi_n\models \psi_1\lor...\lor \psi_m$.
This should follow from the Compactness theorem rather easily but I don't unterstand how.
Thanks in advance.

A: If the logic you're using admits excluded middle, you could convert the hypothesis to $$ ⋀ Φ ∧ ⋀ ¬ ψ ⊢ ⊥. $$
Then Compactness would imply some finite subset $\phi₁ ∧ … ∧ φ_n ∧ ¬ ψ₁ ∧ … ∧ ¬ ψ_m$ of the left hand side entails a contradiction, and from there you can move $\psi₁$ through $\psi_m$ back to the right hand side.

A: By soundness and completeness of propositional logic we only need to prove
If $\bigwedge \Phi \vdash \bigvee \Psi$ then there exist $\phi_1,...,\phi_n$ from $\Phi$ and $\psi_1,...,\psi_m$ from $\Psi$ such that $\phi_1\land...\land \phi_n\vdash \psi_1\lor...\lor \psi_m$.
Proofs are always finite and therefore involve only finitely many steps. So only finitely many of $\phi_i$s can be used in the proof of $\bigwedge \Phi \vdash \bigvee \Psi$. So we have
There exists $\phi_1,...,\phi_n$ such that $\phi_1\land...\land \phi_n\vdash \bigvee \Psi $
With the same reasoning the last step in the proof of $\phi_1\land...\land \phi_n\vdash \bigvee\Psi $ has to be like this:
$\cdots \Rightarrow (\psi_{i_1}\lor \cdots \lor \psi_{i_m}) \Rightarrow \bigvee\Psi$
Which yields:
There exist $\phi_1,...,\phi_n$ and $\psi_1,...,\psi_m$ such that $\phi_1\land...\land \phi_n\vdash \psi_1\lor...\lor \psi_m$.


text:
Q: I'm trying to do draw animation on my 'svg' outline using 'gsap' library, but it's so slow doesn't what duration I set Here I'm calling 'gsap' function to apply my draw animation. I have defined useRefs to target my element, and everything import as well, but still takes dozen of years to finish it's animation
 useEffect(() => {
            gsap.registerPlugin(DrawSVGPlugin)

              .from(outlineLogoRef.current, {
                drawSVG: 0,
                duration: 20,
              })

      }, [])

The
<svg
        width="559pt"
        height="897pt"
        version="1.0"
        viewBox="0 0 559 897"
        xmlns="http://www.w3.org/2000/svg"
      >
        <g
          className="svg-container"
          transform="translate(0 457) scale(.1 -.1)"
          fill="none"
        >
          <path
            ref={outlineLogoRef}
            d="m2930 4560c-344-16-623-85-915-228-231-114-406-241-600-436-61-60-145-137-188-169-432-325-715-757-806-1230-109-564 21-1117 384-1641 250-360 780-877 1547-1511 451-373 600-505 803-708 215-216 275-293 350-448 55-114 75-188 82-298 6-96-6-173-39-257-21-53-27-59-73-76-136-51-374-73-521-46-401 71-763 376-1088 916-21 35-43 63-50 63s-32-13-57-29c-74-48-229-141-233-141-3 0-54-31-113-68s-135-84-168-102c-33-19-67-39-77-45-9-5-56-34-105-63-48-29-153-94-233-143s-152-92-160-96c-26-12-144-86-180-114-19-15-137-88-262-164-130-78-228-143-228-151s30-70 66-137c207-379 396-640 644-887 219-218 401-350 665-480 247-122 484-196 775-241 172-27 628-38 819-19 636 61 1161 302 1561 716 47 48 128 120 181 160 402 304 684 722 804 1189 61 240 70 318 70 640 0 259-3 304-23 418-84 467-268 823-647 1257-192 218-401 409-1095 995-637 539-1034 894-1208 1081-152 163-223 311-223 465 0 43 2 83 5 88 20 32 266 41 394 15 322-65 649-312 972-731 39-51 70-83 82-83 10 0 283 234 615 528 328 290 684 605 792 700s197 181 199 191-38 62-100 131c-399 446-754 740-1106 918-314 159-659 255-962 268-63 2-135 6-160 7-25 2-110 0-190-4zm570-58c671-123 1188-450 1813-1144 53-60 97-112 96-115-1-12-411-367-423-367-6 0-20-13-31-28-11-16-164-156-340-312l-320-283-18 24c-239 311-459 523-675 651-99 59-246 117-344 137-112 23-311 21-416-4-200-48-373-182-450-349-32-70-34-82-34-176 0-179 64-318 229-494 182-195 573-545 1213-1086 693-585 897-771 1085-985 379-434 563-790 647-1257 20-113 23-161 23-398 0-300-10-384-70-620-97-379-302-729-586-1e3 -105-100-185-166-191-159-9 8-63-29-92-63-48-57-291-191-482-266-202-79-481-143-735-167-188-18-606-8-779 19-290 45-528 119-775 241-385 190-680 444-972 836-118 159-345 527-332 538 46 36 763 456 773 453 16-7 36 11 30 27-3 9 131 99 212 142 28 15 203 122 231 141 21 14 23 13 45-23 225-384 515-687 794-829 164-84 300-115 503-115 125 0 235 15 340 46 17 5 22 4 17-4-13-22 24-13 47 11 12 13 53 40 91 61 193 105 351 279 418 462 18 49 21 82 22 199 1 165-11 222-79 363-75 156-135 232-355 453-208 208-355 338-808 713-766 633-1288 1142-1537 1501-305 440-449 908-415 1355 24 318 109 596 262 848 74 123 192 277 231 301 18 11 43 38 56 61 24 42 155 164 277 255 293 221 660 367 1050 419 167 23 601 15 754-13zm-2357-938c-321-485-398-1123-203-1693 70-208 178-417 315-615 250-360 780-877 1547-1511 451-373 600-505 803-708 215-216 275-292 350-448 65-136 80-200 79-343-1-134-15-186-80-302-60-108-201-244-326-317-53-31-55-28-31 35 12 33 17 79 17 184 1 165-12 222-79 363-75 156-135 232-355 453-208 208-355 338-808 713-766 633-1288 1142-1537 1501-305 440-449 908-415 1355 34 454 190 817 504 1174 58 66 264 256 277 256 4 0-23-44-58-97zm2095-529c212-43 445-176 659-378 129-121 368-406 360-429-2-6-95-93-208-193l-204-182-18 24c-105 137-202 250-307 355-191 192-351 304-540 380-145 58-234 72-415 67l-153-4 24 47c28 57 121 159 181 200 71 49 158 88 240 108 99 25 274 27 381 5zm-2672-5486c233-416 511-757 812-997 275-219 616-385 967-472 225-55 364-71 669-76 307-6 445 3 666 43 255 46 474 119 698 233l117 60-75-71c-377-356-881-572-1471-628-188-18-606-8-779 19-465 72-868 244-1222 521-180 141-402 382-575 625-130 183-342 550-326 566 11 11 446 277 454 278 4 1 33-45 65-101z"
          />
        </g>
      </svg>


text:
Q: Is there a way to get specifc data from html respose text using excel vba I cant do it manually so developing vba for it; my VBA code is working for the status field for web scraping data from the website as shown in a snap. I am able to acquire status data but unable to extract that address/location yellow highlighted in the snap. It needed to be added in column "E" from the website for each individual access code(password). I am attaching the current output. I am new to scraping. Here is the image of address/location field which I need in column E. (Access codes are in column C)

Here is my VBA code:
Option Explicit

Public Sub GetStatus()

On Error GoTo ErrHandler
    Dim html As MSHTML.HTMLDocument, xhr As Object, colourLkup As Object
    Dim ws As Worksheet, senhas(), i As Long, results()

Call CopyCommentText
    Set ws = ThisWorkbook.Worksheets("Client")
    senhas = Application.Transpose(ws.Range("C2:C" & ws.Cells(ws.Rows.Count, "C").End(xlUp).Row))

    ReDim results(1 To UBound(senhas))

    Set colourLkup = CreateObject("Scripting.Dictionary")
    colourLkup.Add "active1", "green"
    colourLkup.Add "active3", "orange"
    colourLkup.Add "valid", "valid"

    Set html = New MSHTML.HTMLDocument
    Set xhr = CreateObject("MSXML2.XMLHTTP")

    For i = LBound(senhas) To UBound(senhas)
        If senhas(i) <> vbNullString Then
            With xhr
                .Open "POST", "https://nacionalidade.justica.gov.pt/Home/GetEstadoProcessoAjax", False
                .setRequestHeader "User-Agent", "Mozilla/5.0"
                .setRequestHeader "Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"
                .send "SenhaAcesso=" & senhas(i)
                html.body.innerHTML = .responseText
            End With

            Dim nodes As Object, classinfo() As String

            Set nodes = html.querySelectorAll(".active1, .active3")

            classinfo = Split(nodes(nodes.Length - 1).className, Chr$(32))
            results(i) = Replace$(classinfo(1), "step", vbNullString) & "-" & colourLkup(classinfo(2))

 End If
        Set nodes = Nothing
    Next
    ws.Cells(2, 4).Resize(UBound(results), 1) = Application.Transpose(results)

ErrHandler:

'Error No. 1004 occurs in this case if worksheet with the same name already exists

If Err = 91 Then

'MsgBox "Invalid Code" & Chr(10) & Sheet1.Cells(i + 568, 4).Value & " " & "Row" & i + 568
classinfo(1) = "Invalid"
classinfo(2) = "Valid"

Resume Next
End If

Call CopyCommentText

Call Copy_With_AutoFilter1

End Sub

Here is the output I have made access codes to hide as it is confidential.

Here is the response-text I have using debug print

A: Try the following to get the address:
Public Sub GetAddress()
    Const pUrl$ = "https://nacionalidade.justica.gov.pt/Home/GetEstadoProcessoAjax"
    Dim Html As New HTMLDocument, Xhr As New XMLHTTP60
    Dim address$

    With Xhr
        .Open "POST", pUrl, False
        .setRequestHeader "User-Agent", "Mozilla/5.0"
        .setRequestHeader "Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"
        .send "SenhaAcesso=0908-1378-1843"
        Html.body.innerHTML = .responseText
    End With

    address = Html.querySelector("#block_container + div[style*='bold']").innerText

    MsgBox address
End Sub


text:
Q: Could not resolve android.arch.lifecycle:livedata:1.1.1 Android Studio 3.6.1 Mac It happens when opening projects or with open projects, I don't know if Android Studio may have been corrupted or it could be some permission issue.
All the projects have suddenly stopped working and it indicates the following error:
> Could not resolve android.arch.lifecycle:livedata:1.1.1.
 Required by:
  project :app > com.android.support:loader:28.0.0
> Could not resolve android.arch.lifecycle:livedata:1.1.1.
  > Could not get resource
'https://dl.google.com/dl/android/maven2/android/arch/lifecycle/livedata/1.1.1/livedata-1.1.1.pom'.
     > Failed to move file '/private/var/folders/yl/rjxf9qcx2rdfztl5mh93q_rm0000gn/T/gradle_download32524353575854917bin' into filestore at 'android.arch.lifecycle/livedata/1.1.1/b4b4d001ca961adb29783cfcdb61c36f877c51bf/livedata-1.1.1.pom'
        > Failed to create parent directory '/Users/myuser/.gradle/caches/modules-2/files-2.1/android.arch.lifecycle/livedata' when creating directory '/Users/myuser/.gradle/caches/modules-2/files-2.1/android.arch.lifecycle/livedata/1.1.1/b4b4d001ca961adb29783cfcdb61c36f877c51bf'

I have it installed in a MAC and I do not have this dependency explicitly in my project.
  apply plugin: 'com.android.application'
  apply plugin: 'io.fabric'
  android {
compileSdkVersion 28
defaultConfig {
    applicationId 'com.example.myproject'
    minSdkVersion 21
    targetSdkVersion 28
    versionCode 23
    versionName "2.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
dataBinding {
    enabled = true
}
productFlavors {
}
}
def gsonVersion = "2.8.0"
def butterKnifeVersion = "8.8.1"
def retrofitVersion = "2.3.0"
def supportVersion = "28.0.0"
def okHttpVersion = "3.7.0"
def loggingInterceptorVersion = "3.8.0"
def circleImageViewVersion = "2.1.0"
def googleServiceVersion = "17.3.4"

 dependencies {
 implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.android.support:appcompat-v7:$supportVersion"
implementation "com.android.support:design:$supportVersion"
implementation "com.android.support:support-v4:$supportVersion"
implementation 'com.android.support.constraint:constraint-layout:1.0.2'

implementation "com.google.firebase:firebase-messaging:$googleServiceVersion"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation "com.jakewharton:butterknife:$butterKnifeVersion"
annotationProcessor "com.jakewharton:butterknife-compiler:$butterKnifeVersion"
implementation 'com.github.ViksaaSkool:AwesomeSplash:v1.0.0'
implementation "com.android.support:cardview-v7:$supportVersion"
implementation "com.google.code.gson:gson:$gsonVersion"
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
implementation "com.squareup.okhttp3:okhttp:$okHttpVersion"
implementation "com.squareup.okhttp3:logging-interceptor:$loggingInterceptorVersion"
implementation "de.hdodenhof:circleimageview:$circleImageViewVersion"
implementation('io.socket:socket.io-client:1.0.0') {

    exclude group: 'org.json', module: 'json'
}

implementation 'com.heinrichreimersoftware:material-intro:1.6'
dependencies {
    implementation 'com.skyfishjy.ripplebackground:library:1.0.1'
}

implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'

implementation 'com.facebook.shimmer:shimmer:0.4.0'

implementation 'com.github.MAXDeliveryNG:slideview:1.1.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'

}

apply plugin: 'com.google.gms.google-services'

And app gradle
buildscript {

repositories {
    google()
    jcenter()
    maven {
        url 'https://maven.fabric.io/public'
    }
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.3.1'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath 'com.google.gms:google-services:4.2.0'

    classpath 'io.fabric.tools:gradle:1.28.1'
  }
}

allprojects {
 repositories {
      google()
     jcenter()
     maven { url "https://jitpack.io" }
   }
 }

task clean(type: Delete) {
  delete rootProject.buildDir
}

I have tried updating to the latest version of gradle and updating libraries, but it failed.
UPDATE:
I have tried giving AndroidStudio full disk access and it doesn't work.

A: My problem was that the .gradle 19.26.53 library had been corrupted and I solved it by completely removing Android Studio, with the commands in this post:
How to completely uninstall Android Studio on Mac?


text:
Q: How to get the type of an interface property in TypeScript? So I have a code like:
interface MyInterface{
  a:any,
  b:string,
  c:boolean,
  d:number,
  readonly valueChanges:Subject<{key: keyof MyInterface, value: ???}>
}

where I dont know how to write the type of the value under the correct 'key'. I have tried the typeof MyInterface[key] but probably this is not how to solve it. :(
Thanks for your time in advance!

A: You can make use of the AllValues utility type posted by Titian Cernicova-Dragomir. Note that you do not need the extends Record<PropertyKey, PropertyKey> as that is specific to the problem of inverting.
type AllValues<T> = {
    [P in keyof T]: { key: P, value: T[P] }
}[keyof T]

You then apply this type to your interface, but make sure that {key: valueChanges...} isn't one of your options.
type KeyValueObject = AllValues<Omit<MyInterface, "valueChanges">>

interface MyInterface{
  a: any;
  b: string;
  c: boolean;
  d: number;
  readonly valueChanges: Subject<AllValues<Omit<MyInterface, "valueChanges">>>;
}

I don't like the circular referencing here, so personally I would break it into composable pieces.  MyInterface would end up as a type rather than an interface, but there is very little practical difference.
interface BaseInterface {
  a: any;
  b: string;
  c: boolean;
  d: number;
}

type WithValueChanges<T> = T & {
    readonly valueChanges: Subject<AllValues<T>>
}

type MyInterface = WithValueChanges<BaseInterface>


text:
Q: What's the best practice to do event driven development in Angular.js apps? I am adding some websocket functional to our angular app. The Websocket object is wrapped in a service. Ideally we would like our wrapped socket object to have a standard event API so that we can use it in the controller like the following: (Sorry for the Coffeescript)
angular.module('myApp').controller 'myCtrl', ($scope, socket) ->
  update = (msg)->
    $scope.apply ->
      #do something regarding to the msg

  socket.on 'message', update

  unregister: ->
    socket.off 'message', update

What's the best practice/library for us to achieve this? Use jquery? Backbone.Events? Any suggestion will be helpful. Thanks!

A: You don't need to use any library to achieve this, just create a service, inject $rootscope and publish the events from there to rootscope, then in your controller listen for that event.
var socket; // this be the socketio instance.
angular.module("myApp").factory("SocketHandler", function ($rootScope) {
  var handler = function (msg) {
    $rootScope.$apply(function () {
      $rootScope.$broadcast("socketMessageReceived", msg);
    });
  };

  socket.on("message", handler);

  $rootScope.$on("unregisterSocket", function () {
    socket.off("message", handler);
  });
}).controller("myCtrl", function ($scope, SocketHandler) {
  var listener;
  var addListener = function () {
    listener = $scope.$on("messageReceived", function (e, msg) {
      console.log("New Message: " + msg);
    }); // $on returns a registration function for the listener
  };
  var removeListener = function () {
    if (listener) listener();
  };
});


text:
Q: How to get MethodInfo of static method with generic parameters when method ambiguity occurs? The method I would like to obtain is Observable.Return from System.Reactive.
It's defined like this:
public static IObservable<TResult> Return<TResult>(TResult value)
{
    ...
}

I've tried with
Type observableType = typeof(Observable);
MethodInfo returnMethodInfo = observableType.GetMethod("Return");
var genericMethodInfo = returnMethodInfo.MakeGenericMethod(typeof(int));

The problem is that I'm getting an error message:

Ambiguous match found.

I guess it's because there is another method called "Return":
public static IObservable<TResult> Return<TResult>(TResult value, IScheduler scheduler)
{
   ...
}

How should I call GetMethod to get a MethodInfo to the method I want?

A: You could try it with this solution.
    var method = typeof(Observable).GetMethods().FirstOrDefault(
            x => x.Name.Equals("Return", StringComparison.OrdinalIgnoreCase) &&
                x.IsGenericMethod && x.GetParameters().Length == 1)
        ?.MakeGenericMethod(typeof(int));

A: You'll need to use GetMethods() and filter to the one you want; this could be as simple as:
var returnMethodInfo = observableType.GetMethods().Single(x => x.Name == "Return"
    && x.IsGenericMethodDefinition && x.GetParameters().Length == 1);


text:
Q: Remote access my desktop through router How can I remote access my computer desktop that is behind a router with my Android Tablet?

A: The easiest way:
1) Download Teamviewer (free for non-commercial use) for linux at http://www.teamviewer.com/en/download/index.aspx?os=linux
2) Download Teamviewer for Android from market
3) Open it on your PC, and it will give you an ID and a Password:

4) Open it on your Tablet, and paste the ID and Password:

then click "Connect to partner".
5) Enjoy ;-)
ps.: when installing teamviewer on my Ubuntu 64 bits I got a dependency error (*) that was solved by installing wine before trying to install teamviewer (sudo apt-get install wine).
(*)

 teamviewer6 depends on libc6-i386 (>= 2.7); however:
  Package libc6-i386 is not installed.
 teamviewer6 depends on lib32asound2; however:
  Package lib32asound2 is not installed.
 teamviewer6 depends on lib32z1; however:
  Package lib32z1 is not installed.
 teamviewer6 depends on ia32-libs; however:
  Package ia32-libs is not installed.


text:
Q: Connecting Trimble Geo7x to ArcCollector I'm looking to link a Trimle Geo7x GPS unit to ArcCollector on Ipad or Windows 10. Is there a way to link these these devices easily or do they not play well together?

A: The Trimble Geo7x is not listed on the supported equipment list:

*

*https://doc.arcgis.com/en/collector/ios/create-maps/gps-receiver-support.htm

*https://doc.arcgis.com/en/collector/android/create-maps/gps-receiver-support.htm

*https://doc.arcgis.com/en/collector/windows/create-maps/gps-receiver-support.htm
Not that you asked, but it does work with a Trimble R2  as listed, with the GNSS Status App or GNSS Status App.

A: The Geo 7X does not have a bluetooth module that is supported by Apple iOS. You would not be able to connect the two and have the Geo 7X send NMEA data to the iPad.

A: As the previous replies have said, the Geo 7x does not have an iOS-supported Bluetooth module.  R2 and PG200 / R1 are iOS-compatible.
But you can use Geo 7x with applications on Windows 10, assuming the applications use NMEA data (I don't know what ArcCollector uses.)  Download the Geo 6000 GNSS Connector utility from the Trimble web site, GNSS Collector lets you send data from the NMEA port on the Geo 7x (Com2) to another Com port - the physical USB-to-serial port is Com1, Bluetooth would usually be Com5 for Outgoing port (you initiated pairing from the Geo 7x) or Com9 for incoming port (you initiated pairing on the Windows device).


text:
Q: Does an element has a scope in the pre link phase? I've been told that pre link phase is executing before a scope linked to the DOM element, and post link is after the DOM element been linked. Then I did an experiment: I set a 'debugger' in pre link function, navigated to my angularjs web page, when the page stopped in this breakpoint, I ran this command 'angular.element($0).scope()' in the chrome console, surprisingly I got an available scope object, not null or undefined. I thought this outcome should be in post link instead of pre link. I'm really confused, can anyone explain it to me? p.s. I'm sure $0 is exactly what I want.

A: Fine, I figured it out by myself. Pre link means it will be executed before any child elements execute link function that contains another directive, and the point is "child elements", not the element itself. For example:

JS:

app.directive('dir1', function(){
        return{
            restrict: 'A',
            template: '

',
            compile: function(){
                return {
                    pre: function(){
                        debugger;
                    },
                    post: function(){
                    }
                }
            }
        }
    });
app.directive('dir2', function(){
        return{
            restrict: 'A',
            scope:{},
            template: '<button id="btn1">hi</button>'
        }
    });

angular.element('#div1') has a scope which is $rootScope, and when the codes run to pre link phase, angular.element('#btn1') also has this $rootScope in this moment, but after the link phase in dir2, its scope will become an isolated scope which is no longer $rootScope but a new $scope.
Every element will have a scope as long as be included in a "ng-app" element, so angular.element($0).scope() always returns an available scope object.


text:
Q: MSI installer automatically starting after application already installed when using "Everyone" option? I have an application that was created using Visual Studio which contains an installation project. When I run the MSI that is built, 3 Windows Services are created. Everything installs fine, the services are there and I can start them, when I choose the option to install for "Just Me".
When I choose the option to install for "Everyone", all users on this machine, the services are still installed fine and I can start them while I am logged in as the same user who installed them BUT when I log in as a different user and try starting the application using a shortcut, the installer starts up and tries to uninstall the services. Weird thing is that it only uninstalls 2 of the 3 services.
Again, if I install using "Just Me" I am having no issues at all, it seems to be linked to the "Everyone" option. I am not sure how to even begin looking into this as I am new to setup projects (this project was created by someone else) so any help would be great.
I'm thinking in one of the installation folders a file must be missing for the second user and that is why the installation folder opens up again?
Thanks for any help.
SOLUTION:
The issue was with the DISABLEADVTSHORTCUTS property of the MSI because the shortcut that was installed for everyone was an Advertised Shortcut as far as I understand. There are a few ways to get around this using a post build event or using ORCA...we ended up using ORCA and adding the DISABLEADVTSHORTCUTS = 1 property to the MSI.
Solution and better explanation:
https://jcrawfor74.wordpress.com/2011/08/17/setup-app-config-during-msi-install-msi-re-installing/
https://support.microsoft.com/en-us/kb/255905

A: Try to find the called schema.msi under
C:\Program Files (x86)\Microsoft Visual Studio

This prototype is used in the consecutive generation of your deployment msi file. Then, you can use orca to add DISABLEADVTSHORTCUTS=1 to the Property table. So, from then on, all of your msi files will create the standard shortcut.


text:
Q: Idiomatic complete matching with post skipping What is the most idiomatic way to do post-skipping? More specific I want to ensure there is no "non-skippable" (garbage) characters in my input after matching my top rule.
auto const blankOrComment
    = ascii::space
    | x3::lexeme ['#' >> *(x3::char_ - x3::eol) >> -x3::eol ]
    ;

auto const program = rule<AstProgram>("program")
    = *(as<AstDefinition> (definition > ";"))
    ;

auto const programEntry = x3::skip(blankOrComment) [program];

One idea, I consider quite ugly was to do a separate parse call for the blankOrComment afterwards, if the main iterator position is not the end iterator. The current better idea I have is to change the root rule:
auto const programEntry = x3::skip(blankOrComment) [program >> x3::omit[*blankOrComment]];

Is there a more idiomatic way?

A: The simplest hack is to tack on >> eps: Live On Coliru
Note I'd strive to make the skipper more self-descriptive:
auto const skipper
    = space
    | '#' >> *(char_ - eol) >> (eol|eoi)
    ;

Likewise you can make that postskip hack more self-descriptive:
    auto const post_skip = eps;
    auto const program = "program" >> post_skip;

Live On Coliru
#include <iostream>
#define BOOST_SPIRIT_X3_DEBUG
#include <boost/spirit/home/x3.hpp>

namespace Parser {
    namespace x3 = boost::spirit::x3;

    namespace rules {
        using namespace x3;

        auto const skipper
            = space
            | '#' >> *(char_ - eol) >> (eol|eoi)
            ;

        auto const post_skip = eps;
        auto const program = "program" >> post_skip;

    }

    auto const programEntry = x3::skip(rules::skipper) [rules::program];
}

int main() {
    using It = std::string::const_iterator;
    for (std::string const input : {
            "",
            " program ",
            "#hello\n program # comment\n",
    }) {
        It f = input.begin(), l = input.end();

        if(parse(f, l, Parser::programEntry)) {
            std::cout << "Parse success\n";
        } else {
            std::cout << "Parse failed\n";
        }

        std::cout << "Remaining: '" << std::string(f,l) << "'\n";
    }
}

Prints
Parse failed
Remaining: ''
Parse success
Remaining: ''
Parse success
Remaining: ''


text:
Q: Removing Characters from MySQL database Sorry - I'm a complete novice, so any help greatly appreciated.
I have about 30,000 entries in a column (texty3) in a mysql database that need to have certain characters/words removed:
Specifically,
Any words shorter than 3 characters.
Any non-capilised words.
Anything non-alphanumeric.
I was was wondering if there was a mysql command for this?
I had someone write a script for future uploads via php that looks like this,
function getmtext($str) {
    $text = '';
    $words = str_word_count($str, 1);
    foreach ($words as $word) {
        if ($word[0] >= 'A' && $word[0] <= 'Z')
            if (strlen($word)>3)
                $text .= $word.' ';
    }
    return $text;
}

But I don't know how to edit entries that already exist.
Any help appreciated!

A: You can use that same script to update the entries in your SQL, there's no way (that I'm aware of) to do as you requested using purely SQL.
That said you can retrieve the data from the database (using mysql functions), modify the information and return it to the database.
For arguments sake if you had the database locally, named test with no password logging in as root you could use something like:
function getmtext($str) {
    $text = '';
    $words = str_word_count($str, 1);
    foreach ($words as $word) {
        if ($word[0] >= 'A' && $word[0] <= 'Z')
        if (strlen($word)>3)
            $text .= $word.' ';
    }
    return $text;
}

//set the database parameters
$dbHost = "localhost";
$dbUser = "root";
$dbPass = "";
$dbName = "test";

//create the database connection
$dbConn = mysql_connect ($dbHost, $dbUser, $dbPass) or die ('MySQL connect failed. ' . mysql_error());
mysql_select_db($dbName) or die('Cannot select database. ' . mysql_error());

//sql to get all texty3 rows from table
$sql = "select id, texty3 from testtable";
$query = mysql_query($sql); //run the sql
while($result = mysql_fetch_assoc($query)) { //loop through each row
     $rowId = $result['id'];
     $text = $result['texty3'];
     $cleansedText = getmtext($text);
     mysql_query("update testtable set texty3 = '$cleansedText' where id = '$rowId';");
}

This would go through the database and use that function to remove all words that don't match the parameters defined in the function. (Sorry I don't have the ability to check this code at the minute but it should be correct or at least close)


text:
Q: Tweak xsd validation to partially ignore order I have an xml query which should be xsd validated ...(impossible ??)

Unfortunately the xsd schema for the xml contains an xsd:choice between two sequences.

but i am specifying both these sequences in my xml query.
this is causing the xsd to fail the xml, any direction as to how i override this check ?
Provided:
1. The XSD schema is standardized & cannot be altered.
2. Any change must be done at the C# code behind where i am applying the validation.
the same has been asked in :
Ignore element order while validating XML against XSD
but the answer there was to modify the xsd schema, which was the accepted answer by the user.
update1
the xml is similar to this :
...
<elem>
    <subElemA>textValA</subElemA>
    <subElemB>textValA</subElemB>
<elem>
...

but the XSD says :
...
<xsd:choice>
    <xsd:element name="subElemA" minOccurs="0" maxOccurs="1">
    </xsd:element>
    <xsd:element name="subElemB" minOccurs="0" maxOccurs="1">
    </xsd:element>
</xsd:choice>
...

& if i were to remove either subElemA OR subElemB from the xml, then the xml will schema validate successfully.
update2
i am hoping to find a solution which involves tweaking my schema validation code to allow the schema validator to bypass this check; Code for schema validation :
   XmlReaderSettings setting = new XmlReaderSettings();
   setting.ConformanceLevel = ConformanceLevel.Document;
   setting.IgnoreComments = true;
   setting.IgnoreWhitespace = true;
   setting.IgnoreProcessingInstructions = true;
   setting.ValidationType = ValidationType.Schema;
   setting.Schemas.Add(defaultNameSpace, schemaLocation.AbsoluteUri);
   setting.ValidationEventHandler += new ValidationEventHandler(this.SchemaValidationCallBack);
   MemoryStream ms = new MemoryStream(System.Text.Encoding.ASCII.GetBytes(xmlToValidate));
   XmlReader reader = XmlReader.Create(ms, setting);
   while (reader.Read());

A: It's likely that what you're attempting to do isn't possible. From the validator's perspective, the XML schema is the contract that you're attempting to verify. If your document is inconsistent with that contract, then the validator can't accept it (otherwise it would be going against what you've asked it to do).
If you really need to accept this XML document, the way you would instruct the validator to accept it would be to change the contract its trying to enforce (the schema). The best way to accomplish this would be to work with your third party to help them resolve conflicts between their schema and the instance documents they're providing. Without doing this, anyone else attempting to fulfill the contract is going to run into the same problems you are.
If that's not possible, you could circumvent the system by creating a local schema file that has been modified to allow the instance document to be validated. Instead of loading the customers schema into your validator, load your alternate implementation instead. This would allow you to validate the document without the third party updating the official schema. This can easily turn into a maintenance issue as your local copy may become out-of-sync with changes in the original schema, however if they're unwilling to change the schema for this instance document, it is possible the schema isn't changing frequently anyway.


text:
Q: Which contentType should I use for requests with access_token? I fount out that "Content-type" - "application/x-www-form-urlencoded" should be used with oauth2.
Is it necessary to use this contentType always or only when requesting for access_token, or using refresh_token?
So my question is, which content type I should use for sending regular POST, GET, PUT requests from front-end. If I can use application/json for these requests, or ALL the time I should use x-www-form-urlencoded...
Thank you for advice.

A: You can definitely use other Content-type like application/json for your requests from the FE. Just make sure you have the Authorization header in those requests.
A good starting guide on oauth https://aaronparecki.com/oauth-2-simplified/


text:
Q: Values above points - chart.js I am using this version of ChartJS -> http://www.chartjs.org/samples/latest/charts/line/basic.html
And I'd like to ask you - is there a possibility to add value above the point ?
I think about something like:
 ^ an example :-)
Was trying to find something using google but unsuccessfully
Thanks in advance,

A: Yes, there is a possibility :-)
However, there's no built-in functionality for this in ChartJS as of now. You would rather have to create a chart plugin.
ᴘʟᴜɢɪɴ
plugins: [{
   afterDatasetsDraw: function(chart) {
      var ctx = chart.ctx;
      chart.data.datasets.forEach(function(dataset, index) {
         var datasetMeta = chart.getDatasetMeta(index);
         if (datasetMeta.hidden) return;
         datasetMeta.data.forEach(function(point, index) {
            var value = dataset.data[index],
                x = point.getCenterPoint().x,
                y = point.getCenterPoint().y,
                radius = point._model.radius,
                fontSize = 14,
                fontFamily = 'Verdana',
                fontColor = 'black',
                fontStyle = 'normal';
            ctx.save();
            ctx.textBaseline = 'middle';
            ctx.textAlign = 'center';
            ctx.font = fontStyle + ' ' + fontSize + 'px' + ' ' + fontFamily;
            ctx.fillStyle = fontColor;
            ctx.fillText(value, x, y - radius - fontSize);
            ctx.restore();
         });
      });
   }
}]

* add this followed by your chart options.
ᴡᴏʀᴋɪɴɢ ᴇxᴀᴍᴘʟᴇ ⧩

var chart = new Chart(ctx, {
   type: 'line',
   data: {
      labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
      datasets: [{
         label: 'LINE 1',
         data: [3, 1, 4, 2, 5],
         backgroundColor: 'rgba(0, 119, 290, 0.5)',
         borderColor: 'rgba(0, 119, 290, 0.6)',
         fill: false
      }, {
         label: 'LINE 2',
         data: [2, 4, 1, 5, 3],
         backgroundColor: 'rgba(233, 30, 99, 0.5)',
         borderColor: 'rgba(233, 30, 99, 0.6)',
         fill: false
      }]
   },
   options: {
      scales: {
         yAxes: [{
            ticks: {
               beginAtZero: true,
               max: 7
            }
         }]
      }
   },
   plugins: [{
      afterDatasetsDraw: function(chart) {
         var ctx = chart.ctx;
         chart.data.datasets.forEach(function(dataset, index) {
            var datasetMeta = chart.getDatasetMeta(index);
            if (datasetMeta.hidden) return;
            datasetMeta.data.forEach(function(point, index) {
               var value = dataset.data[index],
                   x = point.getCenterPoint().x,
                   y = point.getCenterPoint().y,
                   radius = point._model.radius,
                   fontSize = 14,
                   fontFamily = 'Verdana',
                   fontColor = 'black',
                   fontStyle = 'normal';
               ctx.save();
               ctx.textBaseline = 'middle';
               ctx.textAlign = 'center';
               ctx.font = fontStyle + ' ' + fontSize + 'px' + ' ' + fontFamily;
               ctx.fillStyle = fontColor;
               ctx.fillText(value, x, y - radius - fontSize);
               ctx.restore();
            });
         });
      }
   }]
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js"></script>
<canvas id="ctx"></canvas>


text:
Q: Необязательное поле формы. yii2 Имеется форма с некоторыми обязательными полями. Нужно одно из них сделать необязательным, а именно поле email.
UserForm
class UserForm extends User
{
    public $passwordConfirmation;
    protected $_password;

    public function rules()
    {
        $rules = parent::rules();
        $rules[] = [['passwordValue', 'passwordConfirmation'], 'required'];
        $rules[] = ['passwordConfirmation', 'compare', 'compareAttribute' => 'passwordValue', 'message' => Yii::t('web', 'Пароли не совпадают')];
        return $rules;
    }

User
public function rules()
{
    return [
        [['login', 'password_hash', 'auth_key', 'email'], 'required'],
        [['is_admin', 'is_active', 'manager_id'], 'integer'],
        [['login', 'password_reset_token', 'email'], 'string', 'max' => 255],
        [['password_hash', 'auth_key', 'validation_code'], 'string', 'max' => 32],
        [['new_password', 'push_token'], 'safe'],
        [['email', 'login', 'password_reset_token'], 'unique'],
    ];
}

т.е. в классе UserForm нужно отменить поле required из базового класса User
Как это сделать?
P.S.
подскажите, а такой вариант правильный?
class UserForm extends User
{
    public $passwordConfirmation;
    protected $_password;

    public function rules()
    {
        $rules = parent::rules();
        $rules[] = [['passwordValue', 'passwordConfirmation'], 'required'];
        $rules[] = ['passwordConfirmation', 'compare', 'compareAttribute' => 'passwordValue', 'message' => Yii::t('web', 'Пароли не совпадают')];
        unset($rules[0][0][3]);  //удаление email
        return $rules;
    }

A: Можно сделать так:
в User:
'required' => [['login', 'password_hash', 'auth_key', 'email'], 'required'],

В форме:
$rules = parent::rules();
$rules['required'] = [['login', 'password_hash', 'auth_key'], 'required'];

Но это в корне неправильно! У формы должны быть полностью свои правила валидации.


text:
Q: Understanding SCSS First, I want to mention that the icon fonts are not freely available ones. We actually purchased them.
I have a SCSS file that is making references to some icon fonts. I get most of it but not sure what the seemingly hexadecimal values mean.
$icomoon-font-path: "../fonts" !default;

$stream-check-1: "\e62f";
$stream-check-circle-1: "\e634";

I then seem to have CSS classes that reference these values:
@font-face {
    font-family: 'myicon';
    src:    url('#{$icomoon-font-path}/streamline.eot?l1dykt');
    src:    url('#{$icomoon-font-path}/streamline.eot?l1dykt#iefix') format('embedded-opentype'),
        url('#{$icomoon-font-path}/streamline.ttf?l1dykt') format('truetype'),
        url('#{$icomoon-font-path}/streamline.woff?l1dykt') format('woff'),
        url('#{$icomoon-font-path}/streamline.svg?l1dykt#streamline') format('svg');
    font-weight: normal;
    font-style: normal;
}

.myicon-check-1 {
    &:before {
        content: $stream-check-1;
    }
}

I think I get most of it. My question is where do I get those hexadecimal values e.g. e62f?
UPDATE:
I've located some json files that are zipped up in file that mentions icomoon. Would these json files be of any help in this case? They look like this:

A: "\e62f" is CSS syntax for what would be  in HTML: a character with hexadecimal code e62f. You can see the code-to-glyph mapping by inspecting your font file (the way to do this will differ based on what OS you are using).

A: I think I found the right solution here. It's an online font viewer and when I click on the font, it shows the assigned value.
Just drag and drop the font file and
it shows you the fonts and their values.

http://jsfiddle.net/iegik/r4ckgdc0/

A: Those are utf-8 icons. You can check them here.
For further lookup, check this.

A: That e62fis actually referring to the utf-8 encoding of characters. The HTML takes that "code" and turns it into a letter depending on what encoding you have. Most American websites I know of are just the utf-8
In your case, your webfont has replaced some of the normal values in order to use their own version of it. However, you might not be able to find the exact list of what other codes there are in this font as it's an Icomoon font (it appears to be) - which allows people to make their own webfont.

EDIT:
So if you have the font downloaded and have a mac - open up your Font Book Application. From there, find your font and look at all the characters. Choose the character you are looking for and copy it.
Go to a tool like this website: http://r12a.github.io/apps/conversion/
And paste your character into the green convert area.
The value that you are looking for will be in the css box! (Of course it will show up as a box on this site, but as soon as you use that code on a site where you have the font downloaded - you'll see it match what you saw in Font Book)
I was able to reproduce this with my own custom font - so I was able to make it work. This was a great question and helped me find a tool that I'm definitely going to book mark! Cheers!


text:
Q: Multiplication using increments My assignment is to write a recursive function to multiply two numbers together, using only an addition function, ++, and --. My addition function is:
public static int peanoplus(int x, int y) {
    if(y==0) return x;
    else return peanoplus(++x,--y);
}

What I have so far for my multiplication function is:
public static int peanotimes(int x, int y)
{
    if(y==0) return x;
    else return peanotimes(peanoplus(x,x),--y);
}

I am not exactly sure what to put in the first parameter for the peanotimes function. Right now the issue is that I'm doubling the number, rather than adding it to the original number. I know that I need to maintain the x variable so that the recursive calls can continue adding the original number (instead of doubling every time), but then where would I actually add the numbers?
I found this which is very similar to my question, but even with those tips I am unable to find a solution.

A: if( y == 0 || x == 0 ) { return 0; }
    else { return peanoplus(x, peanotimes(x,--y)); }

A: This version closest matches the formal Peano axiom of x * S(y) = x + (x * y)
public static int peanotimes(int x, int y)
{
    if (y == 0) {
        return 0;       // terminate recursion, NB: not "x"
    }  else {
        return peanoplus(x, peanotimes(x, --y));
    }
}


text:
Q: How to find where UIView has been created in code - swift - Programmatically If I see a UIView in Debug View Hierarchy and I don't know where it comes from,
Is there a way to see where it has been programmatically created in code?
This question describes and explains the reverse case (you have the code of the view and you see where it is located in the view hierarchy).
How can I find where I (accidentally) created a view in my code using the code provided by the view in the Debug View Hierarchy?

A: That is an extremely good question, but unfortunately the answer is no. There is nothing about the view debugger that tells you how any particular view came into existence.
A good way to track the creation of views might be to put symbolic breakpoints on their designated initializers:

You will break a lot, but each time you do you can look to see if this is the problematic view and then continue. Eventually, it will be! And now you can see who is calling the initializer.