text:
Q: C# Class library collections ObservableCollection vs Collection I'm creating a class library that could be used in a number of situations ASP.NET, Console Apps, other class libraries and XAML targets like Silverlight or WPF.
Initially I decided to expose collections as IList.  But then when writing samples using  XAML I found that if I want to make it easy to bind to these collections I need to use ObservableCollection.
What are my options?
I could make the library expose ObservableCollection and force that upon users who have nothing to do with XAML.  Is that a bad thing?
I could make my class generic allowing the caller to specify the collection type they want as long as it implements ICollection perhaps with default to Collection
I could make a set of classes one that uses ObservableCollection and one that does not say Foo and ObservableFoo.
I could implement INotifyCollectionChanged in my class but that seems silly when ObservableCollection does it for me.
Obviously I'm trying to keep the code clean and simple, but supporting data binding seems important.
Any suggestions?
Edit: Tried creating a Portable Class Library project using both alternatives.
In class Foo I have
    private readonly Collection<string> strings = new Collection<string>();

    public ReadOnlyCollection<string> Strings
    {
        get
        {
            return new ReadOnlyCollection<string>(this.strings);
        }
    }

In class ObservableFoo I have
    private readonly ObservableCollection<string> strings = new ObservableCollection<string>();

    public ReadOnlyObservableCollection<string> Strings
    {
        get
        {
            return new ReadOnlyObservableCollection<string>(this.strings);
        }
    }

The very simple unit test code is
    [TestMethod]
    public void TestMethod1()
    {
        var foo = new ObservableFoo(); // or new Foo()

        Assert.AreNotEqual(0, foo.Id);
        Assert.AreNotEqual(0, foo.Strings.Count);
    }

The only downside is that when I used ReadOnlyObservableCollection the test project got this compile error

The type
  'System.Collections.ObjectModel.ReadOnlyObservableCollection`1' is
  defined in an assembly that is not referenced. You must add a
  reference to assembly 'System.Windows, Version=2.0.5.0,
  Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'

So in this case, using ReadOnlyObservableCollection would force users to add a reference to System.Windows which is a downside.
Edit: I came up with a solution that I posted on my blog - see How to make a library portable and data binding friendly at the same time?

A: Well, it depends. If you are writing a pure model library, it makes no sense to expose WPF-specific interfaces; this would force the users link against WPF libraries even if they don't need to. Even if it were not, it exposes something that the users are not going to need, which is not a good design IMHO.
If your library is not limited to model usage, I would split it into several parts: core needed for all usage scenarios, WPF-dependent part with WPF-specific interfaces, maybe ASP-specific part with ASP-specific features and so on. The users will pick the parts they need and use them.

Edit: as @Julien's comment states, ObservableCollection<T> is now as part of core, so including it won't make the users depend from the WPF-specific libraries. Nevertheless, the idea stays the same. For WPF usage, you often need to offer/work with specific features (ObservableCollection, INotifyPropertyChanged/DependencyObject, dependency properties, notifications in UI thread only and so on). This means that they belong to a separate, WPF-specific part of the project.
So you can make the library consist of several parts: Library.Core.dll containing functions needed for generic/model development, Library.WPF.dll dealing with WPF-specific stuff and using Library.Core.dll, maybe Library.Console.dll and Library.ASP.dll as well. Users of WPF will use Library.Core.dll and Library.WPF.dll, console programs might need Library.Core.dll and Library.Console.dll and so on.

A: I think that the low-level components of your library should offer interfaces that make sense for those components, at that particular level of abstraction, without regard to how the various consumers of your API might need to adapt them for their own uses.
For example, if a composite WPF application would use your components, it would be wholly appropriate for those applications to encapsulate your components into a Model or View Model that adapts the IList<T> (or better still, IEnumerable<T>) offered by your components into an ObservableCollection<T> suitable for binding to a view.
A console application might not need such overhead, and could happily use the IEnumerable<T>.
As an aside, be careful even when exposing collections as IList<T>. This allows consumers of your library to add to and remove items from the list, for example, which might not be in the spirit of the interface.


text:
Q: How to stop function recursion I have a recursive function that call itself. But I want to stop it at a certain situation, something like break, of course it's not a loop so i can't use break. Is there any method? Thank you
Function here, you may see a break, that's when i want to stop the function recall. Thank you!
function generateParseTree(parsingArray, left, right, rootIndex) {
    probability *= parsingArray[left][right][rootIndex].prob;
    if (!parsingArray[left][right][rootIndex]['divide']) {
        if (left == parsingArray.length - 2 && right == parsingArray.length - 1) {
            if (probability > 1e-6) {
                suming ++;
                break;
            }
            return;
        } else {
            return;
        }
    }
    generateParseTree(parsingArray, left, parsingArray[left][right][rootIndex]['divide'], parsingArray[left][right][rootIndex]['right1Index']);
    generateParseTree(parsingArray, parsingArray[left][right][rootIndex]['divide'], right, parsingArray[left][right][rootIndex]['right2Index']);
        return;

}

Update-----------------------------------
Sorry my logic is a little mess, the function has been called many times and in each recursion there may be a situation that could be break. What I want is that the first time it reach the stop situation, all the recursion stoped.
Solution-----------------------------------
I have use try catch to implement my design, the break is replaced with a throw "flag", this way, when i catch the throwed flag, i could break the loop that first call this function.
Thank you all!

A: Since you already have returns in the code I'm assuming you know that you can just return from the function at that point.
You could return with a value that means something somewhere else.
The functionality that you want is almost (or is) a goto.
So, since exceptions run very similarly to gotos you could implement the method something like the following by throwing an exception when the thing occurs.
function generateParseTree(parsingArray, left, right, rootIndex) {
   try
    {
        probability *= parsingArray[left][right][rootIndex].prob;
        if (!parsingArray[left][right][rootIndex]['divide']) {
            if (left == parsingArray.length - 2 && right == parsingArray.length - 1) {
                if (probability > 1e-6) {
                    suming ++;
                    throw "this thing is done";
                }
                return;
            } else {
                return;
            }
        }
        generateParseTree(parsingArray, left, parsingArray[left][right][rootIndex]['divide'], parsingArray[left][right][rootIndex]['right1Index']);
        generateParseTree(parsingArray, parsingArray[left][right][rootIndex]['divide'], right, parsingArray[left][right][rootIndex]['right2Index']);
        return;
      }
      catch (err)
      {
           console.log(err); // "this thing is done"
      }
    }

A: can't  you just return from the place you'd place break?

A: You can change your function to return a value which indicates to continue or not. At the point where you call the function again, just check the returned value before continuing.
<script>
function f(){
  // your code here
  if(breakTheCode){
    return -1;
  }
  if(f()==-1){ // recursion
    return -1;
  }
  return 1;
}
</script>

A: Why don't you use return instead break?

A: Normally if u just write return it should break out of the function and returns an undefined object.

A: you can use 'return' instead of 'break'

redpajama_set_name: RedPajamaStackExchange


text:
Q: Behaviour of generator in lambda safe against future changes? I have the following function:
|    def line_reader_iter(file_object):
|       while True:
|           a_line = file_object.readline()
|           if len(a_line)==0: raise StopIteration
|           yield a_line[:-1]

and somewhere I say:
|    line_reader = lambda: next(line_reader_iter(infile))

Clearly, the lambda only works because there seems to be a difference in compile-time vs. run-time behaviour which is very welcome: the line_reader_iter() puts the reference to the iterator object into the lambda expression instead of the creation of a generator object each time the lambda is evaluated. BUT: is this portable and stable behaviour? I am just a Python novice and I don't know if my code is in a grey area with respect to the Python execution model. Can someone enligthen me?
slarti

A: I think you are actually misunderstanding why this works.  Each time you call line_reader() a new line_reader_iter generator is created.  It appears to work because you use the same infile each time, and each call to readline() will return the next line of the file.
Consider the following simpler example:
>>> counter = lambda: next(iter(range(10)))
>>> counter()
0
>>> counter()    # each time the lambda is called, a new range iter is created
0

You can get the behavior you want by using the following:
line_reader = line_reader_iter(infile).next

Here is how this would work with my range example:
>>> counter = iter(range(10)).next
>>> counter()
0
>>> counter()    # yay, we are actually using the same iterator
1


text:
Q: Unable to Post Image file Data into JSON API In React-Native I am a beginner with react-native and I am trying to Post data of Photograph, firstName,LastName and gender into JSOn API database for add a new Employee but I get an Alert message "not authenticated " when I click on submit button.If there is any easier ways please tell me.Here is my code .Please check my code.
 import React, { Component } from 'react';
 import {
 StyleSheet,
 View,  Image,
 Text,TouchableOpacity,
 SafeAreaView, TextInput,
  } from 'react-native';
  import ImagePicker from 'react-native-image-picker';

   export default class Profile extends Component {
   constructor(props) {
   super(props);
   this.state = {
   Fnametext: '',
   Lnametext: '',Gendertext:'',
   data: null,
   ImageSource: null,
   };
   }
    onClickListener = async () => {
     const formData = new FormData();
     formData.append('photograph',this.state.ImageSource);
     formData.append('firstName', this.state.Fnametext);
     formData.append('lastName', this.state.Lnametext);
     formData.append('gender', this.state.Gendertext);

   try {
   let response = await fetch(
    'http://104.197.28.169:3000/addEmp?',
    {
      method: 'POST',
      headers: {
        Accept: 'application/json',
        'Content-Type':
          'application/json',
      },
      body: formData,
    },
  )
  if (
    response.status >= 200 && response.status < 300 )
    {
    this.props.navigation.navigate(
      'Fourth',
     );
    }
  }
       catch (errors) {
          alert('not authenticated');
      }
    }
  selectPhotoTapped() {
   const options = {
  quality: 1.0,
  maxWidth: 500,
  maxHeight: 500,
  storageOptions: {
    skipBackup: true
  }
 };
ImagePicker.showImagePicker(options, (response) => {
  console.log('Response = ', response);

  if (response.didCancel) {
    console.log('User cancelled photo picker');
  }
  else if (response.error) {
    console.log('ImagePicker Error: ', response.error);
  }
  else if (response.customButton) {
    console.log('User tapped custom button: ', response.customButton);
  }
  else {
    let source = { uri: response.uri }
   this.setState({

      ImageSource: source,
    });
   }
  });
 }

   render() {
     {
      return (
    <View style={styles.container}>
      <SafeAreaView>
       <TouchableOpacity style={{ alignItems: 'center', justifyContent: 'center' }}
          onPress={this.selectPhotoTapped.bind(this)}>
          <View style={styles.ImageContainer}>
            {this.state.ImageSource === null ? <Image style={{ width: 170, height: 170 }}
              source={require('../images/default-profile.jpg')}></Image> :
              <Image
                style={{ width: 150, height: 150, borderRadius: 80 }}
                source={this.state.ImageSource} />
            }
          </View>
        </TouchableOpacity>
        <View style={styles.name}>
          <Text style={styles.label}>First Name:</Text>
          <TextInput style={styles.Shable}
            onChangeText={Fnametext => this.setState({ Fnametext })
            }></TextInput>
        </View>
        <View style={styles.name}>
          <Text style={styles.label}>Last Name:</Text>
          <TextInput style={styles.Shable}
            onChangeText={Lnametext => this.setState({ Lnametext })
            }></TextInput>
        </View>
         <View style={styles.name}>
            <Text style={styles.label}>Gender:</Text>
            <TextInput  style={styles.Shable}
              onChangeText={Gendertext => this.setState({ Gendertext })
              }></TextInput>
          </View>
        <View style={styles.name}>
          <TouchableOpacity style={{  width: '100%',paddingTop: 15,paddingBottom:
       10,backgroundColor: '#2F6995',
           borderRadius: 20,borderWidth: 1,borderColor: '#fff', }}
            onPress={this.onClickListener}
            underlayColor="#fff">
            <Text style={{ color: '#fff', textAlign: 'center', paddingLeft: 10,
                paddingRight: 10, fontSize: 15, }}>
               SUBMIT
              </Text>
          </TouchableOpacity>
        </View>
       </SafeAreaView>
    </View>
        );
     }
    }
  }
 const styles = StyleSheet.create({
 container: {
 flex: 1,
 marginRight: 10,
 marginLeft: 10,
  backgroundColor: '#F5FCFF',
 },
   name: {
 //backgroundColor: "gray",
 flexDirection: 'row',
 height: 50,
 width: '100%',
 marginTop: 15,
 },
  label: {
 flex: 1,
 marginTop: 15,
 height: 40,
 fontSize: 15,
 width: 50,
 marginLeft: 20,
  },
  Shable: {
 fontSize: 15,
 borderWidth: 0.5,
 width: '60%',
 borderColor: 'black',
 height: 40,
 marginTop: 10,
 },
});


text:
Q: SpecialCell(xlCellTypeLastCell) does not work in custom function in Excel The custom function below entered in a cell with a reference to another cell does not work. I do not understand why. Does anybody know the answer?
Public Function SpecialCellBroken(rng As Range)
Debug.Print rng.Worksheet.Cells.Address
Debug.Print rng.Worksheet.Cells.SpecialCells(xlCellTypeLastCell).Address

SpecialCellBroken = rng.Worksheet.Cells.SpecialCells(xlCellTypeLastCell).Address
End Function

Return in debug window:
$1:$1048576
$1:$1048576

However, the following Sub works fine and returns the address of the last cell:
Sub SpecialCellWorksFine()
    Debug.Print Selection.Worksheet.Cells.Address
    Debug.Print Selection.Worksheet.Cells.SpecialCells(xlCellTypeLastCell).Address

    Selection.Worksheet.Cells.SpecialCells(xlCellTypeLastCell).Select
End Sub

Return in debug window:
$1:$1048576
$J$21

Also referencing from the range to the worksheet with Parent does not work.
Tried ByVal on the parameter rng. Also no effect to the better.
Any suggestions what is the issue here? Thank you.

A: .SpecialCells(xlCellTypeLastCell) Wont work in a UDF as UDFs cannot interact with Excel (Or the program you are using at that time). What you can do though is:
Sub SpecialCellWorksFine()
x = Selection.Worksheet.Cells.SpecialCells(xlCellTypeLastCell).Address(False, False)

n = y(x)

End Sub

Public Function y(x As String)
'Code goes here
End Function

This has been simplified but the principal is the same, you assign what values you want to go into the UDF before you call it and then pull the ones you want into the UDF (The limit I believe is 30)


text:
Q: With knockout.js how to refresh observable array in a Select element When the dropdown is loaded the items are populated correctly. But when I click the Refresh button the Dropdown items are not refreshed. The data binding isn't working on clicking the Refresh button. After clicking the Refresh button I am expecting to see 'Mary' and 'Sandra'.
Here's the JavaScript:
        $(function () {

        function viewModel() {
            var self = this;

            self.persons = ko.observableArray([]);
            self.persons.push({
                id: 1,
                name: 'John'
            });
            self.persons.push({
                id: 2,
                name: 'Paul'
            });

            self.refreshPersonList = function () {
                self.persons = ko.observableArray([]);
                self.persons.push({ id: 3, name: 'Mary' });
                self.persons.push({ id: 4, name: 'Sandra' });
            };
        }
        ko.applyBindings(new viewModel());
    });

And HTML:
<select data-bind="options: $root.persons(), optionsValue: 'id', optionsText: 'name'"></select>
    <button value="Refresh" data-bind="event: {click : $root.refreshPersonList() }">Refresh Person List</button>

A: Here you are creating a new array, breaking existing bindings:
self.persons = ko.observableArray([]);

Try emptying the array instead:
self.refreshPersonList = function () {
    self.persons.removeAll();  //Empty array
    self.persons.push({ id: 3, name: 'Mary' });
    self.persons.push({ id: 4, name: 'Sandra' });
};


text:
Q: Control if connected on my website with iphone or ipad Javascript I would like to know how can I know using javascript if the user is connected to my webpage with an Iphone or with an Ipad. Thanks

A: The following is an example of the 2 useragent strings returned when using Safari :

Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us)
  AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b
  Safari/531.21.10
Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+
  (KHTML, like Gecko) Version/3.0 Mobile/1C25 Safari/419.3

so you can use
navigator.userAgent.match(/iphone/i) for iPhone
or
navigator.userAgent.match(/ipad/i) for iPad


text:
Q: What does "Feather your nest" mean? What does the expression/idiom "feather your nest" mean?
I see a lot of references to it but I can't seem to figure out its meaning.

A: "Feather your nest" means to make a profit from some activity.
But it implies that you achieved this because of your position or not entirely honestly. So a politician who leaves office and then goes to work for a company who he had favored- not quite outright theft or bribery, but definitely suspect.
It comes from the sense of buying things to make your home or life (i.e. nest) more comfortable.

A: "Feathers" are a prime commodity that would make a (bird's) nest more comfortable than the average nest.
"Feathering one's nest" means making one's home or life in general fancier, or more comfortable than those of other similarly situated individuals, usually in the same neighborhood.
That's why it sometimes has "suspect" connotations referred to in Martin Beckett's answer (e.g. "How could 'one of us' live so much better?")


text:
Q: Issue with Xcode "No matching provisioning profiles found"
when I click on  Fix issue button, it didn't get resolved and it pops out with sentence "Creating a provisioning profile requires one or more devices to be registered with your team.  Connect a device to your Mac to add it to your team."
what should I do to fix this? Thanks

A: try this:
in "build settings"--"code signing"
change "code signing identity" to "Don't code sign"
change "provisioning profile" to "Automatic"

A: It is not necessary to have developer account to run and debug on your own device (iOs 9+).
Go to Build Settings > Code Signing, set Code Signing Identity as iOS Developer and Provisioning Profile as Automatic.

A: Go to Build Settings > Code Signing, set Code Signing Identity as "iOS Developer" or "iOS Distributor" as your need and Provisioning Profile as Automatic.
your problem will be solve by doing this.
and if you want to run app in your device and your device iOS version is iOS9 or above then you can run app in your device without provisioning profile.


text:
Q: get multiple sql results in one table For statistics I would like to get the number of valid inapp purchase per airline code per months. For a single month I do already have a query:
SELECT
    AirlineCode,
   COUNT(DISTINCT AppUser.Id) AppUser
FROM [followme.aero.live].[dbo].[AppUser]
JOIN [followme.aero.live].[dbo].[UserInAppPurchase]
ON AppUser.Id = UserInAppPurchase.UserId
WHERE ValidTo > '2018-01-01' AND PurchaseDate < '2018-01-01'
GROUP BY AirlineCode
ORDER BY AppUser DESC;

That would give me the January data. What I would like to get is the output not only for January but also for February, March and so on in 2018 in one single table.
How would I manage to do that?
Background:
In our database we have two tables, AppUser and UserInAppPurchase.
A user may or may not have inapp purchases in the table. A user may also have multiple entries here.
Important columns are AppUser.AirlineCode, UserInAppPurchase.ValidTo and UserInAppPurchase.PurchaseDate.
As I said, an AppUser may have multiple table entries or non at all. I'd like to check if one AppUser has at least one inapp purchase valid > than month x, then sum that per AirlineCode per month.

*

*x-axis: AirlineCode

*y-axis: Months of the year

We are using mssql

A: As each purchase might be computed for different months, you can't simply GROUP BY, you will have to somehow multiply each record for each month that applies before grouping.
You can use a CTE to generate month reference dates, then join against these. Note that I added the year of each month, you can omit if you don't need it (or just generate months up to 2018-12-01).
;WITH MonthsStartDates AS
(
    SELECT
        MonthStartDate = CONVERT(DATE, '2018-01-01')

    UNION ALL

    SELECT
        MonthStartDate = DATEADD(MONTH, 1, M.MonthStartDate)
    FROM
        MonthsStartDates AS M
    WHERE
        M.MonthStartDate <= '2020-01-01'
)
SELECT
    AirlineCode,
    Year = DATEPART(YEAR, M.MonthStartDate),
    Month = DATEPART(MONTH, M.MonthStartDate),
    AppUser = COUNT(DISTINCT AppUser.Id)
FROM
    [followme.aero.live].[dbo].[AppUser]
    INNER JOIN [followme.aero.live].[dbo].[UserInAppPurchase] ON AppUser.Id = UserInAppPurchase.UserId
    INNER JOIN MonthsStartDates AS M ON
        PurchaseDate < M.MonthStartDate AND
        ValidTo > M.MonthStartDate
GROUP BY
    AirlineCode,
    DATEPART(YEAR, M.MonthStartDate),
    DATEPART(MONTH, M.MonthStartDate)

A: Add YEAR() and MONTH() for PurchaseDate and add them to GROUP BY clause. Also change PurchaseDate range if you want to see the data from '2018-01-01'.
Check this sample :
SELECT
    AirlineCode
    ,YEAR(PurchaseDate) PurchaseYear
    ,MONTH(PurchaseDate) PurchaseMonth
   ,COUNT(DISTINCT AppUser.Id) AppUser
FROM [followme.aero.live].[dbo].[AppUser]
JOIN [followme.aero.live].[dbo].[UserInAppPurchase]
    ON AppUser.Id = UserInAppPurchase.UserId
WHERE ValidTo > '2018-01-01'
AND ( PurchaseDate >= '2018-01-01' AND PurchaseDate <= '2018-12-31')
GROUP BY AirlineCode,
    ,YEAR(PurchaseDate)
    ,MONTH(PurchaseDate)
ORDER BY AppUser DESC;


text:
Q: Can't modify a cell in UICollectionView I want to "flip" a cell in a UICollectionView when the user two-finger taps a cell.
I've added a gesture recognizer for two-touches, and a breakpoint in the target method shows that I've wired that part up correctly.
The target method at this stage just tries to add a subview to the cell, which should cover it with some different content, but nothing happens.
Am I trying to do something that I shouldn't?

A: For Flip cell Use this code:
[UIView transitionFromView:cell.contentView
                                    toView:newView
                                  duration:.5
                                   options:UIViewAnimationOptionTransitionFlipFromRight
                                completion:nil];


text:
Q: Code Igniter Welcome Page Does Not Appear (Internal Server Error) I just added Code Igniter to my XAMPP directory. When I open up this URL, I can see the Welcome screen:
http://localhost:1372/codeigniter/index.php/welcome

Now I want to remove the index.php part of this URL.
So on config.php in application/config, I did set the
$config['base_url'] to 'http://localhost:1372/codeigniter/';
and
$config['index_page'] to ''; .
Then I created an .htaccess page on the root directory and added these codes to it:
RewriteEngine on
RewriteCond $1 !^(index/.php|assets|images|js|css|uploads|favicon.png)
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^(.*)$ ./index.php/$1 [L]

So what now should happen is to see the default Welcome page on http://localhost:1372/codeigniter/ URL. But instead of that I get the Internal Server Error somehow!
So what is my mistake. What should I do now?

A: Remove all the codes of htaccess and save it, then refresh the page, see what happen.

A: You need to enable mod_rewrite extension.
open the file:
C:\xampp\apache\conf\httpd.conf

find the line:
#LoadModule rewrite_module modules/mod_rewrite.so

and uncoment it (remove the # symbol). thus this line must be look like this:
LoadModule rewrite_module modules/mod_rewrite.so

then search all lines with:
AllowOverride None

and change them to
AllowOverride All

then save the file and restart XAMPP


text:
Q: How to run an application and send file names? I've donwloaded the following maps:
andorra-latest.osm.pbf       https://download.geofabrik.de/europe/andorra-latest.osm.pbf
azores-latest.osm.pbf        https://download.geofabrik.de/europe/azores-latest.osm.pbf
cyprus-latest.osm.pbf        https://download.geofabrik.de/europe/cyprus-latest.osm.pbf

I need to merge the above maps. So I am using osmconvert to merge maps. I read this answer about merging maps.  So if I copy the following command and paste into command window, then it works fine - it creates all.osm.pbf file:

So desired file all.osm.pbf is created:

However, now I would like to call this command programmatically. I mean, I would like to call the above command through C#. So I've tried this code in my Console application:
static Process process = new Process();

static void Main(string[] args)
{
    process.EnableRaisingEvents = true;
    process.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(process_OutputDataReceived);
    process.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(process_ErrorDataReceived);
    process.Exited += new System.EventHandler(process_Exited);

    process.StartInfo.FileName = @"osmconvert.exe";
    process.StartInfo.Arguments = @"osmconvert.exe andorra-latest.osm.pbf --out-o5m | osmconvert.exe - azores-latest.osm.pbf | osmconvert.exe - cyprus-latest.osm.pbf -o=all.osm.pbf";
    process.StartInfo.UseShellExecute = false;
    process.StartInfo.RedirectStandardError = true;
    process.StartInfo.RedirectStandardOutput = true;

    process.Start();
    process.BeginErrorReadLine();
    process.BeginOutputReadLine();
}

But I always see the following error:

My files are located in D:\Downloads:

Could you say, please, what am I doing wrong?
UPDATE:
I've tried this code, however, the error is the same:
process.StartInfo.FileName = @"D:\Downloads\osmconvert.exe";
process.StartInfo.Arguments = @"D:\Downloads\osmconvert.exe D:\Downloads\andorra-latest.osm.pbf --out-o5m | D:\Downloads\osmconvert.exe - D:\Downloads\azores-latest.osm.pbf | D:\Downloads\osmconvert.exe - D:\Downloads\cyprus-latest.osm.pbf -o=D:\Downloads\all.osm.pbf";

and this approach:
process.StartInfo.FileName = @"D:\\Downloads\\osmconvert.exe";
process.StartInfo.Arguments = @"D:\\Downloads\\osmconvert.exe D:\\Downloads\\andorra-latest.osm.pbf --out-o5m | D:\\Downloads\\osmconvert.exe - D:\\Downloads\\azores-latest.osm.pbf | D:\\Downloads\\osmconvert.exe - D:\\Downloads\\cyprus-latest.osm.pbf -o=D:\\Downloads\\all.osm.pbf";

A: I think the problem is that you are sending osmconvert.exe as the first command line argument. The executable is probably trying to open itself and process it as map data. That likely fails because it is trying to be opened in a way (read/write) that isn't possible when it is also executing.
Instead, you could "programatically" invoke cmd.exe and tell it to execute the commands:
static Process process = new Process();

static void Main(string[] args)
{
    process.Exited += new System.EventHandler(process_Exited);

    // create a cmd.exe process.
    process.StartInfo.FileName = @"cmd.exe";
    process.StartInfo.UseShellExecute = false;
    process.StartInfo.RedirectStandardInput = true;
    process.Start();

    var input = process.StandardInput;
    // tell cmd.exe to do your bidding.
    input.WriteLine("osmconvert.exe andorra-latest.osm.pbf --out-o5m | osmconvert.exe - azores-latest.osm.pbf | osmconvert.exe - cyprus-latest.osm.pbf -o=all.osm.pbf");
    // then tell it to exit.
    input.WriteLine("exit");
    // process.Exited event should fire at this point.
    // or you could process.WaitForExit() instead.
}


text:
Q: Can't extract og:image with domcrawler but can with og:description So I'm trying to fetch some open graph data with domcrawler using the php package "Goutte".
Specifically, I'm trying to extract the og:image.
$goutteClient = new Client();
$guzzleClient = new GuzzleClient(array(
    'timeout' => 15,
));

$goutteClient->setClient($guzzleClient);

try {
    $crawler = $goutteClient->request('GET', $url);
    $crawlerError = false;
} catch (RequestException $e) {
    $crawlerError = true;
}

$OGimage = $crawler->filterXPath("//meta[@name='image']")->attr('content');
//find open graph image
dd($OGimage);

So if try this out with this URL, for example:
https://www.bbc.com/sport/football/49421006
it will return an empty string.
However, if I put in meta[@name='description'] instead of image, it will return

"France international Franck Ribery joins Serie A side Fiorentina on a
  free transfer after leaving Bayern Munich in the summer."

But when I view the source of this page, there's clearly an og:image tag.
Why is this returning empty but description does not? Worth noting that ALL of the open graph tags are returning empty strings with this EXCEPT description, which works just fine.


text:
Q: Copy array into ArrayList element I'm using an arrayList that I'm adding entries from a database via a loop to. Within that loop, I fill an array with the fields from the row that I'm reading. I assign this array to the arrayList.
I understand from googling today that when I call arrayList.add() I'm passing a reference to the array instead of copying the array into the arrayList element. This is not what I want.
What's a better way to go about this?
    Cursor cursor = this.managedQuery(Record.Records.CONTENT_URI, projection,       Record.Records.START_TIME + " > " + 1, null, Record.Records.START_TIME + " ASC");

    int i, n, x = 0;
    List<String[]> sleepCollection = new ArrayList<String[]>();
    String[] sleepItem = new String[7];

    for (i=0;i<cursor.getCount();i++)
    {
        if (i==0)
            cursor.moveToFirst();

        for (n=0;n<5;n++)
            sleepItem[n] = cursor.getString(n);

        // hours, duration
        sleepItem[5] = String.valueOf((((Long.valueOf(sleepItem[1])-Long.valueOf(sleepItem[0]))/1000)+(Long.valueOf(sleepItem[4])*60))/60/60);
        // minutes, duration
        sleepItem[6] = String.valueOf((((Long.valueOf(sleepItem[1])-Long.valueOf(sleepItem[0]))/1000)+(Long.valueOf(sleepItem[4])*60))/60%60);

        if ( (x > 0) &&
             (Long.valueOf(sleepCollection.get(x-1)[1]) - Long.valueOf(sleepItem[0]) <= 7200000) // record started within 2 hours if end of previous record
           )
        {
            // set rating
            sleepCollection.get(x-1)[2] = String.valueOf((Float.valueOf(sleepCollection.get(x-1)[2])) + Float.valueOf(sleepItem[2]) / 2);

            sleepCollection.get(x-1)[1] = sleepItem[1]; // set previous record's end date equal to current record's end date
            // then add duration of previous record to current record (hours, then minutes)
            sleepCollection.get(x-1)[5] = String.valueOf(Integer.valueOf(sleepItem[5])+Integer.valueOf(sleepCollection.get(x-1)[5]));
            sleepCollection.get(x-1)[6] = String.valueOf(Integer.valueOf(sleepItem[6])+Integer.valueOf(sleepCollection.get(x-1)[6]));
            // check if minutes are 60 or over
            if (Integer.valueOf(sleepCollection.get(x-1)[6]) >= 60)
            {
                // if so, subtract 60 from minutes
                sleepCollection.get(x-1)[6] = String.valueOf(Integer.valueOf(sleepCollection.get(x-1)[6]) - 60);
                // and add an hour to hours
                sleepCollection.get(x-1)[5] = String.valueOf(Integer.valueOf(sleepCollection.get(x-1)[5]+1));
            }
        }
        else
        {
            // this passes a reference of sleepItem. I want sleepCollection to actually contain the array and not a reference to it. What's the best way to do that?
            sleepCollection.add(sleepItem);
            x++;
        }

A: This seems to be the gist of your problem
// This passes a reference of sleepItem. I want sleepCollection to
// actually contain the array and not a reference to it.   What's
// the best way to do that?

What you are asking does not (literally) make sense.  In Java, it does not sense to say that you want something to contain an array rather a reference to an array.  The array and the reference are fundamentally the same thing as far as the language is concerned.
(From a representational perspective, the "thing" that is in the ArrayList is always going to be a reference to an array.  The list uses a backing array which is an array of references.  It doesn't somehow internalize the argument array that you "add".)

Actually, what I think you are really asking is how to make each element in the list a reference to a different array.  The answer to that is to allocate a new array on each array iteration.  Or you could do this:
    sleepCollection.add(sleepItem.clone());

A: String[] sleepItem = new String[7];

must be moved to the loop inner, else entries of your arraylist will contain the same row data ;-).


text:
Q: Archive files task: Access is denied when writing zip file I am getting access denied during execution of an Archive files task.
It's part of a release pipeline to deploy a web site to a server for which I want to back up existing files before deploying the release.
The Azure Pipelines agent on the server runs under the NT AUTHORITY\SYSTEM account.
It can create the directory into which I want to deploy the archive file but the action of reading the files to archive and writing the file itself fails with the message "Access is denied."
I'm guessing this is more about my understanding of which account is involved and how to grant read and write privileges on directories to that account, however could anyone advise as to what I need to do.
My guess is I need to grant read and write privileges on the relevant directories to the NT AUTHORITY\SYSTEM account but if that is what's needed, I can't edit the security permissions on the relevant directories to grant those rights to that account.
I've put the debug output below for reference.
Any advice gratefully received.
2022-06-24T14:43:16.9751569Z ##[debug]Evaluating condition for step: 'Back Up \\bdcanasr11\Phoenix\Dev\MyDir\Api\A'
2022-06-24T14:43:16.9760355Z ##[debug]Evaluating: succeeded()
2022-06-24T14:43:16.9760696Z ##[debug]Evaluating succeeded:
2022-06-24T14:43:16.9761264Z ##[debug]=> True
2022-06-24T14:43:16.9761776Z ##[debug]Result: True
2022-06-24T14:43:16.9762139Z ##[section]Starting: Back Up \\bdcanasr11\Phoenix\Dev\MyDir\Api\A
2022-06-24T14:43:17.0063977Z ==============================================================================
2022-06-24T14:43:17.0064416Z Task         : Archive files
2022-06-24T14:43:17.0064758Z Description  : Compress files into .7z, .tar.gz, or .zip
2022-06-24T14:43:17.0064950Z Version      : 2.179.0
2022-06-24T14:43:17.0065223Z Author       : Microsoft Corporation
2022-06-24T14:43:17.0065603Z Help         : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/archive-files
2022-06-24T14:43:17.0065901Z ==============================================================================
2022-06-24T14:43:17.0405127Z ##[debug]Using node path: D:\AzureDevOpsAgents\MyApp\vsts-agent-win-x64-2.204.0\externals\node10\bin\node.exe
2022-06-24T14:43:17.2021280Z ##[debug]agent.TempDirectory=D:\AzureDevOpsAgents\MyApp\vsts-agent-win-x64-2.204.0\_work\_temp
2022-06-24T14:43:17.2054683Z ##[debug]loading inputs and endpoints
2022-06-24T14:43:17.2067557Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2022-06-24T14:43:17.2093287Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2022-06-24T14:43:17.2095967Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2022-06-24T14:43:17.2098284Z ##[debug]loading INPUT_ARCHIVEFILE
2022-06-24T14:43:17.2100554Z ##[debug]loading INPUT_ARCHIVETYPE
2022-06-24T14:43:17.2102073Z ##[debug]loading INPUT_INCLUDEROOTFOLDER
2022-06-24T14:43:17.2103776Z ##[debug]loading INPUT_QUIET
2022-06-24T14:43:17.2105730Z ##[debug]loading INPUT_REPLACEEXISTINGARCHIVE
2022-06-24T14:43:17.2107518Z ##[debug]loading INPUT_ROOTFOLDERORFILE
2022-06-24T14:43:17.2109105Z ##[debug]loading INPUT_SEVENZIPCOMPRESSION
2022-06-24T14:43:17.2110744Z ##[debug]loading INPUT_TARCOMPRESSION
2022-06-24T14:43:17.2112310Z ##[debug]loading INPUT_VERBOSE
2022-06-24T14:43:17.2118472Z ##[debug]loaded 12
2022-06-24T14:43:17.2122543Z ##[debug]Agent.ProxyUrl=undefined
2022-06-24T14:43:17.2123656Z ##[debug]Agent.CAInfo=undefined
2022-06-24T14:43:17.2124156Z ##[debug]Agent.ClientCert=undefined
2022-06-24T14:43:17.2124693Z ##[debug]Agent.SkipCertValidation=undefined
2022-06-24T14:43:17.2132980Z ##[debug]System.DefaultWorkingDirectory=D:\AzureDevOpsAgents\MyApp\vsts-agent-win-x64-2.204.0\_work\r1\a
2022-06-24T14:43:17.2140004Z ##[debug]rootFolderOrFile=\\bdcanasr11\Phoenix\Dev\MyDir\Api\A
2022-06-24T14:43:17.2140951Z ##[debug]makeAbsolute:\\bdcanasr11\Phoenix\Dev\MyDir\Api\A
2022-06-24T14:43:17.2143759Z ##[debug]includeRootFolder=true
2022-06-24T14:43:17.2145986Z ##[debug]archiveType=zip
2022-06-24T14:43:17.2147232Z ##[debug]archiveFile=D:\MyWebApi\20220624Test\20220624Test.zip
2022-06-24T14:43:17.2148627Z ##[debug]replaceExistingArchive=false
2022-06-24T14:43:17.2149980Z ##[debug]verbose=false
2022-06-24T14:43:17.2151363Z ##[debug]quiet=false
2022-06-24T14:43:17.2151922Z ##[debug]repoRoot: D:\AzureDevOpsAgents\MyApp\vsts-agent-win-x64-2.204.0\_work\r1\a
2022-06-24T14:43:17.2155800Z ##[debug]win: Win
2022-06-24T14:43:17.2159043Z ##[debug]check path : D:\AzureDevOpsAgents\MyApp\vsts-agent-win-x64-2.204.0\_work\_tasks\ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0\2.179.0\task.json
2022-06-24T14:43:17.2163584Z ##[debug]adding resource file: D:\AzureDevOpsAgents\MyApp\vsts-agent-win-x64-2.204.0\_work\_tasks\ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0\2.179.0\task.json
2022-06-24T14:43:17.2164271Z ##[debug]system.culture=en-US
2022-06-24T14:43:17.2195378Z Found 1 files
2022-06-24T14:43:17.2196969Z Archiving file: A
2022-06-24T14:43:17.2197456Z ##[debug]Listing all 1 files to archive:
2022-06-24T14:43:17.2199432Z ##[debug]A
2022-06-24T14:43:17.2200306Z Archive file: D:\MyWebApi\20220624Test\20220624Test.zip already exists.  Attempting to add files to it.
2022-06-24T14:43:17.2201340Z ##[debug]Checking for archive destination folder:D:\MyWebApi\20220624Test
2022-06-24T14:43:17.2204459Z ##[debug]Creating archive with 7-zip: D:\MyWebApi\20220624Test\20220624Test.zip
2022-06-24T14:43:17.2206456Z ##[debug]which 'D:\AzureDevOpsAgents\MyApp\vsts-agent-win-x64-2.204.0\_work\_tasks\ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0\2.179.0\7zip\7z.exe'
2022-06-24T14:43:17.2213804Z ##[debug]found: 'D:\AzureDevOpsAgents\MyApp\vsts-agent-win-x64-2.204.0\_work\_tasks\ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0\2.179.0\7zip\7z.exe'
2022-06-24T14:43:17.2215033Z ##[debug]D:\AzureDevOpsAgents\MyApp\vsts-agent-win-x64-2.204.0\_work\_tasks\ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0\2.179.0\7zip\7z.exe arg: a
2022-06-24T14:43:17.2216070Z ##[debug]D:\AzureDevOpsAgents\MyApp\vsts-agent-win-x64-2.204.0\_work\_tasks\ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0\2.179.0\7zip\7z.exe arg: -tzip
2022-06-24T14:43:17.2217269Z ##[debug]sevenZipCompression=5
2022-06-24T14:43:17.2218041Z ##[debug]D:\AzureDevOpsAgents\MyApp\vsts-agent-win-x64-2.204.0\_work\_tasks\ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0\2.179.0\7zip\7z.exe arg: -mx=5
2022-06-24T14:43:17.2219052Z ##[debug]D:\AzureDevOpsAgents\MyApp\vsts-agent-win-x64-2.204.0\_work\_tasks\ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0\2.179.0\7zip\7z.exe arg: D:\MyWebApi\20220624Test\20220624Test.zip
2022-06-24T14:43:17.2220836Z ##[debug]Agent.TempDirectory=D:\AzureDevOpsAgents\MyApp\vsts-agent-win-x64-2.204.0\_work\_temp
2022-06-24T14:43:17.2224864Z ##[debug]D:\AzureDevOpsAgents\MyApp\vsts-agent-win-x64-2.204.0\_work\_tasks\ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0\2.179.0\7zip\7z.exe arg: @D:\AzureDevOpsAgents\MyApp\vsts-agent-win-x64-2.204.0\_work\_temp\v493x3tr09
2022-06-24T14:43:17.2226221Z ##[debug]cwd (include root folder)= \\bdcanasr11\Phoenix\Dev\MyDir\Api
2022-06-24T14:43:17.2227569Z ##[debug]exec tool: D:\AzureDevOpsAgents\MyApp\vsts-agent-win-x64-2.204.0\_work\_tasks\ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0\2.179.0\7zip\7z.exe
2022-06-24T14:43:17.2228466Z ##[debug]arguments:
2022-06-24T14:43:17.2229016Z ##[debug]   a
2022-06-24T14:43:17.2229545Z ##[debug]   -tzip
2022-06-24T14:43:17.2230130Z ##[debug]   -mx=5
2022-06-24T14:43:17.2230616Z ##[debug]   D:\MyWebApi\20220624Test\20220624Test.zip
2022-06-24T14:43:17.2231196Z ##[debug]   @D:\AzureDevOpsAgents\MyApp\vsts-agent-win-x64-2.204.0\_work\_temp\v493x3tr09
2022-06-24T14:43:17.2238318Z [command]"D:\AzureDevOpsAgents\MyApp\vsts-agent-win-x64-2.204.0\_work\_tasks\ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0\2.179.0\7zip\7z.exe" a -tzip -mx=5 D:\MyWebApi\20220624Test\20220624Test.zip "@D:\AzureDevOpsAgents\MyApp\vsts-agent-win-x64-2.204.0\_work\_temp\v493x3tr09"
2022-06-24T14:43:17.2946854Z
2022-06-24T14:43:17.2947545Z WARNING: Access is denied.
2022-06-24T14:43:17.2947741Z A
2022-06-24T14:43:17.2947822Z
2022-06-24T14:43:17.2947895Z
2022-06-24T14:43:17.2948377Z 7-Zip [64] 16.00 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-10
2022-06-24T14:43:17.2948663Z
2022-06-24T14:43:17.2948945Z Open archive: D:\MyWebApi\20220624Test\20220624Test.zip
2022-06-24T14:43:17.2949201Z --
2022-06-24T14:43:17.2949743Z Path = D:\MyWebApi\20220624Test\20220624Test.zip
2022-06-24T14:43:17.2949999Z Type = zip
2022-06-24T14:43:17.2950186Z Physical Size = 22
2022-06-24T14:43:17.2950276Z
2022-06-24T14:43:17.2950451Z Scanning the drive:
2022-06-24T14:43:17.2950656Z 0 files, 0 bytes
2022-06-24T14:43:17.2950745Z
2022-06-24T14:43:17.2950984Z Updating archive: D:\MyWebApi\20220624Test\20220624Test.zip
2022-06-24T14:43:17.2951155Z
2022-06-24T14:43:17.2951330Z Items to compress: 0
2022-06-24T14:43:17.2951424Z
2022-06-24T14:43:17.2951492Z
2022-06-24T14:43:17.2952294Z Files read from disk: 0
2022-06-24T14:43:17.2952525Z Archive size: 22 bytes (1 KiB)
2022-06-24T14:43:17.2952636Z
2022-06-24T14:43:17.2952832Z Scan WARNINGS for files and folders:
2022-06-24T14:43:17.2952947Z
2022-06-24T14:43:17.2953131Z A : Access is denied.
2022-06-24T14:43:17.2953690Z ----------------
2022-06-24T14:43:17.2953882Z Scan WARNINGS: 1
2022-06-24T14:43:17.2955384Z ##[debug]execResult: {"code":1,"stdout":"\r\n7-Zip [64] 16.00 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-10\r\n\r\nOpen archive: D:\\MyWebApi\\20220624Test\\20220624Test.zip\r\n--\r\nPath = D:\\MyWebApi\\20220624Test\\20220624Test.zip\r\nType = zip\r\nPhysical Size = 22\r\n\r\nScanning the drive:\r\n0 files, 0 bytes\r\n\r\nUpdating archive: D:\\MyWebApi\\20220624Test\\20220624Test.zip\r\n\r\nItems to compress: 0\r\n\r\n\r\nFiles read from disk: 0\r\nArchive size: 22 bytes (1 KiB)\r\n\r\nScan WARNINGS for files and folders:\r\n\r\nA : Access is denied.\r\n----------------\r\nScan WARNINGS: 1\r\n","stderr":"\r\nWARNING: Access is denied.\r\nA\r\n\r\n"}
2022-06-24T14:43:17.2957637Z ##[debug]Archive creation failed for archive file: D:\MyWebApi\20220624Test\20220624Test.zip
code: 1
stdout:
7-Zip [64] 16.00 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-10

Open archive: D:\MyWebApi\20220624Test\20220624Test.zip
--
Path = D:\MyWebApi\20220624Test\20220624Test.zip
Type = zip
Physical Size = 22

Scanning the drive:
0 files, 0 bytes

Updating archive: D:\MyWebApi\20220624Test\20220624Test.zip

Items to compress: 0

Files read from disk: 0
Archive size: 22 bytes (1 KiB)

Scan WARNINGS for files and folders:

A : Access is denied.
----------------
Scan WARNINGS: 1

stderr:
WARNING: Access is denied.
A

error: undefined;
2022-06-24T14:43:17.2996365Z ##[error]Error: Archive creation failed for archive file: D:\MyWebApi\20220624Test\20220624Test.zip
code: 1
stdout:
7-Zip [64] 16.00 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-10

Open archive: D:\MyWebApi\20220624Test\20220624Test.zip
--
Path = D:\MyWebApi\20220624Test\20220624Test.zip
Type = zip
Physical Size = 22

Scanning the drive:
0 files, 0 bytes

Updating archive: D:\MyWebApi\20220624Test\20220624Test.zip

Items to compress: 0

Files read from disk: 0
Archive size: 22 bytes (1 KiB)

Scan WARNINGS for files and folders:

A : Access is denied.

Scan WARNINGS: 1

stderr:
WARNING: Access is denied.
A

error: undefined;
2022-06-24T14:43:17.3006273Z ##[debug]Processed: ##vso[task.issue type=error;]Error: Archive creation failed for archive file: D:\MyWebApi\20220624Test\20220624Test.zip %0Acode: 1 %0Astdout: %0D%0A7-Zip [64] 16.00 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-10%0D%0A%0D%0AOpen archive: D:\MyWebApi\20220624Test\20220624Test.zip%0D%0A--%0D%0APath = D:\MyWebApi\20220624Test\20220624Test.zip%0D%0AType = zip%0D%0APhysical Size = 22%0D%0A%0D%0AScanning the drive:%0D%0A0 files, 0 bytes%0D%0A%0D%0AUpdating archive: D:\MyWebApi\20220624Test\20220624Test.zip%0D%0A%0D%0AItems to compress: 0%0D%0A%0D%0A%0D%0AFiles read from disk: 0%0D%0AArchive size: 22 bytes (1 KiB)%0D%0A%0D%0AScan WARNINGS for files and folders:%0D%0A%0D%0AA : Access is denied.%0D%0A----------------%0D%0AScan WARNINGS: 1%0D%0A %0Astderr: %0D%0AWARNING: Access is denied.%0D%0AA%0D%0A%0D%0A %0Aerror: undefined;
2022-06-24T14:43:17.3008594Z ##[debug]task result: Failed
2022-06-24T14:43:17.3011129Z ##[error]Archive creation failed for archive file: D:\MyWebApi\20220624Test\20220624Test.zip
code: 1
stdout:
7-Zip [64] 16.00 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-10

Open archive: D:\MyWebApi\20220624Test\20220624Test.zip
--
Path = D:\MyWebApi\20220624Test\20220624Test.zip
Type = zip
Physical Size = 22

Scanning the drive:
0 files, 0 bytes

Updating archive: D:\MyWebApi\20220624Test\20220624Test.zip

Items to compress: 0

Files read from disk: 0
Archive size: 22 bytes (1 KiB)

Scan WARNINGS for files and folders:

A : Access is denied.
----------------
Scan WARNINGS: 1

stderr:
WARNING: Access is denied.
A

error: undefined;
2022-06-24T14:43:17.3013937Z ##[debug]Processed: ##vso[task.issue type=error;]Archive creation failed for archive file: D:\MyWebApi\20220624Test\20220624Test.zip %0Acode: 1 %0Astdout: %0D%0A7-Zip [64] 16.00 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-10%0D%0A%0D%0AOpen archive: D:\MyWebApi\20220624Test\20220624Test.zip%0D%0A--%0D%0APath = D:\MyWebApi\20220624Test\20220624Test.zip%0D%0AType = zip%0D%0APhysical Size = 22%0D%0A%0D%0AScanning the drive:%0D%0A0 files, 0 bytes%0D%0A%0D%0AUpdating archive: D:\MyWebApi\20220624Test\20220624Test.zip%0D%0A%0D%0AItems to compress: 0%0D%0A%0D%0A%0D%0AFiles read from disk: 0%0D%0AArchive size: 22 bytes (1 KiB)%0D%0A%0D%0AScan WARNINGS for files and folders:%0D%0A%0D%0AA : Access is denied.%0D%0A----------------%0D%0AScan WARNINGS: 1%0D%0A %0Astderr: %0D%0AWARNING: Access is denied.%0D%0AA%0D%0A%0D%0A %0Aerror: undefined;
2022-06-24T14:43:17.3023696Z ##[debug]Processed: ##vso[task.complete result=Failed;]Archive creation failed for archive file: D:\MyWebApi\20220624Test\20220624Test.zip %0Acode: 1 %0Astdout: %0D%0A7-Zip [64] 16.00 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-10%0D%0A%0D%0AOpen archive: D:\MyWebApi\20220624Test\20220624Test.zip%0D%0A--%0D%0APath = D:\MyWebApi\20220624Test\20220624Test.zip%0D%0AType = zip%0D%0APhysical Size = 22%0D%0A%0D%0AScanning the drive:%0D%0A0 files, 0 bytes%0D%0A%0D%0AUpdating archive: D:\MyWebApi\20220624Test\20220624Test.zip%0D%0A%0D%0AItems to compress: 0%0D%0A%0D%0A%0D%0AFiles read from disk: 0%0D%0AArchive size: 22 bytes (1 KiB)%0D%0A%0D%0AScan WARNINGS for files and folders:%0D%0A%0D%0AA : Access is denied.%0D%0A----------------%0D%0AScan WARNINGS: 1%0D%0A %0Astderr: %0D%0AWARNING: Access is denied.%0D%0AA%0D%0A%0D%0A %0Aerror: undefined;
2022-06-24T14:43:17.3044788Z ##[section]Finishing: Back Up \\bdcanasr11\Phoenix\Dev\MyDir\Api\A


text:
Q: Understanding responseEncoding i have the following:
responseEncoding="utf-8" in the globalization web.config
does that mean if i put the following in my url parameter:
%253Cscript%253Ealert%2528%2527vulnerability%2527%2529%253C%252Fscript%253E

it will return
<script>alert('vulnerability')</script>

or will it prevent it from doing so?
i'm a little confused. could someone please show me an example of what the utf-8 encoding really does?
Thank you!

A: UTF-8 encoding in response only means that your webserver supports unicode/utf-8, and has nothing to do with decoding the URL in your example. If you are worried about security issues such as xss attacks, you need to consider html encoding text you get from forms or request params in URLs before presenting them on pages.


text:
Q: How to check if an Android device has voice capabilities Does anyone know a good way of programmaticaly checking if an Android device, phone or tablet, has voice capabilities?
By voice capabilities I mean capability to make phone calls. I know there are devices, like Galaxy tab in North America, that don't have this capability.

A: I haven't tried this myself, but it looks like the details you need would be in the TelephonyManager:
private boolean hasPhoneAbility()
{
   TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
   if(telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE)
       return false;

   return true;
}

A: I know this question was posted a long time ago, but I still thought I would post the solution I came up with that works for me so far, just so anyone with the same problem can benefit. (Because it seems like lots of people are having trouble finding a solution).
I just checked for the device's voicemail number, and obviously if it doesn't have one, then it is not a phone. In my code, to check this, it is tm.getVoiceMailNumber();
Here's what I did:
callButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {

            TelephonyManager tm = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
            String ableToMakePhoneCalls = tm.getVoiceMailNumber(); //check device for voicemail number (null means no voicemail number).

            if(ableToMakePhoneCalls == null){ //If the device does not have voicemail, then it must not be a phone. So it can't call.

                //I displayed an alert dialog box here

            }
            else{

                String phoneNum = "tel:8885554444";

                Intent intentPhone = new Intent(android.content.Intent.ACTION_CALL);
                intentPhone.setData(Uri.parse(phoneNum));

                startActivity(intentPhone);
            }
        }
    });

A: In theory, you should be able to use Intent.resolveActivity to do this. There's a problem (described here) with Galaxy tabs in particular. They evidently report that they have calling capability. You can even resolve an intent successfully. Unfortunately, it resolves to a no-op activity.

A: I would assume that prepare() would fail if there is not mic available:
  mRecorder = new MediaRecorder();
  mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
  mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
  mRecorder.setOutputFile(audio_file);
  mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
  try {
      mRecorder.prepare();
      mRecorder.start();
  } catch (Exception e) {}


text:
Q: Bluetooth (Atheros AR3012 0CF3:3004) does not work on Ubuntu 16.04 Edit: This is on a fresh install of the OS.
Hardware details
Laptop
Lenovo Ideapad Z510
Kernel
Linux ip-z510 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Bluetooth
Atheros Communications, Inc. AR3012 Bluetooth 4.0 (0cf3:3004) (rev 00.02) [1]
Kernel modules in use: bnep,btbcm,btrtl,btusb,rfcomm,btintel [2]
Expected kernel module to use: ath3k [3]
WLAN [4]
Qualcomm Atheros AR9485 Wireless Network Adapter [168c:0032] (rev 01)
Subsystem: Lenovo AR9485 Wireless Network Adapter [17aa:3218]
Kernel driver in use: ath9k
Kernel modules: ath9k, wl
Sources
[1] usb-devices | awk '/3004/' RS=:
T:  Bus=03 Lev=01 Prnt=01 Port=06 Cnt=03 Dev#=  5 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0cf3 ProdID=3004 Rev=00.02
S:  Manufacturer=Atheros Communications
S:  Product=Bluetooth USB Host Controller
S:  SerialNumber=Alaska Day 2006
C:  #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb

[2] I'm not sure how to ascertain which driver is in use. However, lsmod | grep -i bluetooth yields:
bluetooth             520192  29 bnep,btbcm,btrtl,btusb,rfcomm,btintel

[3]

*

*According to https://wireless.wiki.kernel.org/en/users/drivers/ath3k?s[]=ar3012, a combination of these files must be used, though I am not certain which ones would apply for my case:
For AR3012, you can find the "AthrBT_0x01020200.dfu" and "ramps_0x01020200_26.dfu" or "ramps_0x01020200_40.dfu" on the linux-firmware git tree:
git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/ar3k/

*modinfo ath3k and modinfo ath3k | grep 3004 confirm my expectation:
filename:       /lib/modules/4.4.0-59-generic/kernel/drivers/bluetooth/ath3k.ko
firmware:       ath3k-1.fw
license:        GPL
version:        1.0
description:    Atheros AR30xx firmware driver
author:         Atheros Communications
alias:          usb:v0CF3p3004d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v04CAp3004d*dc*dsc*dp*ic*isc*ip*in*

[4] lspci -knn | grep Net -A2:
09:00.0 Network controller [0280]: Qualcomm Atheros AR9485 Wireless Network Adapter [168c:0032] (rev 01)
    Subsystem: Lenovo AR9485 Wireless Network Adapter [17aa:3218]
    Kernel driver in use: ath9k
    Kernel modules: ath9k, wl

Additional notes/details:

*

*Loading ath3k on boot via /etc/modules OR via sudo modprobe ath3k does not make BT work. dmesg | tail only reports:
[   17.178240] usbcore: registered new interface driver ath3k

*dmesg | grep -i blue:
[    1.621634] usb 3-7: Product: Bluetooth USB Host Controller
[   16.828268] Bluetooth: Core ver 2.21
[   16.828279] Bluetooth: HCI device and connection manager initialized
[   16.828282] Bluetooth: HCI socket layer initialized
[   16.828284] Bluetooth: L2CAP socket layer initialized
[   16.828288] Bluetooth: SCO socket layer initialized
[   27.793692] usb 3-7: Product: Bluetooth USB Host Controller
[   36.501132] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   36.501134] Bluetooth: BNEP filters: protocol multicast
[   36.501138] Bluetooth: BNEP socket layer initialized
[   46.280055] Bluetooth: hci0 command 0x0c38 tx timeout
[   48.284048] Bluetooth: hci0 command 0x0c39 tx timeout
[   50.288051] Bluetooth: hci0 command 0x0c05 tx timeout
[   50.739075] Bluetooth: RFCOMM TTY layer initialized
[   50.739086] Bluetooth: RFCOMM socket layer initialized
[   50.739090] Bluetooth: RFCOMM ver 1.11
[   52.292034] Bluetooth: hci0 command 0x0c16 tx timeout

*rfkill list; hciconfig hci0; systemctl status bluetooth.service
0: ideapad_wlan: Wireless LAN
    Soft blocked: no
    Hard blocked: no
1: ideapad_bluetooth: Bluetooth
    Soft blocked: no
    Hard blocked: no
2: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: no
3: hci0: Bluetooth
    Soft blocked: no
    Hard blocked: no
hci0:   Type: BR/EDR  Bus: USB
    BD Address: A4:DB:30:D1:E5:52  ACL MTU: 1022:8  SCO MTU: 183:5
    DOWN
    RX bytes:904 acl:0 sco:0 events:38 errors:0
    TX bytes:392 acl:0 sco:0 commands:47 errors:9

● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2017-01-21 13:37:47 IST; 39min ago
     Docs: man:bluetoothd(8)
 Main PID: 896 (bluetoothd)
   Status: "Running"
   CGroup: /system.slice/bluetooth.service
           └─896 /usr/lib/bluetooth/bluetoothd

Jan 21 13:38:01 ip-z510 bluetoothd[896]: Endpoint registered: sender=:1.53 path=/MediaEndpoint/A2DPSink
Jan 21 13:38:04 ip-z510 bluetoothd[896]: Failed to set mode: Failed (0x03)
Jan 21 13:38:14 ip-z510 bluetoothd[896]: Failed to set mode: Failed (0x03)
Jan 21 13:42:55 ip-z510 bluetoothd[896]: Endpoint unregistered: sender=:1.53 path=/MediaEndpoint/A2DPSource
Jan 21 13:42:55 ip-z510 bluetoothd[896]: Endpoint unregistered: sender=:1.53 path=/MediaEndpoint/A2DPSink
Jan 21 13:43:08 ip-z510 bluetoothd[896]: Failed to set mode: Failed (0x03)
Jan 21 13:43:10 ip-z510 bluetoothd[896]: Endpoint registered: sender=:1.100 path=/MediaEndpoint/A2DPSource
Jan 21 13:43:10 ip-z510 bluetoothd[896]: Endpoint registered: sender=:1.100 path=/MediaEndpoint/A2DPSink
Jan 21 13:43:21 ip-z510 bluetoothd[896]: Failed to set mode: Failed (0x03)
Jan 21 13:46:32 ip-z510 bluetoothd[896]: Failed to set mode: Failed (0x03)

Behavior

*

*The bluetooth icon may or may not load in the tray on login.

*The bluetooth toggle may or may not work.

*When the bluetooth toggle works, nothing is found on a search. Tried my phone and bluetooth audio.

Similar questions
Bluetooth (Atheros AR3012) not working on Ubuntu 16.04 -- no answer
Bluetooth not working in Ubuntu 16.04 with [0cf3:3004] Atheros adapter -- Pilot6's solution does not work (this, I attempted before the clean OS reinstall yesterday).

A: I had the same problems, I've found this form which is worked for me (https://forums.bunsenlabs.org/viewtopic.php?id=4375)
in short:
try
sudo bluethoothcli

if it says: "no default controller" then this solution might work for you:

*

*download the listed drivers here (https://github.com/winterheart/broadcom-bt-firmware/tree/master/brcm)

*make a directory called BCM.hcd

sudo mkdir -p /lib/firmware/brcm/BCM.hcd

*copy drivers to that folder like

sudo cp BCM43142A0* /lib/firmware/brcm/BCM.hcd

completely shutdown your computer, then turn on and try
sudo bluethoothcli

if you were able to type
list # or
scan on

and it print controller name or found some devices then it's solved for you.


text:
Q: Python ftplib timing out I'm trying to use ftplib to get a file listing and download any new files since my last check. The code I'm trying to run so far is:
#!/usr/bin/env python
from ftplib import FTP
import sys

host = 'ftp.***.com'
user = '***'
passwd = '***'

try:
    ftp = FTP(host)
    ftp.login(user, passwd)
except:
    print 'Error connecting to FTP server'
    sys.exit()

try:
    ftp.retrlines('LIST')
except:
    print 'Error fetching file listing'
    ftp.quit()
    sys.exit()

ftp.quit()

Whenever I run this it times out when I try to retrieve the listing. Any ideas?

A: If Passive Mode is failing for some reason try:
ftp.set_pasv(False)

to use Active Mode.

A: Most likely a conflict between Active and Passive mode.  Make sure that one of the following is true:

*

*The server supports PASV mode and your client is setting PASV mode

*If the server does not support passive mode, then your firewall must support active mode FTP transfers.

EDIT: I looked at the docs, and found that in Python 2.1 and later the default is passive mode.  What server are you talking to, and di you know if it supports passive mode?
In active mode (non-PASV) the client sends a PORT command telling the server to initiate the DATA connection on that port, which requires your firewall be aware of the PORT command so it can forward the incoming DATA connection to you -- few firewalls support this.  In passive mode the client opens the DATA connection and the server uses it (the server is "passive" in opening the data connection).
Just in case you're not using passive mode, do a ftp.set_pasv(True) and see if that makes a difference.


text:
Q: Expand a custom attribute in Active Directory 2003 I'd like to expand custom attributes in AD 2003. Currently, we are using +50 custom attributes. but we need to add 40 custom attributes in order to support other project.
My question is, is there any performance issue for it? is there any limitation for custom attributes?
Thanks in advance.

A: For the number of attributes, I don't think so.  Just look at Exchange - it has ballooned the number of attributes significantly.
There may be a performance issue with queries if an attribute isn't indexed.  Probably not an issue in smaller environments though.  Just an option to be aware of when creating the attribute.
If the attribute changes frequently, it may not be a good candidate for the global catalog (aka partial attribute set or filtered attribute set) in large distributed environments with multiple domains.  That is due to the attribute being replicated to all domain controllers in the forest.  "Frequently" is somewhat subjective.  An example of this would be the lastLogon attribute, which is not replicated to the GC, but lastLogonTimestamp, which is.
If the attribute will hold data, and you are concerned about limiting the size of the objects, you may use the rangeUpper attribute.  This may be useful to prevent consumers from storing 10 Mbyte strings in an attribute.

A: In general, I don't worry too much about adding custom attribute, but whether there could be a performance issue has to do with a number of factors

*

*AD version

*AD size

*attribute size

*replication options

*Global catalog replication options.

That said, newer versions of AD (2008 & greater) are pretty efficient at attribute replication.  However, you need to get all this in a lab and test it to ensure you won't cause issues in your environment.


text:
Q: Excel - Aggregate Function to Average Reciprocals I'm trying to use the aggregate function to take the average of the reciprocals of an array of values. This works fine for averaging the given values but doesn't seem to be working on their reciprocals. Below is the function I'm using:
Works fine: =AGGREGATE(1, 6, AA11:AA16)
Not working: =AGGREGATE(1, 6, 1/(AA11:AA16))
Does anyone know the source of the error and whether or not there's a work-around?
Clarification
I cannot use array formulas because they contribute too much to the file size.

A: You could instead find the average of the reciprocals using an array formula, for example:
={AVERAGE(1 / AA11:AA16)}

(CTRL + SHIFT + ENTER to enter the array formula)
To ignore error values to fully replicate the aggregate function you have used you could add an IF into the array formula:
=AVERAGE(IF(ISERROR(AA11:AA16), "", 1 / AA11:AA16))

Alternative option...
=SUMPRODUCT(1/AA11:AA16)/COUNT(AA11:AA16)


text:
Q: Not able to wrap viewmodel in ko.validatedObservable I would like to create viewmodel wrapped in ko.validatedObservable from the Json returned from server. I have read Knockout-validation documentation. Instead as documented there, I want to wrap the viewmodel using mapping so that isValid, and errors are part of the viewmodel rather than being part of an extra property.
I am using following javascript file (patientviemodel.js)  -
var patinetViewModelMapping = {
    create: function (options) {
        console.log("mapping");
        var patientVm = ko.mapping.fromJS(options.data, {}, self);
        return ko.validatedObservable(patientVm);
    }
}
PatientViewModel = function (data) {
    var self = this;

    console.log("creating");
    ko.mapping.fromJS(data, patinetViewModelMapping, self);

    self.Name = ko.observable().extend({ required: { params: true, message: 'This field is required.' } });
    //self = ko.validatedObservable(self);
    self.save = function (action) {
        if (!self.isValid()) {
            self.errors.showAllMessages();
            return;
        }
        var ajax = {
            url: "/patientregistration/" + action + "/",
            type: "POST",
            data: ko.toJSON(self),
            contentType: 'application/json',
            success: function (data) {
                if (data.patientViewModel != null) {
                    console.log(data.patientViewModel.Id);
                    ko.mapping.fromJS(data.patientViewModel, {}, self);
                }
                if (data.newLocation != null) {
                    console.log(data.newLocation);
                    window.location = data.newLocation;
                }
            }
        };
        $.ajax(ajax);
    }
}

I found that mapping is recognized if I change
ko.mapping.fromJS(data, patinetViewModelMapping, self);

to
ko.mapping.fromJS(data, patinetViewModelMapping);

However, though the viewmodel gets created as per the mapping, execution fails in save function with error that "isValid is not defined."
Call to applybinding happens in view(.cshtml) as below -
@model MSPro.Apps.ClinicManager.Web.UI.ViewModel.PatientViewModel
@using System.Web.Script.Serialization
@using Newtonsoft.Json;

@{
    ViewBag.Title = "Register New Patient";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@{
    string data = JsonConvert.SerializeObject(Model, new JsonSerializerSettings() { DateFormatHandling = DateFormatHandling.IsoDateFormat });//new JavaScriptSerializer().Serialize(Model);
}
Value of json : @data

@section scripts
{

}
@Html.Partial("_EditPatientRegistration")

<button data-bind="click:function(){save('Create')}" class="btn btn-primary">Save</button>

    @Html.ActionLink("Back to List", "Index")

bower.json contains (added for reference of version) -
{
  "name": "asp.net",
  "private": true,
  "dependencies": {
    "jquery-validation": "~1.15.1",
    "knockoutjs": "~3.4.1",
    "knockout.mapping": "~2.0.1",
    "knockout-validation": "~2.0.3",
    "bootstrap": "~3.3.7",
    "jquery-validation-unobtrusive": "~3.2.6",
    "modernizr": "~3.3.1",
    "respond": "~1.4.2",
    "jquery": "2.2.3"
  },
  "resolutions": {
    "knockout": ">=2.3.0"
  }
}

Very much new to Javascript. Your help will be very appreciated.
Thank you in advance.


text:
Q: Add client credentials or from email credentials in PHPmailer I set the from in PHPmailer configuration to an email different than the username, and I had this error "Client does not have permissions to send as this sender"
I have the credentials of the from email (port, host, password) but I didn't find how to add these to the configuration in PHP mailer docs.
The properties I need are something similar to this
$email->fromHost = "fromHost";
$email->SetFrom("from email");
$email->fromPassword = "password";
$email->fromPort = 465;

A: Just set the standard options:
$email->Host = 'fromHost';
$email->setFrom('from email');
$email->Username = 'user@example.com';
$email->Password = 'password';
$email->Port = 465;

This approach requires that you have access to plain-text credentials of the accounts you want to send from, management of which is outside PHPMailer's scope.
Also note that you can't usually send from arbitrary addresses. It used to work, but nowadays it's usually prevented by DMARC & DKIM settings, and you shouldn't try to spoof email origins anyway.


text:
Q: Cannot create index on view 'View_Table_Name' because the view is not schema bound I am using Views in my stored Procedure(SQL-Server). For Improving Performance, I have tried to created INDEX of that View.
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER VIEW VW_Table_Name
AS
SELECT Col1,Col2,Col3 FROM Table_Name
GO
CREATE UNIQUE CLUSTERED INDEX Index_Name ON [VW_Table_Name](Col1)
GO

Here I am getting the Error like

Msg 1939, Level 16, State 1, Line 1
  Cannot create index on view 'VW_FML' because the view is not schema bound.

Can we created Index for View in SQL Server ?

A: There are a number of restrictions on indexed views: no subqueries, no unions, no outer joins, etc. See this article for more details. But for your case, you simply need to create the view with schema binding.
CREATE VIEW VW_Table_Name WITH SCHEMABINDING
AS
SELECT Col1,Col2,Col3 FROM Table_Name
GO

A: Because you are trying to create an Indexed View or Materialized View. Its mandatory for a view to have "WITH SCHEMABINDING" option if you are creating a Clustered Index on top of it.
A view is nothing but a stored query, if you are going to create an index on it, then the index is going to use that query and execute it on that table, in this case you have to make sure that the table does not change underneath. Thus by enforcing this constraint SQL Server makes sure everything remains in sync.


text:
Q: Two definitions of curvature my question is about the compatibility of two definitions of curvature of a Riemannian manifold. In particular I refer to the one from algebraic geometry and the one from differential geometry.
Reading books like "Principles of algebraic geometry" by Griffiths-Harris or "Complex algebraic geometry" by Claire Voisin we can find the curvature of a manifold defined as the second iteration of the connection. More specifically we define the connection
$\nabla$ as a function from $\Gamma(TM)$ to $\Gamma(TM)\otimes\Gamma(\Omega_M)$. If $\{\frac{\partial}{\partial x_i}\}_i$ is a local base for $\Gamma(TM)$ we write $\nabla(\frac{\partial}{\partial x_i})=\sum_j\theta_{ij}\frac{\partial}{\partial x_j}$ and $(\theta_{ij})$ is the connection matrix. So the curvature is simply defined as $\nabla^2$ from $\Gamma(TM)$ to $\Gamma(TM)\otimes\Gamma(\Omega_M^2)$, in particular in local coordinates $\nabla^2(\frac{\partial}{\partial x_i})=\sum_{l,f}(d\theta_{if}+\theta_{if}\wedge\theta_{fl})\frac{\partial}{\partial x_f}$.
Reading a differential geometry book (for example Do Carmo) we can find the curvature $R$ defined as $R:\Gamma(TM)\times\Gamma(TM)\times\Gamma(TM)\rightarrow \Gamma(TM)$, $(X,Y,Z)\mapsto R(X,Y)Z=\nabla_Y\nabla_XZ-\nabla_X\nabla_YZ+\nabla_{[X,Y]}Z$.
I know that in local coordinates $[\frac{\partial}{\partial x_k},\frac{\partial}{\partial x_j}]=0$, so locally $R(\frac{\partial}{\partial x_k},\frac{\partial}{\partial x_j})\frac{\partial}{\partial x_i}=\nabla_{\frac{\partial}{\partial x_j}}\nabla_{\frac{\partial}{\partial x_k}}\frac{\partial}{\partial x_i}-\nabla_{\frac{\partial}{\partial x_k}}\nabla_{\frac{\partial}{\partial x_j}}\frac{\partial}{\partial x_i}$.
Doing the calculations it comes out $\nabla_{\frac{\partial}{\partial x_k}}\frac{\partial}{\partial x_i}=\sum_l\theta_{il}(\frac{\partial}{\partial x_k})\frac{\partial}{\partial x_l}$ and $\nabla_{\frac{\partial}{\partial x_j}}\nabla_{\frac{\partial}{\partial x_k}}\frac{\partial}{\partial x_i}=\sum_{l,f}d(\theta_{if}(\frac{\partial}{\partial x_k}))(\frac{\partial}{\partial x_j})+\theta_{if}(\frac{\partial}{\partial x_k})\theta_{fl}(\frac{\partial}{\partial x_j}))\frac{\partial}{\partial x_f}$ which is coherent with what i wrote for $\nabla^2(\frac{\partial}{\partial x_i})$, but (QUESTION 1) why should I consider also the term $\nabla_{\frac{\partial}{\partial x_k}}\nabla_{\frac{\partial}{\partial x_j}}\frac{\partial}{\partial x_i}$?
Also, when considering the question globally, (QUESTION 2) why should I consider the term $\nabla_{[X,Y]}Z$?
Thank you very much.

A: Background Material:
The first thing to discuss is how differential two-forms work, in terms of acting on pairs of vectors:
If $\alpha$ and $\beta$ are one-forms:
$(\alpha \wedge \beta)(X,Y) = \alpha(X)\beta(Y) - \alpha(Y)\beta(X)$
Notice this is in fact alternating in $X$ and $Y$ (i.e. the sign changes if you swap them). Something like $\alpha(X)\beta(Y)$ would not be.
As for how $d\alpha$ acts if $\alpha$ is a one-form:
$d\alpha(X,Y) = X\alpha(Y) - Y\alpha(X) - \alpha([X,Y])$
Here $X\alpha(Y)$ is differentiation of the function $\alpha(Y)$ by the vector field $X$; in other words it's $d(\alpha(Y))(X)$. In the case where $X$ and $Y$ are coordinate vector fields, the last term drops out. To prove this formula, just write it out in coordinates with two general vector fields $X$ and $Y$ and a general one-form $\alpha$ and check that it's correct (there are other proofs, but that will do).
Question 1
So the answer to Question 1 is simply that you left off half the terms, as each of the above have two terms (if $X$ and $Y$ are coordinate vector fields).
I'll write it out using your notation except I'll use $\partial_i$ for $\frac{\partial}{\partial x_i}$.
$\nabla^2(\partial_i) = \sum_{l,f}(d\theta_{if}+\theta_{il}\wedge\theta_{lf})\partial_f$
So $\nabla^2_{\partial_j,\partial_k}(\partial_i) = \sum_{l,f} (d(\theta_{if}(\partial_k))(\partial_j) - d(\theta_{if}(\partial_j))(\partial_k) + \theta_{il}(\partial_j)\theta_{lf}(\partial_k) - \theta_{il}(\partial_k)\theta_{lf}(\partial_j))\partial_f$
Notice this is both terms $\nabla_{\partial_j} \nabla_{\partial_k} \partial_i - \nabla_{\partial_k} \nabla_{\partial_i} \partial_i$, not just one of them.
Edit: I just realized I'm using $R(X,Y)Z = \nabla_X \nabla_Y Z - \nabla_Y \nabla_X Z - \nabla_{[X,Y]} Z$, which differs by a factor of $-1$ from yours. This is the one that agrees with the differential form version you gave above. (Different sources have different sign conventions here. I've used this one throughout this post.)
Question 2:
If you leave off the term $\nabla_{[X,Y]} Z$, there are several ways to think about what goes wrong:
First: The expression wouldn't be tensorial. $R$ is a tensor. That is, if we consider $R(fX,Y)Z$ then it equals $fR(X,Y)Z$ for any smooth function $f$ (and similarly for multiplying in the other spots by functions).
If you try $\nabla_X \nabla_Y Z - \nabla_Y \nabla_X Z$ only, and multiply $X$ by $f$ then you get $\nabla_{fX} \nabla_Y Z - \nabla_Y \nabla_{fX} Z = f \nabla_X \nabla_Y Z - \nabla_Y f \nabla_X Z = f \nabla_X \nabla_Y Z - f \nabla_Y \nabla_X Z - df(Y) \nabla_X Z$. Notice the additional term.
The additional term $-\nabla_{[X,Y]} Z$ corrects for this (and is zero when $X$ and $Y$ are coordinate vector fields). Indeed $[fX,Y] = fXY - YfX = fXY - fYX - df(Y) X = f[X,Y] - df(Y)X$. Thus $-\nabla_{[fX,Y]} Z = -\nabla_{f[X,Y]} Z + \nabla_{df(Y)X} Z = -f\nabla_{[X,Y]} Z + df(Y) \nabla_X Z$, which has exactly the term to cancel the above $-df(Y) \nabla_X Z$.
Second: It would no longer change coordinates properly (i.e. as a tensor). This is really the same as the first reason just above, as changing coordinates involves multiplying by the derivative matrix. Writing that out, you'll have a summation of functions (the partial derivatives of your change of coordinates) times vector fields, and the fact that you can pull out the functions from the tensor will show that it changes coordinates nicely.
Third: It would no longer equal the differential form version you gave first, because $d\alpha(X,Y) = d(\alpha(Y))(X) - d(\alpha(X))(Y) - \alpha([X,Y])$, and this third term exactly accounts for the additional $-\nabla_{[X,Y]}Z$ term. (It had to work out nicely this way because both types of expressions you gave for curvature are tensorial and agree on coordinate vector fields, so they must agree in general.)


text:
Q: AngularJS local storage - initialize app retrieving local-stored data I'm pretty new to angular and I'm trying to avoid losing items added on a simple cart application when the user refreshes the page.
I'm using angularLocalStorage  (https://github.com/agrublev/angularLocalStorage) but don't know how to retrieve it back the content.
My lines:
var myApp = angular.module('ionicApp', ['ionic','angularLocalStorage']);
myApp.factory('prodottiData', function($http) {
  return {
    getFooOldSchool: function(callback) {
    $http.get('http://192.168.1.128/hongkongapp/?json=get_recent_posts&post_type=product&custom_fields=all').success(callback);
    }
  }
 });
myApp.factory('DataService', function() {
  var myCart = new shoppingCart("AngularStore");
  return {
    cart : myCart
  };
});
myApp.controller('MyController', function MyController ($scope, storage, $ionicSideMenuDelegate, prodottiData, DataService, $sce) {
    $scope.toggleLeft = function() {
    $ionicSideMenuDelegate.$getByHandle('mainMenu').toggleLeft();
  };
  $scope.toggleMySecondMenuLeft = function() {
    $ionicSideMenuDelegate.$getByHandle('mySecondMenu').toggleLeft();
  };
    //adding menu data to the scope object
    prodottiData.getFooOldSchool(function(data) {
        $scope.menu = data;
    });
    //adding the cart to the scope object
    $scope.cart = DataService.cart;
    $scope.to_trusted = function(html_code) {
        return $sce.trustAsHtml(html_code);
    }
    images = $scope.menu;
    $scope.showloader = function(){
            $scope.shownImage = this.post.thumbnail_images.full.url;
            $scope.itemDesc = this.post.content;
            $scope.itemPrice = this.post.custom_fields._price[0];
            $scope.productName = this.post.title;
            $scope.skuProdotto = this.post.id;
        }
    });

Now, if I check local storage on the console I can see something is really stored, but I miss the way to re-populate the cart at startup.
Any help would be great!

A: why not just using browser local storage ?
you can add it to your services.js as a new service and just used that.
var storeService = myAppServices.factory('storeService', function() {

    var service =
    {
        setClientData:function(client_details)
        {
            window.localStorage.setItem( "client_data", JSON.stringify(client_details) );
            client_data = client_details;
        },
        getClientData:function()
        {
            if (client_data == null)
            {
                client_data = JSON.parse(window.localStorage.getItem("client_data"));
            }
            return client_data;
        }
    }

    var client_data = null;

    return service;
});

A: From the documentation, to retrieve, it's storage.get('key')
So, to check after refresh:
if (storage.get('someKey')){
  $scope.retrieved_value = storage.get('someKey');
}else{
// whatever
}

A: You can use localStorage instead windows.localStorage.

 if(typeof(Storage)!=="undefined")
        {
            // Code for localStorage/sessionStorage.
            var hello = "Hello World!!";

            localStorage.setItem("hello",hello);
            // get string
            console.log(localStorage.getItem("hello")); // will return 'Hello World!!'

            var me = {name:'abel',age:26,gender:'male'};
            localStorage.setItem("user", JSON.stringify(me));
            //fetch object
            console.log(localStorage.getItem("user")); // will return {"name":"myname","age":99,"gender":"myGender"}
            var objetos = JSON.parse(localStorage.getItem("user"));
            console.log(objetos.name);

        }
        else
        {
            // Sorry! No Web Storage support..
        }


text:
Q: AngularJS ngModel directive in select I am working on an angularjs project and i have a problem with the ngModel not binding within the select.But the same concept is working in another select tag and in the same html page.
Below is the code.
  <select ng-model="selectedFont"
          ng-options="font.title for font in fonts"
          ng-change="onFontChange()">
  </select>

onFontChange() function is placed in the controller.
Anyone help is highly appreciable...Thanks in advance.

A: First create data (can be local or from server) in Controller. And initialize the default value, which force the default item selected in HTML form.
// supported languages
$scope.languages = ['ENGLISH', 'SPANISH', 'RUSSIAN', 'HINDI', 'NEPALI'];
// init default language
$scope.language = 'ENGLISH';

Now in your HTML form
<select class="form-control" ng-model="language">
    <option ng-repeat="language in languages">{{language}}</option>
</select>

The screenshot is here (note bootstrap CSS is used and not included here).

You can do a test in controller, whether the change is working
$scope.$watch('language', function (newVal, oldVal) {
    console.log(oldVal + " -> " + newVal);
});

ENGLISH -> RUSSIAN
RUSSIAN -> SPANISH
SPANISH -> RUSSIAN

Hope this is helpful. Thanks!

A: Based on Tony the Pony's fiddle :
<div ng-app ng-controller="MyCtrl">
    <select ng-model="opt"
            ng-options="font.title for font in fonts"
            ng-change="change(opt)">
    </select>

    <p>{{opt}}</p>
</div>

With a controller:
function MyCtrl($scope) {
    $scope.fonts = [
        {title: "Arial" , text: 'Url for Arial' },
        {title: "Helvetica" , text: 'Url for Helvetica' }
    ];
    $scope.change= function(option){
        alert(option.title);
    }
}

http://jsfiddle.net/basarat/3y5Pw/43/


text:
Q: Is this C# code secure for RSA encryption of Classified data? I will be encrypting CLASSIFIED data and my data must be secured with the most advanced encryption available. I am encrypting the data with AES and the key with RSA. My RSA code is below. Please confirm if this code is secure:
  static class Program
  {
    static void Main()
    {
      var csp = new RSACryptoServiceProvider(3072);
      var privKey = csp.ExportParameters(true);
      var pubKey = csp.ExportParameters(false);
      string pubKeyString;
      {
        var sw = new System.IO.StringWriter();
        var xs = new System.Xml.Serialization.XmlSerializer(typeof(RSAParameters));
        xs.Serialize(sw, pubKey);
        pubKeyString = sw.ToString();
      }
  {
    //get a stream from the string
    var sr = new System.IO.StringReader(pubKeyString);
    //we need a deserializer
    var xs = new System.Xml.Serialization.XmlSerializer(typeof(RSAParameters));
    //get the object back from the stream
    pubKey = (RSAParameters)xs.Deserialize(sr);
  }
  csp = new RSACryptoServiceProvider();
  csp.ImportParameters(pubKey);
  var plainTextData = "foobar";
  var bytesPlainTextData = System.Text.Encoding.Unicode.GetBytes(plainTextData);
  var bytesCypherText = csp.Encrypt(bytesPlainTextData, false);
  var cypherText = Convert.ToBase64String(bytesCypherText);
  bytesCypherText = Convert.FromBase64String(cypherText);
  csp = new RSACryptoServiceProvider();
  csp.ImportParameters(privKey);
  bytesPlainTextData = csp.Decrypt(bytesCypherText, false);
  plainTextData = System.Text.Encoding.Unicode.GetString(bytesPlainTextData);
}
}
}

A: You don't specify which government authority you fall under, so I will assume the US DoD.
This encryption scheme will not satisfy any US DoD data security requirements except for data classified at "confidential" or under a special classification that has "confidential" restrictions with compartmentalization (or UCI with the same effective restrictions).
This is primarily because you're not using an approved encryption scheme that protects data integrity, provides tamper evidence, and includes an approved symmetric cipher. You're also preventing OAEP padding during your RSA encryption call, something that has been required for quite some time now.
But your question is also incorrect. "Classified data" is a thing and not really a level of security. Data has a classification, so do processes and the data involved in those processes. Classification is an iterative process to determine the security requirements for data based on their value, the threat model for all involved systems, and the total impact of loss, theft, or modification of the data in transit or storage.
To make your scheme correct, I advise you do the following:

*

*Generate key pairs for all parties that need to exchange data with each other

*Before exchanging data, generate a random 256-bit value to be used as a key

*Encrypt the 256-bit key value with the destination party's public key and digitally sign that result with the sender's private key

*Encrypt your data using AES-256-ICM with key value, digitally sign the result

*Transmit the result of the last two operations to the destination

*The destination verifies the signatures of both the encrypted key and the encrypted data

*The destination decrypts the key and uses that key to decrypt the data

*The destination now has the decrypted data

This above scheme technically would satisfy the basic encryption requirements for "top secret" classified information under the US DoD manual for information security standards.
There's more to it in terms of storage, code review, certifiable relaibility, etc etc. There's a huge review process and it's extremely involved. It's not something an independent developer will be able to accomplish easily.
On a final note, you state you are encrypting classified data and I assume you are not a specialist in information security or cryptography. It is recommended and required in some cases that you hire a subject matter expert for the architectural process. In the US, you can face fines or jail time (in negligence cases) if you don't follow the approved processes for developing software handling sensitive information of any kind. But more than that, nobody is likely to accept your software without a comprehensive code review and more than likely they won't accept C# code because there's not enough validation for the associated runtimes, unless you're using a custom one. You're stuck with C, C++, or Java (rare) most of the time in the sensitive data world of the US government.


text:
Q: Why I'm getting PayPal Android Native Checkout SDK - invalid client_id or redirect_uri I'm using the new Native Checkout SDK for Android with Kotlin and I've been following every step in the documentation but this keeps happening and I don't know why. I'm trying also PayPal Android Native Checkout SDK - invalid client_id or redirect_uri, and CHECKOUT_ERROR but but it didn't work for me.

build.girdle :
plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-android-extensions'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"

    defaultConfig {
        applicationId "com.example.paypalkotlin"
        minSdkVersion 23
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {

    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'androidx.appcompat:appcompat:1.3.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation('com.paypal.checkout:android-sdk:0.2.0')
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

build girdle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = "1.3.72"
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.3"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        // This private repository is required to resolve the Cardinal SDK transitive dependency.
        maven {
            url  "https://cardinalcommerceprod.jfrog.io/artifactory/android"
            credentials {
                // Be sure to add these non-sensitive credentials in order to retrieve dependencies from the private repository.

                username "paypal_sgerritz"
                password "AKCp8jQ8tAahqpT5JjZ4FRP2mW7GMoFZ674kGqHmupTesKeAY2G8NcmPKLuTxTGkKjDLRzDUQ"
            }
        }

    }
}

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

Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.paypalkotlin">
    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.PaypalKotlin">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

layout
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <com.paypal.checkout.paymentbutton.PayPalButton
        android:id="@+id/payPalButton"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

Activity
package com.example.paypalkotlin

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log

import com.paypal.checkout.PayPalCheckout
import com.paypal.checkout.approve.OnApprove
import com.paypal.checkout.config.CheckoutConfig
import com.paypal.checkout.config.Environment
import com.paypal.checkout.config.SettingsConfig
import com.paypal.checkout.createorder.CreateOrder
import com.paypal.checkout.createorder.CurrencyCode
import com.paypal.checkout.createorder.OrderIntent
import com.paypal.checkout.createorder.UserAction
import com.paypal.checkout.order.Amount
import com.paypal.checkout.order.AppContext
import com.paypal.checkout.order.Order
import com.paypal.checkout.order.PurchaseUnit
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

    val YOUR_CLIENT_ID = "AVxCKg9vnFKxNXLU5LLylEOnGCnsG8UiN300FlmY37zI4oKdrpyiuR_zutUn77rKSVxC377x0jM_uCPk";
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val config = CheckoutConfig(
                application = application,
                clientId = YOUR_CLIENT_ID,
                environment = Environment.SANDBOX,
                returnUrl = "${BuildConfig.APPLICATION_ID}://paypalpay",
                currencyCode = CurrencyCode.USD,
                userAction = UserAction.PAY_NOW,
                settingsConfig = SettingsConfig(
                        loggingEnabled = true
                )
        )

        PayPalCheckout.setConfig(config)
        payPalButton.setup(
                createOrder = CreateOrder { createOrderActions ->
                    val order = Order(
                            intent = OrderIntent.CAPTURE,
                            appContext = AppContext(
                                    userAction = UserAction.PAY_NOW
                            ),
                            purchaseUnitList = listOf(
                                    PurchaseUnit(
                                            amount = Amount(
                                                    currencyCode = CurrencyCode.USD,
                                                    value = "10.00"
                                            )
                                    )
                            )
                    )
                    createOrderActions.create(order)
                },

                onApprove = OnApprove { approval ->
                    approval.orderActions.capture { captureOrderResult ->
                        Log.i("CaptureOrder", "CaptureOrderResult: $captureOrderResult")
                    }
                }
        )

    }

}

A: Make sure you have added Same Return Url in the Paypal Developer Website. and The return Url must be "Your Application Id" + "://paypalpay":

A: I had the same problem. I managed to solve it by writing "com.example.appname://paypalpay" in the returnURL from the Sandbox Website. Try it!

A: I too faced the same issue...to fix it as mentioned above you have to go to PayPal Dashboard and in the sandbox settings where you have created the application, there will have the option to enter the return URL.
after adding it and save.
Happy coding

A: *

*Open My Apps & Credentials in Paypal sandbox

*Select your App

*Enable the below options (See attached images for a better idea)

i. Accept Payments > Native Checkout SDK, Vault, Billing agreements.
ii. Login with PayPal > Full name, Email, PayPal account ID, Privacy Policy URL, User agreement URL
4. Save it. now, Sandbox will start working.

Note: (See attached screenshot)

Before going Live, your app will need to be reviewed in order to approve sharing customer data. Full name is enabled by default, but all other scopes will require PayPal's approval through the app review process. The app review process typically takes 7-10 days, so please account for enough time to review before going Live.

A: The solution to above problem is
https://developer.paypal.com/developer/applications (go to this link)
Go to your app edit page.
Click under the "SANDBOX APP SETTINGS" > "Return URL" > "Show" Add your BuildConfig.APPLICATION_ID://paypalpay (com.example.appname://paypalpay)
More important step is left also: Do it must:
Select the "Native Checkout SDK" checkbox,
found within the "Advanced options" of the "Accept payments" option.


text:
Q: Django send key or value from the view to the form class I am writing an Edit form, where some fields already contain data. Example:
class EditForm(forms.Form):
    name = forms.CharField(label='Name',
                           widget=forms.TextInput(),
                           initial=Client.objects.get(pk=??????)) #how to get the id?

What I did for another form was the following (which does not work for the case of the previous EditForm):
class AddressForm(forms.Form):
    address = forms.CharField(...)

    def set_id(self, c_id):
        self.c_id = c_id

    def clean_address(self):
        # i am able to use self.c_id here

views.py
form = AddressForm()
form.set_id(request.user.get_profile().id) # which works in the case of AddressForm

So what is the best way to pass an id or a value to the form, and that could be used in all forms for that session/user?
Second: is it right to use initial to fill in the form field the way I am trying to do it?

A: You need to override the __init__ method for your form, like so:
def __init__(self, *args, **kwargs):
    try:
        profile = kwargs.pop('profile')
    except KeyError:
        super(SelectForm, self).__init__(*args, **kwargs)
        return
    super(SelectForm, self).__init__(*args, **kwargs)
    self.fields['people'].queryset = profile.people().order_by('name')

and, obviously, build your form passing the right parameter when needed :)


text:
Q: Impersonating an ASP.net session with PHP I'm trying to retrieve data from a publicly accessible website that is built on ASP.net sessions. When I send standard browser headers with PHP curl, I keep getting the error that the session has expired. How can I impersonate a session with curl or some other PHP function?

A: curl_septopt
Using the CURLOPT_COOKIEJAR and CURLOPT_COOKIEFILE allows you to capture and re-use the site's cookies to manipulate the session.  Check the doc page for more info.


text:
Q: How to prevent duplicate logs being shipped during postgres daily logrotate We have a postgres server that generates it's logs like so:
postgresql-Sat.csv
postgresql-Sun.csv
postgresql-Mon.csv
postgresql-Tue.csv
postgresql-Wed.csv
postgresql-Thu.csv
postgresql-Fri.csv

Our logstash shipper is simply like this:
input {
  file {
    path => '/pglog/postgresql-*.csv'
    type => 'postgres_csv'
  }
}
output {
  file {
    path => '/pglog/test_logstash.output'
  }
}

After 24 hours, we see TONS of duplicates in the output file /pglog/test_logstash.output
It's as if logstash has forgotten what it has shipped and then re-ships EVERYTHING.
I looked at the sincedb files and they are indeed being updated (just by looking at the timestamp).
Any ideas why we are getting tons of duplicates in the output file?