问:
Should codes be written before super.initState(); or after in Flutter?
Should the code that is being written to initState() function be written before super.initState(); or after?

Which one is proper:

```<code>  @override
    // code here
    super.initState();
  }
</code>```

or

```<code>  @override
    super.initState();
    // code here
  }
</code>```

答:
both will work.

But if you see from any dependencies or official docs flutter, write your code in initSate() after super.initState();

```<code>@overrride
initState(){
  super.initState()
  //your code
}
</code>```

reference to this initState

the opposite for dispose(), write your code before super.dispose();

```<code>@overrride
dispose(){
  //your code
  super.dispose()
}
</code>```

reference to dispose

When I see @Kahoo answer, I check it by cmd + click at super.dispose and super.initstate, I found this for dispose

```<code>  /// If you override this, make sure to end your method with a call to
  /// super.dispose().
  ///
  /// See also:
  ///
  ///  * [deactivate], which is called prior to [dispose].
  @protected
  @mustCallSuper
  void dispose() {
    assert(_debugLifecycleState == _StateLifecycle.ready);
    assert(() {
      _debugLifecycleState = _StateLifecycle.defunct;
      return true;
    }());
  }
</code>```

Body:
Should the code that is being written to initState() function be written before super.initState(); or after?

Which one is proper:

  @override
    // code here
    super.initState();
  }

or

  @override
    super.initState();
    // code here
  }

Body:
both will work.

But if you see from any dependencies or official docs flutter, write your code in initSate() after super.initState();

@overrride
initState(){
  super.initState()
  //your code
}

reference to this initState

the opposite for dispose(), write your code before super.dispose();

@overrride
dispose(){
  //your code
  super.dispose()
}

reference to dispose

When I see @Kahoo answer, I check it by cmd + click at super.dispose and super.initstate, I found this for dispose

  /// If you override this, make sure to end your method with a call to
  /// super.dispose().
  ///
  /// See also:
  ///
  ///  * [deactivate], which is called prior to [dispose].
  @protected
  @mustCallSuper
  void dispose() {
    assert(_debugLifecycleState == _StateLifecycle.ready);
    assert(() {
      _debugLifecycleState = _StateLifecycle.defunct;
      return true;
    }());
  }


来源: stackexchange

问:
Pandas fill consecutive null date values from previous dates + a constant number of days
I have a dataframe that contains a data column

```<code>Comp_date
0 2020-04-24
1        NaT
2        NaT
3        NaT
4 2020-08-06
5        NaT
6        NaT
7        NaT
8 2020-08-22
9        NaT
</code>```

I am trying to fill the null with the value of the previous date + add a constant number of days (10). But I am unable to do so. I tried the following

```<code>df['Comp_date']=df['Comp_date'].fillna((df['Comp_date'].shift()+pd.to_timedelta(10, unit='D')), inplace=True)
</code>```

Nothing happens and I get the same result. Any help?
expected outcome

```<code>    Comp_date
0   2020-04-24
1   2020-05-04
2   2020-05-14
3   2020-05-24
4   2020-08-06
5   2020-08-16
6   2020-08-26
7   2020-09-05
8   2020-08-22
9   2020-09-01
</code>```

答:
Idea is create groups for missing values by Series.notna and Series.cumsum and create counter by GroupBy.cumcount, multiple number of days by Series.mul  convert to timedeltas by to_timedelta what is added to forward filling missing values with ffill:

```<code>num_days = 10
g = df['Comp_date'].notna().cumsum()
days = pd.to_timedelta(df.groupby(g).cumcount().mul(num_days), unit='d')

df['Comp_date'] = df['Comp_date'].ffill().add(days)
print (df)
   Comp_date
0 2020-04-24
1 2020-05-04
2 2020-05-14
3 2020-05-24
4 2020-08-06
5 2020-08-16
6 2020-08-26
7 2020-09-05
8 2020-08-22
9 2020-09-01
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I have a dataframe that contains a data column

Comp_date
0 2020-04-24
1        NaT
2        NaT
3        NaT
4 2020-08-06
5        NaT
6        NaT
7        NaT
8 2020-08-22
9        NaT

I am trying to fill the null with the value of the previous date + add a constant number of days (10). But I am unable to do so. I tried the following

df['Comp_date']=df['Comp_date'].fillna((df['Comp_date'].shift()+pd.to_timedelta(10, unit='D')), inplace=True)

Nothing happens and I get the same result. Any help?
expected outcome

    Comp_date
0   2020-04-24
1   2020-05-04
2   2020-05-14
3   2020-05-24
4   2020-08-06
5   2020-08-16
6   2020-08-26
7   2020-09-05
8   2020-08-22
9   2020-09-01

Body:
Idea is create groups for missing values by Series.notna and Series.cumsum and create counter by GroupBy.cumcount, multiple number of days by Series.mul  convert to timedeltas by to_timedelta what is added to forward filling missing values with ffill:

num_days = 10
g = df['Comp_date'].notna().cumsum()
days = pd.to_timedelta(df.groupby(g).cumcount().mul(num_days), unit='d')

df['Comp_date'] = df['Comp_date'].ffill().add(days)
print (df)
   Comp_date
0 2020-04-24
1 2020-05-04
2 2020-05-14
3 2020-05-24
4 2020-08-06
5 2020-08-16
6 2020-08-26
7 2020-09-05
8 2020-08-22
9 2020-09-01


问:
Finding the max of numbers in multiple DataFrames Python
I have 1000+ .txt files with stock dates and prices that I've cast to a dictionary (with filename(stock ticker) as the key, and the data for each file as a data frame). I calculated the moving average with .rolling, then found the percent difference between the moving average and the price. So, the percent difference is its own column for each DataFrame. The Code for all this looks like this:

```<code>filelist = os.listdir(r'Insert File Path')
filepath = r'Insert File Path'

dic1 = {}

for file in filelist:
    df = pd.read_csv(filepath + file,sep='\t')
dic1[file]= df

for value in dic1.values():
    value.rename(columns={value.columns[0]:'Dates',value.columns[1]:'Prices'},inplace=True)

for value in dic1.values():
    value['ma'] = value['Prices'].rolling(window=50).mean()

for value in dic1.values():
    value['diff'] = value['Prices'] - value['ma']

for value in dic1.values():
     value['pctdiff']= value['diff']/value['Prices']
</code>```

My question is how do I find the top 5 greatest (and smallest, because they can be negative) of the pctdiff columns?

I've tried:

```<code>for df in dic1.values():
    for num in df['pctdiff'].max():
        print(num.max())
</code>```

but I get the following error: "'float' object is not iterable"

答:
Is this what you mean?</p>

```<code>list_result = []
for key,value in dic1.items():
    value.rename(columns={value.columns[0]:'Dates',value.columns[1]:'Prices'},inplace=True)
    value['ma'] = value['Prices'].rolling(window=50).mean()
    value['diff'] = value['Prices'] - value['ma']
    value['pctdiff']= value['diff']/value['Prices']
    list_result.append([key,value['pctdiff'].max()])

list_result.sort(key = lambda x : x[1] )
highest_list = list_result[-5:]
smallest_list = list_result[:5]
</code>```

Body:
I have 1000+ .txt files with stock dates and prices that I've cast to a dictionary (with filename(stock ticker) as the key, and the data for each file as a data frame). I calculated the moving average with .rolling, then found the percent difference between the moving average and the price. So, the percent difference is its own column for each DataFrame. The Code for all this looks like this:

filelist = os.listdir(r'Insert File Path')
filepath = r'Insert File Path'

dic1 = {}

for file in filelist:
    df = pd.read_csv(filepath + file,sep='\t')
dic1[file]= df

for value in dic1.values():
    value.rename(columns={value.columns[0]:'Dates',value.columns[1]:'Prices'},inplace=True)

for value in dic1.values():
    value['ma'] = value['Prices'].rolling(window=50).mean()

for value in dic1.values():
    value['diff'] = value['Prices'] - value['ma']

for value in dic1.values():
     value['pctdiff']= value['diff']/value['Prices']

My question is how do I find the top 5 greatest (and smallest, because they can be negative) of the pctdiff columns?

I've tried:

for df in dic1.values():
    for num in df['pctdiff'].max():
        print(num.max())

but I get the following error: "'float' object is not iterable"

Body:
Is this what you mean?

list_result = []
for key,value in dic1.items():
    value.rename(columns={value.columns[0]:'Dates',value.columns[1]:'Prices'},inplace=True)
    value['ma'] = value['Prices'].rolling(window=50).mean()
    value['diff'] = value['Prices'] - value['ma']
    value['pctdiff']= value['diff']/value['Prices']
    list_result.append([key,value['pctdiff'].max()])

list_result.sort(key = lambda x : x[1] )
highest_list = list_result[-5:]
smallest_list = list_result[:5]


问:
Unable to delete a file with nodejs in protractor
I'm trying to delete the file with nodejs fs and I notice that file has been generated then trying to delete (failed to delete the file) while the file is not even uploaded on browser with protractor. Generate and delete file functions are created using nodejs fs.

So how can I put them in a way then wait until file is uploaded then delete the file?

```<code>helper.generateFile(filePath);
helper.uploadFile(UploadButtonElement, filePath);
uploadButtonElm.click();
helper.deleteFile(filePath);
</code>```

Is there a way to execute deleteFile only when below two actions are completed.

```<code>helper.uploadFile(UploadButtonElement, filePath);
uploadButtonElm.click();
</code>```

Thanks.

答:
```<code>function deleteAlreadyDownloadedFiles(extension,username) {
        let os = require('os');
        console.log('USERNAME HERE IS'+require("os").userInfo().username);
        var downloadDirectory = '/Users/'+require("os").userInfo().username+'/Downloads/';

        const fs = require('fs');
        const path = require('path');
        const directory = '/Users/'+require("os").userInfo().username+'/Downloads/';
        fs.readdir(directory, (err, files) => {
            if (err) throw err;
             for (const file of files) {
                fs.unlink(path.join(directory, file), err => {
                    if (err
                        && (err.code === "EACCES" || err.code === "EPERM")) {
                        console.log("Retrying rename file: ")
                        return;
                    }
                });
            }
        });
    }
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I'm trying to delete the file with nodejs fs and I notice that file has been generated then trying to delete (failed to delete the file) while the file is not even uploaded on browser with protractor. Generate and delete file functions are created using nodejs fs.

So how can I put them in a way then wait until file is uploaded then delete the file?

helper.generateFile(filePath);
helper.uploadFile(UploadButtonElement, filePath);
uploadButtonElm.click();
helper.deleteFile(filePath);

Is there a way to execute deleteFile only when below two actions are completed.

helper.uploadFile(UploadButtonElement, filePath);
uploadButtonElm.click();

Thanks.


问:
Xamarian Webview only https sites working not http sites
How to make http  web sites work in xamarian webview.
its working only  when i use https sites

eg:
    http://www.google.com  // Not working

```<code>https://www.google.com  // working
</code>```

答:
WebView support URLs formed with the protocol specified (i.e. it must have "http://" or "https://" prepended to it).

Based on my test, http://www.google.com works well. Please check your network.

```<code>var browser = new WebView();
        browser.Source = "http://www.google.com";//"https://www.google.com";//"http://xamarin.com";
        Content = browser;
</code>```

Body:
How to make http  web sites work in xamarian webview.
its working only  when i use https sites

eg:
    http://www.google.com  // Not working

https://www.google.com  // working

Body:
WebView support URLs formed with the protocol specified (i.e. it must have "http://" or "https://" prepended to it).

Based on my test, http://www.google.com works well. Please check your network.

var browser = new WebView();
        browser.Source = "http://www.google.com";//"https://www.google.com";//"http://xamarin.com";
        Content = browser;


问:
Firebase and login, not a single tutorial is up to date not even on Google.. What is the correct way to do it?
I am following this line by line
https://firebase.google.com/docs/android/setup

But the second I add

```<code>classpath 'com.google.gms:google-services:4.3.3'
</code>```

I get the error

```<code>ERROR: Plugin with id 'com.android.application' not found.
</code>```

Open File

Or if I add the code:

```<code>classpath 'com.google.gms:google-services:4.3.3'
</code>```

I get this error

ERROR: Plugin with id 'com.google.gms.google-services' not found.
Open File

How can I make a simple login and registration with firebase? I can't even find one single tutorial on google or Youtube.

答:
open your build.gradle file in app folder of your application, and add the following first line in build.gradle file

```<code>apply plugin: 'com.android.application'
</code>```

Body:
I am following this line by line
https://firebase.google.com/docs/android/setup

But the second I add

classpath 'com.google.gms:google-services:4.3.3'

I get the error

ERROR: Plugin with id 'com.android.application' not found.

Open File

Or if I add the code:

classpath 'com.google.gms:google-services:4.3.3'

I get this error

ERROR: Plugin with id 'com.google.gms.google-services' not found.
Open File

How can I make a simple login and registration with firebase? I can't even find one single tutorial on google or Youtube.

Body:
open your build.gradle file in app folder of your application, and add the following first line in build.gradle file

apply plugin: 'com.android.application'


问:
Why is the close function is called release in `struct file_operations` in the Linux kernel?
I'm trying to make a linux kernel module, which supports open, close, read and write operations.
So I want to register these functions via struct file_operations, however I can't find 'close' entry in the struct.
I think I should use 'release' instead of 'close', but I wonder why the name is 'release' and not 'close'?</p>

答:
Note that release isn’t invoked every time a process calls close.
  Whenever a file structure is shared (for example, after a fork or a
  dup),release won’t be invoked until all copies are closed. If you need
  to flush pending data when any copy is closed, you should implement
  the flush method.

taken from LDD3 (chapter 3).


问:
Developing API - how to make it secured?
I'm putting together read and write methods to my database and exposing them via URL (I'm using CodeIgniter framework and using URL segments to pass parameters to these methods). The original idea was to have my Ajax script call these methods. However, now I am thinking I could potentially expose these methods to any developer.

What should I do to make sure only authorized developers use my API? I'm thinking they should pass an API key and possibly password to each method call. If I were to provide them with such details, would that be secure enough?

Also, I'm thinking that I should support POST instead of GET as some of the required parameters may not fit in nicely with URL segments. Thoughts?

答:
First: require HTTPS.

HTTPS ensures that a secure channel is established before any request data is sent. Yes, before any request data is sent: URL, headers, cookies, GET or POST parameters... anything. This means that you can use simple methods such as HTTP Basic authentication over HTTPS without putting the user's credentials at risk.

This is really not negotiable, unless the data you are passing over the API is truly public. If you aren't using HTTPS, then any communication with your API (including HTTP Basic credentials) can be sniffed in plain text.

The only reason major sites (like Facebook) don't use HTTPS is because it gets expensive at massive scale.

If you absolutely can't run HTTPS, then you should look into OAuth, which is making strides in API authentication in exactly this situation. With OAuth you can authenticate users while keeping credentials secret over unencrypted channels.

Second: authentication is not authorization.

Don't blindly trust data from authenticated API users. Make sure that the methods and actions they are accessing are appropriate, otherwise you may give your users a backdoor into other users' data or administrative functions.

There's a lot more to it than this, but if you follow these two principles you're on your way.


问:
Go template function
It noticed a weird thing with Go templates when I try to use Funcs and FuncMap. The following code works as expected:

```<code>buffer := bytes.NewBufferString("")

funcMap := template.FuncMap{
    "label": strings.Title,
}

t, _ := template.New("alex").Funcs(funcMap).Parse("{{label \"alex\"}}")

t.Execute(buffer, "")

return string(buffer.Bytes()) //=> "Alex"
</code>```

But when I try to put the template in a file, it does not work (Execute() says: "alex" is an incomplete or empty template):

```<code>t, _ := template.New("alex").Funcs(funcMap).ParseFiles("template.html")
</code>```

With template.html:

```<code>{{label \"alex\"}}
</code>```

Any idea why ? Is this a bug ? Are there simpler ways to use methods/functions in templates ?

答: you need to first parse all the files and execute them .you cannot direclty access all the files .</p>

Title: Go template function

Body:
It noticed a weird thing with Go templates when I try to use Funcs and FuncMap. The following code works as expected:

buffer := bytes.NewBufferString("")

funcMap := template.FuncMap{
    "label": strings.Title,
}

t, _ := template.New("alex").Funcs(funcMap).Parse("{{label \"alex\"}}")

t.Execute(buffer, "")

return string(buffer.Bytes()) //=> "Alex"

But when I try to put the template in a file, it does not work (Execute() says: "alex" is an incomplete or empty template):

t, _ := template.New("alex").Funcs(funcMap).ParseFiles("template.html")

With template.html:

{{label \"alex\"}}

Any idea why ? Is this a bug ? Are there simpler ways to use methods/functions in templates ?


问:
Azure devops users cant see repos even though they have full read/contribute permissions. How could we fix?
If we add new users to a team, by just adding their email address, the new user can login to the project, but they can't see any of the repos, and don't even see the repos icon on the left (they do see overview, boards, pipelines and artifacts).  These users have been given full access rights to all the repos, i.e. they are in the contributors group. If I look at repositories in the project settings, then find the user, they have all the permissions to all the repos, including read and contribute.

How I can I give them "more" access so they can see and use the git repos?

I have seen similar posts which mention users as being "basic" or "stakeholder", however this is not something I can see or change.

I am full administrator to the project.

Any suggestions?

Interestingly, we used to use git-hub where PRs automatically reflected the latest commit of a branch of a PR.  We migrated to Dev ops a few weeks back, buy cloning the old github repo, setting the remote to devops, and pushing it to devops.  Maybe this is causing the problem.  Now we dont use github at all, and only use the devops copy.

答:
They can't see any of the repos, and don't even see the repos icon on
  the left (they do see overview, boards, pipelines and artifacts

According to your description, these users should only have stakeholder access.

Actually, to use Code you need be qualified with two things:  Permission ,  Access Level.

Have you checked that User’s Access Level you are? Is that user a Stakeholder in your organization?

User with Stakeholder access level, he will not be able to use Azure Repos for your private project.

You could check this info from Organization Setting-- Users--Access Level

For more detail concept you could refer our official link:  https://learn.microsoft.com/en-us/azure/devops/organizations/security/get-started-stakeholder?view=azure-devops&tabs=agile-process

Please change the user access level to Basic and above, then this user should be able to see and access these repos.

Note: To change access level, you must have Project Collection Administrator or organization Owner permissions in Azure DevOps.

Hope this helps.


问:
How to securely compile and hide Clojure code?
Is there a way to securely ship Clojure written code without(or minimizing) the risk of it being decompiled and accessed?

Are jar files generated with uberjar, safe enough to pass around?

Thanks heaps!

答:
If you can run code on a web server that is only accessed over a network by those who use your code, then as long as you keep that server secure, it does not matter whether the server has the source code or not.

It is possible to create JAR files that contain Clojure source code that can be deployed, by using the Clojure compiler on the computer where the JAR is deployed to compile the Clojure source to JVM byte code soon after the JVM process starts.  You can do 'unzip -v foo.jar' on a JAR file to see a list of the file names within it, and any that have a file name suffix like '.clj', '.cljs', or '.cljc' are likely Clojure source code.

If any files in the JAR have file names ending in '.class', those are Java class files containing JVM byte code.  You can run a decompiler on most such files and often get back syntactically legal Java source code that behaves the same as the Clojure source code does.  e.g. See https://github.com/clojure-goes-fast/clj-java-decompiler or do a Google search for 'java decompiler' for many other such tools.

If you search for terms like 'java byte code obfuscation' you can probably find tools that claim to provide some level of scrambling of names and or functionality of JVM byte code.  I do not know how effective they are.

In general, making a contract with a party that has something to lose in the contract, or more important things to do than try to reverse engineer your code, is a more sure protection against reverse engineering than technical methods.


问:
Text displayed in debug window instead of popup window of Kivy App
I encountered some weird behavior of Kivy when trying to place the results of some analysis in a popup window of my App. By the button activation I can get a popup window (that should display the results of the analysis but is empty) and then my results are displayed in a debug window. But I'd like to see them in a popup. No error, no traceback, just weirdness.

This is how it looks like:

This is the line that runs a popup:

```<code>show_syllsoutput_popup()
</code>```

This is the line that should populate it but populates debug window instead:

```<code>try: SyllOutputPopup.screen_output_label.text = cfd_syll.tabulate()
</code>```

So, the question is how to put cfd_syll.tabulate() into this popup (.kv):

```<code><SyllOutputPopup>:

    FloatLayout:

        Label:

            id: screen_output_label
            font_size: 12
            pos: 100, 120
</code>```

=============================================================

Alternative test: if I try to populate output popup by this:

```<code>SyllOutputPopup.screen_output_label.text = cfd_syll.tabulate()
</code>```

(without try:), I get AttributeError: type object 'SyllOutputPopup' has no attribute 'screen_output_label'

Here is the full traceback, in case it'd be helpful:

```<code>File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\runpy.py", line 193, in _run_module_as_main
  "__main__", mod_spec)
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\runpy.py", line 85, in _run_code
  exec(code, run_globals)
File "C:\GUI Projects\gercort\main.py", line 190, in <module>
  Gercort().run()
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\app.py", line 855, in run
  runTouchApp()
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\base.py", line 504, in runTouchApp
  EventLoop.window.mainloop()
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\core\window\window_sdl2.py", line 747, in mainloop
  self._mainloop()
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\core\window\window_sdl2.py", line 479, in _mainloop
  EventLoop.idle()
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\base.py", line 342, in idle
  self.dispatch_input()
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\base.py", line 327, in dispatch_input
  post_dispatch_input(*pop(0))
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\base.py", line 293, in post_dispatch_input
  wid.dispatch('on_touch_up', me)
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\_event.cp37-win32.pyd", line 707, in kivy._event.EventDispatcher.dispatch
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\uix\behaviors\button.py", line 179, in on_touch_up
  self.dispatch('on_release')
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\_event.cp37-win32.pyd", line 703, in kivy._event.EventDispatcher.dispatch
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\_event.cp37-win32.pyd", line 1214, in kivy._event.EventObservers.dispatch
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\_event.cp37-win32.pyd", line 1098, in kivy._event.EventObservers._dispatch
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\lang\builder.py", line 64, in custom_callback
  exec(__kvlang__.co_value, idmap)
File "C:\GUI Projects\gercort\gercort.kv", line 484, in <module>
  on_release: root.output_toscreen(root.filepath)
File "C:\GUI Projects\gercort\main.py", line 135, in output_toscreen
  SyllOutputPopup.screen_output_label.text = cfd_syll.tabulate() # populate the popup

builtins.AttributeError: type object 'SyllOutputPopup' has no attribute 'screen_output_label'
</code>```

Would be grateful for any help! I don't know what parts of code would be helpful, so I apologize in advance, any suggestions are greatly appreciated.

==================================================================

Additional info:

cfd_syll is defined in the fourth line of:

```<code>    def output_toscreen(сorpus_root, *args):

        corpus = PlaintextCorpusReader(args[0], '.*')
        cfd_syll = nltk.ConditionalFreqDist(
            (textname, num_syll)
            for textname in corpus.fileids()
            for num_syll in [len(w) for w in ''.join(char for char in reduce_dip(corpus.raw(fileids=textname)) if char in vowels).split()])

        show_syllsoutput_popup() # run the popup

        try: SyllOutputPopup.screen_output_label.text = cfd_syll.tabulate() # populate the popup

        except: pass
</code>```

Here is the Popup class:

```<code>class SyllOutputPopup(FloatLayout):
    pass
</code>```

Here is definition of show_syllsoutput_popup:

```<code>def show_syllsoutput_popup():
    show = SyllOutputPopup() # Create a new instance of the LicensePopup class

    SyllOutputPopupWindow = Popup(title="Output", content=show, size_hint=(None,None),size=(600,400))
    # Create the popup window

    SyllOutputPopupWindow.open() # show the popup
</code>```

In the .kv Popup is defined as:

```<code><SyllOutputPopup>:

    FloatLayout:

        Label:

            id: screen_output_label
            font_size: 12
            pos: 100, 120
</code>```

答:
screen_output_label is not the parameter of your class, it's widget's id, so that line

```<code>SyllOutputPopup.screen_output_label.text = cfd_syll.tabulate()
</code>```

is wrong, you should use:

```<code>SyllOutputPopup.ids.screen_output_label.text = cfd_syll.tabulate()
</code>```

==========

Also you are creating several objects of SyllOutputPopup class. You put the text in one object:

```<code>try: SyllOutputPopup.ids.screen_output_label.text = cfd_syll.tabulate()
</code>```

And then you create new object, which is blank and has empty Label, and you show it:

```<code>show = SyllOutputPopup() # Create a new instance
    SyllOutputPopupWindow = Popup(title="Output", content=show, size_hint=(None,None),size=(600,400))
    SyllOutputPopupWindow.open()
</code>```

You should use one object - set the text there and then show exactly that object, something like:

```<code>    def output_toscreen(сorpus_root, *args):

        corpus = PlaintextCorpusReader(args[0], '.*')
        cfd_syll = nltk.ConditionalFreqDist(
            (textname, num_syll)
            for textname in corpus.fileids()
            for num_syll in [len(w) for w in ''.join(char for char in reduce_dip(corpus.raw(fileids=textname)) if char in vowels).split()])
        # that will be your object
        self.sylloutputpopup = SyllOutputPopup()
        self.sylloutputpopup.ids.screen_output_label.text = cfd_syll.tabulate()
        show_syllsoutput_popup() # run the popup

def show_syllsoutput_popup():
    show = self.sylloutputpopup
    SyllOutputPopupWindow = Popup(title="Output", content=show, size_hint=(None,None),size=(600,400))
    SyllOutputPopupWindow.open()
</code>```

But that will work only if both of functions above are in the same class.

Body:
I encountered some weird behavior of Kivy when trying to place the results of some analysis in a popup window of my App. By the button activation I can get a popup window (that should display the results of the analysis but is empty) and then my results are displayed in a debug window. But I'd like to see them in a popup. No error, no traceback, just weirdness.

This is how it looks like:

This is the line that runs a popup:

show_syllsoutput_popup()

This is the line that should populate it but populates debug window instead:

try: SyllOutputPopup.screen_output_label.text = cfd_syll.tabulate()

So, the question is how to put cfd_syll.tabulate() into this popup (.kv):

<SyllOutputPopup>:

    FloatLayout:

        Label:

            id: screen_output_label
            font_size: 12
            pos: 100, 120

=============================================================

Alternative test: if I try to populate output popup by this:

SyllOutputPopup.screen_output_label.text = cfd_syll.tabulate()

(without try:), I get AttributeError: type object 'SyllOutputPopup' has no attribute 'screen_output_label'

Here is the full traceback, in case it'd be helpful:

File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\runpy.py", line 193, in _run_module_as_main
  "__main__", mod_spec)
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\runpy.py", line 85, in _run_code
  exec(code, run_globals)
File "C:\GUI Projects\gercort\main.py", line 190, in <module>
  Gercort().run()
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\app.py", line 855, in run
  runTouchApp()
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\base.py", line 504, in runTouchApp
  EventLoop.window.mainloop()
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\core\window\window_sdl2.py", line 747, in mainloop
  self._mainloop()
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\core\window\window_sdl2.py", line 479, in _mainloop
  EventLoop.idle()
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\base.py", line 342, in idle
  self.dispatch_input()
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\base.py", line 327, in dispatch_input
  post_dispatch_input(*pop(0))
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\base.py", line 293, in post_dispatch_input
  wid.dispatch('on_touch_up', me)
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\_event.cp37-win32.pyd", line 707, in kivy._event.EventDispatcher.dispatch
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\uix\behaviors\button.py", line 179, in on_touch_up
  self.dispatch('on_release')
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\_event.cp37-win32.pyd", line 703, in kivy._event.EventDispatcher.dispatch
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\_event.cp37-win32.pyd", line 1214, in kivy._event.EventObservers.dispatch
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\_event.cp37-win32.pyd", line 1098, in kivy._event.EventObservers._dispatch
File "C:\Users\gavrk\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\kivy\lang\builder.py", line 64, in custom_callback
  exec(__kvlang__.co_value, idmap)
File "C:\GUI Projects\gercort\gercort.kv", line 484, in <module>
  on_release: root.output_toscreen(root.filepath)
File "C:\GUI Projects\gercort\main.py", line 135, in output_toscreen
  SyllOutputPopup.screen_output_label.text = cfd_syll.tabulate() # populate the popup

builtins.AttributeError: type object 'SyllOutputPopup' has no attribute 'screen_output_label'

Would be grateful for any help! I don't know what parts of code would be helpful, so I apologize in advance, any suggestions are greatly appreciated.

==================================================================

Additional info:

cfd_syll is defined in the fourth line of:

    def output_toscreen(сorpus_root, *args):

        corpus = PlaintextCorpusReader(args[0], '.*')
        cfd_syll = nltk.ConditionalFreqDist(
            (textname, num_syll)
            for textname in corpus.fileids()
            for num_syll in [len(w) for w in ''.join(char for char in reduce_dip(corpus.raw(fileids=textname)) if char in vowels).split()])

        show_syllsoutput_popup() # run the popup

        try: SyllOutputPopup.screen_output_label.text = cfd_syll.tabulate() # populate the popup

        except: pass

Here is the Popup class:

class SyllOutputPopup(FloatLayout):
    pass

Here is definition of show_syllsoutput_popup:

def show_syllsoutput_popup():
    show = SyllOutputPopup() # Create a new instance of the LicensePopup class

    SyllOutputPopupWindow = Popup(title="Output", content=show, size_hint=(None,None),size=(600,400))
    # Create the popup window

    SyllOutputPopupWindow.open() # show the popup

In the .kv Popup is defined as:

<SyllOutputPopup>:

    FloatLayout:

        Label:

            id: screen_output_label
            font_size: 12
            pos: 100, 120

Body:
screen_output_label is not the parameter of your class, it's widget's id, so that line

SyllOutputPopup.screen_output_label.text = cfd_syll.tabulate()

is wrong, you should use:

SyllOutputPopup.ids.screen_output_label.text = cfd_syll.tabulate()

==========

Also you are creating several objects of SyllOutputPopup class. You put the text in one object:

try: SyllOutputPopup.ids.screen_output_label.text = cfd_syll.tabulate()

And then you create new object, which is blank and has empty Label, and you show it:

show = SyllOutputPopup() # Create a new instance
    SyllOutputPopupWindow = Popup(title="Output", content=show, size_hint=(None,None),size=(600,400))
    SyllOutputPopupWindow.open()

You should use one object - set the text there and then show exactly that object, something like:

    def output_toscreen(сorpus_root, *args):

        corpus = PlaintextCorpusReader(args[0], '.*')
        cfd_syll = nltk.ConditionalFreqDist(
            (textname, num_syll)
            for textname in corpus.fileids()
            for num_syll in [len(w) for w in ''.join(char for char in reduce_dip(corpus.raw(fileids=textname)) if char in vowels).split()])
        # that will be your object
        self.sylloutputpopup = SyllOutputPopup()
        self.sylloutputpopup.ids.screen_output_label.text = cfd_syll.tabulate()
        show_syllsoutput_popup() # run the popup

def show_syllsoutput_popup():
    show = self.sylloutputpopup
    SyllOutputPopupWindow = Popup(title="Output", content=show, size_hint=(None,None),size=(600,400))
    SyllOutputPopupWindow.open()

But that will work only if both of functions above are in the same class.


问:
Difference between Fortran 90 and Fortran 95
Can I compile Fortran 90 files with a Fortran 95 compiler?   There seems to be a lot for Fortran 95 but not Fortran 90.</p>

答:
This one can:

NAGWare f95 Compiler Release 5.1

See also:

Clive Page's list of Fortran Resources

Michel Olagnon's Fortran 90 List


答:
Just to make the code a bit more clean, and run all you variable adding in one for loop insted of four

```<code>filelist = os.listdir(r'Insert File Path')
filepath = r'Insert File Path'

dic1 = {}

for file in filelist:
    df = pd.read_csv(filepath + file,sep='\t')
dic1[file]= df

for value in dic1.values():
    value.rename(columns={value.columns[0]:'Dates',value.columns[1]:'Prices'},inplace=True)
    value['ma'] = value['Prices'].rolling(window=50).mean()
    value['diff'] = value['Prices'] - value['ma']
    value['pctdiff']= value['diff']/value['Prices']
</code>```

and then use the answer by @Edchum here to sort the pctdiff by absolute value (convert it to a pandas Series if the object is something else). Something like (if you want to store it sorted)

```<code>...

for value in dic1.values():
    ...
    pctdiff = value['diff']/value['Prices']
    pctdiff = pctdiff.reindex(pctdiff.abs().sort_values().index)
    value['pctdiff']= pctdiff
</code>```

Title: Finding the max of numbers in multiple DataFrames Python

Body:
Just to make the code a bit more clean, and run all you variable adding in one for loop insted of four

filelist = os.listdir(r'Insert File Path')
filepath = r'Insert File Path'

dic1 = {}

for file in filelist:
    df = pd.read_csv(filepath + file,sep='\t')
dic1[file]= df

for value in dic1.values():
    value.rename(columns={value.columns[0]:'Dates',value.columns[1]:'Prices'},inplace=True)
    value['ma'] = value['Prices'].rolling(window=50).mean()
    value['diff'] = value['Prices'] - value['ma']
    value['pctdiff']= value['diff']/value['Prices']

and then use the answer by @Edchum here to sort the pctdiff by absolute value (convert it to a pandas Series if the object is something else). Something like (if you want to store it sorted)

...

for value in dic1.values():
    ...
    pctdiff = value['diff']/value['Prices']
    pctdiff = pctdiff.reindex(pctdiff.abs().sort_values().index)
    value['pctdiff']= pctdiff


问:
Azure Storage SAS signature does not match, how can I generate SAS token?
I'm having some problems generating SAS token to download the file of Azure Storage. The following produces a URI that does not work. The error message I get back is Signature did not match, and I'm uncertain why.

Has anyone generated SAS tokens, and got the signature to match manually?

```<code>    static void Main(string[] args)
    {
        var sas = generateSAS
        (
            key,            // Azure portal very secret ^-^
            keyName,        // Azure portal, example: key1
            resourceUri,    // example: https://myaccount.blob.core.windows.net/emails/email.pdf
            resourcePath    // example: /blob/myaccount/emails/email.pdf
        );
    }

    private static string generateSAS(string key, string keyName, string uri, string path)
    {
        var permissions = "r";
        var startTime = DateTime.UtcNow;
        var endTime = DateTime.UtcNow.AddSeconds(60 * 2);
        var canonicalizedresource = path;
        var signedidentifier = keyName;
        var signedversion = "2012-02-12";

        var stringToSign = permissions + "\n" +
                           startTime.ToUniversalTime().ToString("u").Replace(" ", "T") + "\n" +
                           endTime.ToUniversalTime().ToString("u").Replace(" ", "T") + "\n" +
                           canonicalizedresource + "\n" +
                           signedidentifier + "\n" +
                           signedversion;

        HMACSHA256 hmac = new HMACSHA256(Encoding.UTF8.GetBytes(key));

        var signature = Convert.ToBase64String(hmac.ComputeHash(Encoding.UTF8.GetBytes(stringToSign)));

        return string.Format(CultureInfo.InvariantCulture, "{0}?sp={1}&st={2}&se={3}&spr={4}&sv={5}&sr={6}&si={7}&sig={8}",
            uri,
            permissions,
            startTime.ToUniversalTime().ToString("u").Replace(" ", "T"),
            endTime.ToUniversalTime().ToString("u").Replace(" ", "T"),
            "https",
            signedversion,
            "b",
            keyName,
            HttpUtility.UrlEncode(signature));
    }
</code>```

答:
More than likely the issue is with the following line of code:

```<code>HMACSHA256 hmac = new HMACSHA256(Encoding.UTF8.GetBytes(key));
</code>```

Please change it to:

```<code>HMACSHA256 hmac = new HMACSHA256(Convert.FromBase64String(key));
</code>```

Body:
I'm having some problems generating SAS token to download the file of Azure Storage. The following produces a URI that does not work. The error message I get back is Signature did not match, and I'm uncertain why.

Has anyone generated SAS tokens, and got the signature to match manually?

    static void Main(string[] args)
    {
        var sas = generateSAS
        (
            key,            // Azure portal very secret ^-^
            keyName,        // Azure portal, example: key1
            resourceUri,    // example: https://myaccount.blob.core.windows.net/emails/email.pdf
            resourcePath    // example: /blob/myaccount/emails/email.pdf
        );
    }

    private static string generateSAS(string key, string keyName, string uri, string path)
    {
        var permissions = "r";
        var startTime = DateTime.UtcNow;
        var endTime = DateTime.UtcNow.AddSeconds(60 * 2);
        var canonicalizedresource = path;
        var signedidentifier = keyName;
        var signedversion = "2012-02-12";

        var stringToSign = permissions + "\n" +
                           startTime.ToUniversalTime().ToString("u").Replace(" ", "T") + "\n" +
                           endTime.ToUniversalTime().ToString("u").Replace(" ", "T") + "\n" +
                           canonicalizedresource + "\n" +
                           signedidentifier + "\n" +
                           signedversion;

        HMACSHA256 hmac = new HMACSHA256(Encoding.UTF8.GetBytes(key));

        var signature = Convert.ToBase64String(hmac.ComputeHash(Encoding.UTF8.GetBytes(stringToSign)));

        return string.Format(CultureInfo.InvariantCulture, "{0}?sp={1}&st={2}&se={3}&spr={4}&sv={5}&sr={6}&si={7}&sig={8}",
            uri,
            permissions,
            startTime.ToUniversalTime().ToString("u").Replace(" ", "T"),
            endTime.ToUniversalTime().ToString("u").Replace(" ", "T"),
            "https",
            signedversion,
            "b",
            keyName,
            HttpUtility.UrlEncode(signature));
    }

Body:
More than likely the issue is with the following line of code:

HMACSHA256 hmac = new HMACSHA256(Encoding.UTF8.GetBytes(key));

Please change it to:

HMACSHA256 hmac = new HMACSHA256(Convert.FromBase64String(key));


问:
Linq query update all items in groups that meet my condition
I want to update the property "IsQualified= True" for-

All students in only qualified groups

Qualified groups? Those groups that have at least one student who passed from "University= OPQ" (Example: Group 2 and 3)

Leave other group students' "IsQualified" property unchanged. (Example: Group 1)

What I tried-

```<code>var results = studentsList
.Where(x => x.University= OPQ)
.GroupBy(x => x.GroupID)
.SelectMany(g => g)
.ToList();

results.ForEach(x => x.IsQualified = true);
</code>```

This doesn't work. Please help me.

My Code-

```<code>public class StudentInfo
{
  public string Student { get; set; }
  public string University { get; set; }
  public int GroupID { get; set; }
  public bool IsQualified {get; set;}

}

List<StudentInfo> studentsList = new List<StudentInfo>();

StudentsList.Add( new StudentInfo { Student="John", University="ABC", GroupID = 1, IsQualified=False});
StudentsList.Add( new StudentInfo { Student="Jack", University="DEF", GroupID = 1, IsQualified=False} );
StudentsList.Add( new StudentInfo { Student="Peter", University="GHI", GroupID = 1, IsQualified=False} );

StudentsList.Add( new StudentInfo { Student="Donald", University="JKL", GroupID = 2, IsQualified=False} );
StudentsList.Add( new StudentInfo { Student="Olivia", University="ABC", GroupID = 2, IsQualified=False} );
StudentsList.Add( new StudentInfo { Student="Emity", University="OPQ", GroupID = 2, IsQualified=False} );
StudentsList.Add( new StudentInfo { Student="Emma", University="GHI", GroupID = 2, IsQualified=False} );
StudentsList.Add( new StudentInfo { Student="Alan", University="DEF", GroupID = 2, IsQualified=False} );

StudentsList.Add( new StudentInfo { Student="Adam", University="GHI", GroupID = 3, IsQualified=False} );
StudentsList.Add( new StudentInfo { Student="Jacob", University="ABC", GroupID = 3, IsQualified=False} );
StudentsList.Add( new StudentInfo { Student="Matthew", University="OPQ", GroupID = 3, IsQualified=False} );
StudentsList.Add( new StudentInfo { Student="Saint", University="VWX", GroupID = 3, IsQualified=False} );
StudentsList.Add( new StudentInfo { Student="Joshua", University="TRP", GroupID = 3, IsQualified=False} );
StudentsList.Add( new StudentInfo { Student="Aubrey", University="STU", GroupID = 3, IsQualified=False} );
</code>```

答:
The problem in your solution is applying where condition before grouping the results. It will filter out the other students who are in GroupId 2 and 3,

You have to group the results first and then apply the condition "Those groups that have at least one student who passed from "University= OPQ""

```<code>var results = studentsList
            .GroupBy(x => x.GroupID)
            .Where(x => x.Any(y => y.University == "OPQ"))
            .SelectMany(x => x)
            .ToList();
</code>```

Then you can do the foreach to update the IsQualified field,

```<code>results.ForEach(x => x.IsQualified = true);
</code>```

Body:
I want to update the property "IsQualified= True" for-

All students in only qualified groups

Qualified groups? Those groups that have at least one student who passed from "University= OPQ" (Example: Group 2 and 3)

Leave other group students' "IsQualified" property unchanged. (Example: Group 1)

What I tried-

var results = studentsList
.Where(x => x.University= OPQ)
.GroupBy(x => x.GroupID)
.SelectMany(g => g)
.ToList();

results.ForEach(x => x.IsQualified = true);

This doesn't work. Please help me.

My Code-

public class StudentInfo
{
  public string Student { get; set; }
  public string University { get; set; }
  public int GroupID { get; set; }
  public bool IsQualified {get; set;}

}

List<StudentInfo> studentsList = new List<StudentInfo>();

StudentsList.Add( new StudentInfo { Student="John", University="ABC", GroupID = 1, IsQualified=False});
StudentsList.Add( new StudentInfo { Student="Jack", University="DEF", GroupID = 1, IsQualified=False} );
StudentsList.Add( new StudentInfo { Student="Peter", University="GHI", GroupID = 1, IsQualified=False} );

StudentsList.Add( new StudentInfo { Student="Donald", University="JKL", GroupID = 2, IsQualified=False} );
StudentsList.Add( new StudentInfo { Student="Olivia", University="ABC", GroupID = 2, IsQualified=False} );
StudentsList.Add( new StudentInfo { Student="Emity", University="OPQ", GroupID = 2, IsQualified=False} );
StudentsList.Add( new StudentInfo { Student="Emma", University="GHI", GroupID = 2, IsQualified=False} );
StudentsList.Add( new StudentInfo { Student="Alan", University="DEF", GroupID = 2, IsQualified=False} );

StudentsList.Add( new StudentInfo { Student="Adam", University="GHI", GroupID = 3, IsQualified=False} );
StudentsList.Add( new StudentInfo { Student="Jacob", University="ABC", GroupID = 3, IsQualified=False} );
StudentsList.Add( new StudentInfo { Student="Matthew", University="OPQ", GroupID = 3, IsQualified=False} );
StudentsList.Add( new StudentInfo { Student="Saint", University="VWX", GroupID = 3, IsQualified=False} );
StudentsList.Add( new StudentInfo { Student="Joshua", University="TRP", GroupID = 3, IsQualified=False} );
StudentsList.Add( new StudentInfo { Student="Aubrey", University="STU", GroupID = 3, IsQualified=False} );

Body:
The problem in your solution is applying where condition before grouping the results. It will filter out the other students who are in GroupId 2 and 3,

You have to group the results first and then apply the condition "Those groups that have at least one student who passed from "University= OPQ""

var results = studentsList
            .GroupBy(x => x.GroupID)
            .Where(x => x.Any(y => y.University == "OPQ"))
            .SelectMany(x => x)
            .ToList();

Then you can do the foreach to update the IsQualified field,

results.ForEach(x => x.IsQualified = true);


问:
Getting error while installing DotNetNuke?
Error:

The following error has occurred during the installation of application: Installation of DotNetNuke at https://mccallumtech.com/dnn/ failed. Non-zero exit status returned by script. Output stream: 'Error during MSSQL version checking

[DBNETLIB][ConnectionOpen (SECCreateCredentials()).]SSL Security error.

at (SiteApplicationManager::fsaExecuteScript line 468)
at execute console command --run-application-script(vconsoleapp::start line 93)
at execute "C:\Program Files (x86)\Plesk\admin\bin\sappmng" --run-application-script "--script-filename=configure" "--fsa-xml-file=C:/Program Files (x86)/Plesk/PrivateTemp/afrE9E7.tmp" "--script-name=install" "--user-name=mccallum" "--application-full-name=file:///C:\Program Files (x86)\Plesk\var\apspackages\adi431B.tmp.zip4931ec96-b5f6-4785-d5\cache"(vconsoleapp::run line 110)
(Error code 1)'. Error stream: 'Error during MSSQL version checking

[DBNETLIB][ConnectionOpen (SECCreateCredentials()).]SSL Security error.

at (SiteApplicationManager::fsaExecuteScript line 468)
at execute console command --run-application-script(vconsoleapp::start line 93)
at execute "C:\Program Files (x86)\Plesk\admin\bin\sappmng" --run-application-script "--script-filename=configure" "--fsa-xml-file=C:/Program Files (x86)/Plesk/PrivateTemp/afrE9E7.tmp" "--script-name=install" "--user-name=mccallum" "--application-full-name=file:///C:\Program Files (x86)\Plesk\var\apspackages\adi431B.tmp.zip4931ec96-b5f6-4785-d5\cache"(vconsoleapp::run line 110)
(Error code 1)'.

答:
Based on that error message it appears to be occurring BEFORE the DNN installation process as the commands that you are seeing in error are not part of the DNN Installation.

DNN Installation is always triggered either by Install.aspx (silent install) or InstallWizard.aspx (Guided install)

It appears you might be using a Plesk packaged installation, I would check with your hosting provider.


问:
Can't start docker on windows
I continue to get the following error when trying to start docker on Windows 10 pro.  my HyperV is turned on and running:
Version 18.04.0-ce-win62 (17151)
Channel: edge
e0a85f6

Any help would be appreciated!

Unable to create: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Hyper-V encountered an error trying to access an object on computer 'C001715587' because the object was not found. The object might have been deleted. Verify that the Virtual Machine Management service on the computer is running.
at New-Switch, : line 117
at , : line 394
   at Docker.Core.Pipe.NamedPipeClient.Send(String action, Object[] parameters) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Core\pipe\NamedPipeClient.cs:line 36
   at Docker.Actions.DoStart(SynchronizationContext syncCtx, Boolean showWelcomeWindow, Boolean executeAfterStartCleanup) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Windows\Actions.cs:line 75
   at Docker.Actions.<>c__DisplayClass15_0.b__0() in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Windows\Actions.cs:line 59
   at Docker.WPF.TaskQueue.<>c__DisplayClass19_0.<.ctor>b__1() in C:\gopath\src\github.com\docker\pinata\win\src\Docker.WPF\TaskQueue.cs:line 59

答:
If you facing

Unable to stop Hyper-V VM: Service 'Hyper-V Host Compute Service
  (vmcompute)' cannot be started due to the following error: Cannot
  start service vmcompute on computer '.'.

this error then follow the steps:

Open "Window Security"

Open "App & Browser control"

Click "Exploit protection settings" at the bottom

Switch to "Program settings" tab

Locate "C:\WINDOWS\System32\vmcompute.exe" in the list and expand it

Click "Edit"

Scroll down to "Code flow guard (CFG)" and uncheck "Override system settings"

Start vmcompute from powershell "net start vmcompute"

Title: Can't start docker on windows


问:
How to implement shadow in Android?
My UX designer has provided me with an elegant design and exported it as an Xd file. For shadows of some elements, Xd gives me below information:

```<code>Shadow color: #101F400D
X: 0dp
Y: 3dp
Blur: 10dp
</code>```

How can I create this layout in android with the above information?

Note: elevation is not what I want!

答:
You can use cardView or Material design cardview to get the shadow effect

If you want to follow the guideline of material design you have to implement dependency

```<code>implementation 'com.google.android.material:material:1.2.0-alpha02'
</code>```

You can use material cardview as shown below

```<code> <com.google.android.material.card.MaterialCardView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:cardElevation="4dp"
                    app:cardBackgroundColor="@color/colorWhite">
</androidx.constraintlayout.widget.ConstraintLayout>
</code>```

Title: How to implement shadow in Android?

Body:
My UX designer has provided me with an elegant design and exported it as an Xd file. For shadows of some elements, Xd gives me below information:

Shadow color: #101F400D
X: 0dp
Y: 3dp
Blur: 10dp

How can I create this layout in android with the above information?

Note: elevation is not what I want!

Body:
You can use cardView or Material design cardview to get the shadow effect

If you want to follow the guideline of material design you have to implement dependency

implementation 'com.google.android.material:material:1.2.0-alpha02'

You can use material cardview as shown below

 <com.google.android.material.card.MaterialCardView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:cardElevation="4dp"
                    app:cardBackgroundColor="@color/colorWhite">
</androidx.constraintlayout.widget.ConstraintLayout>


问:
How to prevent resetting of the files present in Packages section in Unity

I am working with Vuforia in Unity 2019.2.5f1 and building the project for Android. I have some Vuforia related files in the Packages section which I have edited to make some part of the project work. Everything works fine and the changes made in that file are visible when I run the project in my device directly by using the Build and Run option.

However, I also want to do some additional stuff in the project using Android Studio. For that, I export the project by checking the Export Project option in Build settings. The exporting is done fine, but the Package file in which I made some changes, is reset to its original data. The exported project (which is an Android Studio project) does not reflect the changes as well. Other files present in Assets section work fine and changes are visible, but not the files present in the Packages section.

Basically, I have a file in the Packages section which I need to change, but the changes are not reflected in the exported project. But, are visible when I run the project directly from Unity in my device. I want those files not to reset. I need some guidance on how to achieve this.

I am not very experienced in Unity. Any help in this regard is appreciated.

Thanks

答:
In short: Do not edit anything in the Packages .. they get recompiled/imported automatically and in simple words: You can't prevent it.

What you can do however is copy the entire according folder from the Library over into the Assets and thereby make them local files you can then edit. See Embedded Dependencies

As mentioned in this thread by Unity Technologies (22.05.2019)

Yes, currently the way to develop a package is to copy/move it to your project's Packages folder.

Also see Copying a Unity package from the cache for further information.

In general no changes should be necessary to a Package directly. Maybe you should rather implement your own script and only copy the original content and then rather make your changes their?


问:
Embed git commit hash in a .NET dll
I'm building a C# application, using Git as my version control.

Is there a way to automatically embed the last commit hash in the executable when I build my application?

For example, printing the commit hash to console would look something like:

```<code>class PrintCommitHash
{
    private String lastCommitHash = ?? // What do I put here?
    static void Main(string[] args)
    {
        // Display the version number:
        System.Console.WriteLine(lastCommitHash );
    }
}
</code>```

Note that this has to be done at build time, not runtime, as my deployed executable will not have the git repo accessible.

A related question for C++ can be found here.

EDIT

Per @mattanja's request, I'm posting the git hook script I use in my projects. The setup:

The hooks are linux shell scripts, which are placed under: path_to_project\.git\hooks

If you are using msysgit, the hooks folder already contains some sample scripts. In order to make git call them, remove the '.sample' extension from the script name.

The names of the hook scripts match the event that invokes them. In my case, I modified post-commit and post-merge.

My AssemblyInfo.cs file is directly under the project path (same level as the .git folder). It contains 23 lines, and I use git to generate the 24th.

As my linux-shelling a bit rusty, the script simply reads the first 23-lines of AssemblyInfo.cs to a temporary file, echos the git hash to the last line, and renames the file back to AssemblyInfo.cs. I'm sure there are better ways of doing this:

```<code>#!/bin/sh
cmt=$(git rev-list --max-count=1 HEAD)
head -23 AssemblyInfo.cs > AssemblyInfo.cs.tmp
echo [assembly: AssemblyFileVersion\(\"$cmt\"\)] >> AssemblyInfo.cs.tmp
mv AssemblyInfo.cs.tmp AssemblyInfo.cs
</code>```

答:
Place

<Target Name="UpdateVersion" BeforeTargets="CoreCompile">
  <Exec Command="php "$(SolutionDir)build.php" $(SolutionDir) "$(ProjectDir)Server.csproj"" />
</Target>
```

<p>in <code>YOUR_PROJECT_NAME.csproj</code></p>

<pre class="lang-php prettyprint-override"><code><?php

function between(string $string, string $after, string $before, int $offset = 0) : string{
    return substr($string, $pos = strpos($string, $after, $offset) + strlen($after),
        strpos($string, $before, $pos) - $pos);
}

$pipes = [];
$proc = proc_open("git rev-parse --short HEAD", [
    0 => ["pipe", "r"],
    1 => ["pipe", "w"],
    2 => ["pipe", "w"]
], $pipes, $argv[1]);

if(is_resource($proc)){
    $rev = stream_get_contents($pipes[1]);
    proc_close($proc);
}

$manifest = file_get_contents($argv[2]);
$version = between($manifest, "<Version>", "</Version>");
$ver = explode("-", $version)[0] . "-" . trim($rev);
file_put_contents($argv[2], str_replace($version, $ver, $manifest));

echo "New version generated: $ver" . PHP_EOL;

</code>```

Title: Embed git commit hash in a .NET dll

Body:
I'm building a C# application, using Git as my version control.

Is there a way to automatically embed the last commit hash in the executable when I build my application?

For example, printing the commit hash to console would look something like:

class PrintCommitHash
{
    private String lastCommitHash = ?? // What do I put here?
    static void Main(string[] args)
    {
        // Display the version number:
        System.Console.WriteLine(lastCommitHash );
    }
}

Note that this has to be done at build time, not runtime, as my deployed executable will not have the git repo accessible.

A related question for C++ can be found here.

EDIT

Per @mattanja's request, I'm posting the git hook script I use in my projects. The setup:

The hooks are linux shell scripts, which are placed under: path_to_project\.git\hooks

If you are using msysgit, the hooks folder already contains some sample scripts. In order to make git call them, remove the '.sample' extension from the script name.

The names of the hook scripts match the event that invokes them. In my case, I modified post-commit and post-merge.

My AssemblyInfo.cs file is directly under the project path (same level as the .git folder). It contains 23 lines, and I use git to generate the 24th.

As my linux-shelling a bit rusty, the script simply reads the first 23-lines of AssemblyInfo.cs to a temporary file, echos the git hash to the last line, and renames the file back to AssemblyInfo.cs. I'm sure there are better ways of doing this:

#!/bin/sh
cmt=$(git rev-list --max-count=1 HEAD)
head -23 AssemblyInfo.cs > AssemblyInfo.cs.tmp
echo [assembly: AssemblyFileVersion\(\"$cmt\"\)] >> AssemblyInfo.cs.tmp
mv AssemblyInfo.cs.tmp AssemblyInfo.cs

Body:
Place

<Target Name="UpdateVersion" BeforeTargets="CoreCompile">
  <Exec Command="php &quot;$(SolutionDir)build.php&quot; $(SolutionDir) &quot;$(ProjectDir)Server.csproj&quot;" />
</Target>

in YOUR_PROJECT_NAME.csproj

<?php

function between(string $string, string $after, string $before, int $offset = 0) : string{
    return substr($string, $pos = strpos($string, $after, $offset) + strlen($after),
        strpos($string, $before, $pos) - $pos);
}

$pipes = [];
$proc = proc_open("git rev-parse --short HEAD", [
    0 => ["pipe", "r"],
    1 => ["pipe", "w"],
    2 => ["pipe", "w"]
], $pipes, $argv[1]);

if(is_resource($proc)){
    $rev = stream_get_contents($pipes[1]);
    proc_close($proc);
}

$manifest = file_get_contents($argv[2]);
$version = between($manifest, "<Version>", "</Version>");
$ver = explode("-", $version)[0] . "-" . trim($rev);
file_put_contents($argv[2], str_replace($version, $ver, $manifest));

echo "New version generated: $ver" . PHP_EOL;


问:
How to insert python list to particular Oracle database column?
I am trying to insert a python list to particular oracle database column but i am getting error. Tablename is MSDS_VII and the columns are NO,ITEM,STATUS,STATUS1. You can see the datatype of each column based on the output i have pasted below. Here is what I tried till now. Need guidance!

```<code>conn = cx_Oracle.connect(conn_str)
c = conn.cursor()
c.execute(u'select NO,ITEM,STATUS,STATUS1 from MSDS_VII')
a=[]
b=[]
e=[]
f=[]
for row in c:
    e.append(row[0])
    f.append(row[1])
    a.append(row[2])
    b.append(row[3])
d=[[k,l,i,j] for k,l,i,j in zip(e,f,a,b)]
print(d)
print("\n")
for i in d:
    if(i[2]==1):
        i[3]="ON"
    elif(i[2]==0):
        i[3]="OFF"
    else:
        i[3]="NULL"
print(d)
for i in d:
    c.execute( 'insert into MSDS_VII(STATUS1 ) values (%s)',i[3])
conn.close()

Output:

[[1, 'item1', 1, None], [2, 'item2', 0, None], [3, 'item3', 1, None], [4, 'item4', 1, None], [5,
'item5', 0, None]]

[[1, 'item1', 1, 'ON'], [2, 'item2', 0, 'OFF'], [3, 'item3', 1, 'ON'], [4, 'item4', 1, 'ON'], [5,
'item5', 0, 'OFF']]

Traceback (most recent call last):
File "C:/Users/Admin/Desktop/status.py", line 28, in <module>
c.execute( 'insert into MSDS_VII(STATUS1 ) values (%s)',i[3])
cx_Oracle.DatabaseError: ORA-01036: illegal variable name/number
</code>```

Database description

答:
Bind variables in Oracle are denoted by a colon followed by a number. Also, values for bind variables should be passed as a tuple:

```<code>c.execute( 'insert into MSDS_VII(STATUS1 ) values (:1)', (i[3],))
</code>```

Edit: It is now clear that you are only trying to update the existing rows, rather than inserting new rows. You should use the UPDATE statement instead:

```<code>c.execute("update MSDS_VII set STATUS1=decode(STATUS, 1, 'ON', 0, 'OFF', 'NULL')")
</code>```

Body:
I am trying to insert a python list to particular oracle database column but i am getting error. Tablename is MSDS_VII and the columns are NO,ITEM,STATUS,STATUS1. You can see the datatype of each column based on the output i have pasted below. Here is what I tried till now. Need guidance!

conn = cx_Oracle.connect(conn_str)
c = conn.cursor()
c.execute(u'select NO,ITEM,STATUS,STATUS1 from MSDS_VII')
a=[]
b=[]
e=[]
f=[]
for row in c:
    e.append(row[0])
    f.append(row[1])
    a.append(row[2])
    b.append(row[3])
d=[[k,l,i,j] for k,l,i,j in zip(e,f,a,b)]
print(d)
print("\n")
for i in d:
    if(i[2]==1):
        i[3]="ON"
    elif(i[2]==0):
        i[3]="OFF"
    else:
        i[3]="NULL"
print(d)
for i in d:
    c.execute( 'insert into MSDS_VII(STATUS1 ) values (%s)',i[3])
conn.close()

Output:

[[1, 'item1', 1, None], [2, 'item2', 0, None], [3, 'item3', 1, None], [4, 'item4', 1, None], [5,
'item5', 0, None]]

[[1, 'item1', 1, 'ON'], [2, 'item2', 0, 'OFF'], [3, 'item3', 1, 'ON'], [4, 'item4', 1, 'ON'], [5,
'item5', 0, 'OFF']]

Traceback (most recent call last):
File "C:/Users/Admin/Desktop/status.py", line 28, in <module>
c.execute( 'insert into MSDS_VII(STATUS1 ) values (%s)',i[3])
cx_Oracle.DatabaseError: ORA-01036: illegal variable name/number

Database description

Body:
Bind variables in Oracle are denoted by a colon followed by a number. Also, values for bind variables should be passed as a tuple:

c.execute( 'insert into MSDS_VII(STATUS1 ) values (:1)', (i[3],))

Edit: It is now clear that you are only trying to update the existing rows, rather than inserting new rows. You should use the UPDATE statement instead:

c.execute("update MSDS_VII set STATUS1=decode(STATUS, 1, 'ON', 0, 'OFF', 'NULL')")


问:
SQL Server : merge cells based on one column
I have some raw data in staging environment in a SQL Server database. It doesn't have any primary key/unique constraints.

I am trying to clean data and get from one format to another format.

Example, if you look at row 1 and 2, I want the title "Interior-Tr" and "im" to be merged into "Interior-Trim" and Description of the two rows concatenated.

The first two rows of the sources data, should be the first row of the expected output

Could someone help me with how to change to required format (one set of sample data attached)?

Current table format

Output format

.

答:
This is a fairly simple example of when to use lead/lag - I'm assuming you've managed to import this and retain the correct order (in future I suggest adding a row-number on import - I've simulated this for now):

--SETUP--

```<code>create table table1 (
      SheetNumber varchar (255) null
    , ID integer null
    , Title varchar(255) null
    , Reasonv varchar(255) null
    , Description varchar (255) null
    , Qty1 integer null
    , UOM varchar(255) null
    , UnitPrice varchar(255) null
    , TotalPrice varchar(255) null
)

insert into table1 values(2,3165257,'Interior-Tr','ReplaceMissing','Descrption Line 1','30','LF','1.17','35.1')
insert into table1 values(2,NULL,'im',NULL,NULL,NULL,NULL,NULL,NULL)
insert into table1 values(2,3165252,'Demo-Dumpst','ReplaceMissing','Descrption Line 1','1','LS','478.26','478.26')
insert into table1 values(2,NULL,'er',NULL,'Descrption Line 2',NULL,NULL,NULL,NULL)
insert into table1 values(2,3165263,'Demo-Structure','ReplaceMissing','Descrption Line 1','1','LS','30','30')
insert into table1 values(2,3165267,'Paint-Inter','ReplaceMissing','Descrption Line 1','2592','SF','1.04','2695.68')
insert into table1 values(2,NULL,'ior',NULL,'Descrption Line 2',NULL,NULL,NULL,NULL)
insert into table1 values(2,NULL,NULL,NULL,'Descrption Line 3',NULL,NULL,NULL,NULL)
</code>```

--SOLUTION FRAMEWORK--

```<code>select * from (

    select
          ID
        , Title as old_title
        , lead(Title) OVER (ORDER BY (SELECT 100)) as lead_title
        , case
            when (ID is null) then title
            else concat(Title, lead(Title) OVER (ORDER BY (SELECT 100)))
            end as combined_title

     from table1) subQuery

where ID is not null
</code>```

Body:
This is a fairly simple example of when to use lead/lag - I'm assuming you've managed to import this and retain the correct order (in future I suggest adding a row-number on import - I've simulated this for now):

--SETUP--

create table table1 (
      SheetNumber varchar (255) null
    , ID integer null
    , Title varchar(255) null
    , Reasonv varchar(255) null
    , Description varchar (255) null
    , Qty1 integer null
    , UOM varchar(255) null
    , UnitPrice varchar(255) null
    , TotalPrice varchar(255) null
)

insert into table1 values(2,3165257,'Interior-Tr','ReplaceMissing','Descrption Line 1','30','LF','1.17','35.1')
insert into table1 values(2,NULL,'im',NULL,NULL,NULL,NULL,NULL,NULL)
insert into table1 values(2,3165252,'Demo-Dumpst','ReplaceMissing','Descrption Line 1','1','LS','478.26','478.26')
insert into table1 values(2,NULL,'er',NULL,'Descrption Line 2',NULL,NULL,NULL,NULL)
insert into table1 values(2,3165263,'Demo-Structure','ReplaceMissing','Descrption Line 1','1','LS','30','30')
insert into table1 values(2,3165267,'Paint-Inter','ReplaceMissing','Descrption Line 1','2592','SF','1.04','2695.68')
insert into table1 values(2,NULL,'ior',NULL,'Descrption Line 2',NULL,NULL,NULL,NULL)
insert into table1 values(2,NULL,NULL,NULL,'Descrption Line 3',NULL,NULL,NULL,NULL)

--SOLUTION FRAMEWORK--

select * from (

    select
          ID
        , Title as old_title
        , lead(Title) OVER (ORDER BY (SELECT 100)) as lead_title
        , case
            when (ID is null) then title
            else concat(Title, lead(Title) OVER (ORDER BY (SELECT 100)))
            end as combined_title

     from table1) subQuery

where ID is not null


问:
Titan's IllegalArgumentException on Graph creation
I'm getting an initialization error when I try to instantiate my graph in blueprints. Here's the code that I'm using to create a new graph:

```<code>String path = "conf/titan-cassandra-" + System.getProperty("env") + ".properties";
Graph graph = TitanFactory.open(path);
</code>```

The system property is being set and the file exists. The error is being thrown in TitanFactory:

```<code>final Pattern p = Pattern.compile("(" +
Pattern.quote(GraphDatabaseConfiguration.STORAGE_NS.getName()) + "\\..*" + "(" +
Pattern.quote(GraphDatabaseConfiguration.STORAGE_DIRECTORY.getName()) + "|" +
Pattern.quote(GraphDatabaseConfiguration.STORAGE_CONF_FILE.getName()) + ")" + "|" +
Pattern.quote(GraphDatabaseConfiguration.INDEX_NS.getName()) + "\\..*" + "(" +
Pattern.quote(GraphDatabaseConfiguration.INDEX_DIRECTORY.getName()) + "|" +
Pattern.quote(GraphDatabaseConfiguration.INDEX_CONF_FILE.getName()) + ")" + ")");
</code>```

Evaluating the expression GraphDatabaseConfiguration.STORAGE_NS yields 'null'. Why might this be?

Edit:

I'm including the stack trace as well

```<code>Exception in thread "main" java.lang.NoSuchMethodError: org.apache.commons.lang.StringUtils.containsAny(Ljava/lang/String;[C)Z
    at com.thinkaurelius.titan.diskstorage.configuration.ConfigElement.<init>(ConfigElement.java:26)
    at com.thinkaurelius.titan.diskstorage.configuration.ConfigNamespace.<init>(ConfigNamespace.java:19)
    at com.thinkaurelius.titan.diskstorage.configuration.ConfigNamespace.<init>(ConfigNamespace.java:24)
    at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.<clinit>(GraphDatabaseConfiguration.java:81)
    at com.thinkaurelius.titan.core.TitanFactory.getLocalConfiguration(TitanFactory.java:240)
    at com.thinkaurelius.titan.core.TitanFactory.getLocalConfiguration(TitanFactory.java:170)
    at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:61)
    at io.fama.api.service.GraphHolder.populateGraph(GraphHolder.java:28)
    at io.fama.api.service.GraphHolder.graph(GraphHolder.java:21)
    at io.fama.api.DebugTests.main(DebugTests.java:7)
</code>```

When maven runs the test it throws a different error. This one looks like it's related to dependencies.

答: Passing the absolute path for the properties file solved the issue for me.</p>

Body:
I'm getting an initialization error when I try to instantiate my graph in blueprints. Here's the code that I'm using to create a new graph:

String path = "conf/titan-cassandra-" + System.getProperty("env") + ".properties";
Graph graph = TitanFactory.open(path);

The system property is being set and the file exists. The error is being thrown in TitanFactory:

final Pattern p = Pattern.compile("(" +
Pattern.quote(GraphDatabaseConfiguration.STORAGE_NS.getName()) + "\\..*" + "(" +
Pattern.quote(GraphDatabaseConfiguration.STORAGE_DIRECTORY.getName()) + "|" +
Pattern.quote(GraphDatabaseConfiguration.STORAGE_CONF_FILE.getName()) + ")" + "|" +
Pattern.quote(GraphDatabaseConfiguration.INDEX_NS.getName()) + "\\..*" + "(" +
Pattern.quote(GraphDatabaseConfiguration.INDEX_DIRECTORY.getName()) + "|" +
Pattern.quote(GraphDatabaseConfiguration.INDEX_CONF_FILE.getName()) + ")" + ")");

Evaluating the expression GraphDatabaseConfiguration.STORAGE_NS yields 'null'. Why might this be?

Edit:

I'm including the stack trace as well

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.commons.lang.StringUtils.containsAny(Ljava/lang/String;[C)Z
    at com.thinkaurelius.titan.diskstorage.configuration.ConfigElement.<init>(ConfigElement.java:26)
    at com.thinkaurelius.titan.diskstorage.configuration.ConfigNamespace.<init>(ConfigNamespace.java:19)
    at com.thinkaurelius.titan.diskstorage.configuration.ConfigNamespace.<init>(ConfigNamespace.java:24)
    at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.<clinit>(GraphDatabaseConfiguration.java:81)
    at com.thinkaurelius.titan.core.TitanFactory.getLocalConfiguration(TitanFactory.java:240)
    at com.thinkaurelius.titan.core.TitanFactory.getLocalConfiguration(TitanFactory.java:170)
    at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:61)
    at io.fama.api.service.GraphHolder.populateGraph(GraphHolder.java:28)
    at io.fama.api.service.GraphHolder.graph(GraphHolder.java:21)
    at io.fama.api.DebugTests.main(DebugTests.java:7)

When maven runs the test it throws a different error. This one looks like it's related to dependencies.


问:
Qubole Kinesis Connector for Spark structured streaming throws an error
We are using Qubole Kinesis Connector (jar) for Spark structured streaming. This used to work fine but suddenly, it is throwing an error "S3 filesystem not found".

We could use the KCL but we need to test it for foreachbatch. Are there any other available Kinesis connectors available that provide seamless writing operations?

答: @Lightning-Analytics, Please share the full stack trace and respective qubole streaming command-id if any.</p>


问:
react-native - warnings setting up basic project
I was trying to init a project in ReactNative using CLI and the command I gave was:
npx react-native init testy
The output looks like this:

```<code>This will walk you through creating a new React Native project in C:\Users\Vipul\ReactProjects\testy
Using yarn v1.19.1
Installing react-native...
yarn add v1.19.1
info No lockfile found.
[1/4] Resolving packages...
warning react-native > fbjs-scripts > core-js@2.6.10: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > fbjs > core-js@2.6.10: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > create-react-class > fbjs > core-js@1.2.7: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > metro-babel-register > core-js@2.6.10: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > @react-native-community/cli > metro-core > jest-haste-map > fsevents@1.2.9: One of your dependencies needs to upgrade to fsevents v2: 1) Proper nodejs v10+ support 2) No more fetching binaries from AWS, smaller package size
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "win32" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-native > metro-react-native-babel-transformer@0.56.3" has unmet peer dependency "@babel/core@*".
warning " > react-native@0.61.4" has unmet peer dependency "react@16.9.0".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 381 new dependencies.
...
...
info Setting up new React Native app in C:\Users\Vipul\ReactProjects\testy
info Adding required dependencies
yarn add v1.19.1
[1/4] Resolving packages...
warning jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > left-pad@1.3.0: use String.prototype.padStart()
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "win32" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@react-native-community/eslint-config > eslint-plugin-react-native@3.6.0" has incorrect peer dependency "eslint@^3.17.0 || ^4 || ^5".
warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
warning "@react-native-community/eslint-config > eslint-plugin-react@7.12.4" has incorrect peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0".
warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
warning "@react-native-community/eslint-config > @typescript-eslint/parser@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 179 new dependencies.
...
...
info Adding required dev dependencies
yarn add v1.19.1
[1/4] Resolving packages...
[2/4] Fetching packages...
warning Pattern ["@babel/core@^7.7.2"] is trying to unpack in the same destination "C:\\Users\\Vipul\\AppData\\Local\\Yarn\\Cache\\v6\\npm-@babel-core-7.7.2-ea5b99693bcfc058116f42fa1dd54da412b29d91-integrity\\node_modules\\@babel\\core" as pattern ["@babel/core@^7.0.0","@babel/core@^7.0.0","@babel/core@^7.0.0","@babel/core@^7.0.0","@babel/core@^7.0.0","@babel/core@^7.1.0","@babel/core@^7.1.0"]. This could result in non-deterministic behavior, skipping.
warning Pattern ["@babel/runtime@^7.7.2"] is trying to unpack in the same destination "C:\\Users\\Vipul\\AppData\\Local\\Yarn\\Cache\\v6\\npm-@babel-runtime-7.7.2-111a78002a5c25fc8e3361bedc9529c696b85a6a-integrity\\node_modules\\@babel\\runtime" as pattern ["@babel/runtime@^7.0.0"]. This could result in non-deterministic behavior, skipping.
info fsevents@1.2.9: The platform "win32" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
warning "@react-native-community/eslint-config > @typescript-eslint/parser@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
warning "@react-native-community/eslint-config > eslint-plugin-react@7.12.4" has incorrect peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0".
warning "@react-native-community/eslint-config > eslint-plugin-react-native@3.6.0" has incorrect peer dependency "eslint@^3.17.0 || ^4 || ^5".
warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
</code>```

The package.json file looks like:

```<code>{
  "name": "testy",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "react": "16.9.0",
    "react-native": "0.61.4"
  },
  "devDependencies": {
    "@babel/core": "^7.7.2",
    "@babel/runtime": "^7.7.2",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "eslint": "^6.6.0",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.57.0",
    "react-test-renderer": "16.9.0"
  },
  "jest": {
    "preset": "react-native"
  }
}
</code>```

Now I want to know if these warnings are going to affect my project later. How can I remove them and even though I did not specify them why is RN even using incorrect or unmet dependency?

Please note that I tried to build a RN project before this too and here React Native - Unable to resolve module `@babel/runtime/helpers/interopRequireDefault` from 'index.js' is the error I got stuck at and started with a fresh project then.

Any help is appreciated.

答:
Just in case other people search this error again.
For my case, I solve it by updating my yarn packages. </p>

```<code>npm install -g yarn
</code>```

Body:
I was trying to init a project in ReactNative using CLI and the command I gave was:
npx react-native init testy
The output looks like this:

This will walk you through creating a new React Native project in C:\Users\Vipul\ReactProjects\testy
Using yarn v1.19.1
Installing react-native...
yarn add v1.19.1
info No lockfile found.
[1/4] Resolving packages...
warning react-native > fbjs-scripts > core-js@2.6.10: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > fbjs > core-js@2.6.10: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > create-react-class > fbjs > core-js@1.2.7: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > metro-babel-register > core-js@2.6.10: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > @react-native-community/cli > metro-core > jest-haste-map > fsevents@1.2.9: One of your dependencies needs to upgrade to fsevents v2: 1) Proper nodejs v10+ support 2) No more fetching binaries from AWS, smaller package size
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "win32" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-native > metro-react-native-babel-transformer@0.56.3" has unmet peer dependency "@babel/core@*".
warning " > react-native@0.61.4" has unmet peer dependency "react@16.9.0".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 381 new dependencies.
...
...
info Setting up new React Native app in C:\Users\Vipul\ReactProjects\testy
info Adding required dependencies
yarn add v1.19.1
[1/4] Resolving packages...
warning jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > left-pad@1.3.0: use String.prototype.padStart()
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "win32" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@react-native-community/eslint-config > eslint-plugin-react-native@3.6.0" has incorrect peer dependency "eslint@^3.17.0 || ^4 || ^5".
warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
warning "@react-native-community/eslint-config > eslint-plugin-react@7.12.4" has incorrect peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0".
warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
warning "@react-native-community/eslint-config > @typescript-eslint/parser@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 179 new dependencies.
...
...
info Adding required dev dependencies
yarn add v1.19.1
[1/4] Resolving packages...
[2/4] Fetching packages...
warning Pattern ["@babel/core@^7.7.2"] is trying to unpack in the same destination "C:\\Users\\Vipul\\AppData\\Local\\Yarn\\Cache\\v6\\npm-@babel-core-7.7.2-ea5b99693bcfc058116f42fa1dd54da412b29d91-integrity\\node_modules\\@babel\\core" as pattern ["@babel/core@^7.0.0","@babel/core@^7.0.0","@babel/core@^7.0.0","@babel/core@^7.0.0","@babel/core@^7.0.0","@babel/core@^7.1.0","@babel/core@^7.1.0"]. This could result in non-deterministic behavior, skipping.
warning Pattern ["@babel/runtime@^7.7.2"] is trying to unpack in the same destination "C:\\Users\\Vipul\\AppData\\Local\\Yarn\\Cache\\v6\\npm-@babel-runtime-7.7.2-111a78002a5c25fc8e3361bedc9529c696b85a6a-integrity\\node_modules\\@babel\\runtime" as pattern ["@babel/runtime@^7.0.0"]. This could result in non-deterministic behavior, skipping.
info fsevents@1.2.9: The platform "win32" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
warning "@react-native-community/eslint-config > @typescript-eslint/parser@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
warning "@react-native-community/eslint-config > eslint-plugin-react@7.12.4" has incorrect peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0".
warning "@react-native-community/eslint-config > eslint-plugin-react-native@3.6.0" has incorrect peer dependency "eslint@^3.17.0 || ^4 || ^5".
warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".

The package.json file looks like:

{
  "name": "testy",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "react": "16.9.0",
    "react-native": "0.61.4"
  },
  "devDependencies": {
    "@babel/core": "^7.7.2",
    "@babel/runtime": "^7.7.2",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "eslint": "^6.6.0",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.57.0",
    "react-test-renderer": "16.9.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

Now I want to know if these warnings are going to affect my project later. How can I remove them and even though I did not specify them why is RN even using incorrect or unmet dependency?

Please note that I tried to build a RN project before this too and here React Native - Unable to resolve module `@babel/runtime/helpers/interopRequireDefault` from 'index.js' is the error I got stuck at and started with a fresh project then.

Any help is appreciated.

Body:
Just in case other people search this error again.
For my case, I solve it by updating my yarn packages.

npm install -g yarn


问:
Nested JSON - Join sub-object
How can I remove sub-objects?   </p>

```<code>[{
    "id": "1",
    "desc": "SOME PRODUCT",
    "codigo": "CODE-28",
    "codigoBarras": "2000000001",
    "unidade": "PCT",
    "price": "24.15",
    "current_inventory": [{
        "2kg": "5",
        "5kg": "5",
        "10kg": "5",
        "20kg": "5",
        "productId": "1"
     }]
 }]

[{
    "id": "1",
    "desc": "SOME PRODUCT",
    "codigo": "CODE-28",
    "codigoBarras": "2000000001",
    "unidade": "PCT",
    "price": "24.15",
    "current_inventory_2kg": "5",
    "current_inventory_5kg": "5",
    "current_inventory_10kg": "5",
    "current_inventory_20kg": "5",
}]
</code>```

答:
Use Object.entries and reduce will simplify.

const data = [
  {
    id: "1",
    desc: "SOME PRODUCT",
    codigo: "CODE-28",
    codigoBarras: "2000000001",
    unidade: "PCT",
    price: "24.15",
    current_inventory: [
      {
        "2kg": 5,
        "5kg": 5,
        "10kg": 5,
        "20kg": 5,
        productId: 1
      }
    ]
  }
];

const [first] = data;

const updated = Object.entries(first).reduce((acc, [key, value]) => {
  if (Array.isArray(value)) {
    value.forEach(item =>
      Object.entries(item).forEach(
        ([cKey, cValue]) => (acc[`${key}_${cKey}`] = cValue)
      )
    );
  } else {
    acc[key] = value;
  }
  return acc;
}, {});

console.log(updated);```

Title: Nested JSON - Join sub-object

Body:
How can I remove sub-objects?

[{
    "id": "1",
    "desc": "SOME PRODUCT",
    "codigo": "CODE-28",
    "codigoBarras": "2000000001",
    "unidade": "PCT",
    "price": "24.15",
    "current_inventory": [{
        "2kg": "5",
        "5kg": "5",
        "10kg": "5",
        "20kg": "5",
        "productId": "1"
     }]
 }]

[{
    "id": "1",
    "desc": "SOME PRODUCT",
    "codigo": "CODE-28",
    "codigoBarras": "2000000001",
    "unidade": "PCT",
    "price": "24.15",
    "current_inventory_2kg": "5",
    "current_inventory_5kg": "5",
    "current_inventory_10kg": "5",
    "current_inventory_20kg": "5",
}]


问:
nginx enables https on port 80 and 8080 only
I know almost nothing about nginx, please help me to see if it can be achieved ?

A public network IP with only 80 and 8080 ports open, Such as 182.148.???.135

A domain name with an SSL certificate, Such as mini.????.com

This domain name can resolve to this IP.

Using the above conditions, how to enable https ? So that I can pass visit https://mini.????.com to the target server 182.148.???.135

Thank you very much for your help!

答:
Just came accross an issue. Doesn’t matter if its a local setup or one with a domain name.

When you create a symbolic frpom sites-available to sites-enabled you have to use the whole path to each location.

e.g. you can’t

```<code>cd /etc/nginx/sites-available/
ln -s monitor ../sites-enabled/
</code>```

It has to be:

```<code>ln -s  /etc/nginx/sites-available/monitor  /etc/nginx/sites-enabled/
</code>```

Inside /etc/nginx/sites-available you should have just edited the default file to change the root web folder you specified and left the server name part alone. Restart nginx, should work fine. You don’t need to specify the IP of your droplet. That’s the whole purpose of the default file.

You only need to copy the default file and change server names when you want to set up virtual hosts.

Body:
Just came accross an issue. Doesn’t matter if its a local setup or one with a domain name.

When you create a symbolic frpom sites-available to sites-enabled you have to use the whole path to each location.

e.g. you can’t

cd /etc/nginx/sites-available/
ln -s monitor ../sites-enabled/

It has to be:

ln -s  /etc/nginx/sites-available/monitor  /etc/nginx/sites-enabled/

Inside /etc/nginx/sites-available you should have just edited the default file to change the root web folder you specified and left the server name part alone. Restart nginx, should work fine. You don’t need to specify the IP of your droplet. That’s the whole purpose of the default file.

You only need to copy the default file and change server names when you want to set up virtual hosts.


问:
Is There Any Client Side Web Automation
I work in a public sector university
I use selenium with C# for automating routine tasks. I have admin rights so I just develop
various win forms apps to do that. But most of my colleagues cant use such apps as they do not
have admin rights. The apps are so useful and time saving that I want it to share with all colleagues
But admin rights is the issue, so please direct me to a solution that can work completely on client side.

Plz also note that I cant create setups and ask networking staff to install it on all PCs as there are
around 150 of them, and also the apps often are updated every couple of months.

答: PhantomJS worked without requiring admin rights, but it is already paused, as per their official page, so the only hack to my mind is, ask networking staff to install visual studio (with C# setup) on all PCs, this way I can just hand over the apps to all and they can open and run from VS, instead of direct exe, and it will eliminate requiring updating of apps as users will just need to get the latest app folder. A down side is un necessary window of VS and the memory but the benefits would outweigh this issue.</p>

Title: Is There Any Client Side Web Automation