text:
Q: Android app open gpx files I have build an app to edit gpx files on Android. Now I want to register my app to handle gpx files.
Therefor I have build some intent-filters. These filters are working sometimes, but not often. I can open gpx files, that I have received via Inbox, but no files from Gmail. Files from Dropbox are sometimes working.
Can anyone help me, to improve my intent filters, so that they are working every time my user trys to open a gpx file?
         <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />

            <data android:scheme="http" />
            <data android:host="*" />
            <data android:pathPattern=".*\\.gpx" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />

            <data android:scheme="http" />
            <data android:host="*" />
            <data android:mimeType="application/gpx+xml" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />

            <data android:scheme="file" />
            <data android:host="*" />
            <data android:pathPattern=".*\\.gpx" />
        </intent-filter>

EDIT:
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />

            <data android:scheme="content" />
            <data android:host="*" />
            <data android:mimeType="application/gpx+xml" />
        </intent-filter>


text:
Q: Only getting one result when running two spiders sequentially with scrapy I have two spiders in my spider.py class, and I want to run them and generate a csv file.
Below is the structure of my spider.py
class tmallSpider(scrapy.Spider):
    name = 'tspider'
    ...
class jdSpider(scrapy.Spider):
    name = 'jspider'
    ...

configure_logging()
runner = CrawlerRunner()
@defer.inlineCallbacks
def crawl():
    yield runner.crawl(tmallSpider)
    yield runner.crawl(jdSpider)
    reactor.stop()
crawl()
reactor.run()

Below is the structure for my items.py
class TmallspiderItem(scrapy.Item):
    # define the fields for your item here like:

    product_name_tmall = scrapy.Field()
    product_price_tmall = scrapy.Field()

class JdspiderItem(scrapy.Item):
    product_name_jd = scrapy.Field()
    product_price_jd = scrapy.Field()

I want to generate a csv file with four columns:
product_name_tmall | product_price_tmall | product_name_jd | product_price_jd

I did scrapy crawl -o prices.csv in pycharm's terminal but nothing is generated.
I scrolled up and find out only the jd items are printed in terminal, I do not see any tmall items printed.
However, if I add a open_in_browser command for the tmall spider, the brower DOES open. I guess the code was executed, but somehow the data is not recorded?
If I run scrapy crawl tspider and scrapy crawl jspider individually, everything is correct and the csv file is generated.
Is this a problem with how I ran the program or is there a problem with my code? Any ideas how to fix it?

A: I think it's going wrong how you are initiating spider runs.
You can simply use CrawlerProcess to initiate jobs.
You can have a look at this page https://docs.scrapy.org/en/latest/topics/practices.html for the usage of CrawlerProcess.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Fill a range of cells with a specified value thats divided by another specified value I have three different inputs, these being 'Flow Demand (Litres)' (amount of fluid needed), 'Number an hour' (number of fluid demands within an hour), and 'time of delivery' (all fluid needs to be despatched within this time, so if demand is 10 litres and time of delivery is 5 minute, then 2 l/m would be needed for 5 minutes).
I effectively want to be able to specify these three values in a cell then have excel auto fill cells which I have set up for each minute within 2 hours.
To give an example I will attach a google sheets link (as excel files can not be) which has what I would like to be shown but without any coding/ formula just as an example.
excel sheet

A: Per my comment on your question, delete minute 60 on the sheet  as you're also including minute 0 (min 60 will be min 0 of the next hour).
Then, in cell B6 type the formula
=IF(MOD(A6, ROUNDDOWN(60/$B$2, 0))<$B$3, $B$1/$B$3, 0)

A Warning; This formula first checks whether a given minute should have flow or not, then checks what the flow rate for demands is. If Number of Demands x Delivery time is more than 60 this will not work, because demands will overlap and some minutes will have to be at double the calculated flow rate.


text:
Q: ASP.NET - Ajax Control Toolkit - TabContainer always hidden I used the following code to add TabContainer to page
      <asp:TabContainer ID="TabContainer1" runat="server">

        <asp:TabPanel runat="server" HeaderText="tab one" ID="TabPanel0">
            <ContentTemplate>
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            </ContentTemplate>
        </asp:TabPanel>

         <asp:TabPanel runat="server" HeaderText="tab two" ID="TabPanel1">
            <ContentTemplate>
                <asp:Button ID="Button1" runat="server" Text="Button" />
            </ContentTemplate>
        </asp:TabPanel>

    </asp:TabContainer>

but when the page is rendered TabPanel is always Hidden,I wateched the html code by Firebug and found visibility is hidden... what is the problem?
http://i.stack.imgur.com/m1eSW.jpg

A: Have you tried to set the ActiveTab-Property(from codebehind) or the ActiveTabIndex from codebehind or aspx?
You could also check if it works if you explicitly set the display to visible:
ActiveTabIndex="0" style="display:block;visibility:visible;"

Are you sure that the Ajax libraries are loaded correctly? Do you have other Ajax-Controls inside of your TabContainer? Check if all of your html in that page is valid.
Are you using the latest AjaxToolkit and the ToolkitScriptManager instead of the ScriptManger?

A: You need to use the Script Manager from the Ajax Control Toolkit, add it after the form tag.

A: i had the same issue and after 2 hours of googling i found a solution. In my case I had to change asp:ScriptManager to ajaxToolkit:ToolkitScriptManager.

A: You may want check that you have used ToolkitScriptManager instead of ScriptManager. This will solve your problem.

A: We've solved this problem at our company, after trying everything found on websites by changing the website's appPool from Classic to Integrated.

A: In my case: The active tab was hidden (server side: Visible="false").
It seems if you activate in server side a hidden tab, it'll add visibilty:hidden to the tabcontainer!

A: Try setting ActiveTabIndex="0" on the TabContainer


text:
Q: Removing the lower element between 2 arrayLists I have this code which compares two arrayLists and removes the lower hypotenuse and returns it.
public static GeometricShape removeLowerHypotenuse(ArrayList<GeometricShape> left, ArrayList<GeometricShape> right) {
    GeometricShape x = null;
    if(((RightTriangle)right.get(0)).getHypotenuse() < ((RightTriangle)left.get(0)).getHypotenuse() && right.size() != 0 && left.size() != 0) {
        x = right.get(0);
        right.remove(0);
    }
    if(((RightTriangle)left.get(0)).getHypotenuse() < ((RightTriangle)right.get(0)).getHypotenuse() && right.size() != 0 && left.size() != 0) {
        x = left.get(0);
        left.remove(0);
    }
    if(right.size() != 0 && left.size() == 0) {
        x = right.get(0);
    }
    if(right.size() == 0 && left.size() != 0) {
        x = left.get(0);
    }
    if(right.size() == 0 && left.size() == 0) {
        return left.get(0);
    }
    return x;
}

When both arrayLists have a size of 1 (1 element in each) I get an out of bounds exception and confused why this is. I dont see what im missing in my code.

A: You need to use else if() rather than if() for this, like so:
if(right.size() != 0 && left.size() == 0) {
    x = right.get(0);
}
else if(right.size() == 0 && left.size() == 0) {
    x =  left.get(0);
}
else if(right.size() == 0 && left.size() != 0) {
    x = left.get(0);
}
else if(((RightTriangle)right.get(0)).getHypotenuse() < ((RightTriangle)left.get(0)).getHypotenuse() && right.size() != 0 && left.size() != 0) {
    x = right.get(0);
    right.remove(0);
}
else if(((RightTriangle)left.get(0)).getHypotenuse() < ((RightTriangle)right.get(0)).getHypotenuse() && right.size() != 0 && left.size() != 0) {
    x = left.get(0);
    left.remove(0);
}

In your code, if the ArrayList right had one element, and if the first if() case was true, then the first element of right would be removed, leaving it null.
In the subsequent if() statement, when right.get(0) is called, an IndexOutOfBoundsException is thrown.
Hence, you shold use else-if statements.
Also, if either of the ArrayLists is empty, then by your code, in the first if statement, an IndexOutOfBoundsException would be thrown. Hence, I've rearranged some of the conditions.
Hope it helps!

A: As you are getting IndexOutOfBoundsException it means you are trying to access object from the list using such index value whose value is greater that list size.You always need to take care about this  while working with list,arrays.
In your case IndexOutOfBoundsException will occure when your very first if condition executed in that you are removing object from right list.
When both list size is 1 and you removed one object from right list the size of right list becomes 0. In your very next if condition  you are trying this
RightTriangle)right.get(0)).getHypotenuse()
when there is size of right list is 0. so there is nothing in list on index 0
This is reason you are getting IndexOutOfBoundsException in your code
change your conditions and check size first before doing any operations on list as follows
public static GeometricShape removeLowerHypotenuse(ArrayList<GeometricShape> left, ArrayList<GeometricShape> right) {
        GeometricShape x = null;
        if(right.size() != 0 && left.size() != 0 && ((RightTriangle)right.get(0)).getHypotenuse() < ((RightTriangle)left.get(0)).getHypotenuse()  ) {
            x = right.get(0);
            right.remove(0);
        }
        if(right.size() != 0 && left.size() != 0 && ((RightTriangle)left.get(0)).getHypotenuse() < ((RightTriangle)right.get(0)).getHypotenuse() ) {
            x = left.get(0);
            left.remove(0);
        }
        if(right.size() != 0 && left.size() == 0) {
            x = right.get(0);
        }
        if(right.size() == 0 && left.size() != 0) {
            x = left.get(0);
        }
        if(right.size() == 0 && left.size() == 0) {
            return left.get(0);
        }
        return x;
    }

Still you will get IndexOutOfBoundsException  with this code as in last condition you are trying to access from empty list you need to change this code in your last if


text:
Q: Question on the Proof of Proposition 2.2.4 of Bruns and Herzog Let $(R, \mathfrak m, k)$ be a regular local ring with unique maximal ideal $\mathfrak m$ and residue field $k = R / \mathfrak m.$ Let $\dim(R) = d.$ Let $I$ be a proper ideal of $R.$ Proposition 2.2.4 of Bruns and Herzog asserts the following.

(*) If $R/I$ is a regular local ring, then $I$ is generated by a subset of a regular system of parameters of $R.$

By hypothesis that $R/I$ is a regular local ring, it follows that $\mu(\mathfrak m/I) = \dim(R/I).$ Call this invariant $d'.$ By definition, we have that $\mu(\mathfrak m/I)$ is the $k$-vector space dimension of $(\mathfrak m/I)/ \mathfrak m(\mathfrak m/I)) = \mathfrak m/(\mathfrak m^2 + I).$ Bruns and Herzog claim that one can appeal to Nakayama's Lemma to conclude that $I$ contains some elements $x_1, \dots, x_{d - d'}$ that belong to a minimal system of generators of $\mathfrak m$; however, this is unclear to me. On the other hand, by Nakayama's Lemma and the previous sentence, we can find some elements $y_1, \dots, y_d'$ of $\mathfrak m$ that belong to a minimal system of generators of $\mathfrak m.$
Given that such elements $x_1, \dots, x_{d - d'}$ of $I$ can be found (i.e., once I understand why they can be found), the authors claim that $R / (x_1, \dots, x_{d - d'})$ has dimension $d - (d - d') = d'.$ But does this not a priori require that $R$ is a Cohen-Macaulay local ring so that the generators of $\mathfrak m$ form a regular sequence? (Of course, a regular local ring is a Cohen-Macaulay local ring, but in my line of argument, the statement (*) that we seek to prove is part of the proof of this fact.)
Thank you very much for your time and consideration.

A: By Nakayama's lemma, we have $\dim R=\mu_R(\mathfrak{m})=\dim_k(\mathfrak{m}/\mathfrak{m}^2)$ and $\dim R/I=\mu_R(\mathfrak{m}/I)=\dim_k \mathfrak{m}/(\mathfrak{m}^2+I).$ There is an exact sequence $$0 \to I/\mathfrak{m}^2 \cap I \to \mathfrak{m}/\mathfrak{m}^2 \to \mathfrak{m}/(\mathfrak{m}^2+I) \to 0.$$
By additivity of dimension, we have $\dim_k I/\mathfrak{m}^2 \cap I=\dim R-\dim R/I$. Letting $x_1,\dots, x_{\dim R-\dim R/I}$ be preimages of chosen basis elements provides elements of $I$ which are part of a minimal generating set of $\mathfrak{m}$.
One does not need to know a priori, that $R$ is Cohen-Macaulay to calculate that the dimension of $R/(x_1,\dots,x_{\dim R-\dim R/I})$ is $\dim R/I$. This follows as $x_1,\dots,x_{\dim R-\dim R/I}$ are part of a system of parameters of $R$.


text:
Q: Spring JdbcTemplate limit query result to 15 rows I'm using Spring Boot 2.3.1 and JdbcTemplate to query simple table.
I execute following queries:

*

*select * from products

*select * from products limit 200 offset 0

*select * from products where ... limit 200 offset 0.

All above queries returns 15 rows or less(when where is used). Does anybody know where this limit(15) can be configured?
I have added following properties
spring.jdbc.template.fetch-size=300
spring.jdbc.template.max-rows=300

but this doesn't work for me.
PS. I use PostgreSQL 12
EDIT 1
    public List<Product> getList(final ProductFilter filter) {
        final String query = filterToWhereClause(filter);
        final String where = query.isEmpty() ? "" : " where " + query;
        final String sql = String.format("select * from products %s order by id limit %d offset %d", where, filter.getSize(), filter.getPage() * filter.getSize());

        return jdbcTemplate.query(sql, (resultSet, rowNumber) -> productRowMapper(resultSet));
    }

    private static String filterToWhereClause(final ProductFilter filter) {
        return Stream.of(
            like("name", filter.getName()),
            gte("price", filter.getPriceFrom()),
            lte("price", filter.getPriceTo()),
            gte("total", filter.getTotalFrom()),
            lte("total", filter.getTotalTo())
        )
            .filter(Objects::nonNull)
            .collect(Collectors.joining(" AND "));
    }

    private static Product productRowMapper(final ResultSet resultSet) throws SQLException {
        return resultSet.next()
            ? Product.of(resultSet.getInt("id"), resultSet.getString("name"), resultSet.getBigDecimal("price"), resultSet.getBigDecimal("total"))
            : null;
    }


text:
Q: How do I share my Internet connection wirelessly while using it on my MacBook Pro? How do I share my Internet connection wirelessly with other gadgets while using it simultaneously on my MacBook Pro?
I am using a Idea Netsetter 3g dongle for broadband Internet access. However, when I go to the settings to share it with other devices, the MacBook Pro is the only one left out of the connection.

A: I've used  Idea Netsetter Dongle and shared my internet over the Wifi.

*

*First connect to the Internet with Idea Netsetter 3G

*Open System Preferences > Sharing

*Select the Network which you want to share ( In your case it's Ethernet Adaptor )

*Select the network(s) which you want to share the internet to (In your case Wifi)

*Don't forget to switch you're Wifi On

*Now if you look at the Wifi Icon on your Menu Bar , You'll notice something different.

*

*Now take any other device ( iPhone , Android Phone , iPad ) and connect to your WiFi Network.

Hope this is what you were looking for !

A: http://www.4shared.com/file/5-AHKzPA/Marywifi-EN.html
this apps help it's easy and simple to share your wireless


text:
Q: Django 1.6 - templates for password change/reset I want to use django's password change/reset views so for example for the view
django.contrib.auth.views.password_change

I need create a template named
registration/password_change_form.html

the problem is that even though I have this template implemented in my project, django still shows the password-change page of the admin website, the only way I can make django use my template is by renaming it to something different - like registration/password_change_form_1.html and then pass the name
url(r'^password/change/$',
    auth_views.password_change,
    {'template_name': 'registration/password_change_form_1.html',
     'password_change_form': MyPasswordChangeForm},
    name='password_change'),

Am I missing something here? why won't django use my template when I use the default name?

A: I think because your app is under django.contribute.admin in the INSTALLED_APP.

A: Django automatically generates the admin template with the default name, so, if you use the admin, you must specify a different template name.
It simply fails to find your template, since it is overiden by the generated one.

A: Add in settings
INSTALLED_APPS = (
    ...
    'registration',
)

After
TEMPLATE_DIRS = (
    ...
    "/home/user/templates",
)

Add in directory templates "registration"
base.html that will contain the template and other templates
run in django==1.5


text:
Q: Unexpected output when using PHP shell_exec with dpkg utility Running the following code:
$version = shell_exec('dpkg -l myprogram | grep myprogram');

The problem is, when the package doesn't exist on the system, $version is NULL. I expect to actually get "No packages found matching myprogram", which is what happens when I run the command on the command-line.
Code works fine when myprogram does exist.
Note, adding "2>&1" (which is a suggestion I saw on other similar questions) to the end of the command does not help.
Curious why I'm getting different results within PHP versus the command-line.

A: You probably misplaced the 2>&1. The right place to put it is before the pipe:
$version = shell_exec('dpkg -l myprogram 2>&1 | grep myprogram');

This works (just tested on a ubuntu) as expected: dpkg outputs to stderr the error message, with 2>&1 you redirect it to the stdout, which is then passed through grep, ending into the php variable as you need.


text:
Q: Print receipt from url Thermal printer ESC/POS I have a POS application in kotlin. Currently I can print from url but I need to use third party service like rawbt
    private fun prepPrintWebView(name: String): WebView? {
        val result: WebView = getWebView()!!
        result.webViewClient = object : WebViewClient() {
            override fun onPageFinished(view: WebView, url: String) {
                print(
                    name, view.createPrintDocumentAdapter(),
                    PrintAttributes.Builder().build()
                )
            }
        }
        return result
    }

    private fun getWebView(): WebView? {
        if (wv == null) {
            wv = WebView(requireContext())
        }
        return wv
    }

    private fun print(
        name: String, adapter: PrintDocumentAdapter,
        attrs: PrintAttributes
    ): PrintJob? {
        val intent = Intent(context, PrintJobMonitorService::class.java)
        requireActivity().startService(intent)
        return mgr!!.print(name, adapter, attrs)
    }

I want to print a receipt from the url and send this to the USB printer directly without any third party service.
I tried many libraries but nothing worked for me.


text:
Q: How do I delete all posts associated with a user in my node application using mongodb So, I was wondering why deleteMany() isn't working for me here. I have a node application that uses mongodb as db and Mongoose along with expressjs.
I have a function that delete a user and I would like to delete the user's posts, comments, replies, that have that user's id.
I used deleteMany() and passed the user's mongodb _id. But this has refused to work. It is not deleting the user's posts, comments and replies. The user gets deleted but the associated contents are not getting deleted and not returning any error. What is the best way to go about this? I have searched on google but couldn't find anything helpful so far. Here is the function code:
const deleteUser = async (req, res) => {
  if (req.user.userId === req.params.id || req.user.role === 'admin') { //we checked if the user id matched

    try {
      const user = await User.findById(req.params.id) //get the user and assign it to user variable
      if (!user) {
        return res.status(200).json("User not found")
      }

      await Post.deleteMany({
        _id: user._id
      }) //deleting user posts once the username matches with the variable user object .username
      await Comment.deleteMany({
        author: user._id
      }) //delete user's comment by checking the comment author's id.
      await Reply.deleteMany({
        author: user._id
      }) //deletes user's replies
      await User.findByIdAndDelete(req.params.id) //delete the user
      res.status(200).json("User has been deleted")

    } catch (err) {
      res.status(404).json("User not found")
    }

  } else {
    res.status(401).json("You can only delete your account!")
  }

}


text:
Q: Get pdf file metadata from command line To get the Creation Date value from a file I would use wmic from the command line
wmic datafile where name="C:\\something.pdf" get CreationDate
However, I would like to get the Creation (date) value from the pdf file metadata (in reader Files -> Properties). Can I achieve that with a similar approach?


text:
Q: Trick for evaluating integrals over the whole real line (possible alternative derivation of gamma function?) Consider the integral,
$$ I_n= \int_{\Bbb{R}} f_n(x) dx \tag{1}$$
Where, $$f_n(x) = \begin{cases} 0, x \leq 0 \\
x^n e^{-x} , x > 0 \end{cases}$$
An interesting property of the integral is that, we can shift it by any amount $\epsilon$ and the value should be same since we would still be integrating over the same domain :
$$I_n = \int_{\Bbb{R}} f_n(x+ \epsilon)  dx \tag{2}$$
Substracting (1) and (2),
$$ 0 = \int_{\Bbb{R}} \left[ f_n(x+ \epsilon) - f_n(x) \right] dx$$
Divide both side by $\epsilon$ and sending $\epsilon \to 0 $, we have:
$$ 0 =\int_{\Bbb{R}} f_n'(x) dx$$
For $n>1$ , the function is differentiable at $x=0$, and hence:
$$ \int_{\Bbb{R}} f_n'(x) dx = \int_0^{\infty} nx^{n-1} e^{-x} - x^n e^{-x} dx =0$$
Using (1), we have:
$$ n I_{n-1} = I_n$$
By finding $I_1$, we can solve the above recurrence relation which leads to $I_n = n!$.

*

*Is there a name for the method I've used here?

*Are there other integrals where this method would be helpful in evaluating?

A: If $\int_{\Bbb R}g(x)dx$ converges$$0=\lim_{\epsilon\to0}\int_{\Bbb R}\frac{g(x+\epsilon)-g(x)}{\epsilon}dx\stackrel{!}{=}\int_{\Bbb R}\lim_{\epsilon\to0}\frac{g(x+\epsilon)-g(x)}{\epsilon}dx=\int_{\Bbb R}g^\prime(x)dx$$assumes the integration operator commutes with the limit operator, while$$\int_{\Bbb R}g^\prime(x)dx\stackrel{!}{=}\lim_{x\to\infty}g(x)-\lim_{x\to-\infty}g(x)$$assumes the limits exist. For $g=f_n$, your strategy is the top approach and the usual strategy is the bottom one (and I leave it to you to explain why both strategies' assumptions hold), but both note $f_n^\prime=nf_{n-1}-f_n$. I think that answers part $2$. To address part $1$, I think all that would be named is theorems that justify the aforementioned operator exchange (six are listed here).


text:
Q: VBA webscraper - Return InnerHTML with regex Using Excel VBA, i have to scrape some data from this website.
Since the relevant website objects dont contain an id, I cannot use HTML.Document.GetElementById.
However, I noticed that the relevant information is always stored in a
-section like the following:

Basler Versicherung AG Özmen

Question:
Is it possible to construct a RegExp that, probably in a Loop, returns the contents inside
 and the next
?
What I have so far is the complete InnerHtml of the container, obviously I need to add some code to loop over the yet-to-be-constructed RegExp.
Private Function GetInnerHTML(url As String) As String
    Dim i As Long
    Dim Doc As Object
    Dim objElement As Object
    Dim objCollection As Object

On Error GoTo catch
   'Internet Explorer Object is already assigned
   With ie
        .Navigate url
        While .Busy
            DoEvents
        Wend
        GetInnerHTML = .document.getelementbyId("cphContent_sectionCoreProperties").innerHTML
    End With
    Exit Function
catch:
    GetInnerHTML = Err.Number & " " & Err.Description
End Function

A: I don't think you need Regular expressions to find the content on the page. You can use the relative positions of the elements to find the content I believe you are after.
Code
Option Explicit

Public Sub GetContent()
    Dim URL     As String: URL = "https://www.uid.admin.ch/Detail.aspx?uid_id=CHE-105.805.649"
    Dim IE      As Object: Set IE = CreateObject("InternetExplorer.Application")
    Dim Labels  As Object
    Dim Label   As Variant
    Dim Values  As Variant: ReDim Values(0 To 1, 0 To 5000)
    Dim i       As Long

    With IE
        .Navigate URL
        .Visible = False

        'Load the page
        Do Until IE.busy = False And IE.readystate = 4
            DoEvents
        Loop

        'Find all labels in the table
        Set Labels = IE.document.getElementByID("cphContent_pnlDetails").getElementsByTagName("label")

        'Iterate the labels, then find the divs relative to these
        For Each Label In Labels
            Values(0, i) = Label.InnerText
            Values(1, i) = Label.NextSibling.Children(0).InnerText
            i = i + 1
        Next

    End With

    'Dump the values to Excel
    ReDim Preserve Values(0 To 1, 0 To i - 1)
    ThisWorkbook.Sheets(1).Range("A1:B" & i) = WorksheetFunction.Transpose(Values)

    'Close IE
    IE.Quit
End Sub

A: Another way you can achieve the same using XMLHTTP request method. Give it a go:
Sub Fetch_Data()
    Dim S$, I&

    With New XMLHTTP60
        .Open "GET", "https://www.uid.admin.ch/Detail.aspx?uid_id=CHE-105.805.649", False
        .send
        S = .responseText
    End With

    With New HTMLDocument
        .body.innerHTML = S
        With .querySelectorAll("#cphContent_sectionCoreProperties label[id^='cphContent_ct']")
            For I = 0 To .Length - 1
                Cells(I + 1, 1) = .Item(I).innerText
                Cells(I + 1, 2) = .Item(I).NextSibling.FirstChild.innerText
            Next I
        End With
    End With
End Sub

Reference to add to the library before executing the above script:
Microsoft HTML Object Library
Microsoft XML, V6.0


text:
Q: Html sprite showing full height I have a div which I have a plus icon to expand the view. When the user hovers overs the icon moves to the green version.
I am now adding a extra line of text but now the full icon gets shown. I am not sure how to set the height to only allow the fist part of the icon to be show.

   Classic Double Room

Sleeps: 2

css:
.roomtitle {
            background: url("../images/icons/icon_add.gif") no-repeat scroll 0 0 transparent;
            color: #990000;
            line-height: 14px;
            padding-left: 25px;
            }

A: You have two options here:
1) you can change the sprite so that there is a gap inbetween each image (not very good)
2) add a span within the .roomtitle div and add the sprite to that. (this is the approch I will usually take)
.roomtitle{
    width:25px;
    height:25px;
    background:url("../images/icons/icon_add.gif") no-repeat scroll 0 0 transparent;
    float:left;
    display:block;
}

A: Put the sprite in the link instead of the div:
.roomtitle {
    color: #990000;
    line-height: 14px;
}
.roomtitle > a {
    display: inline-block;
    height: 14px;
    background: url("../images/icons/icon_add.gif") no-repeat scroll 0 0 transparent;
    padding-left: 25px;
}

Working demo: http://jsfiddle.net/gilly3/U285K/


text:
Q: VB6 RSS Example? i need an example - how to parse RSS feeds by under Visual Basic 6... help please)

A: Here you go, using ChilkatRSS.
Dim r As New ChilkatRSS

' Get the searchenginewatch.com feed
success = r.DownloadRss("http://feeds.searchenginewatch.com/sew")
If (success = 0) Then
    MsgBox "Failed to download RSS feed"
    Exit Sub
End If

' Get the first channel
Dim channel As ChilkatRSS
Set channel = r.GetChannel(0)

Dim item As ChilkatRSS

nItems = channel.NumItems
For i = 0 To nItems - 1
    Set item = channel.GetItem(i)
    List1.AddItem item.GetString("title")
Next

A: One place to begin might be Introducing the Windows RSS Platform.
However I haven't seen any useful examples.


text:
Q: Not closing HTML5 tags to avoid whitespace between inline elements - is this correct? I've been curious about this for some time now.
According to this article I read, CSS-Tricks it is okay to skip the end tags for the li to prevent the whitespace that is created between each element due to the style inline or inline-block.
I am a very anal person when it comes to the writing of my html and try my best to keep a clean structure. Recently I have been commenting the whitespace out between the elements which has brought concern to myself due to load time and a sloppy feel.

"Skip the closing tag HTML5 doesn't care anyway."

one

two

three

Compared to the classic way,

one

two

three

Is this valid html and is there the possibility that this may cause complications later down the road?

A: End tags were optional on list items since at least the first standardised version of HTML (HTML 2) was released in 1995. (Edit: Also optional in the first public document that specified HTML, published in 1992).
It was only XHTML that made end tags mandatory, and practically nobody ever used the application/xhtml+xml content-type that would make that matter, even when XHTML was the flavour of the week.

A: The classic way was the XHTML way. XHTML is actually XML, which demands you close your tags or else your pages wouldn't validate.
If you write your pages to be consistent with the HTML5 specification, it is ok to not close those tags (but I do it anyway!)
Just make sure your pages validate: http://validator.w3.org/

A: HTML5 is very tolerant of open tags.  However I would personally recommend always closing the tags.  Its just good practice.
This is especially the case if you are developing web projects that mix other languages and markup, like XML, PHP, Javascript, etc.  It will help greatly when it comes to debugging.


text:
Q: React JS Props not updating In the code below when I change the state of pendingCount the first key prop changes but the one inside the < Pending/> does not. Why is that?

            <motion.p
                key={pendingCount}
                whileHover={{textDecoration:"underline"}}
                style={{cursor:"pointer"}}
                onClick={ ()=>{ render(<Pending key={pendingCount} data={AllPendingsData}/>) } }
                className="position-relative d-inline-block pe-3"
            >
                Pending Requests

                    {pendingCount}

            </motion.p>

There is one more thing that I want to add that is that what I wanted to do was to re-render the < Pending/> when its props changes. Changing the key prop was one of the suggested way that I found on the internet for this but it is not working for me. So is there any better or preferred way to do for a functional component?

A: Do you use props or state?
for test you try with state

A: The problem was the onClick just as Drew Reese mentioned.
Props are causing updates but only when user clicks the element.
So instead of passing the data as prop I used useContext hook which solved my problem.


text:
Q: Java 2D collision response method Recently I have been playing around with basic 2D java game programming and have been having a lot of fun discovering things on my own, but I have come up with a problem. I have created a simple collision method that has been extremely buggy. So my question is how to change the x and y of the player when they collid with a block. I have tried the below code and it is recognizing when the player has collided but it doesn't set his x and y to the x and y to the tempx and y. Code:
private void update(){
    tempx = player.getX();
    tempy = player.getY();
    collided = checkCollision();
    if(collided == false){
        player.update();
    }
    else if(collided){
        player.setX((int)tempx);
        player.setY((int)tempy);
        System.out.println("COLLIDED");
    }
}

private boolean checkCollision(){
    for(int i = 0; i < tiles.size(); i++){
        Tile t = tiles.get(i);
        Rectangle tr = t.getBounds();
        if(tr.intersects(player.getBounds())){
            return tr.intersects(getBounds());
        }
    }
    return false;
}

The collision is being detected but the player x and y aren't being changed accordingly. If you need more code or have any questions just ask. Thanks for any help:)
P.S. I have tried adding gravity and the collision only works for the top of the blocks if that is any help
Below is the player.update() method:
@Override
public void keyPressed(KeyEvent e){
    int k = e.getKeyCode();
    if(k != 0){
        if(k == KeyEvent.VK_W){
            y -= vy;
        }
        else if(k == KeyEvent.VK_A){
            x -= vx;
        }
        else if(k == KeyEvent.VK_S){
            y += vy;
        }
        else if(k == KeyEvent.VK_D){
            x += vx;
        }
    }
}
public void update(){

}

A: The problem appears to be in your update method.
private void update(){
    tempx = player.getX(); // tempx now is the same as the players x location
    tempy = player.getY();
    collided = checkCollision();
    if(collided == false){
        player.update();
    }
    else if(collided){
        player.setX((int)tempx);  // you set players location equal to temp, which is
        player.setY((int)tempy);  // already the players location
        System.out.println("COLLIDED");
    }
}

Since you are setting the players location equal to the location that it is currently in, you're not going to see the character move anywhere at all. You'll probably want to change the values of tempx and tempy
tempx = player.getX() + 10;
tempy = player.getY() + 10;

Update
There seems to be some confusion about how the updating process is working.
Consider the following:

*

*character starts at (0,0)

*some object at (2,2) chich would cause a collision

Given the above the following happens in your update method and IN THIS ORDER

*

*tempx = player.getX() both x's are now 0

*tempy = player.getY() both y's are now 0

*checks collision, there are none

*since no collisions, player is updated. (I'll presume the update method moves the character (+1,+1). So character is now at location (1,1).

*tempx and tempy are set to getX and getY again. X and Y are now both 1. Now tempx and tempy are also 1

*no collisions, so character is updated (moved) to (2,2)

*tempx and tempy are set to getX and getY. X and Y are now both 2, so tempx and tempy are also 2.

*checks collisions, its true there was one at (2,2)

*because there was a collision you then "move" the character to tempx and tempy, BUT tempx and tempy are the same value as character.getX and character.getY.

You have to set tempx and tempy equal to the characters location outside of the update loop if you want them to remain the same throughout the characters updated movements.


text:
Q: Help to find the solution of $y' = \begin{pmatrix}-2 & 1 \\1 &-2\end{pmatrix} \cdot y + \begin{pmatrix}2\sin(t) \\ 2(\cos(t) - \sin(t))\end{pmatrix}$ I'm currently studying a course on numerical solutions of ODEs and I've been given this system of differential equations:
$$y'  = \begin{pmatrix}-2 & 1 \\ 1 &-2\end{pmatrix} \cdot y + \begin{pmatrix}2\sin(t) \\ 2(\cos(t) - \sin(t))\end{pmatrix}$$
Of course the derivatives are in time $t$, so $y' = [ dy_1/dt ; \; dy_2/dt]$ where $y_1, y_2$ are the two components of the $2$d vector $y$.
I've implemented all the methods to solve it numerically but the question is to study the errors of those methods, and the only way to do so is comparing the numerical solution towards the exact solution of the system.
Here is my question:

can anyone help me solving this system of equations please? Since I've been studying numerical analysis for a while I'm a bit rusted on this abstract things..

A: Homogeneous Portion
The homogeneous part of $y$, given by $y_h(t)$, solves the following system:
$$y_h' = \begin{pmatrix} -2 & 1 \\ 1 & -2 \end{pmatrix}y_h.$$
The above system can be solved directly by looking at the eigenvalue of the matrix $\begin{pmatrix} -2 & 1 \\ 1 & -2 \end{pmatrix}$. One can check that the eigenvalues are given by $-1$ and $-3$. This yields
$$y_h(t) = e^{-t}v_1 + e^{-3t}v_2$$
where $v_1$ and $v_2$ are arbitrary vectors in $\mathbb{R}^2$ (am assuming that is what you are working with) to be determined by providing the relevant initial data.
Inhomogeneous Portion
One can check that a particular solution $y_p(t)$ is given by
$$y_p(t) = \begin{pmatrix} \sin(t) \\ \cos(t) \end{pmatrix}.$$
(Remark: One way you could have known this is to guess that $y_p(t) = \begin{pmatrix} A \sin(t) + B \cos(t) \\ C \sin(t) + D\cos (t)\end{pmatrix}$ and solve for $A,B,C,$ and $D$.)
This gives
$$\begin{aligned} y(t) &= y_h(t) + y_p(t) \\ &= \boxed{e^{-t}v_1 + e^{-3t}v_2 + \begin{pmatrix} \sin(t) \\ \cos(t) \end{pmatrix}}. \end{aligned}$$

A: This kind of matrix structure has some very simple eigenvectors. In general for circulant matrices one can use a Fourier basis.
Here consider $u_1=y_1+y_2$ and $u_2=y_1-y_2$ to get the decoupled system of scalar equations
\begin{align}
u_1'&=-u_1+2\cos(t)\\
u_2'&=3u_2+4\sin(t)-2\cos(t).
\end{align}
These you should be able to solve with your previous experiences. Reconstructing $y_1,y_2$ from their solutions is then a trivial step.


text:
Q: Leaving a Project file open after retrieving it with GetObject What is the right way to leave an MS Project file opened with GetObject() open and visible to the user after the end of a macro in a different app?
The information I found online suggests that setting the Application.UserControl property to True before the objects go out of scope should allow the user to continue using the opened file. However, for MS Project at least, the Application.UserControl property appears to be read-only. Is there a way to work around this?
A simplified example showing the problem:
Sub AddTasks()
    Dim proj As Object

    ' Already have the file path from another part of the workflow
    Set proj = GetObject("C:\projtest.mpp")

    ' perform some calculations and add new tasks to project
    proj.Tasks.Add "additional task"

    ' Leave Project open and visible for the user
    proj.Application.Visible = True
    proj.Application.UserControl = True ' Gives "Type Mismatch" error
    ' without the UserControl line, runs ok, but Project closes after the end of the macro
End Sub

A: Instead of using GetObject, could you create an instance of the application and open the project file in the instance?
Sub AddTasks()
   Dim msProj as Object
   Set msProj = CreateObject("Project.Application")

   msProj.FileOpen "C:\projtest.mpp"

   'do stuff to project file here

   msProj.Visible = True
End Sub

Something like the above (I can't test the above code because I don't have MSProject, but similar code works for MSWord)

A: For Project UserControl just indicates if the user started the application or not; it appears to be read-only because it is. I've not done what you're asking for with Project, although here is a similar example for Word trying to see and find running instances of Excel. Perhaps this helps a little:
can-vba-reach-across-instances-of-excel


text:
Q: Code stop running after opening the gnuplot I am writing a code in python that opens the terminal, and goes to gnuplot. The problem is that after entering the gnuplot, the lines that follows the code aren't read, and so does nothing. What could i do in such way that the codes remain running, even after open the gnuplot?
import os
    os.system("gnuplot; p 'd.dat'")
    os.system(f"f(x) = a*cos(b*(x-c))+d")
    os.system(f"a = at")

As above shows, after the codes write gnuplot on the terminal, it opens the gnuplot and it stops to run. That is, it does not write. I would expect it writes p "d.dat" after opening the gnu terminal.


text:
Q: Stop User From Liking Post Multiple Times I have a like button, which allows users to like posts on my site. If the user likes a post they have not liked before it will +1, if they press the same like button again it will -1. This is working on my virtual server on my laptop. However, the same code is not working on my live site. On my live site the user is able to like the same post multiple times, which is not what I want. I'm using a JQuery Ajax call to a PHP file that fires a some MySQL code.
Can anyone see anything obviously wrong with the PHP below?
include ("../con/config.php");

$postid = $_POST['postid'];
$userid = $_POST['userid'];

$query = $con->prepare("SELECT COUNT(*) AS CntPost FROM Likes WHERE UserID = ? AND PostID = ?");
$query->bind_param('ss',$userid,$postid);
$query->execute();
$result = $query->get_result();
$fetchdata = $result->fetch_assoc();
$count = $fetchdata['CntPost'];

if($count == 0){

     $stmt = $con->prepare("INSERT INTO Likes(UserID,PostID) VALUES(?,?)");
     $stmt->bind_param("ss", $userid, $postid);
     $stmt->execute();

} else {

     $stmt = $con->prepare("DELETE FROM Likes WHERE UserID = ? AND PostID = ?");
     $stmt->bind_param("ss", $userid, $postid);
     $stmt->execute();
}

// count numbers of likes in post

$query = $con->prepare("SELECT COUNT(*) AS CntLike FROM Likes WHERE PostID = ?");
$query->bind_param('s', $postid);
$query->execute();
$result = $query->get_result();
$fetchlikes = $result->fetch_assoc();
$totalLikes = $fetchlikes['CntLike'];

$return_arr = array("likes"=>$totalLikes,"type"=>$count);

echo json_encode($return_arr);

A: Managed to solve it. The issue was in the MySQL database column itself for the UserID. The number of chars for the column was not long enough and was truncating the UserID, which I populate using the sessionID. I amended this field in the database to allow for the length of a sessionID.

A: perhaps this statement
"SELECT COUNT(*) AS CntLike FROM Likes WHERE PostID = ?" need UserID in WHERE statement so you would know that specific UserID in that specific PostID


text:
Q: vSphere Client unable to attach the virtual machine console I was using vSphere Client to connect my ESXi 6 server, but can't attach to any virtual machine console via Internet.
vSphere Client has error message:

Unable to connect to the MKS: Login(username/password) incorrect

Can telnet the ESXi 443 and 902 port.

A: As far as I remember, solved this issue by allowing few ports by host firewall (902, 903, 443). Make sure it isn't blocked on both sides.
Also, there are some options here https://communities.vmware.com/thread/238478

A: As of version 6 web UI is the only fully compatible client for ESXi. Try connect via browser:
https://11.22.33.44

where 11.22.33.44 is your host IP-address.


text:
Q: What is the PHP function naming and argument order logic/convention? Are the functions named, and their arguments ordered randomly in PHP? I find it real hard to remember which function is how, and always find myself referring the manual. What do you do to remember them without having to refer the manual every time?
few examples:
array_map(callback, array) but array_filter(array, callback). When dealing with strings strstr(), strpos() and substr() has no underscores but str_replace(), str_pad() and str_split() does. and in most cases, the string is accepted as the first argument but in explode() the string is the second argument.

A: PHP has quite a few inconsistencies in the internal functions, just something you have to get used to - always have the function reference open when coding.
This is an acknowledged problem, but unresolvable without breaking huge amounts of existing code, ie. all of it, as the functions affected are highly used ones for the most part. :-/

A: I find it nice to have a bookmark keyword search on firefox http://php.net/%s
So this way I can type in the URL bar: p function_name, and firefox automatically opens http://php.net/function_name, which is the php function reference manual for the function...
I disagree with Orbling when he says the inconsistency problem is unresolvable... new function aliases could be made to reorganize all of php functions that could be used in new code... for instance having a prefix or some standard way of grouping the functions...

A: *

*English is somewhat inconsistent in the same way. Sir Bernard Shaw once noted that a word that pronounced "fish" may be written in English as "ghote".

*PHP was grown as any other natural language. With bugs, mistakes and inconsistency.

*Nobody forbids you from writing your own abstraction library with whatever naming and syntax rules you choose.


text:
Q: What machine computational phenomena is responsible for errors in plots of certain functions at very small scales? Consider the function $f(x)=\frac{e^{x^2}-1}{x^2}$. One can use elementary methods (e.g. l'Hospital's rule) to show that $\displaystyle\lim_{x\to 0} f(x)=1$. A plot over $[-1,1]$ is consistent with this.
plot of $f(x)=\frac{e^{x^2}-1}{x^2}$ over $[-1,1]$
However, if one plot this on the interval $[-10^{-3},10^{-3}]$ we get error:
plot of $f(x)=\frac{e^{x^2}-1}{x^2}$ over $[-10^{-3},10^{-3}]$
I have a loose understanding that this is due to floating point arithmetic details, but I am hoping someone can give me some sharper insight into this phenomena.
Thank you in advance!

A: Roundoff error with catastrophic cancellation.
To see what's happening, let's suppose your computer did floating-point arithmetic with $10$ decimal digits.  Any number that doesn't fit in $10$ digits is rounded to the nearest number that does.  Let's see what happens when you compute
$$ \frac{e^{x^2}-1}{x^2}$$
with $x = 1/(3 \cdot 10^4)$.  In floating-point, $x$ is represented as
3.333333333e-5

(note the $10$ digits before the exponent).  It's not exact, but it's the best that can be done with $10$ digits.  Computing $x^2$ is no problem: it is
1.111111111e-9

Again, this is the best that can be done with $10$ digits.  Next we take the exponential:
 1.000000001

Still the best that can be done with $10$ digits.  But notice how close that is to $1$.  Next we subtract $1$:
.000000001 = 1.000000000e-9

Those 0's at the end are just "filler": the initial 1 is the only digit that came from our approximation of $x^2$.  The actual value of $\exp(x^2)-1$, rounded to $10$ digits precision, would have been $1.111111112e-9$.  At this point the difference between
the two (the "absolute error") is $1.11111112 \times 10^{-10}$.  Not
so bad, you might say, considering we're using $10$ digits.  But the "relative error", the ratio of this absolute error to the actual value, is not so good: approximately $0.1$.  And when we divide our approximation of $\exp(x^2)-1$ by our approximation of $x^2$ (which is a small number), we get
9.000000001e-1

The absolute error now has been magnified to about $10^{-1}$.
If you took an even smaller $x$, things would get even worse: the computer would not be able to tell the difference between $e^{x^2}$ and $1$, resulting in a value of $0$.


text:
Q: ServiceStack SwaggerUI route location The documentation for ServiceStack's SwaggerUI implementation states

Default configuration expects that ServiceStack services are available under '/api' path.

but I have my api at the root. Is there a way to change where the SwaggerUI's looks?

A: I found /swagger-ui/index.html includes the JavaScript code containing the api location.
        window.swaggerUi = new SwaggerUi({
            discoveryUrl:'../api/resources',
            apiKey:"",
            dom_id:"swagger-ui-container",
            supportHeaderParams: false,
            supportedSubmitMethods: ['get', 'post', 'put']
        });

Change the discoveryUrl to be:
discoveryUrl:'../resources'

The Swagger-UI should then correctly auto-discover the available resources.


text:
Q: Third party C static library: Add -ffunction-sections -fdata-sections I am in the situation to have a c static library (compiled with arm-gcc), which is provided by a third party. I have no possibility to (let the third party) re-compile the library.
When investigating the library contents, i found that the gcc options -ffunction-sections and -fdata-sections have not been used for compiling the library. But this would be very helpful for reducing the binary size of the project.
Compilation is done with: (GNU Tools for ARM Embedded Processors) 4.8.4 20140526 (release) [ARM/embedded-4_8-branch revision 211358].
Is there any way to put every data and every function into their own separate section to enable function-level-linking for this library, without needing to recompile code?
I thought of this possible approach:

*

*Split library into its object files.

*For each object file:

*

*Write code to move the symbols into own sections

*Put new object files back together into archive file

Could this work, or do you have other suggestions, which ideally only use the tools provided by arm-gcc?

A: I'm aware this is old, but I came across this problem as well, and figured I'd provide my findings.
TL;DR: It's possible, but incredibly difficult. You can't simply move symbols into their own sections. Relocations will bite you.
When the compiler generates machine code, it will generate slightly different instructions if the -ffunction-sections and -fdata-sections flags are, or are not, provided. This is due to assumptions the compiler is able to make about where symbols will be located. These assumptions change depending on the flags provided.
This is best illustrated by example. Take the following very simple code snippet:

int a, b;

int getAPlusB()
{
    return a + b;
}

The following is the result of arm-none-eabi-objdump -xdr test.o:
arm-none-eabi-gcc -c -Os -mthumb -mcpu=cortexm3 -mlittle-endian -o test.o test.c:
SYMBOL TABLE:
00000000 g     F .text  0000000c getAPlusB
00000004 g     O .bss   00000004 b
00000000 g     O .bss   00000004 a

Disassembly of section .text:

00000024 <getAPlusB>:
  24:   4b01        ldr r3, [pc, #4]    ; (2c <getAPlusB+0x8>)
  26:   cb09        ldmia   r3, {r0, r3}
  28:   4418        add r0, r3
  2a:   4770        bx  lr
  2c:   00000000    .word   0x00000000
            2c: R_ARM_ABS32 .bss

arm-none-eabi-gcc -c -Os -ffunction-sections -fdata-sections \
  -mthumb -mcpu=cortexm3 -mlittle-endian -o test.o test.c:
SYMBOL TABLE:
00000000 g     F .text.getAPlusB    00000014 getAPlusB
00000000 g     O .bss.b 00000004 b
00000000 g     O .bss.a 00000004 a

Disassembly of section .text.getAPlusB:

00000000 <getAPlusB>:
   0:   4b02        ldr r3, [pc, #8]    ; (c <getAPlusB+0xc>)
   2:   6818        ldr r0, [r3, #0]
   4:   4b02        ldr r3, [pc, #8]    ; (10 <getAPlusB+0x10>)
   6:   681b        ldr r3, [r3, #0]
   8:   4418        add r0, r3
   a:   4770        bx  lr
    ...
            c: R_ARM_ABS32  .bss.a
            10: R_ARM_ABS32 .bss.b

The difference is subtle, but important. The flag enabled code performs two separate loads, while the disabled code performs a single "load multiple." The enabled code does this because it knows both symbols are contained in the same section, in a certain sequence. With the enabled code, this is not the case. The symbols are in two separate sections, and while it is likely they will keep their order and proximity, it is not guaranteed. What's more, if both sections are not referenced, the linker may decide one section is not used, and remove it.
Another example:

int a, b;

int getB()
{
  return b;
}

And the generated code. First without the flags:
SYMBOL TABLE:
00000000 g     F .text  0000000c getB
00000004 g     O .bss   00000004 b
00000000 g     O .bss   00000004 a

Disassembly of section .text:

00000018 <getB>:
  18:   4b01        ldr r3, [pc, #4]    ; (20 <getB+0x8>)
  1a:   6858        ldr r0, [r3, #4]
  1c:   4770        bx  lr
  1e:   bf00        nop
  20:   00000000    .word   0x00000000
            20: R_ARM_ABS32 .bss

And with the flags:
SYMBOL TABLE:
00000000 g     F .text.getB 00000014 getB
00000000 g     O .bss.b 00000004 b
00000000 g     O .bss.a 00000004 a

Disassembly of section .text.getB:

00000000 <getB>:
   0:   4b01        ldr r3, [pc, #4]    ; (8 <getB+0x8>)
   2:   6818        ldr r0, [r3, #0]
   4:   4770        bx  lr
   6:   bf00        nop
   8:   00000000    .word   0x00000000
            8: R_ARM_ABS32  .bss.b

In this case, the difference is even more subtle. The enabled code loads with an offset of 0, while the disabled code uses 4. Since the disabled code references the beginning of the section, it needs to offset to the location of b. However the enabled code references the section which contains solely b, and therefore does not need an offset. If we were to split this and only change the relocation, the new code would contain a reference to the section a was in, but not b. This, again, could cause the linker to garbage collect the wrong section.
These were just two scenarios that I came across when looking at this problem, there may be more.
Producing valid object files functionally equivalent to code compiled with the -ffunction-sections and -fdata-sections flags would require parsing the machine instructions looking for these and any other relocation issues that could come up. This is not an easy task to accomplish.


text:
Q: How do I pass a property changed event to an ancestor? I'm sure I am missing some of the basics here so please bear with me.
I have a two objects, a SalesOrder and a SalesOrderLineItem. The lineitems are kept in an Observablecollection<SalesOrderLineItem> of SalesOrder, and if I add line items my databound listView knows about the new items.
Now where I am having a problem is here: The SalesOrder has a read only property called "OrderTotal", which knows what the total price from all the line items combined are.
If I change the quantity, or price of a line item, I don't seem to know how to get change notification to bubble up to "OrderTotal".
Both classes inherit from, and fire INotifyPropertyChanged.
Wham am I missing?

A: The ObservableCollection only notifies when an Item is added, removed, or when the list is refreshed, not when a property of an Item within the collection changes.
The SalesOrder class needs to be listening to each SalesOrderLineItem's PropertyChanged event.
-
The OrderTotal property could also be dynamic, generating the total each time...

A: If you feel adventurous, you can try BindableLinq or something similar.
It allows you to expose the result of a query that listens to changes.
But it's not out of beta yet, and I'm not sure it will ever be...
ContinuousLinq is another one, but it does not support Silverlight at all yet.
Other than that, you'll have to listen to each child, and add/remove handlers whenever the collection changes.

A: public ObservableCollection<TestClass> List
    {
        get { return _List; }
        set {
            if (_List!= value)
            {
                _List = value;
                raisePropertyChange("List");
                List.ToList().ForEach(i=> i.PropertyChanged+= (o,e)=>
                {
                    //PropertyChanged.Raise(() => List);
        raisePropertyChange("List");
        //or what ever you want
                }
            );

            }
        }
    }


text:
Q: Using makeExprParser with ambiguity I'm currently encountering a problem while translating a parser from a CFG-based tool (antlr) to Megaparsec.
The grammar contains lists of expressions (handled with makeExprParser) that are enclosed in brackets (<, >) and separated by ,.
Stuff like <>, <23>, <23,87> etc.
The problem now is that the expressions may themselves contain the > operator (meaning "greater than"), which causes my parser to fail.
<1223>234> should, for example, be parsed into [BinaryExpression ">" (IntExpr 1223) (IntExpr 234)].
I presume that I have to strategically place try somewhere, but the places I tried (to the first argument of sepBy and the first argument of makeExprParser) did unfortunately not work.
Can I use makeExprParser in such a situation or do I have to manually write the expression parser?:
This is the relevant part of my parser:
-- uses megaparsec, text, and parser-combinators
{-# LANGUAGE OverloadedStrings #-}

module Main where

import Control.Monad.Combinators.Expr
import Data.Text
import Data.Void
import System.Environment
import Text.Megaparsec
import Text.Megaparsec.Char
import qualified Text.Megaparsec.Char.Lexer as L

type BinaryOperator = Text

type Name = Text

data Expr
  = IntExpr Integer
  | BinaryExpression BinaryOperator Expr Expr
  deriving (Eq, Show)

type Parser = Parsec Void Text

lexeme :: Parser a -> Parser a
lexeme = L.lexeme sc

symbol :: Text -> Parser Text
symbol = L.symbol sc

sc :: Parser ()
sc = L.space space1 (L.skipLineComment "//") (L.skipBlockCommentNested "/*" "*/")

parseInteger :: Parser Expr
parseInteger = do
  number <- some digitChar
  _ <- sc
  return $ IntExpr $ read number

parseExpr :: Parser Expr
parseExpr = makeExprParser parseInteger [[InfixL (BinaryExpression ">" <$ symbol ">")]]

parseBracketList :: Parser [Expr]
parseBracketList = do
  _ <- symbol "<"
  exprs <- sepBy parseExpr (symbol ",")
  _ <- symbol ">"
  return exprs

main :: IO ()
main = do
  text : _ <- getArgs
  let res = runParser parseBracketList "stdin" (pack text)
  case res of
    (Right suc) -> do
      print suc
    (Left err) ->
      putStrLn $ errorBundlePretty err

A: You've (probably) misdiagnosed the problem.  Your parser fails on <1233>234> because it's trying to parse > as a left associative operator, like +.  In other words, the same way:
1+2+

would fail, because the second + has no right-hand operand, your parser is failing because:
1233>234>

has no digit following the second >.  Assuming you don't want your > operator to chain (i.e., 1>2>3 is not a valid Expr), you should first replace InfixL with InfixN (non-associative) in your makeExprParser table.  Then, it will parse this example fine.
Unfortunately, with or without this change your parser will still fail on the simpler test case:
<1233>

because the > is interpreted as an operator within a continuing expression.
In other words, the problem isn't that your parser can't handle expressions with > characters, it's that it's overly aggressive in treating > characters as part of an expression, preventing them from being recognized as the closing angle bracket.
To fix this, you need to figure out exactly what you're parsing.  Specifically, you need to resolve the ambiguity in your parser by precisely characterizing the situations where > can be part of a continuing expression and where it can't.
One rule that will probably work is to only consider a > as an operator if it is followed by a valid "term" (i.e., a parseInteger).  You can do this with lookAhead.  The parser:
symbol ">" <* lookAhead term

will parse a > operator only if it is followed by a valid term.  If it fails to find a term, it will consume some input (at least the > symbol itself), so you must surround it with a try:
try (symbol ">" <* lookAhead term)

With the above two fixes applied to parseExpr:
parseExpr :: Parser Expr
parseExpr = makeExprParser term
  [[InfixN (BinaryExpression ">" <$ try (symbol ">" <* lookAhead term))]]
  where term = parseInteger

you'll get the following parses:
λ> parseTest parseBracketList "<23>"
[IntExpr 23]
λ> parseTest parseBracketList "<23,87>"
[IntExpr 23,IntExpr 87]
λ> parseTest parseBracketList "<23,87>18>"
[IntExpr 23,BinaryExpression ">" (IntExpr 87) (IntExpr 18)]

However, the following will fail:
λ> parseTest parseBracketList "<23,87>18"
1:10:
  |
1 | <23,87>18
  |          ^
unexpected end of input
expecting ',', '>', or digit
λ>

because the fact that the > is followed by 18 means that it is a valid operator, and it is parse failure that the valid expression 87>18 is followed by neither a comma nor a closing > angle bracket.
If you need to parse something like <23,87>18, you have bigger problems.  Consider the following two test cases:
<1,2>3,4,5,6,7,...,100000000000,100000000001>
<1,2>3,4,5,6,7,...,100000000000,100000000001

It's a challenge to write an efficient parser that will parse the first one as a list of 10000000000 expressions but the second one as a list of two expression:
[IntExpr 1, IntExpr 2]

followed by some "extra" text.  Hopefully, the underlying "language" you're trying to parse isn't so hopelessly broken that this will be an issue.


text:
Q: onClick event for Google Forms Submit button This is driving me crazy, I have a simple Google Form that accepts subscriber code and their slot timings. My purpose is to get data via Google Forms and save it to Google Sheets without having any clashes in the slots timings.
To show you an example, I am attaching an image of my form and sheet. After the first entry was done, if another slot is to be given to same subscriber, we need to ensure that the slot timings do not clash with the saved timings in google sheet that is assigned to the same subscriber. If you see the second entry, it just accepts it and for this we need a validation check which is not available. My question is, is it even possible to have an onClick validation on the submit button? I have been searching for it on google like crazy but haven't got a solution. If this is not possible to do it in Google forms, what are my alternatives or is there any workaround available?
Eagerly awaiting responses for my query. Thank you.

A: As @Cooper pointed out, it seems best that you create your own web app.
After a few hours of work I've made a web app that will work for you using Google Apps Script. Here are the spreadsheet and script file.
Server Side Codes:
var ss = SpreadsheetApp.getActiveSheet()

function doGet() {
  return HtmlService.createTemplateFromFile('form').evaluate()
}

function submitData (data) {

  ss.appendRow([new Date(),data.ssCode, new Date(data.startDateTime), new Date(data.endDateTime)])
}

function isAvailible (start, end) {
  var data = ss.getDataRange().getValues()
  var isAvailible = true;
  var message = '';

  data.forEach(row => {

    if(start > row[2].valueOf() && start < row[3].valueOf() || end > row[2].valueOf() && end < row[3].valueOf()) {
      isAvailible = false;
      message = new Date(row[2].valueOf()) +'
 to ' + new Date(row[3].valueOf()) + '
 isn\'t availible.'
    }
  })

  var response = {status: isAvailible, message: message}

  return response;

}

Client Side Codes:

M.FormSelect.init(document.querySelectorAll('select'));

var dps = document.querySelectorAll('.datepicker');
var dpsInstances = M.Datepicker.init(dps, {
  showClearBtn: true,
  autoClose: true
});

dpsInstances[0].options.onSelect = function(day) {
  dpsInstances[1].setDate(day);
  endDate.value = dpsInstances[1].toString()
  M.updateTextFields();
}

var tps = document.querySelectorAll('.timepicker');
var tpsInstances = M.Timepicker.init(tps, {
  twelveHour: false,
  showClearBtn: true,
  autoClose: true
});

function formSubmit(data) {

  var startDate = new Date(data.startDate.value);
  var startTime = data.startTime.value.split(':');
  startDate.setHours(startTime[0]);
  startDate.setMinutes(startTime[1]);

  var endDate = new Date(data.endDate.value);
  var endTime = data.endTime.value.split(':')
  endDate.setHours(endTime[0]);
  endDate.setMinutes(endTime[1]);

  if (startDate.valueOf() >= endDate.valueOf()) {
    M.toast({html: 'End date should be greater then start date.'})
    return;
  }

  var dataToSubmit = {
    ssCode: data.ssCode.value,
    startDateTime: startDate.valueOf(),
    endDateTime: endDate.valueOf()
  }

  google.script.run.withSuccessHandler(function(response) {
    if (response.status) {
      google.script.run.withSuccessHandler(function() {
        myForm.reset()
        M.toast({
          html: "Successful"
        })
      }).submitData(dataToSubmit)
    } else {
      M.toast({
        html: response.message
      })
    }

  }).isAvailible(dataToSubmit.startDateTime, dataToSubmit.endDateTime)

}
body {
  background: rgb(244, 235, 234)
}

.outer-field {
  border-radius: 15px;
  background: white;
  height: 150px;
  margin: 10px;
  padding: 20px;
}

.title {
  padding-left: 2%;
  font-weight: bold;
}

    <base target="_top">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

Slot Timings

        <form id="myForm" onsubmit="event.preventDefault(); formSubmit(this) ">

Subscriber Code

              <select form="myForm" name="ssCode" required>
                <option value="001">001</option>
                <option value="002">002</option>
                <option value="003">003</option>
              </select>

From

                <input type="text" id="startDate" name="startDate" class="datepicker validate" form="myForm" required>
                Date

                <input type="text" id="startTime" name="startTime" class="timepicker validate" form="myForm" required>
                Time

To

                <input type="text" id="endDate" name="endDate" class="datepicker" form="myForm" required>
                Date

                <input type="text" id="endTime" name="endTime" class="timepicker" form="myForm" required>
                Time

          <button class="btn waves-effect waves-light" type="submit" name="action" style="margin-left: 3%" >Submit
            send
          </button>
        </form>

A: Another idea you can try on your current setup is that you could use an onFormSubmit trigger. And once the response is submitted, it is compared to the previous rows that were added to the sheet to check if there have been any conflict with your data.
Upon confirming there is, just remove the last response. If no conflict, then let it be and end the script there.
Sheet Script:
function checkConflict(e) {
  var sheet = e.range.getSheet();
  var lastRow = sheet.getLastRow();
  // exclude the last submitted response
  var timeSlots = sheet.getRange(2, 3, lastRow - 2, 2).getValues();
  var lastResponse = e.values;
  var lastStart = new Date(lastResponse[2]).getTime();
  var lastEnd = new Date(lastResponse[3]).getTime();

  // convert timeslots to comparable data type
  timeSlots = timeSlots.map(timeSlot => [timeSlot[0].getTime(), timeSlot[1].getTime()]);
  // get conflicts
  var conflict = timeSlots.filter(timeSlot => (timeSlot[0] <= lastStart && timeSlot[1] >= lastStart) ||
                                              (timeSlot[0] <= lastEnd && timeSlot[1] >= lastEnd));
  // remove lastRow if conflict is 1
  if(conflict.length) {
    sheet.deleteRow(lastRow);
    MailApp.sendEmail(lastResponse[4],
                      "Time Slot conflict",
                      "Your recent response was removed due to a conflict. Your submitted time slot is the following:\n" +
                      "From: " + new Date(lastStart) + "\n" +
                      "To: " + new Date(lastEnd));
  }
  else {
    MailApp.sendEmail(lastResponse[4],
                      "Time Slot confirmed",
                      "Your time slot is now confirmed. Confirmed time slot is the following:\n " +
                      "From: " + new Date(lastStart) + "\n" +
                      "To: " + new Date(lastEnd));
  }
}

Sample Data:

Trigger:

Emails confirm:

Emails conflict:

Output:

Note:

*

*This approach doesn't check your input before the submission. It just removes the last response afterwards IF there have been conflicts with the previous slot timings to that one.

*Also, the one who sent the response wouldn't know that his slot was confirmed or not, not unless you ask for his email in the form and send confirmation afterwards the checking (whether his submitted response was removed due to conflict, or approved due to it having no conflict)

*If you have a time slot of 9:00 - 10:00, it won't accept another response with 9:00 in it since (>=, <=) is inclusive. What you can do is to pick timeslots where starting has 1/31 minute (e.g. 9:01-10:00, 8:31-9:30) or the ending slots has 59/29 minutes (e.g. 9:00-9:59, 8:30-9:29).

*If that is a hassle, then you need to adjust the conditional on checking conflicts. You should be able to figure it out.


text:
Q: Windows 10 taskbar pinned items exploring the exe folder instead launching the application I've upgraded my Windows-7_home_premium to windows-10_Home.
Everything looks fine, but the items pinned to the taskbar are opening the folder which contains the target app instead of launching the app.
E.g: When I click on the pinned chrome icon it does not launch the chrome but opens windows explorer in the folder where chrome.exe is installed.
The pinned items which target an exe file are behaving this way, but which target to a UWP-Based app (Not sure this is the correct word, I mean apps like Settings, Windows Store, Callender, etc.) are being launched as expected.
I tried un-pinning and re-pinning the apps but the behavior is same.

A: Go to "Control Panel\Hardware and Sound" and click "Mouse" and check your mouse settings;
For example look if left and right click are not interchanged: ensure that the left button is set to "Click" and right button is "Right-click".


text:
Q: Difference between dependency injection syntaxes in AngularJS AngularJS supports two slightly different syntaxes for dependency injection
Syntax 1
myModule.controller('myCtrl', function($scope, $http, myService) {
    ...
    ...
});

Syntax 2
myModule.controller('myCtrl', ['$scope', '$http', 'myService', function($scope, $http, myService) {
    ...
    ...
}]);

Is there a fundamental difference between the two syntaxes?
When to use either of the two syntaxes?

A: Syntax 2 is called type hinting, if you plan to uglify and mangle your code, angular would still know what services to inject.
After mangling and ugilying:
myModule.controller('myCtrl', ['$scope', '$http', 'myService', function(a, b, c) {

Angular would read the string values of the array provided in order to determine the name of the services a, b, c in order to inject them properly.


text:
Q: Timeout in polling result file: error when starting Google Dataflow SQL query I am new to Google Dataflow & Apache Beam. I am trying to deploy a dataflow job through Dataflow SQL. The job takes input from pubsub and writes to bigquery.
When I start a job using Dataflow SQL, I am getting error - Timeout in polling result file.
This error comes for both gcloud CLI and also through Google Cloud Console.
Below is the snippet of the error.
2020-05-16 21:46:50.193 ISTTimeout in polling result file: gs://dataflow-staging-us-central1-XXXXXXXXXXX/staging/template_launches/2020-05-16_09_06_52-11619869258908426171/operaton_result. Possible causes are: 1. Your launch takes too long time to finish. Please check the logs on stackdriver. 2. Service account XXXXXXXXXXXX-compute@developer.gserviceaccount.com may not have enough permissions to pull container image gcr.io/dataflow-sql-templates/dataflow-sql-launcher-templates/dataflow_sql_launcher_image:20200303-rc00 or create new objects in gs://dataflow-staging-us-central1-XXXXXXXXXXXXX/staging/template_launches/2020-05-16_09_06_52-11619869258908426171/operaton_result. 3. Transient errors occurred, please try again.

I guess the reason mentioned in this log cannot be true, because few times I was able to deploy the job successfully.
For successful cases the parameters between SELECT and FROM in the dataflow SQL query was less than 10. With the number of parameters between SELECT and FROM increased to 18 this problem is arising.
Below is a sample query I am using
        SELECT MIN(sensor.event_date) as day,
            MIN(sensor.event_timestamp) as event_timestamp,
            TUMBLE_START("INTERVAL 1 MINUTE") as parameters_timestamp,
            sensor.sensor_id as sensor_id,
            AVG(CAST(sensor.param2 AS FLOAT64)) as param2,
            AVG(CAST(sensor.param3 AS FLOAT64)) as param3,
            AVG(CAST(sensor.param4 AS FLOAT64)) as param4,
            AVG(CAST(sensor.param5 AS FLOAT64)) as param5,
            AVG(CAST(sensor.param6 AS FLOAT64)) as param6,
            AVG(CAST(sensor.param7 AS FLOAT64)) as param7,
            AVG(CAST(sensor.param8 AS FLOAT64)) as param8,
            AVG(CAST(sensor.param9 AS FLOAT64)) as param9,
            AVG(CAST(sensor.param10 AS FLOAT64)) as param10,
            AVG(CAST(sensor.param11 AS FLOAT64)) as param11,
            AVG(CAST(sensor.param12 AS FLOAT64)) as param12,
            AVG(CAST(sensor.param13 AS FLOAT64)) as param13,
            AVG(CAST(sensor.param14 AS FLOAT64)) as param14,
            AVG(CAST(sensor.param15 AS FLOAT64)) as param15
    FROM pubsub.topic.`project1`.`table1` AS sensor
    GROUP BY
      sensor.sensor_id,
      TUMBLE(sensor.event_timestamp, "INTERVAL 1 MINUTE")

When the error happens I found there is no console logs (i.e 2020-05-16_09_06_52-11619869258908426171/operaton_result) present in the Storage path.
gs://dataflow-staging-us-central1-XXXXXXXXXXX/staging/template_launches/
Thanks,
Jagan
Also here is the image with Job logs.
Job Logs


text:
Q: What is the type that the Scala REPL prints? When I create a small Map in the repl, it tells me that its type is immutable.Map
scala> Map(1->1, 2->2)
res8: scala.collection.immutable.Map[Int,Int] = Map((1,1), (2,2))

This isn't the whole truth though, as in this case
scala> Map(1->1, 2->2).getClass
res9: java.lang.Class[_] = class scala.collection.immutable.Map$Map2

How does Scala decide what to print as the type of an expression?

A: The short answer is that the Scala REPL prints the static type of your results, as inferred from your expression Map(1->1, 2->2), and getClass returns the dynamic type, which can be a subtype of the static type.
A longer answer would be about how Scala's type inference engine works. You'll maybe want to read the relevant sections in the Scala Language Reference.


text:
Q: How to pass user's TextFormField input to a button in a different class in flutter I am creating a flutter app. For the code reusability, I need to differentiate Email and password forms and Login Button, I am not sure how to properly to pass the input from textformfield to the button for the form to be validated, when clicking it. Here's my code. Note that im a beginner in flutter.
//This is my EmailTextForm class:
    class EmailTextForm extends StatelessWidget {
    String email;

   EmailTextForm({Key key, this.email}) : super(key: key);

  Widget build(BuildContext context) {

return Container(
    width: 370.0,
    height: 54.0,
    child: TextFormField(
      decoration: InputDecoration(
        enabledBorder: OutlineInputBorder(
            //DEFAULT STATE OF THE BORDER(FOCUSED BORDER DOWN BELOW TO HAVE MORE CONTROL OF THE FORM)
            borderSide: BorderSide(
                width: 1.0, color: Color.fromRGBO(16, 25, 53, 0.1)),
            borderRadius: BorderRadius.circular(12.0)),
        focusedBorder: OutlineInputBorder(
          //ON FOCUSED BORDER TO NOT CHANGE STATE WHILE BEING PRESSED ON
          borderSide: BorderSide(
              width: 1.0, color: Color.fromRGBO(16, 25, 53, 0.1)),
          borderRadius: BorderRadius.circular(12.0),
        ),
        prefixIcon: Icon(Icons.mail, color: Color(0xFF9FA3AE)),
        hintText: 'El.Paštas',
        hintStyle: TextStyle(
          fontFamily: 'Sora',
          fontSize: 16.0,
          color: Color(0xFF9FA3AE),
        ),
      ),
      validator: (input) =>
          !input.contains('@') ? 'Please enter a valid email' : null,
      onSaved: (input) => email = input,
    ));
 }
}

//This is the button class.
import 'package:flutter/material.dart';
import 'dart:math' as math;

class LoginButton extends StatelessWidget {
  final _formKey = GlobalKey<FormState>();
  String email;
  String password;

  _submit() {
    if (_formKey.currentState.validate()) {
      _formKey.currentState.save();
      print('validated');
      //logging in the user
    }
  }

  @override
  Widget build(BuildContext context) {
    //Container to manipulate button design
    return Container(
        width: 370.0,
        height: 54.0,
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular((12.0)),
          gradient: LinearGradient(
            //change gradient, wrong value, maybe something in AdobeXD.
            colors: <Color>[Color(0xFF00BAFF), Color(0xFF448CFA)],
            stops: [0.0, 1.0],
            begin: Alignment(-1.0, 0.0),
            end: Alignment(1.0, 0.0),
            transform: GradientRotation(math.pi / 2),
          ),
          boxShadow: [
            BoxShadow(
              color: Color.fromRGBO(48, 183, 241, 1.0),
              offset: Offset(0.0, 4.0),
              blurRadius: 12.0,
            ),
          ],
        ),

        //@@@@ WHEN BUTTON IS PRESSED @@@@
        child: ElevatedButton(
          onPressed: _submit,
          child: Text(
            'Prisijungti',
          ),
          style: ElevatedButton.styleFrom(
              //COLOR OF THE TEXT INSIDE THE BUTTON
              onPrimary: Color(0xFFFFFFFF),
              shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(12.0),
              ),
              primary: Colors.transparent,
              textStyle: TextStyle(
                //Text inside button style
                fontSize: 16.0,
                fontWeight: FontWeight.w600,
                fontFamily: 'Sora',
              )),
        ));
  }
}

A: You need to wrap them in a Form widget and pass the key, for example:
Form(
  key: _keyForm
  child: Column(
    children: <Widget>[
     EmailTextFieldForm(),
     PasswordTextFieldForm(),
     FormButton(),
   ],
 )
)

A: you need to wrap all the TextFormFields in a form to get it like this
Column(
  children: [
    TextFormField(),
    ....
    TextFormField(),
])

TextFormFields can be wrapped or moved to another widget, as long as it is a child of the Form.
if everything is in one widget
Form(
  child:
     Column(
     children: [
       TextFormField(),
       ....
       TextFormField(),
       Button(
         onTap: () {},
       ),
])

you need to wrap the button in the Builder so that the context of the current element in the tree is available
Builder(
  builder: (context) => Button(
    onTap: () {},
  ),
),

and after that, you can do Form.of(context).validate(). This entry will find the first form higher in the tree and validate all text fields.
in this way you should get out like this
Builder(
  builder: (context) => Button(
    onTap: () {
      Form.of(context).validate()
    },
  ),
)

if the button is placed in a separate widget, then there is no need to wrap it in the Builder, you can simply call the validation, since the context below the form is available to you
Button(
  onTap: () {
    Form.of(context).validate()
  },
),

also, you can create GlobalKey
and use validation with a key. You can pass key, for example, through the constructor(if needed)
final _formKey = GlobalKey<FormState>();

Form(
  key: _formKey
  child: Column(
    children: [
      TextFormField(),
      ....
      Button(
        onTap: () {
          _formKey.currentState!.validate ()
        }
      )
    ],
  ),
 )

A: Accessing Field Data
The code sample at bottom shows two different ways to get access to the email field value using:

*

*FormFieldState

*TextEditingController
These two methods don't rely on having a Form wrapping your fields (although it's often convenient to do so, giving you more options for handling form data & showing validation errors.)

Why use Form?
A Form widget wrapping fields is useful for handling/manipulating several fields together as a group for things such as form resetting, validation, and submitting.
We access these Form functions via a GlobalKey<FormState> that we give to the Form when we declare it.
      child: Form(
        key: formKey, // declared above as a field in our State object

For example, TextFormField has a validator: argument (takes a function).  If our field is inside a Form, we can ask the Form call all validator functions to "validate" our form:
formKey.currentState.validate();

The validator: will display any non-null String you return to it:

Code Sample
import 'package:flutter/material.dart';

class FormValuesPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Form Values'),
      ),
      body: FormValuesExample(),
    );
  }
}

class FormValuesExample extends StatefulWidget {
  @override
  _FormValuesExampleState createState() => _FormValuesExampleState();
}

class _FormValuesExampleState extends State<FormValuesExample> {
  GlobalKey<FormState> formKey = GlobalKey<FormState>();
  GlobalKey<FormFieldState> emailFieldKey = GlobalKey();
  TextEditingController emailController = TextEditingController();

  @override
  void dispose() {
    emailController.dispose();
    super.dispose();
  }
  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.symmetric(horizontal: 20),
      child: Form(
        key: formKey, // declared above as a field in our State object
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: [
            TextFormField(
              key: emailFieldKey,
              controller: emailController,
              decoration: InputDecoration(
                labelText: 'Email'
              ),
              validator: (val) => validateEmail(val),
            ),
            LoginButton(formKey: formKey, fieldKey: emailFieldKey, controller: emailController,)
          ],
        ),
      ),
    );
  }

  String validateEmail(String email) {
    if (email == null || email.isEmpty)
      return 'Email cannot be empty';
    return null;
  }
}

class LoginButton extends StatelessWidget {
  final GlobalKey<FormState> formKey;
  final GlobalKey<FormFieldState> fieldKey;
  final TextEditingController controller;

  LoginButton({this.formKey, this.fieldKey, this.controller});

  @override
  Widget build(BuildContext context) {
    return ElevatedButton(
        onPressed: () {
          formKey.currentState.validate();
          print('from FormFieldState ${fieldKey.currentState.value}');
          print('from controller: ${controller.text}');
        },
        child: Text('Submit'));
  }
}


text:
Q: CSS Show active element above the div with overflow:hidden I have a scrolling pane div with overflow:hidden. Please check it here. There are products as images with captions shown in the scrolling pane. When I move mouse cursor over a product div, it gets light-yellow background and changes its height - I just add a class to the div using jQuery and it works fine. The problem I need to solve some way is to show the expanded div for the active product as a separate div that appears above the scrolling pane, though now it appears inside that pane and extends it in its height. I want to make it look in similar way to this one. Here you move mouse cursor over the product and get an extended div showing you details. Surely, my task is a little harder because of that scrolling pane.

A: Shouldn't be too difficult if you use the .offset() method on hover of a .product.  What you can do is the following:

*

*In your .product hover event handler, get the offset of the product.  This will give you the position of your product in relation to the document.

*Next create your overlay product information div and append it directly to the <body>.

*Set the overlay div to position: absolute and use the values returned from the offset call to position it.

*Lastly make sure your overlay has a higher z-index than the scrolling pane and you should be in business.


text:
Q: What is an efficient way to Merge two iOS Core Data Persistent Stores? In our app under development we are using Core Data with a sqlite backing store to store our data. The object model for our app is complex. Also, the total amount of data served by our app is too large to fit into an iOS (iPhone/iPad/iPod Touch) app bundle. Because of the fact that our users are, typically, interested only in a subset of the data, we've partitioned our data in such a way that the app ships with a subset (albeit, ~100 MB) of the data objects in the app bundle. Our users have the option of downloading additional data objects (of size ~5 MB to 100 MB) from our server after they pay for the additional contents through iTunes in-app purchases.

The incremental data files (existing in sqlite backing stores) use the same xcdatamodel version as the data that ships with the bundle; there is zero changes to the object model. The incremental data files are downloaded from our server as a gzipped sqlite files. We don't want to bloat our app bundle by shipping the incremental contents with the app. Also, we don't want to rely on queries over webservice (because of the complex data model).

We've tested the download of the incremental sqlite data from our server. We have been able to add the downloaded data store to the app's shared persistentStoreCoordinator.

{
       NSError *error = nil;
       NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
                                [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
                                [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];

       if (![__persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:defaultStoreURL options:options error:&error])
       {
           NSLog(@"Failed with error:  %@", [error localizedDescription]);
           abort();
       }

       // Check for the existence of incrementalStore
       // Add incrementalStore
       if (incrementalStoreExists) {
           if (![__persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:incrementalStoreURL options:options error:&error])
           {
               NSLog(@"Add of incrementalStore failed with error:  %@", [error localizedDescription]);
               abort();
           }
       }
 }

However, there are two problems with doing it this way.

*

*Data fetch results (e.g., with NSFetchResultController) show up with
the data from the incrementalStoreURL appended to the end of the
data from the defaultStoreURL.

*Some of the objects are duplicated. There are many entities with
read-only data in our data model; these get duplicated when we add
the second persistentStore to the persistentStoreCoordinator.

Ideally, we would like Core Data to merge the object graphs from the two persistent stores into one (there are no shared relationships between data from the two stores at the time of the data download). Also, we would like to remove the duplicate objects.
Searching the web, we saw a couple of questions by people attempting to do the same thing we are doing--such as this answer and this answer. We've read Marcus Zarra's blog on importing large data sets in Core Data. However, none of the solutions we've seen worked for us. We don't want to manually read and save the data from the incremental store to the default store as we think this will be very slow and error prone on the phone. Is there a more efficient way of doing the merge?
We've attempted to solve the problem by implementing a manual migration as follows. However, we haven't been able to successfully get the merge to happen. We are not really clear on the solution suggested by answers 1 and 2 referenced above. Marcus Zarra's blog addressed some of the issues we had at the outset of our project importing our large dataset into iOS.
{
       NSError *error = nil;
       NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
                                [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
                                [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];

       NSMigrationManager *migrator = [[NSMigrationManager alloc] initWithSourceModel:__managedObjectModel destinationModel:__managedObjectModel];
       if (![migrator migrateStoreFromURL:stateStoreURL
                                type:NSSQLiteStoreType
                             options:options
                    withMappingModel:nil
                    toDestinationURL:destinationStoreURL
                     destinationType:NSSQLiteStoreType
                  destinationOptions:nil
                               error:&error])
       {
           NSLog(@"%@", [error userInfo]);
           abort();
       }
}

It seems that the author of answer 1 ended up reading his data from the incremental store and saving to the default store. Perhaps, we've misunderstood the solution suggested by both articles 1 & 2. The size of our data may preclude us from manually reading and re-inserting our incremental data into the default store. My question is: what is the most efficient way to get the object graphs from two persistentStores (that have the same objectModel) to merge into one persistentStore?
Automatic migration works pretty well when we add new entity attributes to object graphs or modify relationships. Is there a simple solution to merging similar data into the same persistent store that will be resilient enough to stop and resume--as automatic migration is done?

A: After several attempts, I've figured out how to make this work. The secret is to first create the incremental store data without any data for the read-only entities. Without leaving read-only data out of the incremental stores, the entities instances for these would get duplicated after the data migration and merge. Hence, the incremental stores should be created without these read-only entities. The default store will be the only store that has them.
For example, I had entities "Country" and "State" in my data model. I needed to have only one instance of Country and State in my object graph. I kept these entities out of incremental stores and created them only in the default store. I used Fetched Properties to loosely link my main object graph to these entities. I created the default store with all the entity instances in my model. The incremental stores either didn't have the read-only entities (i.e., Country and State in my case) to start with or deleted them after data creation is completed.
Next step is to add the  incremental store to it's own persistentStoreCoordinator (not the same as the coordinator for the default store that we want to migrate all contents to) during application startup.
The final step is to call migratePersistentStore method on the incremental store to merge its data to the main (i.e., default) store. Presto!
The following code fragment illustrates the last two steps I mentioned above. I did these steps to make my setup to merge incremental data into a main data store to work.
{
    NSError *error = nil;
    NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
    [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
    [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];

    if (![__persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:defaultStoreURL options:options error:&error])
    {
        NSLog(@"Failed with error:  %@", [error localizedDescription]);
        abort();
    }

    // Check for the existence of incrementalStore
    // Add incrementalStore
    if (incrementalStoreExists) {

        NSPersistentStore *incrementalStore = [_incrementalPersistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:incrementalStoreURL options:options error:&error];
        if (!incrementalStore)
        {
            NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
            abort();
        }

        if (![_incrementalPersistentStoreCoordinator migratePersistentStore:incrementalStore
            toURL:_defaultStoreURL
            options:options
            withType:NSSQLiteStoreType
            error:&error])
        {
            NSLog(@"%@", [error userInfo]);
            abort();

        }

        // Destroy the store and store coordinator for the incremental store
        [_incrementalPersistentStoreCoordinator removePersistentStore:incrementalStore error:&error];
        incrementalPersistentStoreCoordinator = nil;
        // Should probably delete the URL from file system as well
        //
    }
}

A: The reason your migration isn't working is because the managed object model is identical.
Technically, you're talking about "data migration" not "schema migration". CoreData's migration API is designed for schema migration, that is handling changes to the managed object model.
As far as transferring data from one store to another you're kind of on your own. CoreData can help you be efficient by using batching and fetch limits on your fetch requests, but you need to implement the logic yourself.
It sounds like you have two persistent stores, a big one and a small one. It would be most efficient to load the small one and analyze it, discovering the set of primary keys or unique identifiers you need to query for in the larger store.
You could then de-dupe easily by simply querying the larger store for those identifiers.
The documentation for NSFetchRequest has the API for scoping your queries:
https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/CoreDataFramework/Classes/NSFetchRequest_Class/NSFetchRequest.html

A: You  don't need any migration - migration is designed to bring changes in NSManagedObjectModel,not in data itself.
What you really need is a Persistent Store Coordinator managing two Persistent Stores. That's kinda tricky, but not too difficult, really.
There's a similar question, that can explain you,what you really need to do.
Can multiple (two) persistent stores be used with one object model, while maintaining relations from one to the other?
Here's a good article by Marcus Zarra
http://www.cimgf.com/2009/05/03/core-data-and-plug-ins/


text:
Q: standard Copy/Paste does not respond to a long press I had this problem, did the usual SO research, and did not find a solution that
worked so I am offering up this one.
I came upon this error after I had wrapped a working TextView in a ScrollView. Some time later I tried the long press and discovered that it was no longer working. Fortunately I had been making daily backups. I found the two backups between which the anomaly occurred, did some StackOverflow research and got it fixed as follows ...

A: textview.setTextIsSelectable enables standard Copy/Paste in response to a
long press. However, if that TextView is wrapped in a ScrollView and if
setMovementMethod(new ScrollingMovementMethod() is called on the TextView, then the standard Copy/Paste will not respond to the long press.  Apparently you do not need the setMovementMethod() if the textview is wrapped in a ScrollView; furthermore, using it creates this difficult to find error.
Hope this helps :)


text:
Q: Spring Data JPA method name I need help with name of method in repository for Spring Data JPA and I have such entity:
  public class User {

    @Id
    @Column(name = "user_id", unique = true, nullable = false)
    private Integer userId;

    @Size(min = 3, message = "Login must be at least 3 characters!")
    @Column(name = "login", length = 50, updatable = false, unique = true)
    private String login;

    @Size(min = 5, message = "Password must be at least 5 characters!")
    @JsonIgnore
    @Column(name = "password", length = 70)
    private String password;

    @Size(min = 3, message = "Name must be at least 3 characters!")
    @Column(name = "firstName", length = 70)
    private String firstName;

    @Size(min = 3, message = "Name must be at least 3 characters!")
    @Column(name = "lastName", length = 70)
    private String lastName;

       /**
     * Contains images uploaded by this user
     */
    @JsonIgnore
    @OneToMany(mappedBy = "user", fetch = FetchType.EAGER, orphanRemoval = true)
    private Set<Image> images = new HashSet<Image>();

       * Contains requests submitted by this user
     */
    @JsonIgnore
    @OneToMany(mappedBy = "author", orphanRemoval = true, fetch = FetchType.LAZY)
    private Set<Request> requests = new HashSet<Request>();

    /**
     * Contains feedbackas provided by this user to hosters
     */
    @JsonIgnore
    @OneToMany(mappedBy = "author", orphanRemoval = true, fetch = FetchType.LAZY)
    private Set<Feedback> feedbacks = new HashSet<Feedback>();

    @JsonIgnore
    @OneToMany(mappedBy = "owner", fetch = FetchType.EAGER, orphanRemoval = true)
    private Set<Place> places;

    @OneToMany
    @JsonIgnore
    private Set<Place> bookedPlaces;

    @ManyToMany(fetch = FetchType.EAGER)
    @Cascade({ CascadeType.DELETE, CascadeType.PERSIST })
    @JsonIgnore
    @JoinTable(name = "user_place", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "place_id"))
    private Set<Place> attendee;

I'm using Spring Data JPA and I need to write method that will return to me private Set attendee;
How method for this should be called??