text:
Q: Trying to convert existing spring app to springboot app I have existing spring app which i am trying to convert to springboot app. Existing app has gradle as dependency/build manager.
So far I have performed following steps:

*

*Following dependency has been added in existing build.gradle file
dependencies {
    compileOnly("org.springframework.boot:spring-boot-starter-web:2.0.3.RELEASE") {
        exclude group: 'com.fasterxml.jackson.core', module: 'jackson-databind'
    }
}

*Add an application entry point
.
@SpringBootApplication
    public class MyApplication {
            public static void main(String[] args) {
                SpringApplication.run(MyApplication.class, args);
            }
        }

So far no problem in building the project with gradle but when I try to up the project by executing the following command:
java -jar myapplication.jar
I am getting the following exception:
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication
    at com.netspend.partnerconnection.ws.PartnerConnectionApplication.main(PartnerConnectionApplication.java:9)
    ... 8 more
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:93)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 9 more

I am using gradle 4.10

A: Do NOT use compileOnly configuration for dependencies needed at runtime (see here for dependency types explanation)
Use implementation configuration, as Spring classes are needed at runtime.
dependencies {
    implementation("org.springframework.boot:spring-boot-starter-web:2.0.3.RELEASE") {
        exclude group: 'com.fasterxml.jackson.core', module: 'jackson-databind'
    }
}


text:
Q: Select item in details form dropdown when datagrid item is selected I have this datagrid:
<mx:DataGrid id="dgCompetenteN" includeIn="Test" left="10" right="472" top="69" bottom="149"
             dataProvider="{colCompetente}" editable="false">
    <mx:columns>
        <mx:DataGridColumn headerText="ID Competență" dataField="idCompetenta"/>
        <mx:DataGridColumn headerText="Denumire Competență" dataField="denCompetenta"/>
        <mx:DataGridColumn headerText="Competență Superioară" dataField="idCompSuperioara" rendererIsEditor="true" editorDataField="idCompSuperioara" itemRenderer="renderers.CompetentaSuperioara"/>
    </mx:columns>
</mx:DataGrid>

and this form:
<s:Form includeIn="Test" x="536" y="69">
    <s:FormItem label="Denumire competenta">
        <s:helpContent>
            <s:Label text="Help String"></s:Label>
        </s:helpContent>
        <s:TextInput text="{dgCompetenteN.selectedItem.denCompetenta}"/>
    </s:FormItem>
    <s:FormItem label="Competenta superioara">
        <s:helpContent>
            <s:Label text="Help String"></s:Label>
        </s:helpContent>
        <s:DropDownList dataProvider="{colCompetente}"
                        labelField="denCompetenta">
        </s:DropDownList>
    </s:FormItem>
</s:Form>

What I want to do is, when I select an item in the datagrid, the selected item of the dropdown should be the correct one (the one which has the field idCompSuperioara equal to the third element in the selected datagrid row).
Any ideas?
Thank you.

A: Try something along these lines:
The itemClickHandler:
protected function dgCompetenteN_itemClickHandler(event:ListEvent):void
{
  for each (var o:Object in colCompetente)
  {
    if (o.idCompSuperioara == dgCompetenteN.selectedItem.idCompSuperioara)
    {
      ddlCompetenta.selectedItem = o;
      break;
    }
  }
}

The DataGrid:
<mx:DataGrid id="dgCompetenteN" includeIn="Test" left="10" right="472" top="69" bottom="149" dataProvider="{colCompetente}" editable="false" itemClick="dgCompetenteN_itemClickHandler(event)">
  <mx:columns>
        <mx:DataGridColumn headerText="ID Competență" dataField="idCompetenta"/>
        <mx:DataGridColumn headerText="Denumire Competență" dataField="denCompetenta"/>
        <mx:DataGridColumn headerText="Competență Superioară" dataField="idCompSuperioara" rendererIsEditor="true" editorDataField="idCompSuperioara" itemRenderer="renderers.CompetentaSuperioara"/>
    </mx:columns>
</mx:DataGrid>

The form:
<s:Form includeIn="Test" x="536" y="69">
    <s:FormItem label="Denumire competenta">
        <s:helpContent>
            <s:Label text="Help String"></s:Label>
        </s:helpContent>
        <s:TextInput text="{dgCompetenteN.selectedItem.denCompetenta}"/>
    </s:FormItem>
    <s:FormItem label="Competenta superioara">
        <s:helpContent>
            <s:Label text="Help String"></s:Label>
        </s:helpContent>
        <s:DropDownList id="ddlCompetenta" dataProvider="{colCompetente}"
                        labelField="denCompetenta">
        </s:DropDownList>
    </s:FormItem>
</s:Form>

redpajama_set_name: RedPajamaStackExchange


text:
Q: Gradle not downloading test dependencies I am very new with Gradle and I would like to download all my test dependencies using Gradle. I used gradle init to generate my build file, and copied some dependencis from my previous scripts. However upon using gradle --refresh-dependencies in the project root, the test dependencies still do not download.
I tried searching for answers as to why this happens, but they don't seem to fix my issue. Is there something wrong with my build file?
Particularly, I am after downloading mockito and hamcrest below.
build file:
apply plugin: 'java'

repositories {
    mavenCentral()
}

dependencies {
    compile 'org.slf4j:slf4j-api:1.7.5'

    testCompile "junit:junit:4.11"
    testCompile "org.mockito:mockito-core:1.9.5"
    testCompile "org.hamcrest:hamcrest-library:1.3"
}

test {
  testLogging {
    events 'started', 'passed'
  }
}

task wrapper(type: Wrapper) { gradleVersion = '1.11' }

I am also using Eclipse if that helps.
EDIT: After adding the Gradle nature to my project, it seemed to work. Can anyone explain why?

A: As far as I understand, --refresh-dependencies makes sure that the already cached dependencies are ignored and that dependencies are re-downloaded when they're needed.
Just use gradlew build, or gradlew test, and gradle will compile your tests, and thus download the missing dependencies.

A: It seemed to work now, after I added the Gradle nature to my project, then cleaning and regenerating eclipse files.


text:
Q: What is the better url structure for RESTful application? We have a Laravel back-end and Angular2 for front-end.
Which URL structure is better:
what/:id/action
Example: course/2/edit

(I've seen this version in most blogs and it's Laravel's default convention)

or
what/action/:id
Example: course/edit/2

This version seems to have better protection from "overlapping"
what/:id/action would run into an issue if I would have
course/categories because categories would fall into :id slot.

All of these URLs share the same method (GET) so the structure itself needs to be good enough.
The overlapping issue could be solved with ordering the routes in right order or using pathMatch: 'full' but that would mean that the pattern itself is not good enough.
Sorry for the kinda subjective question, and thank you for your time in advance.

A: The best way is to use standard RESTful controllers and routes:
GET         /photos
GET         /photos/create
POST        /photos
GET         /photos/{photo}
GET         /photos/{photo}/edit
PUT/PATCH   /photos/{photo}
DELETE      /photos/{photo}


text:
Q: hide section in nsis installer conditionally on choice of radiobuttons How can a section be hidden conditionally on check or uncheck of RadioButtons in MUI NSIS installer Components Page dialog.
I have added 2 RadioButtons, DEMO & BACKUP.
When user chooses, DEMO RadioButton , then Section displayed will be "INSTALL DATA OR NOT", it can be checked or unchecked by the user, & "BACKUP DATA OR NOT" section would be hidden.
When user chooses, BACKUP RadioButton , then Section displayed will be "BACKUP DATA OR NOT", it can be checked or unchecked by the user, & "INSTALL DATA OR NOT" section would be hidden.
IF I USE THE - SIGN, then the section "INSTALL DATA OR NOT" is hidden for BOTH RADIOBUTTON CHOICES, i.e. for DEMO also & for UPDATE also, please help.
Also , there are features of SelectSection or UnSelectSection, but they do not hide the Section, which is what I want, that the Section should be hidden and unchecked.

A: A hidden section has no name so you need to give it a name for it to become visible again:
!include Logiclib.nsh
!include Sections.nsh

page Components InitComponentsPage

!define INSTALLSECTIONNAME "Install"
section "" SEC_INSTALL
sectionend

!define BACKUPSECTIONNAME "Backup"
section "" SEC_BACKUP
sectionend

Function InitComponentsPage
${If} $InstallType == BACKUP
    SectionSetText ${SEC_BACKUP} "${BACKUPSECTIONNAME}"
    !insertmacro UnSelectSection ${SEC_INSTALL}
    SectionSetText ${SEC_INSTALL} ""
${Else}
    SectionSetText ${SEC_INSTALL} "${INSTALLSECTIONNAME}"
    !insertmacro UnSelectSection ${SEC_BACKUP}
    SectionSetText ${SEC_BACKUP} ""
${EndIf}
Functionend


text:
Q: Create a Tree Path during aggregation using Spark I'm using spark to aggregate my data.
Let's say I have a table:
+----+-------+---------+
| id | value | country |
+----+-------+---------+
|  0 |     2 | us      |
|  1 |     5 | us      |
|  2 |     1 | ca      |
|  3 |     3 | us      |
|  4 |     8 | ca      |
+----+-------+---------+

And I'd like to groupBy data by country so it becomes:
+------+-------+---------+----------+
|  id  | value | country | treePath |
+------+-------+---------+----------+
| null |    24 | null    | /        | <- total row
| us   |    15 | null    | /us      |
| 0    |     2 | us      | /us/0    |
| 1    |     5 | us      | /us/1    |
| 3    |     3 | us      | /us/3    |
| ca   |     9 | null    | /ca      |
| 2    |     1 | ca      | /ca/2    |
| 4    |     8 | ca      | /ca/4    |
+------+-------+---------+----------+

which has an additional column to display the tree path.
I'm thinking to modify child rows during aggregation to reference its direct parent and recursively build the treePath. Is this viable approach?

A: All you have to do is create three dataframes
a total dataframe with id and country populated as null and value as sum of all the values and treePath as root
import org.apache.spark.sql.functions._
//total dataframe for root tree path
val totalDf = df.select(lit(null).as("id"), sum("value").as("value"), lit(null).as("country"))
                  .withColumn("treePath", lit("/"))

a grouped dataframe with id and country populated as country value and value populated as sum of grouped values and treePath as home
//grouped dataframe for home treepath for every group
val groupedDf = df.groupBy(col("Country").as("id")).agg(sum("value").as("value"), first(col("country")).as("country"))
                  .withColumn("treePath", concat_ws("/", lit(""), col("country")))

And original dataframe populated with treePath of country and id, and finally union all of them
//union all three dataframe for final treePath column
df.withColumn("treePath", concat_ws("/", lit(""), col("country"), col("id")))
  .union(totalDf)
  .union(groupedDf)

Thats it. And you should have output dataframe as
+----+-----+-------+--------+
|id  |value|country|treePath|
+----+-----+-------+--------+
|null|19.0 |null   |/       |
|ca  |9.0  |ca     |/ca     |
|2   |1    |ca     |/ca/2   |
|4   |8    |ca     |/ca/4   |
|us  |10.0 |us     |/us     |
|0   |2    |us     |/us/0   |
|1   |5    |us     |/us/1   |
|3   |3    |us     |/us/3   |
+----+-----+-------+--------+


text:
Q: Should I compress python files in Django? I know that I should compress frontend files (HTML, CSS, JS) to increase the security and loading speed of a website.
But how about the backend files (for example Python)? Should I compress them too? Do I get any benefits from doing that?

A: I've been developing Django applications for the past 10 years, and I've never worried about compressing the actual python files since these files are not going to be transferred to the client. However, you actually can compress the responses sent from your Django server by using the built-in GZipMiddleware which compresses content for browsers that understand GZip compression (all modern browsers).
The process is as simple as adding the following line to your settings.py
Either by enabling the middleware in settings.py by adding:

MIDDLEWARE_CLASSES = (
    django.middleware.gzip.GZipMiddleware,
    ...
)

Note: This middleware should be placed before any other middleware that need to read or write the response body so that compression happens afterward.

This is what I usually do on the backend side, and then I just focus on making the server-side processing faster.


text:
Q: Versioning data schema in android internal storage I am using Android's internal storage to hold data for my application and I am trying to find a good way to handle reading data of an older schema. For example, let's say I have serialized and written several instances of class Data to a file:
public class Data{
    private String text;
    public Data(text){
        this.text = text;
    }
}

and later I read that stringified data back out and cast to (Data). But then say I change Data to look like this:
public class Data{
    private String name;
    public Data(name){
        this.name = name;
    }
}

now that the property is named differently, when I read out data that was saved in the original schema, it will not easily cast to the new type. What are some solutions to version the data so that I can read out old data and cast it to a new type?


text:
Q: Proof for "any $p \in \operatorname{Sym^3(\mathbb C^2)}$ can be written as a product of linear factors?" Here is the paper I am trying to understand:

I need a proof that "any $p \in \operatorname{Sym^3(\mathbb C^2)}$ can be written as a product of linear factors $(a_1 x + b_1 y)(a_2 x + b_2 y)(a_3 x + b_3 y)$" please?
Intuitively I agree on this statement because the basis elements $(x^3, x^2y, xy^2, y^3)$ can be obtained from these linear factors but this is not a rigorous proof.
Also, I do not understand the statement: what if $\theta$ is the cube of the inverse of the determinant character of $G'.$ This will descend to a character of $G.$
Could anyone explain this for me please?

A: You have a polynomial $$p(x,y)=ax^3+bx^2y+cxy^2+dy^3=y^3\Big(a\Big(\frac{x}{y}\Big)^3+b\Big(\frac{x}{y}\Big)^2+c\Big(\frac{x}{y}\Big)+d\Big)=y^3q\Big(\frac{x}{y}\Big)$$ where $q(t)=at^3+bt^2+ct+d$. Since $\mathbb{C}$ is algebraically closed, $q$ can be factor into linear terms : $q(t)=(a_1t+b_1)(a_2t+b_2)(a_3t+b_3)$. Thus $$p(x,y)=y^3\Big(a_1\frac{x}{y}+b_1\Big)\Big(a_2\frac{x}{y}+b_2\Big)\Big(a_3\frac{x}{y}+b_3\Big)=(a_1x+b_1y)(a_2x+b_2y)(a_3x+b_3y)$$
You have an equality of polynomials which holds for any $y\neq 0$, thus which hold for any $y$.


text:
Q: iOS-Swift How to update progressView I am developing an app where i am downloading data from web.
here i am using cancel button to cancel the download progress,this works fine if i am in the same view controller and if i navigate to new view controller and return back to download view controller progress view is not updating but the download is happening.
This is the code i am using to download data
func URLSession(session: NSURLSession,
                downloadTask: NSURLSessionDownloadTask,
                didFinishDownloadingToURL location: NSURL){

    let path = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)
    let documentDirectoryPath:String = path[0]
    let fileManager = NSFileManager()
    let destinationURLForFile = NSURL(fileURLWithPath: documentDirectoryPath.stringByAppendingString( Variables.name ))

    if fileManager.fileExistsAtPath(destinationURLForFile.path!){
        print("File Already Exists")
    } else {
        do {
            try fileManager.moveItemAtURL(location, toURL: destinationURLForFile)
            print("File doesn't exists")
        }catch{
            print("An error occurred while moving file to destination url")
        }
    }
}

// 2
func URLSession(session: NSURLSession,
                downloadTask: NSURLSessionDownloadTask,
                didWriteData bytesWritten: Int64,
                             totalBytesWritten writ: Int64,
                             totalBytesExpectedToWrite exp: Int64){
    //progressView.setProgress(Float(totalBytesWritten)/Float(totalBytesExpectedToWrite), animated: true)

    print("downloaded \(100*writ/exp)")

    dispatch_async(dispatch_get_main_queue(), {
        self.counter = Float(100*writ/exp)
        return
    })
}

func URLSession(session: NSURLSession,
                task: NSURLSessionTask,
                didCompleteWithError error: NSError?){
    downloadTask = nil

    //  progressView.setProgress(0.0, animated: true)
    if (error != nil) {
        print(error?.description)
    } else {
        print("The task finished transferring data successfully")
    }
}

func documentInteractionControllerViewControllerForPreview(controller: UIDocumentInteractionController) -> UIViewController{
    return self
}


text:
Q: What is the quickest way in Python to identify lists with common elements A & B in indices [i] & [j] without using expensive for loops? Context:
I went through many similar questions on the internet for list filters and tried all suggested solutions. But they all seem to be fine for comparing two different lists. But they do not give desired results for a my list-of-lists.
Problem:
I have a list of lists and two different numbers that I want to check if they are located in the first two index elements (index[0] and index[1]) of the nested lists within the list of lists. I wish to identify all such lists and then if such lists exist, compare the fourth index member of all those similar lists against a fixed number.
My Sample list:
[[1, 4, 65, 77, 22.0], [3, 2, 12, 55, 77.0], [1, 4, 16, 99, 13.0]]

Numbers to check:
`index[0] == 1 and index[1] == 4.`

The above list of lists has two such nested lists where the first index member is 1 and second index member is 4.
Hence we we now compare the fourth index member of each similar list against our reference weight = 17.
Thus there is one list where the number 22 is greater than our reference number 17; and another list where the number 13 is lesser than our reference number 17.
My Output should be :
return True if there is at least one list where the fourth index is < reference weight

return False if all values in fourth index are > = reference weight

What I am looking for is an efficient way of quickly identifying the similar lists within the list of lists. I know for loop is an option, but performance becomes an issue since my list-of-lists can get very big over time (during every iteration new list members get added to the list of lists).

A: You can use collections.defaultdict to group lists similar by your definition with O(n) complexity. You should test to see whether the performance of this solution suits your needs.
from collections import defaultdict

lst = [[1, 4, 65, 77, 22.0], [3, 2, 12, 55, 77.0], [1, 4, 16, 99, 13.0]]

d = defaultdict(list)

for item in lst:
    d[tuple(item[:2])].append(item)

# defaultdict(list,
#             {(1, 4): [[1, 4, 65, 77, 22.0], [1, 4, 16, 99, 13.0]],
#              (3, 2): [[3, 2, 12, 55, 77.0]]})

For the second part of your question, you can iterate your dictionary items:
res = {k: any(i[4]<17 for i in v) for k, v in d.items()}

# {(1, 4): True, (3, 2): False}


text:
Q: Level curves in $\mathbb{R}^3$ I am looking at the following exercise:
State an analogue of Theorem 1.5.1 for level curves in $\mathbb{R}^3$ given by $f(x, y, z) = g(x, y, z) = 0$.
The Theorem 1.5.1 is the following:

So, is the analogue for level curves in $\mathbb{R}^3$ as follows?
Let $f(x, y,z)$ and $g(x,y,z)$ be two smooth functions of three variables.
Assume that, at every point of the level curve
$$C = \{(x, y, z) \in \mathbb{R}^3 \mid  f(x, y, z)=g(x,y,z)=0\}$$
$\nabla f$ and $\nabla g$ are not simultaneously zero.
If $p$ is a point of $C$, with coordinates $(x_0, y_0, z_0)$, say, there is a regular parametrized curve $\gamma (t)$, defined on an open interval containing $0$, such that $\gamma$ passes through $p$ when $t = 0$ and $\gamma (t)$ is contained in $C$ for all $t$.
Or is it in this case somehow different?

A: In general, $C$ won't be a regular curve without imposing some extra conditions. For example, if $f = g$, then generically $C$ will be a surface. Even if $f = 0$ and $g = 0$ are two different surfaces, their intersection can be singular as demonstrated in the following image (taken from Wikipedia):

A popular condition that forces the intersection to be a regular curve is to require that the surfaces intersect transversely in $p$. The technical requirement is that $\nabla_f|_p$ and $\nabla_g|_p$ must be linearly independent. This means that the tangent planes to $f = 0$ and $g = 0$ at $p$ are not the same and so the surfaces are not tangent to each other at $p$. An inverse function theorem argument then shows that locally, around $p$, the intersection $C$ is the image of a regular curve.


text:
Q: couldn't access registry HKLM keys couldn't access registry HKLM keys from windows xp limited/guest user accounts
public int GetEnabledStatus()
{
 RegistryKey hklm = Registry.LocalMachine;
 int Res;
 try
 {
    RegistryKey run1 =
      hklm.OpenSubKey(@"Software\Microsoft\Windows\myApp", true);
    hkcu.OpenSubKey(@"Software\Microsoft\Windows\myApp", true);
    Res = int.Parse(run1.GetValue("enabled").ToString());
 }
 catch
 {
    Res = 0;
    return Res;
 }
 finally
 {
    hklm.Close();
 }
  return Res;
}

this code works fine in administrator user accounts, under limited/guest accounts call to this  function doest not return value. is there any work around

A: You are opening the keys in "write" mode (2nd parameter is set to 'true'). As a limited user, you do not have permissions to write to HKLM. By changing mode to "readonly" (2nd parameter set to 'false') you should be able to read the value.
I would recommend updating the code as follows:
private static int GetEnabledStatus()
{
    const int defaultStatus = 0;
    using (var key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\myApp")) // open read-only
    {
        int valueInt;
        var value = (key != null
            ? key.GetValue("enabled", defaultStatus)
            : defaultStatus);
        return (value is int
            ? (int)value
            : int.TryParse(value.ToString(), out valueInt)
                ? valueInt
                : defaultStatus);
    }
}

No need for exception handling, works on my machine when run as limited user :-).

A: If you only want to read the key, use the overload of OpenSubKey which takes only a string.


text:
Q: Disable Transactions for Hibernate calling Stored Procedures For our web application, all DB access is performed via stored procedures.  This design decision is set in stone and there is no way I can change it.
Additionally, all transaction handling is done within the stored procedures.  The Java layer must not use transactions.
I can easily accomplish this using plain JDBC.  But I'd prefer to use Hibernate for its ORM and caching features.
Calling stored procedures with Hibernate is easy:
final Session session = sessionFactory.getCurrentSession();
final Query query = session.createSQLQuery("EXEC dbo.SP_ProductSearch :searchStr").addEntity(Product.class).setString("searchStr", "ap");
return query.list();

But when I run a DB profile, I see the following.
SET IMPLICIT_TRANSACTIONS ON
EXEC dbo.SP_ProductSearch  N'ap'
IF @@TRANCOUNT > 0 COMMIT TRAN
IF @@TRANCOUNT > 0 COMMIT TRAN
SET IMPLICIT_TRANSACTIONS OFF

Is there anyway I can disable the 4x transaction statements?
My technology stack is as follows.

*

*Spring 3.1.2

*Hibernate 4.1.8

*jTDS (JDBC driver) 1.2.5

*MS SQL Server 10.x

Many thanks in advance... Adam.

@ctapobep - this is how it is done using plain JDBC.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class PlainJdbcTest
{
    private static final String USERNAME = "sa";
    private static final String PASSWORD = "password";
    private static final String URL = "jdbc:jtds:sqlserver://myserver:1433;DatabaseName=testDatabase;prepareSQL=0";
    private static final String QUERY = " EXEC dbo.SP_ProductSearch ?";
    private static final String DRIVER = "net.sourceforge.jtds.jdbc.Driver";

    public static void main(String[] args) throws Exception
    {
        Class.forName(DRIVER).newInstance();

        final Connection connection = DriverManager.getConnection(URL, USERNAME, PASSWORD);
        final PreparedStatement statement = connection.prepareStatement(QUERY);
        statement.setString(1, "ba");
        final ResultSet resultSet = statement.executeQuery();

        while(resultSet.next())
        {
            final int id = resultSet.getInt(1);
            final String desc = resultSet.getString(2);
            System.out.print(id + " / " + desc);
        }

        if(resultSet != null) resultSet.close();
        if(statement != null) statement.close();
        if(connection != null) connection.close();
    }
}

And this is what is shown in the profile - so works perfectly!
EXEC dbo.SP_ProductSearch  N'ba'

A: How are you calling your hibernate code (executing stored procedure)? Is it called through Spring Service class having @Transactional annotation?

A: I haven't discovered any way to prevent Hibernate from using transactions, so as a work-around I've switched to MyBatis which works perfectly.
http://www.mybatis.org/spring/index.html


text:
Q: Changing content of page with Angular I have a website I build on a MEAN stack. My main navigation has about 10 pages which are controlled by ngRoute. One of these navigation items has a lot of inside links to pages where the content is almost the same everywhere. The only thing I need to change on each page is a cityname and phonenumber and some other small stuff. So my question is: Can I make only one page where I change content on each link-click in Angular?

A: Create a custom directive:
https://www.tutorialspoint.com/angularjs/angularjs_custom_directives.htm
Basically this allows you to create a configurable 'template' by adding a custom attribute to an element of your HTML (you define the attribute name, as the name of your custom directive). You can add the custom data that you need to each view you need to display, by passing it as data to the custom directive.


text:
Q: Ext4 partition 8TB Just setup a 8TB disk with gparted as GPT with a single ext4 partition, but now that is mounte it says:
/dev/sdc1              7,3T   38G    6,9T   1% /mnt/BACKUP
Why only 7.3T are available, the ext4 would use the other 700GB?
If I setup multiple partitions I can get more space for data?
i.e. 2 partition of 4 TB would change the situation?
Thanks, BR

A: Because HDD vendors rarely (if ever) use KiB/MiB/GiB/TiB (x1024) as notation for their storage, but use KB/MB/GB/TB (x1000) instead. Your OS / filesystem uses binary-multiple prefixes, opposed to the industry standard of decimal-multiple prefixes.
Examples and comparisons with SI prefixes
one mebibyte    1 MiB = 220 Byte = 1,048,576 Byte
one megabyte    1 MB = 106 Byte = 1,000,000 Byte
one gibibyte    1 GiB = 230 Byte = 1,073,741,824 Byte
one gigabyte    1 GB = 109 Byte = 1,000,000,000 Byte
one tebibyte    1 TiB = 240 Byte = 1,099,511,627,776 Byte
one terabyte    1 TB = 1012 Byte = 1,000,000,000,000 Byte

8 TB = 8000000000000 B

Byte based with decimal-multiple prefixes (powers of 10):
8000000000 KB (kilobyte)
8000000 MB (megabyte)
8000 GB (gigabyte)

8 TB (terabyte) Byte based with binary-multiple prefixes (powers of 2):
7812500000 KiB (kibibyte)
7629394.53125 MiB (mebibyte)
7450.58059692383 GiB (gibibyte)
7.27595761418343 TiB (tebibyte)

Source: http://wintelguy.com/tb2tib.html
Ext4 adds overhead for sure, but it should be more like ~1,5% of the space.

A: Reserved Space
By default, ext4 reserves 5% of the space for root.  You can adjust this using tune2fs -m percentage device so in your case, tune2fs -m0 /dev/sdc.
That should give your space back.


text:
Q: array of child objects in Nested Classes and accessing child objects in .Net I have a nested class, let's call it class1 and it has class2 inside it; VB.Net eg:
Public Class class1

     Public Class class2
        Public Sub New()

        end sub
     end class

  Public Sub New()
    '**1) How can I define X number of Class2 objects[let's call it: Node(x)  array]** with NEW() subroutine called?
    ' this raises error: dim cls2(n) as new class2
  end sub

  Public ReadOnly Property Count As Integer
     Get
        ' **2) How can I return actual number of Node() array?**
        End Get
     End Property

end class

Outside my class in main project I define cls1 object:

dim cls1 as new class1

Now an array of class2 is created inside cls1.
3) Now,How can I access All of them[node(x) array which is created inside cls1] with all properties and methods available?
I remember I wrote a ProcessManager class with this functionality in .net 2003, nearly 4 years age, I don't have the code now.
Please write the answer in VB.net or if you can't C#. thanks a lot and saluets to you.

A: Create a list:
Private _MyClass2List As New List(Of Class2)

Public Sub New()
  For i As Integer = 0 to 4
    _MyClass2List.Add(New class2())
  Next
End sub

Then your property would return:
Public ReadOnly Property Count As Integer
  Get
    Return _MyClass2List.Count
  End Get
End Property

To expose the list of items, I would favor a readonly IEnumerable property:
Public ReadOnly Property Class2Items() As IEnumerable(of class2)
  Get
    Return _MyClass2List
  End Get
End Property


text:
Q: Using pvalue from list of anova results as condition I want run a series of kruskal.tests, followed by a dunn_test where the Kruskal was significant. Then print the results of the significant dunn_tests.
library(rstatix)
library(purrr)

iris<- iris

for(i in 1:4){
  a<- colnames(iris)
  anova<- map(names(iris)[1:4], ~ kruskal.test(reformulate('Species', response=.x), data=iris))
  post<- dunn_test(iris, as.formula(paste(a[i], a[5], sep="~")), p.adjust.method= "bonferroni")

  if(any(post$p.adj < 0.05 & anova[[i]]$p.value < 0.05)){
    print(a)
    print(setNames(post, a))
  }
}

I'm wondering how I can print only the significant dunntests when the kruskal test of the same variable was significant.
I realize this wouldn't give me the result I'm looking for as the post and anova items are two separate objects, this was just my original line of thinking.
Using anova[[i]]$p.valuealso results in a subscript out of bounds error.

A: Here is a way with a function to just get the post-hoc results you want. It works similar to a loop. I see you are familiar with as.formula and I think that's the best approach here. I've used the same formula for the Kruskal-Wallis test and the Dunn test. The function just uses the column names you want to test and creates the formula from that. If you want to return all post-hoc tests if any one comparison is significant, any works with a small change. The output want captures all the post-hoc tests with at least one significant pairwise comparison.
As an aside from your code, it's not great practice to create object names that have the same name as functions in R. anova is a base function in R, so you wouldn't want to then have your result named anova as well. You also create the object a over and over in your loop. It's the same task, so it should be outside your loop. It's not a huge deal, but if you start working with larger datasets it can add up.
library(rstatix)
#>
#> Attaching package: 'rstatix'
#> The following object is masked from 'package:stats':
#>
#>     filter

iris <- iris

a <- colnames(iris)
a <- a[1:4]

myfunc <- function(y, x){
  form <- as.formula(paste0(y, " ~ ", x))
  res <- rstatix::kruskal_test(form, data = iris)

  if (res$p < 0.05){
     post <- rstatix::dunn_test(data = iris, form, p.adjust.method= "bonferroni")

     if(any(post$p.adj < 0.05)) return(post)
  }
}

want <- lapply(a, FUN = myfunc, x = "Species")
want <- do.call(rbind, want)

If you only want the specific pairwise comparisons that were significant, because the output from dunn_test is a data.frame, you can just subset it by the adjusted p-values that are less than 0.05 and return that.
myfunc <- function(y, x){
  form <- as.formula(paste0(y, " ~ ", x))
  res <- rstatix::kruskal_test(form, data = iris)

  if (res$p < 0.05){
     post <- rstatix::dunn_test(data = iris, form, p.adjust.method= "bonferroni")
     post <- post[post$p.adj < 0.05 ,]
     return(post)
  }
}

As a loop, this would be:
res <- list()
post <- list()
post_sig <- list()
for(i in 1:4){
  form <- as.formula(paste0(a[i], " ~ Species"))
  res[[i]] <- rstatix::kruskal_test(form, data = iris)
  post[[i]] <- rstatix::dunn_test(data = iris, form, p.adjust.method= "bonferroni")

  if (res[[i]]$p < 0.05 & any(post[[i]]$p.adj < 0.05)){
       print(post[[i]])
       ## could be blanks in the list here as the number i is used
       ## e.g. if var 2 was not significant, post_sig[[2]] is blank
       post_sig[[i]] <- post[[i]]
  }
}

## if you want results as a dataframe
res <- do.call(rbind, res)
post <- do.call(rbind, post)
post_sig <- do.call(rbind, post_sig)

A: As far as I can tell, your code mostly works. The only major problem is that you misuse the any() function. You misplaced the second parenthesis. Fixing that and rearranging the code a little, I ran this:
library(rstatix)
library(purrr)

iris<- iris

a<- colnames(iris)
anova<- map(names(iris)[1:4], ~ kruskal.test(reformulate('Species', response=.x), data=iris))

for(i in 1:4){
  post<- dunn_test(iris, as.formula(paste(a[i], a[5], sep="~")), p.adjust.method= "bonferroni")

  if(any(post$p.adj < 0.05) & anova[[i]]$p.value < 0.05){
    print(a[i])
    print(post)
  }
}

This piece of code prints out one after another, the name of the variable being tested and the output from the dunn_test, so long as the relevant p-value from the kruskal test is less that 0.05, and at least one of the comparisons in the dunn_test is significant.


text:
Q: Chat app popup a window at client I made a simple chat app. It uses database, this is not efficient cause the client queries database every few sec. Any way, I achieved what i needed, There are good ways out there like polling and commet, I will implement those later. Please take time to read abt this, I have few probs with this.
1) Consider two users 100 and 101, When 100 sends a msg to 101, i am saving the id as 100_101 in DB
2) When 101 send back msg to 100 it is saved as 101_100 in DB.
3) I am able to get the messages in order.
Problem-
1) Users should keep tht particular window open.
I want popup to open when there is new message. How to achieve that.
2) When a user(100) is typing user(101) should see the text as "100 is typing" if 101 chat window with 100 is open only. This should not involve any database stuff.
Work I have done. I can send data to server when user(100) starts typing to server. How to send data, i.e how to push data to user(101).
My presnt code is below.
ajax
$.ajax( {
                    type : "POST",
                    data : "uName=" + uName +"&opName=" + opName + "&msg=" + msg + "&colorCode="
                            + colorCode,
                    url : "<%= path %>/chat/SaveChat",
                    error : function(xhr, ajaxOptions, thrownError) {
                        alert(xhr.status);
                        alert(thrownError);
                    },
                    success : function(data) {
                                      //      alert(data);
                        $("#chat-area").html(data);
                                            document.getElementById('chat-area').scrollTop = document.getElementById('chat-area').scrollHeight;
                                            }
                });

Servlet
try {
                    String newline = System.getProperty("line.separator");
                        String uName = req.getParameter("uName");
                        String opName= req.getParameter("opName");
                        String msg = req.getParameter("msg");
                        String colorCode = req.getParameter("colorCode");
                        DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
                        Date date = new Date();
                        String dat =dateFormat.format(date);

                        PreparedStatement ps = db.conn.prepareStatement("INSERT INTO chatmessage"
                                + "(message,username,msgtime,colorselected) "
                                + " VALUES(?,?,?,?)");
                        ps.setString(1,msg);
                        ps.setString(2,uName+"_"+opName);
                        ps.setString(3,dat);
                        ps.setString(4,colorCode);
            ps.executeUpdate();
            ps.close();

                        ps = db.conn.prepareStatement("select * from chatmessage where username=? or username=? order by id asc");
                        ps.setString(1,uName+"_"+opName);
                        ps.setString(2,opName+"_"+uName);
                        ResultSet rs=ps.executeQuery();
                        String temp[];
                        StringBuilder sb = new StringBuilder();
                        while(rs.next())
                        {
                            temp=rs.getString("username").split("_");
                           /* out.println(newline);
                            out.print(temp[0]+":");
                            out.print(rs.getString("message"));
                            out.println(newline);*/

                            sb.append("" + temp[0]
                    + "" + rs.getString("message") + "

");
                        }
            db.conn.close();
                        out.print(replaceEmoticons(sb.toString()));
            //out.print("success");
        }
        catch(Exception ce){
            out.println("Error Code 004");
        //  RequestDispatcher rd = req.getRequestDispatcher("../status/error.jsp");
        //  rd.forward(req, res);
        }finally{
                    try{
                        db.conn.close();
                    }catch(Exception e){}
                }

Thankyou any easy and valid ideas are appreciated.


text:
Q: React Native Keychain - Cannot read property 'getSupportedBiometryType' of null I have followed the installation steps, but when I start the application on android I get an error saying: "Cannot read property 'getSupportedBiometryType' of null, please check the last image.

*

*Run yarn add react-native-keychain - Only for React Native <= 0.59: $ react-native link react-native-keychain and check MainApplication.java to verify the package was added. See manual installation below if you have issues with the react-native link.

*Run pod install in iOS/directory to install iOS dependencies.

*If you want to support FaceID, add an NSFaceIDUsageDescription entry in your Info.plist.
Re-build your Android and iOS projects.`
On iOS Everything works fine and the getSupportedBiometryType returns a string or null depending if the biometrics authentication is enabled.
On android on another hand, I get a Render Error: Cannot Read property 'getSupportedBiometryType' of null.

*I also did the react-native link react-native-keychain command to try to fix the issue, but I had no luck.
Note: I also did the Manual Android install as described in the library installation guide.
Note: Everything works fine on iOS.
Packages:
"react-native": "0.64.2"
"react-native-keychain": "^8.1.0"
Keychain library import
.getSupportedBiometryType() function call
Error Message on Android Device


text:
Q: what's wrong with the script? can figure out what's wrong? always returns failure
function addItem() {
            var rowCount = $('#grid').getGridParam('records');
            var lastRow = $('#grid').getRowData(rowCount - 1);

            var newRow = lastRow;
            newRow.Id = "0";
            newRow.Person = "";
            newRow.Date = "";

            var newItem = $('grid').addRowData(rowCount - 1, newRow);

            if (newItem == true) {
                alert('success');
            }
            else { alert('falire'); }
        }

A: I don't know, but perhaps this:
var newItem = $('grid').addRowData(rowCount - 1, newRow);

Should be this:
var newItem = $('#grid').addRowData(rowCount - 1, newRow); // missing pound sign

-- edit:
And if this turns out to be the problem, I suggest you define the names of things at the top, like so:
var theGridElement = $("#grid");

Thus helping in these little mistakes of minor inconsistency :)


text:
Q: Microsoft Teams SSO Authentication method getAuthToken() returns 'resourceDisabled' I am trying to get the AuthToken from Microsoft team and I get an error despite doing everything by book.
I know there is a similar question on S.O, but I tried every suggestion, still didn't work.
This is my tab code:
  useEffect(() => {
    if (inTeams === true) {
      microsoftTeams.authentication.getAuthToken({
        successCallback: (result) => {
            console.log(result)
        },
        failureCallback: function (error) {
          console.log(error)
        }
    });
    } else {
      setEntityId("Not in Microsoft Teams");
    }
  }, [inTeams]);

And this is my manifest.json. file, I am not sure if the 'webApplicationInfo' part is in the correct place:
{
  "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.11/MicrosoftTeams.schema.json",
  "manifestVersion": "1.11",
  "id": "{{APPLICATION_ID}}",
  "version": "{{VERSION}}",
  "packageName": "{{PACKAGE_NAME}}",
  "developer": {
    "name": "Vizibit",
    "websiteUrl": "https://{{PUBLIC_HOSTNAME}}",
    "privacyUrl": "https://{{PUBLIC_HOSTNAME}}/privacy.html",
    "termsOfUseUrl": "https://{{PUBLIC_HOSTNAME}}/tou.html"
  },
  "name": {
    "short": "TeamsAddIn",
    "full": "TeamsAddIn"
  },
  "description": {
    "short": "TODO: add short description here",
    "full": "TODO: add full description here"
  },
  "icons": {
    "outline": "icon-outline.png",
    "color": "icon-color.png"
  },
  "accentColor": "#D85028",
  "configurableTabs": [
    {
      "configurationUrl": "https://{{PUBLIC_HOSTNAME}}/signatorDemoTab/config.html?name={loginHint}&tenant={tid}&group={groupId}&theme={theme}",
      "canUpdateConfiguration": true,
      "scopes": [
        "team"
      ]
    }
  ],
  "staticTabs": [],
  "bots": [],
  "connectors": [],
  "composeExtensions": [],
  "permissions": [
    "identity",
    "messageTeamMembers"
  ],
  "validDomains": [
    "{{PUBLIC_HOSTNAME}}"
  ],
  "showLoadingIndicator": true,
  "webApplicationInfo": {
    "id": "{{APPLICATION_ID}}",
    "resource": "api://{{PUBLIC_HOSTNAME}}/{{APPLICATION_ID}}"
  }
}

The error I get:

This is also in the errors:

Thank you :)

Update:
This is the error I get now.

And this is what I used:
  useEffect(() => {
    if (inTeams === true) {
      microsoftTeams.authentication.getAuthToken({
        successCallback: (result) => {
          const serviceRequest: AuthRequest = {
            client_id: "[CLIENTID]",
            client_secret: "[CLIENTSECRET]",
            requested_token_use: "on_behalf_of",
            grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
            scope:
              "api://[MYNGROK].ngrok.io/[CLIENTID]",
            assertion: result,
          };

          httpClient.GetAuthenticationToken(serviceRequest).then((res) => {
            console.log(res);
          });
          microsoftTeams.appInitialization.notifySuccess();
        },
        failureCallback: function (error) {
          console.log(error);
        },
      });
    } else {
      setEntityId("Not in Microsoft Teams");
    }
  }, [inTeams]);

 "error_description": "AADSTS7000215: Invalid client secret provided. Ensure the secret being sent in the request is the client secret value, not the client secret ID, for a secret added to app '[CLIENTID]'.\r\nTrace ID: 2dc1bddf-a15c-45a8-9346-4d2b83011600\r\nCorrelation ID: cf790d06-19e5-49c4-a79c-364f044d7ee8\r\nTimestamp: 2022-03-31 11:39:59Z",

My client secret is correct, I don't know why it gives this error.

Update:
Still get the same CORS error, even though I managed to work it out in postman, still cannot do it in React axios.
         var formData = new URLSearchParams();
          formData.append("client_id", "[CLIENT_ID]");
          formData.append(
            "client_secret",
            "[CLIENT_SECRET]"
          );
          formData.append("requested_token_use", "on_behalf_of");
          formData.append(
            "grant_type",
            "urn:ietf:params:oauth:grant-type:jwt-bearer"
          );
          formData.append(
            "scope",
            "api://[NGROK].ngrok.io/[CLIENT_ID]/scope"
          );
          formData.append("assertion", result);

          axios.post("https://login.microsoftonline.com/common/oauth2/v2.0/token", formData);

A: I don't know which docs you're doing (i.e. which "book" you're "by"), as some (many) of them are very old and require complete rewrite. The best source is this one: https://learn.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/authentication/auth-aad-sso?tabs=dotnet
Here's a great video overview: https://www.youtube.com/watch?v=kruUnaZgQaY and here's a sample (covers both node and dotnet): https://github.com/pnp/teams-dev-samples/tree/main/samples/tab-sso
That said, it looks like the error is being shown in the bottom screenshot you posted - you need admin consent for the app. See more here: https://learn.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/authentication/auth-aad-sso?tabs=dotnet#tenant-admin-consent


text:
Q: React Navigation TabBarIcon not appearing I can't get a TabBarIcon to appear in my TabNavigator. I've read a bunch of posts from people with a similar issue, but their solutions don't work for me. I'd really just like to be able to have a PNG image component for each TabBarIcon but it just won't appear.
const Tabs = TabNavigator({
    Feed: {
      screen: FeedPage,
      navigationOptions: {
        tabBarLabel:"Feed",
        tabBarIcon: () => (<Image source={require('./Resources/Images/TabBar Icons_Feed.png')} style={{height: 10, width: 10}} />)
      }
    },
    Me: {
      screen: MePage,
      navigationOptions: {
        tabBarLabel:"Me",
      }
    },
  },
  {
    initialRouteName: 'Me',
    tabBarOptions: {
      showIcon: true,
      showLabel: true
    }
  }
);

const RootStack = StackNavigator(
  {
    //All Tabs
    Tabs: {
      screen: Tabs,
    },
    //Other Pages
    Signup: {
      screen: SignupPage,
    },
    ProfilePicUploader: {
      screen: ProfilePicUploaderPage,
    },
    Login: {
      screen: LoginPage,
    },
    User: {
      screen: UserPage,
    },
    EasterEgg: {
      screen: EasterEggPage,
    },
  },
  {
    initialRouteName: 'Tabs',
    headerMode: 'none'
  }
);

export default class App extends Component<Props> {
  render() {
    return (
      <RootStack/>
    );
  }
}

Anyone know what's going on?

A: You just need make sure that your file doesn't have whitespace name. So change TabBar Icons_Feed.png to TabBar_Icons_Feed.png. Because android or ios will find name like /xxxx/Resources/Images/TabBar%20Icons_Feed.png. This actually the packager does the job.  See here:

The image name is resolved the same way JS modules are resolved. In
  the example above, the packager will look for my-icon.png in the same
  folder as the component that requires it. Also, if you have
  my-icon.ios.png and my-icon.android.png, the packager will pick the
  correct file for the platform.

Check Valid/Correct Path File
if you see .expo/packager-info.json:
{
  "expoServerPort": 19000,
  "packagerPort": 19001,
  "packagerPid": 84703
}

as you see the port packager is 19001, then you can access your file by http://127.0.0.1:19001/Resources/Images/TabBar Icons_Feed.png (make sure you already running app) in browser. You can make sure all path file is correct.

Permit on Android
Also, if you are using expo for development, make sure you set permission to write drawer for android (source).

Best Practice
I usually use import image like this:
import Icon_Feed from './Resources/Images/TabBarIcons_Feed.png';

...

tabBarIcon: () => (
    <Image
        source={Icon_Feed}
        style={styles.stretch}
        />
)

It works and more readable.

A: I have setup a smallest possible example to show image on tabs instead of icons have a look on this expo snack. Don't use resizeMode or spaces in the image file name as you are using TabBar Icons_Feed.png. Just import the file and use it with proper height and width,
e.g.
import Icon_Feed from './Resources/Images/TabBar_Icons_Feed.png';

and use it like this
tabBarIcon: () => (
    <Image source={Icon_Feed} style={{ height: 20, width: 20 }} />
),

OR
You can use require if you want to e.g.
tabBarIcon: () => (
    <Image source={require('./Resources/Images/TabBar_Icons_Feed.png')} style={{ height: 20, width: 20 }} />
),

Read this image guide by react native official documentation to get the possible ways to manage image and properly display it according to your needs.

A: Could you try this one? This is my setup:
const PrimaryNav = TabNavigator({
  ['app/t1']: { screen: T1 },
  ['app/t2']: { screen: T2 },
}, {
  headerMode: 'none',
  initialRouteName: 'app/t1',
  navigationOptions: ({ navigation }) => ({
    tabBarIcon: ({ focused, tintColor }) => {
      const { routeName } = navigation.state;
      if (routeName === 'app/t1') {
        return <Icon name="event-note" color={tintColor} />;
      } else if (routeName === 'app/t2') {
        return <Icon name="place" color={tintColor} />;
      }
      return null;
    },
  }),
  tabBarOptions: {
    showIcon: true,
    showLabel: false,
    activeTintColor: ApplicationStyles.screen.header.tintColor,
    inactiveTintColor: ApplicationStyles.screen.header.inactiveTintColor,
    style: {
      backgroundColor: ApplicationStyles.screen.header.backgroundColor,
    },
  }
})

<Icon> is the react-native-material-ui icon, but Image should work as well.


text:
Q: Harish-Chandra isomorphism for characteristic $p$ I am trying to understand the proof of Theorem 1 from this paper V. Kac and B. Weisfeiler (Indag. Math. 1976, DOI link).

Theorem 1. Let either $p\neq 2$ or $\varrho\in X(\mathscr{T})$. Then $\gamma(Z^\mathscr{G})=U(T)^W$ and $\gamma:Z^\mathscr{G}\to U(T)^W$ is a ring isomorphism.

Here $Z$ is the center of universal enveloping algebra $U(G)$ (here $G = \operatorname{Lie} \mathscr{G}$ ). $T$ is a Lie algebra of a maximal torus. $Z^{ \mathscr{G} }$ denote invariants (with respect to Ad-action of group $\mathscr{G}$) in $Z$.
Proof is not very short. But the last two lines are these

From 4.4, 4.6 and 5.3 we get $\overline{U(T)^W}=\overline{\gamma(Z^\mathscr{G})}$. Since both $U(T)^W$ and $\gamma(Z^\mathscr{G})$ are integrally closed we get $U(T)^W=\gamma(Z^\mathscr{G})$ as desired.

Here $\bar{A}$ means field of fraction of ring $A$. Suppose I believe that these fields are isomorphic and these rings are integrally closed.

Question How does it imply isomorphism of initial rings?

For example $ \mathbb{k} [x, xy] \subset \mathbb{k} [x, y]$

A: In the previous lines it is proven that $U(T)^W$ is integral over $\gamma(Z^{\mathcal G})$. Since $U(T)^W\subset Frac(U(T)^W)=Frac(\gamma(Z^{\mathcal G}))$ the equality follows from $\gamma(Z^{\mathcal G})$ being integrally closed.


text:
Q: Using Angular 2 RC5 router, how can I navigate, given an ActivatedRouteSnapshot? Use Case
The user can access certain parts of my site without being logged in. If they click a download button and are logged in, the download starts automatically. However, if they click the download button and are not logged in, I'd like to prompt them to login. Once they're logged in, I'd like them to be sent straight back to the route they were previously on.
How I'm trying to accomplish it
When an "anonymous" user clicks a download button, they're given a modal with a prompt to login. If they decide to login, I'll stash some object in local storage (was thinking an ActivatedRouterSnapshot would do?). After login, I'll check to see if there's an object stored under stashedRoute in local storage. If there is, I'll use it to navigate them back to their original route!
What I want to do
Given:
import { Router } from '@angular/router';

and
private someRoute: ActivatedRouterSnapshot;

constructor(private _router: Router) {}

I want to:
this._router.navigate(someRoute)
The question
What is the syntax for either doing the above, or getting the same functionality for storing a route and re-navigating to it?

A: i think you need some thing like a history for going back in routes
you can use code below as described here
import {Component} from '@angular/core';
import {Location} from '@angular/common';

@Component(...)

class AppCmp {
  constructor(private _location: Location) {
  }
  backClicked() {
    this._location.back();
  }
}

A: I had a similar issue and solved it by the following. flatten is from lodash and route is your ActivatedRoute. It's not great, but it works for now. You might want to use flattenDeep instead to accommodate for deeply nested routes.
const route = flatten(route.pathFromRoot.map(r => r.url)).map(s => s.path);
this.router.navigate(route);


text:
Q: Power BI mobile - how to notify end user that data has changed? I'm quite newbie to Power BI.
I have a published report, and want to know how the end user of PBI mobile version is informed (pushed notification) that data like date has changed?
I know that the end user can turn some sort of notifications/alerts, but I doubt that my CEO's will know how to mend it( training them how to do it is not an option :(
Can I as the owner of the report set some sort of notification as a general ? For example when the date is changed, all end users will get the notification on their smartphones ?
I'm thinking about Power Automate, but I'm not sure/don't know how to set this up.
Any help/tip will be much appreciated

A: In PowerBI you can create a data alert to send you a notification. By default, the data alert is an in-app alert but there is in an option to have it also send you an email.
Unfortunately, there is no capability in PowerBI to set an alert for another user.
You can use a Power Automate Flow to meet your requirement:
Before starting, be sure you've configured your Data Alert, the Flow will connect to PowerBI to find your data alerts

*

*Go to http://make.powerapps.com

*Select Flows -> New flow -> Automated cloud flow

*Search on Power to find and select the When a data driven alert is triggered trigger. Give your Flow a name (optional.)

*Power Automate will connect to your PowerBI instance and find the available data alerts. You will select the appropriate data alert from the drop-down.

*You can now build out the rest of your flow based on how you want the user notified. If your organization makes use of Teams you send a notification in Teams, using the Teams Connector. Email will be all around most universal easiest and not require a premium connector license. You could also deploy a PowerApp to your users and send a push notification to the PowerApp (but that will take more work and some experience/familiarity with Power Apps Canvas.)


text:
Q: Trying to understand $_POST and Database Here's the html structure:
<select name="marke" class="marke">
<option value="1">Bosch</option></select>

<select name="modell" class="modell">
<option value="2">Nocria 14 LBC</option></select>

Here is my Php string (simplified)
$modellz = $_POST['marke']. ' ' .$_POST['modell'];
$insertQuery = "INSERT INTO producz (model)
VALUES
('" . $modellz . "')";

Im trying to get the name inside the <option> - tag to Post into the database.
But with this code I just get the values.
So when i run this i get 1 2 in the database.
But I want Bosch Nocria 14 LBC
OBS: I NEED THE VALUE attribute for my jquery selection script.
Please help!

A: The value of the option is what gets passed to the server, if you want to receive the text within the option instead just remove the value attribute altogether:
<option>Nocria 14 LBC</option>

Will submit that actual string when its selected.
Other than that, please read up about SQL Injections because your current PHP code is vulnerable to attacks.

A: either make value='Bosch' or create an array in your php that converts '1' to the string you require.
This:
<select name="marke" class="marke">
<option value="Bosch">Bosch</option></select>

<select name="modell" class="modell">
<option value="Nocria 14 LBC">Nocria 14 LBC</option></select>

or
<?
Options = Array();
Options['1'] = "Bosch";
Options["2"] = "Nocria 14 LBC";
?>

and use Options[insert] to get the real value
Also remember to use mysql_real_escape_string or string->real_escape() for security

A: The issue is with the HTML. The value for each <option> tag is what's sent in the POST request.
Change the HTML to:
<select name="marke" class="marke">
<option value="Bosch">Bosch</option></select>

<select name="modell" class="modell">
<option value="Nocria 14 LBC">Nocria 14 LBC</option></select>

and you will see the results you desire.
Also, please validate/sanitize your form-input before saving into the database. If you're using mysql functions, try mysql_real_escape_string().
If jQuery needs access to the original ID for each option, I would suggest one of two methods. Either add a separate attribute to each option, such as rel: <option value="Bosch" rel="1">Bosch</option>, or keep your code as-is (<option value="1">Bosch</option>) and have PHP aware of the ID/value combinations.
The actual database-structure could, and possibly should,  modified to support the actual IDs instead of textual values.

A: That's because you need to set the value of the option to Bosch and Nocria. POST stores what ever the option value to its corresponding <select> name.
Try this
<select name="marke" class="marke">
<option value="Bosch">Bosch</option></select>

<select name="modell" class="modell">
<option value="Nocria 14 LBC">Nocria 14 LBC</option></select>


text:
Q: Why do my static files serve with dev_appserver.py but not on GAE? My static files serve great on the development server, but when I deploy my application via appcfg.py my themes don't load.  GAE returns Error: Not Found when I try to access my .css files with the following url.
http://sprucepress.appspot.com/static/default/css/bootstrap-responsive.css

I have download a copy of my source and verified the files are actually on GAE.  I've also verified that everything is working on my local dev_appserver.py.
You can see the current deployed version on GitHub.
My directory structure...

*

*app.yaml

*static.py

*themes

*

*default

*

*admin

*

*edit.html

*index.html

*published.html

*assets

*

*css

*ico

*img

*js

*base.html

*listings.html

*post.html

*simple

*

*default

*admin

*

*edit.html

*index.html

*published.html

*assets

*

*css

*ico

*img

*js

*base.html

*listings.html

*post.html

My app.yaml.
application: sprucepress
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:

- url: /admin/.*
  script: admin.app
  login: admin

- url: /static/([^/]+)/(.*)
  static_files: themes/\1/assets/\2
  upload: themes/[^/]+/static/.*

- url: .*
  script: static.app

builtins:
- remote_api: on

libraries:
- name: webapp2
  version: "2.5.1"

- name: jinja2
  version: latest

An example of the HTML not working..
<link href="/static/default/css/bootstrap.css" rel="stylesheet" />

the live site is at http://sprucepress.appspot.com
update 1 - I tried to redeploy, but that did not solve the issue.
update 2 - Here is my appcfg.py output.
john@ogradylan-lap01:~$ appcfg.py update google_projects/sprucepress
09:27 AM Host: appengine.google.com
09:27 AM Application: sprucepress; version: 1
09:27 AM
Starting update of app: sprucepress, version: 1
09:27 AM Getting current resource limits.
Email: <ny email>
Password for <ny email>:
09:27 AM Scanning files on local disk.
09:27 AM Cloning 117 application files.
09:27 AM Cloned 100 files.
09:27 AM Compilation starting.
09:27 AM Compilation completed.
09:27 AM Starting deployment.
09:27 AM Checking if deployment succeeded.
09:27 AM Will check again in 1 seconds.
09:27 AM Checking if deployment succeeded.
09:27 AM Will check again in 2 seconds.
09:27 AM Checking if deployment succeeded.
09:27 AM Will check again in 4 seconds.
09:27 AM Checking if deployment succeeded.
09:27 AM Will check again in 8 seconds.
09:27 AM Checking if deployment succeeded.
09:27 AM Deployment successful.
09:27 AM Checking if updated app version is serving.
09:27 AM Will check again in 1 seconds.
09:27 AM Checking if updated app version is serving.
09:27 AM Will check again in 2 seconds.
09:28 AM Checking if updated app version is serving.
09:28 AM Will check again in 4 seconds.
09:28 AM Checking if updated app version is serving.
09:28 AM Will check again in 8 seconds.
09:28 AM Checking if updated app version is serving.
09:28 AM Completed update of app: sprucepress, version: 1
09:28 AM Uploading index definitions.

update 3
I've downloaded the app to verify the files are actually on the server. Everything appears to   have been uploaded correctly.
appcfg.py download_app -A sprucepress sp3
09:37 AM Host: appengine.google.com
09:37 AM Fetching file list...
Email: <my email>
Password for <my email>:
09:37 AM Fetching files...
09:37 AM [1/117] themes/default/assets/ico/apple-touch-icon-114-precomposed.png
09:37 AM [2/117] themes/default/assets/js/bootstrap-carousel.js
09:37 AM [3/117] themes/default/assets/css/bootstrap.css
09:37 AM [4/117] lib/wtforms/ext/django/templatetags/wtforms.py
09:37 AM [5/117] themes/default/assets/img/glyphicons-halflings.png
09:37 AM [6/117] lib/wtforms/fields/__init__.py
09:37 AM [7/117] themes/default/assets/img/examples/bootstrap-example-fluid.jpg
09:37 AM [8/117] themes/default/assets/css/bootstrap-responsive.css
09:37 AM [9/117] lib/wtforms/ext/i18n/__init__.py
09:37 AM [10/117] themes/default/assets/js/bootstrap-modal.js
09:37 AM [11/117] lib/wtforms/compat.py
09:37 AM [12/117] lib/wtforms/widgets/__init__.py
09:37 AM [13/117] static.py
09:37 AM [14/117] themes/default/assets/js/bootstrap-tooltip.js
09:37 AM [15/117] themes/default/assets/img/grid-baseline-20px.png
09:37 AM [16/117] themes/default/listing.html
09:37 AM [17/117] lib/wtforms/fields/simple.py
09:37 AM [18/117] themes/default/assets/img/bs-docs-masthead-pattern.png
09:37 AM [19/117] themes/default/assets/js/bootstrap-alert.js
09:37 AM [20/117] lib/wtforms/ext/i18n/messages/pl/LC_MESSAGES/wtforms.mo
09:37 AM [21/117] themes/default/assets/img/bs-docs-bootstrap-features.png
09:37 AM [22/117] themes/default/assets/ico/apple-touch-icon-72-precomposed.png
09:37 AM [23/117] app.yaml
09:37 AM [24/117] themes/default/assets/js/jquery.js
09:37 AM [25/117] lib/wtforms/ext/__init__.py
09:37 AM [26/117] lib/wtforms/ext/sqlalchemy/__init__.py
09:37 AM [27/117] lib/wtforms/ext/django/templatetags/__init__.py
09:37 AM [28/117] themes/default/assets/js/bootstrap.min.js
09:37 AM [29/117] lib/aetycoon/app.yaml
09:37 AM [30/117] themes/default/assets/img/examples/bootstrap-example-hero.jpg
09:37 AM [31/117] themes/default/assets/js/bootstrap-button.js
09:38 AM [32/117] favicon.ico
09:38 AM [33/117] lib/wtforms/ext/django/i18n.py
09:38 AM [34/117] lib/wtforms/ext/i18n/form.py
09:38 AM [35/117] themes/default/assets/img/example-sites/jshint.png
09:38 AM [36/117] themes/default/assets/img/responsive-illustrations.png
09:38 AM [37/117] themes/default/assets/ico/favicon.ico
09:38 AM [38/117] themes/default/admin/index.html
09:38 AM [39/117] themes/default/assets/js/google-code-prettify/prettify.js
09:38 AM [40/117] lib/wtforms/validators.py
09:38 AM [41/117] themes/default/assets/css/docs.css
09:38 AM [42/117] themes/default/admin/edit.html
09:38 AM [43/117] lib/wtforms/ext/csrf/form.py
09:38 AM [44/117] lib/wtforms/ext/i18n/messages/pl/LC_MESSAGES/wtforms.po
09:38 AM [45/117] lib/wtforms/ext/django/orm.py
09:38 AM [46/117] admin.py
09:38 AM [47/117] themes/default/assets/ico/apple-touch-icon-144-precomposed.png
09:38 AM [48/117] lib/wtforms/ext/i18n/messages/en/LC_MESSAGES/wtforms.po
09:38 AM [49/117] themes/default/assets/img/examples/bootstrap-example-starter.jpg
09:38 AM [50/117] handlers.py
09:38 AM [51/117] lib/wtforms/ext/i18n/messages/es/LC_MESSAGES/wtforms.po
09:38 AM [52/117] themes/default/assets/js/bootstrap-scrollspy.js
09:38 AM [53/117] themes/default/assets/js/bootstrap-tab.js
09:38 AM [54/117] lib/aetycoon/README
09:38 AM [55/117] lib/wtforms/ext/i18n/messages/fa/LC_MESSAGES/wtforms.mo
09:38 AM [56/117] lib/wtforms/ext/i18n/messages/fa/LC_MESSAGES/wtforms.po
09:38 AM [57/117] themes/default/assets/test.jpg
09:38 AM [58/117] themes/default/assets/js/README.md
09:38 AM [59/117] lib/wtforms/ext/i18n/messages/wtforms.pot
09:38 AM [60/117] lib/wtforms/ext/sqlalchemy/fields.py
09:38 AM [61/117] themes/default/assets/js/google-code-prettify/prettify.css
09:38 AM [62/117] themes/default/admin/published.html
09:38 AM [63/117] lib/wtforms/ext/csrf/fields.py
09:38 AM [64/117] models.py
09:38 AM [65/117] lib/wtforms/ext/i18n/messages/en/LC_MESSAGES/wtforms.mo
09:38 AM [66/117] lib/wtforms/ext/i18n/messages/es/LC_MESSAGES/wtforms.mo
09:38 AM [67/117] themes/default/assets/img/bootstrap-mdo-sfmoma-03.jpg
09:38 AM [68/117] themes/default/assets/ico/apple-touch-icon-57-precomposed.png
09:38 AM [69/117] themes/default/assets/js/bootstrap-popover.js
09:38 AM [70/117] lib/wtforms/ext/dateutil/fields.py
09:38 AM [71/117] lib/wtforms/fields/core.py
09:38 AM [72/117] config.py
09:38 AM [73/117] lib/wtforms/ext/appengine/fields.py
09:38 AM [74/117] themes/default/assets/img/bs-docs-twitter-github.png
09:38 AM [75/117] themes/default/assets/js/bootstrap.js
09:38 AM [76/117] lib/wtforms/ext/i18n/messages/README.txt
09:38 AM [77/117] lib/wtforms/ext/i18n/messages/zh/LC_MESSAGES/wtforms.po
09:38 AM [78/117] themes/default/assets/img/less-logo-large.png
09:38 AM [79/117] themes/default/assets/img/example-sites/soundready.png
09:39 AM [80/117] themes/default/assets/img/example-sites/kippt.png
09:39 AM [81/117] lib/wtforms/widgets/core.py
09:39 AM [82/117] themes/default/base.html
09:39 AM [83/117] lib/wtforms/ext/i18n/messages/it/LC_MESSAGES/wtforms.mo
09:39 AM [84/117] utils.py
09:39 AM [85/117] themes/default/assets/js/bootstrap-affix.js
09:39 AM [86/117] lib/wtforms/ext/csrf/__init__.py
09:39 AM [87/117] index.yaml
09:39 AM [88/117] lib/wtforms/ext/django/fields.py
09:39 AM [89/117] themes/default/assets/js/bootstrap-typeahead.js
09:39 AM [90/117] lib/wtforms/ext/csrf/session.py
09:39 AM [91/117] generators.py
09:39 AM [92/117] lib/wtforms/ext/sqlalchemy/validators.py
09:39 AM [93/117] README.md
09:39 AM [94/117] lib/wtforms/ext/i18n/messages/zh/LC_MESSAGES/wtforms.mo
09:39 AM [95/117] themes/default/assets/js/bootstrap-transition.js
09:39 AM [96/117] themes/default/assets/img/bootstrap-mdo-sfmoma-02.jpg
09:39 AM [97/117] listing.html
09:39 AM [98/117] lib/wtforms/ext/i18n/utils.py
09:39 AM [99/117] themes/default/assets/js/bootstrap-dropdown.js
09:39 AM [100/117] themes/default/assets/js/bootstrap-collapse.js
09:39 AM [101/117] themes/default/assets/js/application.js
09:39 AM [102/117] lib/wtforms/ext/appengine/db.py
09:39 AM [103/117] lib/wtforms/ext/i18n/messages/it/LC_MESSAGES/wtforms.po
09:39 AM [104/117] themes/default/assets/img/example-sites/fleetio.png
09:39 AM [105/117] lib/wtforms/ext/sqlalchemy/orm.py
09:39 AM [106/117] fix_path.py
09:39 AM [107/117] lib/wtforms/form.py
09:39 AM [108/117] themes/default/post.html
09:39 AM [109/117] lib/wtforms/ext/appengine/__init__.py
09:39 AM [110/117] lib/wtforms/__init__.py
09:39 AM [111/117] themes/default/assets/img/bs-docs-responsive-illustrations.png
09:39 AM [112/117] lib/wtforms/ext/django/__init__.py
09:39 AM [113/117] lib/wtforms/ext/dateutil/__init__.py
09:39 AM [114/117] themes/default/assets/img/bootstrap-mdo-sfmoma-01.jpg
09:39 AM [115/117] themes/default/assets/img/glyphicons-halflings-white.png
09:39 AM [116/117] main.py
09:39 AM [117/117] lib/aetycoon/__init__.py

A: The upload value should read themes/[^/]+/assets/.*. You dont' have a static folder inside themes.


text:
Q: Rails - How to group dates by time when they're in different timezones? I have a series of Appointments where the date and time is stored under start_date as DateTime. I'd like to categorize them as starting in the Morning, Daytime, or Evening. I created an array of hashes with labels and ranges I used for a SQL statement where I convert the start_date records into seconds using CAST(EXTRACT (EPOCH FROM start_time) AS INT)
TIME_RANGES = [
    {label: "Morning", min: 0, max: 32399},
    {label: "Daytime", min: 32400, max: 61199},
    {label: "Evening", min: 61200, max: 86399}
]

cases = TIME_RANGES.map do |r|
    "when CAST (EXTRACT (EPOCH FROM start_date) AS INT) % 86400 between '#{r[:min]}' and '#{r[:max]}' then '#{r[:label]}'"
end

time_ranges = Appointment.select("count(*) as n, case #{time_cases.join(' ')} end as time_range").group('time_range')

This takes the number of seconds in a day (86400) and labels the appointments based on the modulo of the start_date with 86400. However, a number of appointments take place in different timezones, but they're all stored as UTC. So an appointment at 08:00 AM EST is equivalent to one at 07:00 AM CST, but both are stored internally as 12:00 PM UTC. This would cause the appointments to be incorrectly labelled as "Daytime" when they're intended to be "Morning" (from the perspective of the User booking it).
Ideally, I would like some way to convert the start_date based on the User's timezone to make it look like it occurred in UTC. So I would want a 12:00 PM EST appointment to be labelled as if it were a 12:00 PM UTC appointment instead of 04:00 PM UTC. More specifically, I would like to subtract 14400 seconds from the converted start_date before performing the modulo.
I can join Appoinments to Users, which contains the User's timezone. How can I incorporate this information into my query above, so that a modified start_date is used for each record, depending on the User's timezone in that same record?
I know I could accomplish this with a loop of each timezone and adding/substracting a specific amount of seconds in each loop, then combining the results of all the loops, but I was wondering if there was a way to do it in one query.

A: Per my comment, I am assuming we have three tables: appointments, users, and preferences. In appointments we have start_date and user_id. In users we have preference_id. In preferences we have some column that names the time zone, so I'll call that tz_name.
Note: Postgres timezone functions are messy. I would highly recommend you read up on them. This excellent article is a good place to start.
It is possible to use pure SQL to generate the time ranges and return a grouped result. A pure SQL solution would be best if you need to label and group many records (thousands or more) at a time.
Assuming you are working with 1000 records or fewer at a time, you'll probably want to use Rails scopes, as this will give you an ActiveRecord result. Then you'll do your grouping using Ruby's Array methods.
That solution would look something like this:
# app/user.rb

class User < ApplicationRecord
  belongs_to :preference
  has_many :appointments
end

# app/appointment.rb

class Appointment < ApplicationRecord
  belongs_to :user

  scope :with_seconds, lambda {
    joins(user: :preference)
      .select('appointments.*, extract(epoch from timezone(tz_name, start_date::timestamptz)::time)::int as seconds')
  }

  # This method is optional. If it is excluded, calling #seconds
  # on an appointment instance will raise an error if the
  # .with_seconds scope has not been applied.
  def seconds
    attributes['seconds']
  end

  def time_range
    return nil unless seconds.present?

    if seconds.between?(0, 32_399)
      'Morning'
    elsif seconds.between?(32_400, 61_199)
      'Daytime'
    else
      'Evening'
    end
  end
end

The select portion of the scope probably deserves some explanation.
start_date::timestamptz: Take the start_date, which is stored as a Postgres timestamp, and convert it into a Postgres timestamp with time zone in the time zone of the Postgres server (presumably UTC).
timezone(tz_name, start_date::timestamptz): Convert the timestamp with time zone back into a timestamp type in the local time of the tz_name time zone.
timezone(tz_name, start_date::timestamptz)::time: Drop the date and keep the time component.
Then we extract epoch from that time component, which converts it into seconds.
Finally we convert the result to an integer to avoid anything falling through the cracks when we determine the time range.
Now you can do:
Appointment.all.with_seconds.group_by(&:time_range)

or
user = User.first
user.appointments.with_seconds.group_by(&:time_range)

For a pure SQL solution that will return ids grouped under the three time ranges, add this method to your Appointment model:
  def self.grouped_by_time_range
    current_scope = with_seconds.to_sql
    query = <<~SQL
      with converted_seconds as (#{current_scope})
      select array_agg(id) as ids, case when seconds < 32400 then 'Morning'
                                        when seconds < 61200 then 'Daytime'
                                        else 'Evening' end as time_range
      from converted_seconds
      group by time_range
    SQL

    result = ActiveRecord::Base.connection.execute(query.squish)
    result.to_a
  end

A: If you don't need strictly SQL based solution you might use Ruby's select method to extract this appointments as in this example:
(I am assuming there is some kind of tz_name field in appointment model which holds timezone name)
morning_appointments = Appointment.all.select do |a|
  a.start_date.in_time_zone(a.tz_name).hour > 6 && a.start_date.in_time_zone(a.tz_name).hour < 20
end

Edit:
Thanks @moveson for pointing out my mistake, I changed solution a bit.


text:
Q: Erro: Could not find class 'com.google.android.chimera.Activity' ... did not call through to super.onResume() Estou tentando integrar um scanner ao meu aplicativo e, a principio, fiz idêntico ao que está no github:
https://github.com/KingsMentor/MobileVisionBarcodeScanner
Porém, quando chamo a ActivityScanner acontece o erro:

02-17 20:25:31.058 26651-26735/br.codes.locadoraFilmes E/dalvikvm: Could
  not find class 'com.google.android.chimera.Activity', referenced from
  method mu.b 02-17 20:25:31.088 26651-26651/br.codes.locadoraFilmes
  E/AndroidRuntime: FATAL EXCEPTION: main
                                                                        Process: br.codes.locadoraFilmes, PID: 26651
                                                                        java.lang.RuntimeException: Unable to resume activity
  {br.codes.locadoraFilmes/br.codes.locadoraFilmes.view.ActivityScanner}:
  android.util.SuperNotCalledException: Activity
  {br.codes.locadoraFilmes/br.codes.locadoraFilmes.view.ActivityScanner} did
  not call through to super.onResume()
                                                                            at
  android.app.ActivityThread.performResumeActivity(ActivityThread.java:2790)
                                                                            at
  android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2819)
                                                                            at
  android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2254)
                                                                            at android.app.ActivityThread.access$800(ActivityThread.java:141)
                                                                            at
  android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)
                                                                            at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                            at android.os.Looper.loop(Looper.java:136)
                                                                            at android.app.ActivityThread.main(ActivityThread.java:5113)
                                                                            at java.lang.reflect.Method.invokeNative(Native Method)
                                                                            at java.lang.reflect.Method.invoke(Method.java:515)
                                                                            at
  com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
                                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
                                                                            at dalvik.system.NativeStart.main(Native Method)
                                                                         Caused by: android.util.SuperNotCalledException: Activity
  {br.codes.locadoraFilmes/br.codes.locadoraFilmes.view.ActivityScanner} did
  not call through to super.onResume()
                                                                            at android.app.Activity.performResume(Activity.java:5326)
                                                                            at
  android.app.ActivityThread.performResumeActivity(ActivityThread.java:2780)
                                                                            at
  android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2819)
                                                                            at
  android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2254)
                                                                            at android.app.ActivityThread.access$800(ActivityThread.java:141)
                                                                            at
  android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)
                                                                            at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                            at android.os.Looper.loop(Looper.java:136)
                                                                            at android.app.ActivityThread.main(ActivityThread.java:5113)
                                                                            at java.lang.reflect.Method.invokeNative(Native Method)
                                                                            at java.lang.reflect.Method.invoke(Method.java:515)
                                                                            at
  com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
                                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
                                                                            at dalvik.system.NativeStart.main(Native Method)  02-17 20:25:31.158
  2763-24817/? E/Vision: Download Failed: Status{statusCode=Download not
  allowed: Não há espaço suficiente para fazer o download.,
  resolution=null}

activity_scanner.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".view.ActivityScanner">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/actions"
        android:layout_weight="1"
        android:gravity="center">

        <fragment
            android:id="@+id/barcode"
            android:name="com.google.android.gms.samples.vision.barcodereader.BarcodeCapture"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            app:gvb_auto_focus="true"
            app:gvb_code_format="all_format"
            app:gvb_flash="false"
            app:gvb_rect_colors="@array/rect_color" />
    </RelativeLayout>

    <LinearLayout
        android:id="@+id/actions"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:orientation="vertical"
        android:paddingLeft="16dp"
        android:paddingRight="16dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:padding="4dp">

            <android.support.v7.widget.SwitchCompat
                android:id="@+id/focus"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="auto focus" />

            <android.support.v7.widget.SwitchCompat
                android:id="@+id/draw_rect"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="18dp"
                android:layout_weight="1"
                android:text="draw rect" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:padding="4dp">

            <android.support.v7.widget.SwitchCompat
                android:id="@+id/support_multiple"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="support multiple" />

            <android.support.v7.widget.SwitchCompat
                android:id="@+id/touch_callback"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="18dp"
                android:layout_weight="1"
                android:text="touch callback" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <android.support.v7.widget.SwitchCompat
                android:id="@+id/draw_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="18dp"
                android:layout_weight="1"
                android:text="draw text" />

            <CheckBox
                android:id="@+id/from_xml"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:checked="true"
                android:text="From xml" />

            <Button
                android:id="@+id/refresh"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="Refresh" />
        </LinearLayout>

    </LinearLayout>

</RelativeLayout>

ActivityScanner.java
import android.support.v4.app.FragmentActivity;

import com.google.android.gms.samples.vision.barcodereader.BarcodeCapture;
import com.google.android.gms.samples.vision.barcodereader.BarcodeGraphic;
import com.google.android.gms.vision.barcode.Barcode;

import java.util.List;

import br.codes.locadoraFilmes.R;
import xyz.belvi.mobilevisionbarcodescanner.BarcodeRetriever;

public class ActivityScanner extends FragmentActivity implements BarcodeRetriever{
    SurfaceView preview = null;
    SurfaceHolder previewHolder = null;
    Camera camera;
    boolean inPreview = false;
    boolean cameraConfigured = false;
    Dialog dialog;
    Permissao p = new Permissao();
    String tipoActivity = "";
    ImageView buscaManual,buscaPorNome;

    private static final String TAG = "BarcodeMain";

    CheckBox fromXMl;
    SwitchCompat drawRect, autoFocus, supportMultiple, touchBack, drawText;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_scanner);

        final BarcodeCapture barcodeCapture = (BarcodeCapture) getSupportFragmentManager().findFragmentById(R.id.barcode);
        barcodeCapture.setRetrieval(this);

        fromXMl = (CheckBox) findViewById(R.id.from_xml);
        drawRect = (SwitchCompat) findViewById(R.id.draw_rect);
        autoFocus = (SwitchCompat) findViewById(R.id.focus);
        supportMultiple = (SwitchCompat) findViewById(R.id.support_multiple);
        touchBack = (SwitchCompat) findViewById(R.id.touch_callback);
        drawText = (SwitchCompat) findViewById(R.id.draw_text);

        findViewById(R.id.refresh).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (fromXMl.isChecked()) {

                } else {
                    barcodeCapture.setShowDrawRect(drawRect.isChecked());
                    barcodeCapture.setSupportMultipleScan(supportMultiple.isChecked());
                    barcodeCapture.setTouchAsCallback(touchBack.isChecked());
                    barcodeCapture.shouldAutoFocus(autoFocus.isChecked());
                    barcodeCapture.setShouldShowText(drawText.isChecked());
                    barcodeCapture.refresh();
                }
            }
        });
@Override
    public void onRetrieved(final Barcode barcode) {
        Log.d(TAG, "Barcode read: " + barcode.displayValue);
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                AlertDialog.Builder builder = new AlertDialog.Builder(ActivityScanner.this)
                        .setTitle("code retrieved")
                        .setMessage(barcode.displayValue);
                builder.show();
            }
        });

    }

    @Override
    public void onRetrievedMultiple(final Barcode closetToClick, final List<BarcodeGraphic> barcodeGraphics) {
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                String message = "Code selected : " + closetToClick.displayValue + "\n\nother " +
                        "codes in frame include : \n";
                for (int index = 0; index < barcodeGraphics.size(); index++) {
                    Barcode barcode = barcodeGraphics.get(index).getBarcode();
                    message += (index + 1) + ". " + barcode.displayValue + "\n";
                }
                AlertDialog.Builder builder = new AlertDialog.Builder(ActivityScanner.this)
                        .setTitle("code retrieved")
                        .setMessage(message);
                builder.show();
            }
        });

    }

    @Override
    public void onBitmapScanned(SparseArray<Barcode> sparseArray) {

    }

    @Override
    public void onRetrievedFailed(String s) {

    }

Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="br.codes.locadoraFilmes"
    android:installLocation="preferExternal"
    android:screenOrientation="portrait">

    <uses-feature android:name="android.hardware.camera.autofocus" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-feature android:name="android.hardwar.ListaProe.camera" />
    <uses-permission android:name="android.permission.MEDIA_CONTENT_CONTROL" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

    <application
        tools:node="replace"
        android:name="android.support.multidex.MultiDexApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="SocialMarket"
        android:screenOrientation="portrait"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
        <meta-data android:name="com.google.android.gms.vision.DEPENDENCIES" android:value="barcode"/>
...
</aplication>
</manifest>

Peço desculpas pelo quantidade de código. Imagino que o erro esteja em alguma dessas partes mas nao tenho ideia de qual.


text:
Q: Having trouble setting up Multiple emails notification through a process Having trouble setting up a work flow for multiple email notification throughout a process. So i have created 3 work flows for this. Tested and everything and all of it seems to be working. The problem is when it workflow2 is completed it will run workflow 1 and send and email again on 1. So if workflow3 is completed and triggers an email it will resend email notification on workflow2 and 1 again.
Current Process
Workflow 1- If "Person 1 Complete" Then Email Trigger
Workflow 2- If "Person 2 Complete" Then Email Trigger
Workflow 3- If "Person 3 Complete" Then Email Trigger
Currently its working like this:
If Workflow 2 Completed Emails - Send Emails, reruns Workflow 1 send Emails
If Workflow 3 Completed Emails- Sends Emails, Reruns Workflow 2 send Emails, Reruns Workflow 1.
I only want it to send an email once after each step is completed. Any help out there is greatly appreciated

A: There is no reason to build these a separate workflows. You simply need to place a Wait action after you start your workflow. To prevent the next approval from starting simply add a new variable to your list (call it Status) and update the status based on the outcome of the preceding approval.
So you might have something like this;

Start Approval 1 process on Current Item with Email 1
then Wait for Approval Status to not equal 2;#Pending
then Set Status to Approval Status_1

"Approval Status_1" is a concatenated string with a _1 appended to the end to indicate that this is the status of the first approval step

If Status equals 0;#Approved_1
Start Approval 2 process on Current Item with Email 2
then Wait for Approval Status to not equal 2;#Pending
then Set Status to Approval Status_2

If Status equals 0;#Approved_2
Start Approval 3 process on *Current Item* with Email 3
then Wait for Approval Status to not equal 2;#Pending
then Set Status to Approval Status_3

If Status equals 0;#Approved_3
Send E-mail

To stop the whole workflow starting again you might want to set the Status variable to Complete or Rejected and test for these conditions before starting any approvals.

If Status is not equal to Completed
or Status is not equal to Rejected
Step through approvals

Or turn off workflow "Start workflow automatically when an item is changed"
Cheers unibod50


text:
Q: Python DLL ImportError cryptography I'm trying to convert script below into an exe, but I think that even including the package cryptography, when the tool is executed in another machine, DLL importerror pronpts out, any idea of how I can solve it?, thanks!
error
trying import.... 1
Traceback (most recent call last):
  File "XXX\AppData\Local\Continuum\anaconda3\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 40, in run
  File "XXX\AppData\Local\Continuum\anaconda3\lib\site-packages\cx_Freeze\initscripts\Console.py", line 23, in run
  File "pod pdf merge tool.py", line 2, in <module>
  File "XXX\AppData\Local\Continuum\anaconda3\lib\site-packages\cryptography\hazmat\backends\openssl\__init__.py", line 7, in <module>
  File "XXX\AppData\Local\Continuum\anaconda3\lib\site-packages\cryptography\hazmat\backends\openssl\backend.py", line 74, in <module>
  File "XXX\AppData\Local\Continuum\anaconda3\lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", line 195, in <module>
  File "XXX\AppData\Local\Continuum\anaconda3\lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", line 142, in init_static_locks
ImportError: DLL load failed: The specified module could not be found.

script.py
print ("trying import.... 1")
from cryptography.hazmat.backends.openssl.backend import Backend as OpenSSLBackend
print ("import ok")
print ("trying import... 2")
import pysftp
from pysftp import CnOpts
print ("import ok")
import re
import _ssl
import os, msvcrt
print ("trying import... 3")
import cryptography
print ("import ok")
import time
from PyPDF2 import PdfFileMerger

setup.py
from cx_Freeze import setup, Executable
import os

packages = ['pysftp','time','bcrypt','pycparser','six','re','msvcrt','os','PyPDF2','paramiko','cryptography','cffi']
includes = ['_cffi_backend']

# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages":packages,'includes': includes}

# GUI applications require a different base on Windows (the default is for a
# console application).
base = None

setup(  name = "POD PDF Merger tool",
        version = "0.1",
        description = "V1",
        options = {"build_exe": build_exe_options},
        executables = [Executable("pod pdf merge tool.py", base=base)])

A: This may appear if openssl isn't installed on your machine or in anaconda.


text:
Q: Evaluate $\lim_{x \to 0+} (\sin x)^x$ I have tried to evaluate this by :--
$$(\sin x)^x = e^{(x \cdot \log (\sin x))} = (e^x)^{\log (\sin x)}$$
$$\lim_{x \to 0+} (e^x)^{\log (\sin x)} = \lim_{ x \to 0+} e^{\log (\sin x)}(e^x-1)$$
But after this I couldn't proceed.

A: Let $L=\lim\limits_{x\to0^+}(\sin x)^x$. Then $\ln L=\lim\limits_{x\to0^+}x\ln(\sin x)=\lim\limits_{x\to0^+}\frac{\ln(\sin x)}{1/x}$. This puts the limit in a form to use L'Hopital's rule:
$$\lim\limits_{x\to0^+}\frac{\ln(\sin x)}{1/x}=\lim\limits_{x\to0^+}\frac{\cos x/\sin x}{-1/x^2}=\lim\limits_{x\to0^+}-\frac{x^2\cos x}{\sin x}=-\lim\limits_{x\to0^+}\frac{x}{\sin x}\cdot\lim\limits_{x\to0^+}x\cos x$$
Using the fact that $\lim\limits_{x\to0^+}\frac{x}{\sin x}=1$ (this can be verified using the squeeze theorem), we get that $$-\lim\limits_{x\to0^+}\frac{x}{\sin x}\cdot\lim\limits_{x\to0^+}x\cos x=-1\cdot0\cdot1=0\implies \ln L=0$$
Now exponentiating:
$$\ln L=0\implies L=1$$
Therefore, $\lim\limits_{x\to0^+}(\sin x)^x=1$.

A: Apply L'Hopitals Rule twice.
$$ = \lim_{x \to 0^+} e^{\left(\frac{\log (\sin x)}{1/x}\right)}$$
$$ = \lim_{x \to 0^+} e^ {\left(\frac{-\cot x}{-1/x^2}\right)}$$
$$= \lim_{x \to 0^+} e^{\left(\frac{x^2}{\tan x}\right)}$$
$$= \lim_{x \to 0^+} e^{\left(\frac{2x}{(\sec x)^2}\right)}$$
$$= e^{0/1}=1$$

A: If you want a bit more than the limit itself, almost as you started, consider
$$y=\sin ^x(x)\implies \log(y)=x \log (\sin (x))$$ and use Taylor expansion
$$\sin(x)=x-\frac{x^3}{6}+\frac{x^5}{120}+O\left(x^7\right)$$
$$\log (\sin (x))=\log (x)-\frac{x^2}{6}-\frac{x^4}{180}+O\left(x^6\right)$$ $$\log(y)=x \log (x)-\frac{x^3}{6}-\frac{x^5}{180}+O\left(x^7\right)$$
$$y=e^{\log(y)}=1+x \log (x)+\frac{1}{2} x^2 \log ^2(x)+O\left(x^3\right)$$

A: This is based on hint from user csch2 (via comments to question) and IMHO is a simpler approach to the problem.
The expression under limit can be written as $$x^x\left(\frac{\sin x} {x} \right) ^x$$ and the second factor tends to $1^0=1$ so that the desired limit is equal to the limit of $x^x$ as $x\to 0^+$. This is easily handled by taking logs to get the expression $x\log x$ which tends to $0$ so that $x^x\to 1$.
That $x\log x\to 0$ is a well known fact on par with other well known limits like $\dfrac{\log(1+x)}{x}\to 1$.

A: I like binomial expansions, so why not try one?
$$
\begin{align}
\lim_{x\rightarrow 0} (\sin(x))^x & = \lim_{x\rightarrow 0}(\tfrac{e^{ix}-e^{-ix}}{2i})^x \\
& = \lim_{x\rightarrow 0}\tfrac{1}{(2i)^x}\sum_{k=0}^{x} {x\choose k} e^{ix(x-k)}(-e)^{-ix(k)} \\
& = \sum_{k=0}^{0} {0\choose k} e^{i0(0-k)}(-e)^{-i0(k)}\\
& = {0\choose 0} e^{0}(-1)^0e^{0}\\
& = 1
\end{align}
$$