text:
Q: Gmail on iPhone app : pictures broken The native Gmail iPhone 4 app on my phone behaves weird, it is not showing pictures that come as attachment, when I click on the picture it starts downloading the picture but it displays those classic picture not available pic with a question mark. I tried deleting account and adding it again still no luck..
Any clue?
I'm on iOS 4.1

A: I haven't found anything that officially says there's an iPhone file-size limitation, but I have noticed that over 3G, some larger pictures will not download to my mailbox. Try over WiFi or get 3G Unrestrictor and see what happens.


text:
Q: Finder: What are the keyboards shortcuts "Arrow down+Alt" "Shift+Arrow down+Alt" supposed to do Tonight, I discovered that the keyboard shortcuts "Arrow down+Alt" and "Shift+Arrow down+Alt" when used in Finder reopened older Finder windows.
As I sat a lot of keyboard shortcuts I thought there should be a problem.
I just wanted to find the keyboard shortcut that will let me select all the files/folders under the currently selected folder.
In forklift, "Shift+Arrow down+Alt" let me do that.
OS X version:10.10.

A: A setting in DefaultFolder X I sat was replacing all the keyboard shortcuts of all my applications with keyboard shortcuts I sat for DefaultFolder X.
Case closed.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Average of multiple survey responses (columns) I feel a bit embarrassed for asking this but here goes:
I'm using Excel 2010 and I have a worksheet containing 700+ customer satisfaction survey responses. Each row is a survey with a 1-5 or NA response to 5 questions. It looks like the following:
+-Agent--+--Q1--+--Q2--+--Q3--+
|        |      |      |      |
| Jeff   |  5   |  5   |  5   |
+--------+------+------+------+
| James  |  1   |  1   |  1   |
+--------+------+------+------+
| Jack   |  5   |  5   |  5   |
+--------+------+------+------+
| Jeff   |  3   |  NA  |  5   |
+--------+------+------+------+
| Jeff   |  NA  |  NA  |  3   |
+--------+------+------+------+
| James  |  5   |  5   |  5   |
+--------+------+------+------+
| ...    |  ... |  ... |  ... |
+--------+------+------+------+

I want to create a worksheet listing each agent in column A and the average of all of questions answered regarding them. I tried a formula like AVERAGEIF(SurveyResponses!A2:A7,A2,SurveyResponses!B2:D7) where A2 contains the agent's name, but it doesn't appear to work properly.
For example, I get a 5.00 average for some agents when it should be a 4.61. When I look in the Function Arguments screen for my AVERAGEIF on this person, it looks like it recognizes the values properly. The Average_rage shows {"NA","NA","NA","NA",1;5,5,5,5,5;5,... but the returned value below that says = 5 which is not right since there is a 1.
Can anyone guide me in the right direction?

A: AVERAGEIF works like SUMIF, the second range used is actually the same size and shape as the first range, starting with the top left cell, so when you use this
=AVERAGEIF(SurveyResponses!A2:A7,A2,SurveyResponses!B2:D7)
because the first range is a single column then the second range used must be too (there's a 1 to 1 relationship between the cells) so because the top left cell in SurveyResponses!B2:D7 is SurveyResponses!B2 the range begins there and is the same size and shape as SurveyResponses!A2:A7
....so you are actually getting this....
=AVERAGEIF(SurveyResponses!A2:A7,A2,SurveyResponses!B2:B7)
AVERAGEIF help does tell you that but it isn't very clear
If you want the ranges to be different sizes you need an "array formula" like this
=AVERAGE(IF(SurveyResponses!A2:A7=A2,SurveyResponses!B2:D7))
You need to confirm that with CTRL+SHIFT+ENTER so that curly braces appear around the formula in the formula bar. That formula will count any blanks as zeroes but ignore text values like NA

A: Easiest way to do this would be a pivot table.  They look scary, but they're fairly easy to use.  Rows = names, Columns = Q, Average for the answers.


text:
Q: How to write UTF-8 characters using bulk insert in SQL Server? I am doing a BULK INSERT into sqlserver and it is not inserting UTF-8 characters into database properly. The data file contains these characters, but the database rows contain garbage characters after bulk insert execution.
My first suspect was the last line of the format file:
10.0
3
1 SQLCHAR  0  0  "{|}"  1 INSTANCEID ""
2 SQLCHAR  0  0  "{|}"  2 PROPERTYID ""
3 SQLCHAR  0  0  "[|]"  3 CONTENTTEXT "SQL_Latin1_General_CP1_CI_AS"

But, after reading this official page it seems to me that this is actually a bug in reading the data file by the insert operation in SQL Server version 2008. We are using version 2008 R2.
What is the solution to this problem or at least a workaround?

A: Microsoft just added UTF-8 support to SQL Server 2014 SP2:
https://support.microsoft.com/en-us/kb/3136780

A: I came here before looking for a solution for bulk inserting special characters.
Didn't like the workaround with UTF-16 (that would double the size of csv file).
I found out that you definitely CAN and it's very easy, you don't need a format file.
This answer is for other people who are looking for the same, since it doesn't seem to be documented well anywhere, and I believe this is a very common issue for non-english speaking people. The solution is:
just add CODEPAGE='65001' inside the with statement of the bulk insert. (65001=codepage number for UTF-8).
Might not work for all unicode characters as suggested by Michael O, but at least it works perfect for latin-extended, greek and cyrillic, probably many others too.
Note: MSDN documentation says utf-8 is not supported, don't believe it, for me this works perfect in SQL server 2008, didn't try other versions however.
e.g.:
BULK INSERT #myTempTable
FROM  'D:\somefolder\myCSV.txt'+
WITH
    (
        CODEPAGE = '65001',
        FIELDTERMINATOR = '|',
        ROWTERMINATOR ='\n'
    );

If all your special characters are in 160-255 (iso-8859-1 or windows-1252), you could also use:
BULK INSERT #myTempTable
FROM  'D:\somefolder\myCSV.txt'+
WITH
    (
        CODEPAGE = 'ACP',
        FIELDTERMINATOR = '|',
        ROWTERMINATOR ='\n'
    );

A: You can re-encode the data file with UTF-16. That's what I did anyway.

A: You can't. You should first use a N type data field, convert your file to UTF-16 and then import it. The database does not support UTF-8.

A: Use these options -
DATAFILETYPE='char' and CODEPAGE = '1252'

A: Note that as of Microsoft SQL Server 2016, UTF-8 is supported by bcp, BULK_INSERT (as was part of the original question), and OPENROWSET.

A: *

*In excel save file as CSV(Comma delimited)

*Open saved CSV file in notepad++

*Encoding -> Convert tO UCS-2 Big Endian

*Save

BULK INSERT #tmpData
    FROM 'C:\Book2.csv'
    WITH
    (
        FIRSTROW = 2,
        FIELDTERMINATOR = ';',  --CSV field delimiter
        ROWTERMINATOR = '\n',   --Use to shift the control to next row
        TABLOCK
    )

Done.

A: Shouldn't you be using SQLNCHAR instead of SQLCHAR for the unicode data?

A: Thought I would add my thoughts to this.  We were trying to load data into SqlServer using bcp and had lots of trouble.
bcp does not, in most versions, support any type of UTF-8 files.  We discovered that UTF-16 would work, but it is more complex than is shown in these posts.
Using Java we wrote the file using this code:
PrintStream fileStream = new PrintStream(NEW_TABLE_DATA_FOLDER + fileName, "x-UTF-16LE-BOM");

This gave us the correct data to insert.

We tried using just UTF16 and kept getting EOF errors.  This is because we were missing the BOM part of the file.  From Wikipedia:

UTF-16, a BOM (U+FEFF) may be placed as the first character of a file or character stream to indicate the endianness (byte order) of all the 16-bit code units of the file or stream.

If these bytes are not present, the file won't work.  So we have the file, but there is one more secret that needs to be addressed.  When constructing your command line you must include -w to tell bcp what type of data it is.  When using just English data, you can use -c (character).  So that will look something like this:

bcp dbo.blah in C:\Users\blah\Desktop\events\blah.txt -S tcp:databaseurl,someport -d thedatabase -U username -P password -w

When this is all done you get some sweet looking data!

A: Only for to share, I had a similar problem, I had portugues accents in a file and bcp imported garbage chars.(e.g. À became ┴ )
I tried -C with almost all codepages without success. After hours I found a hint on the bcp MS help page.

Format File codepages are having priority over the -C attribute

Means that in the format file I had to use "" like in LastName, once I changed the codepage, the attribute -C 65001 imported the UTF8 file without any problem
13.0
4
1       SQLCHAR             0       7       ","      1     PersonID               ""
2       SQLCHAR             0       25      ","      2     FirstName              SQL_Latin1_General_CP1_CI_AS
3       SQLCHAR             0       30      ","      3     LastName               ""
4       SQLCHAR             0       11      "\r\n"   4     BirthDate              ""

A: I managed to do this using SSIS and a ADO NET destination instead of OLEDB.

A: My exported data are in TSV format from DB which has Latin-1 encoding.
This easy to check:
SELECT DATABASEPROPERTYEX('DB', 'Collation') SQLCollation;
Extract file is in UTF-8 format.
BULK INSERT isn't working with UTF-8, so I convert UTF-8 to ISO-8859-1 (aka Latin-1) with simple Clojure script:
(spit ".\\dump\\file1.txt"
   (slurp ".\\dump\\file1_utf8.txt" :encoding "UTF-8")
   :encoding "ISO-8859-1")
To execute - correct paths and
java.exe -cp clojure-1.6.0.jar clojure.main utf8_to_Latin1.clj

A: I have tested the bulk insertion with UTF -8 Format. It works fine in Sql Server 2012.
string bulkInsertQuery = @"DECLARE @BulkInsertQuery NVARCHAR(max) = 'bulk insert [dbo].[temp_Lz_Post_Obj_Lvl_0]
                                      FROM ''C:\\Users\\suryan\\Desktop\\SIFT JOB\\New folder\\POSTdata_OBJ5.dat''
                                      WITH ( FIELDTERMINATOR =  '''+ CHAR(28) + ''', ROWTERMINATOR = ''' +CHAR(10) + ''')'
                                      EXEC SP_EXECUTESQL @BulkInsertQuery";

I was using *.DAT file with FS as column separator.


text:
Q: How to route to particular app details when i click on the app I have Json data
models: Array<Model> = [
    {
      name: 'kanban',
      version: '1',
      processes: [
        {
          name: 'kanban',
          version: '1',
          descrption: 'kanabn'
        },
        {
          name: 'kanban 2',
          version: '2',
          descrption: 'kanban 2'
        }
      ]
    },
    {
      name: 'gibier',
      version: '1',
      processes: [
        {
          name: 'gibier',
          version: '1',
          descrption: 'gibier'
        },
        {
          name: 'gibier 2',
          version: '2',
          descrption: 'gibier 2'
        }
      ]
    }
  ];
so that by using this i have created a page by using

<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>

{{app.name}}

{{app.version}}

So i got two cards
So when i click on one card i should get the particulars details of specific appName

** App.module.Ts **

  {
    path: 'applicationDashboard',
    component: ApplicationDashboardComponent
  }, {
    path: 'applicationDashboard/:id',
    component: ApplicationDetailComponent
  },
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />

              v{{process.version}}

                {{process.name}}

import {
  Component,
  OnInit
} from '@angular/core';
import {
  Model
} from '../../model';
import {
  ModelService
} from '../../model.service';
import {
  Route,
  ActivatedRoute
} from '@angular/router';

@Component({
  selector: 'app-application-detail',
  templateUrl: './application-detail.component.html',
  styleUrls: ['./application-detail.component.css']
})
export class ApplicationDetailComponent implements OnInit {
  name;
  model: any;
  models: Array < Model > = [];
  constructor(private modelservice: ModelService, private _route: ActivatedRoute) {
    this.models = modelservice.getModel();
    this.name = this._route.snapshot.paramMap.get('id');
    console.log(this.name);
  }

  ngOnInit() {
    this.model = this.models;
    console.log(this.model);
  }
  showProcessDetails(process) {
    console.log('keerthi', this.models.find(x => x.processes === process));
  }

}

I have written the above code for routing and displaying data.
What happening is:
I can route to the correct page , But i am getting displayed all 4 processes in my json data without regarding to particular App
can anyone help?
Thanks in advance.!

A: You have to use just (click) instead of ng-click which is an angularjs syntax,
(click)="showProcessDetails(process);

A: I have taken the name from id which i am routing to :
this.name = this._route.snapshot.paramMap.get('id');

After that i have looped through the model and got the details by checking this.name
and in html also i used *ngFor="let apps of model.processes"
*ngIf="apps.name ==name"

import {
  Component,
  OnInit
} from '@angular/core';
import {
  Model
} from '../../model';
import {
  ModelService
} from '../../model.service';
import {
  Route,
  ActivatedRoute,
  Router
} from '@angular/router';

@Component({
  selector: 'app-application-detail',
  templateUrl: './application-detail.component.html',
  styleUrls: ['./application-detail.component.css']
})
export class ApplicationDetailComponent implements OnInit {
  name;
  model: any;
  models: Array < Model > = [];
  constructor(private modelservice: ModelService, private _route: ActivatedRoute, private router: Router) {
    this.name = this._route.snapshot.paramMap.get('id');
    console.log('name', this.name);
  }

  ngOnInit() {
    this.models = this.modelservice.getModel();
    for (let i = 0; i < this.models.length; i++) {
      if (this.name === this.models[i].name) {
        this.model = this.models[i];
        console.log('model:', this.model);
      }
    }
  }
  showProcessDetails(process) {
    this.router.navigate(['/process', process.name]);
  }

}

App definition Details :{{name}}

{{apps.name}}

{{apps.details}}

                  v{{process.version}}

                    {{process.name}}


text:
Q: What's wrong with this SQL code syntax? I'm trying to implement this code into my script but I get a syntax error

INSERT INTO prospectstbl ( 'customerNumber', 'namePerson1', 'LnamePerson1', 'street', 'city', 'state', 'zip', 'homePhone', 'cellPhone', 'clientSince', 'clientLevel', 'closingDate', 'lastPaymentDate', 'currentBalance', 'repurchaseDate', 'repurchaseAmount', 'delinquentBalance', ) VALUES ('20713254', 'Sonia', 'Amaya', '338 Railroad Ave', 'Ctr Moriches', 'NY', '11934', '6318788386', '6318137972', '10/24/2002', '1', '7/26/2011', '8/11/2011', '$792.15', '', '$0.00', '$0.00')

and the error I get:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''customerNumber', 'namePerson1', 'LnamePerson1', 'street', ' at line 2

Any help would be greatly appreciated.

A: remove the '' at the column names and the , at the last column:
INSERT INTO prospectstbl ( customerNumber, namePerson1, LnamePerson1, street, city,
state, zip, homePhone, cellPhone, clientSince, clientLevel, closingDate,
lastPaymentDate, currentBalance, repurchaseDate, repurchaseAmount, delinquentBalance )
VALUES ('20713254', 'Sonia', 'Amaya', '338 Railroad Ave', 'Ctr Moriches', 'NY', '11934', '6318788386', '6318137972', '10/24/2002', '1', '7/26/2011', '8/11/2011', '$792.15', '', '$0.00', '$0.00')

A: There is a comma , after 'delinquentBalance'

A: use
`

instead of
'

And remove , after , delinquentBalance
or you can remove list of your columns
INSERT INTO prospectstbl VALUES ('20713254', 'Sonia', 'Amaya', '338 Railroad Ave', 'Ctr Moriches', 'NY', '11934', '6318788386', '6318137972', '10/24/2002', '1', '7/26/2011', '8/11/2011', '$792.15', '', '$0.00', '$0.00')

A: IIRC, single quotes (') are generally used for quoting literal values (strings and such) and indicating that certain tokens are NOT fieldnames. Graves (`) are used to indicate fields.
Try quoting your column names with graves (`) instead.
Also, as others have said, you have an extra comma at the end of your column name list. Remove this as well.


text:
Q: boost shared pointer constructor destructor The following code
struct Base
{
  public:
  Base()
  {
    std::cout<<"Base Ctr";
  }

  ~Base()
  {
    std::cout<<"Base Dtr";
  }
};

struct Derived : Base
{
  Derived()
  {
    std::cout<<"Derived Ctr";
  }

  ~Base()
  {
    std::cout<<"Derived Dtr";
  }
};

int main()
{
  Base* b = new Derived;
  delete b;
}

gives me the following output :
Base Ctr
Derived Ctr
Base Dtr

The solution to this is to make the base destructor virtual.
However when I use boost smart pointers without virtual base destructor. I get a different output.
int main()
{
  boost::shared_ptr<Base> b = boost::make_shared<Derived>();
}

The output is
 Base Ctr
 Derived Ctr
 Derived Dtr
 Base Dtr

How is boost shared_ptr able to achieve this without affecting(I'm assuming) the Base and Derived classes.
How does it scale it for multiple level inheritance, i.e base points to dervderv
where dervderv is inherited from derv.
EDIT:
Most answers tell me that the "magic" happens in make_shared. I however get the same behaviour for the following code
boost::shared_ptr<Base> ptr(new Derived);

A: In brief, boost::smart_ptr contains pointer to an object, reference count and a deleter function, which is called in destructor, when you call boost::make_shared<Derived>(), it will create default-constructed object of class Derived and deleter will point to a destructor of Derived. This should work for inheritance chain of any length, but having virtual destructor in the base class is really mandatory.
Consider next simplified naive example implementation of such technique:
#include <iostream>
#include <functional>
using namespace std;

struct Base
{
  public:
  Base()
  {
    std::cout<<"Base Ctr ";
  }

  ~Base()
  {
    std::cout<<"Base Dtr ";
  }
};

struct Derived : Base
{
  Derived()
  {
    std::cout<<"Derived Ctr ";
  }

  Derived(const Derived& d)
  {
    std::cout<<"Derived copy Ctr ";
  }

  ~Derived()
  {
    std::cout<<"Derived Dtr ";
  }
};

template <typename T>
void default_deleter(T* p) {
    delete p;
}

template <typename T>
struct pointer {
    pointer(T* p, std::function<void ()> d) : p_(p), deleter_(d) {}
    template <typename U>
    pointer(pointer<U> other) : p_(new U(*other.p_)),
    deleter_(std::bind(&default_deleter<U>, (U*)p_)) {}
    template <typename Y>
    explicit pointer(Y* p) : p_(p), deleter_(std::bind(&default_deleter<Y>, p)) {}
    ~pointer() {
        deleter_();
    }
    T* p_;
    std::function<void ()> deleter_;
};

template <typename T>
pointer<T> make_pointer() {
    T* p = new T;
    return pointer<T>(p, std::bind(&default_deleter<T>, p));
}

int main() {
    pointer<Base> b = make_pointer<Derived>();
    pointer<Base> b2(new Derived);
    return 0;
}

The output is:
Base Ctr Derived Ctr Base Ctr Derived copy Ctr Derived Dtr Base Dtr Derived Dtr Base Dtr

destructors of Derived class are called twice because there are 2 instances of pointer : one which was created in make_pointer function and the second is in main function.

A: A solution implemented using normal function pointers:
#include <iostream>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <typeinfo>

using namespace std;

struct Base{

  Base(){
    cout<<"Base ctor."<<endl;
  }

  ~Base(){
    cout<<"Base dtor."<<endl;
  }

};

struct Derv: Base{

  Derv():Base(){
    cout<<"Derv ctor."<<endl;
  }

  ~Derv(){
    cout<<"Derv dtor."<<endl;
  }

};

typedef void (*DEL)(void*);

template<typename U>
void deleter(void* ptr)
{
  delete static_cast<U*>(ptr);
}

template<typename T>
struct SmartPtr{

  T* memPtr;

  DEL func;

  template<typename U>
    SmartPtr(U* p):
      memPtr(p)
  {
    func = deleter<U>;
  }

  ~SmartPtr(){

      func(memPtr);
  }
};
int main()
{
  //case 1
  SmartPtr<Base> ptrSmart1(new Derv());

  //case 2
  SmartPtr<Base> ptrSmart2(new Base());

  //case 3
  SmartPtr<Derv> ptrSmart3(new Derv());

  return 0;
}

A: Boost achieves that by having a deleter functor. The default implementation calls delete on the type created using make_shared.


text:
Q: How do I get request input in route closure? I just finished reading Request chapter. And I want to know how to get request input in route closure?

A: Create a object of Illuminate\Http\Request;
Route::get('/', function (Request $request) {
        $request->all();
    });

Or
Route::get('/', function () {
    Illuminate\Support\Facades\Input::all();
});

A: You can use a global helper:
Route::get('/', function () {
    request()->id;
});


text:
Q: Spectral Theorem for compact self-adjoint operators on real Hilbert spaces Is the spectral theorem for self-adjoint compact operators on a Hilbert space also true if the Hilbert space is real (instead of complex)?
Wikipedia says this is true.
However, it seems to me that in none of the references of that article, the theory is established for real Hilbert spaces.
If it is true I would be grateful for a reference.


text:
Q: Why is this$0 field of an inner class not private? Java inner classes store the reference to the outer instance in a synthetic field:
class A {
    class B {}
}

java.util.Arrays.toString(A.B.class.getDeclaredFields())
// [final A A$B.this$0]

What I am wondering is why this field isn't generated as private.
It can't be accessed by the programmer without reflection (outside B, where A.this refers to it).
The obvious guess is that you can write something in A (outside B) which needs to access it, but I can't think of any such case.

A: I was thinking in the wrong direction. It isn't A that needs to access B.this$0, but potential inner classes of B itself!
If we have
class A {
    class B {
        class C {}
    }
}

then after desugaring C becomes
class A$B$C {
    final A$B this$1;

    A$B$C(A$B b) {
        this$1 = b;
    }
}

and A.this inside C has to be accessed as this$1.this$0. Alternatively, it could have two fields
    final A$B this$1;
    final A this$0;

in which case the constructor would contain this$0 = b.this$0; (this was actually what I expected before checking).


text:
Q: C# WinForms application runs slow from mapped network drive over VPN We have a Winforms application that is located on a server.
In other words, the people start the application by a shortcut that points to the executable on the intranet. There where never any performance issues with this approach up till now.
The problem is that over a VPN the application loads extreme slow.
It takes 1 minute and 40 seconds just to show the main form.
All code in the main form in the Load and Show events are disabled to test the performance, and it still takes this long time just to load the form.
Also the mapped directory is set a trusted by windows.
The question is what could cause this slow loading over VPN ?
It seems to me that just loading the main form without any code is already slow.
The application uses DevExpress so there are lots off DLL's to load. Can that be the cause of this problem ?
I know this is not a good question for SO but I need some ideas in which direction to look for this problem.
I found this question here but the problem there was due to a bug in their code so it does not helps me

A: Deploy the application as ClickOnce. When the application is first run it will be slow as the application will download, then install in the Users[user]\AppData folder. From then on as long as the application hasn't been redeployed it'll run from the local copy after checking with the network deployed version.
You can choose to have the application install locally so it has a start menu entry and can be removed with add/remove programs or you can have it only available online which means there's no start menu entry and it should be started from the setup.exe (I would assume this is the option you would want to go for so your users still start it from the VPN network location.


text:
Q: How to populate an objects List member variable with String values using Java Reflection A sample of what I need to do.
Field field=myBean.getClass().getDeclaredField("listOfStringMemberVar");
field.setAccessible(true);
field.set(myBean, value);
//value is a String. I want to add it to the listOfStringMemberVar

How do I populate an objects List with String values through reflection?
Thanks

A: field.set(myBean, Collections.singletonList("myvalue")); // for one element list

// if list already exists and you just want to append your value
List<String> theList = (List<String>)field.get(myBean);
list.add("myvalue");

A: List<String> list = (List<String>)Field.get(myBean);
list.add(value);


text:
Q: Asp.net Core options class needs class instance as parameter, what if the class uses DI references? In startup.cs I have
services.AddAuthorization(options =>
{
    options.AddPolicy("RequireSomething", policy => policy.Requirements.Add(new SomeRequirement()));
});

What if the SomeRequirement -class needs a class that is only available through dependency injection, like below. I can't/don't want to instantiate SomeRequirement.
public class SomeRequirement : AuthorizationHandler<SomeRequirement>, IAuthorizationRequirement
{
    ISomething _something;
    public SomeRequirement(ISomething something)
    {
        _something = something;
    }

    protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, SomeRequirement requirement)
    {
        //TODO Do stuff
        return Task.CompletedTask;
    }
}

A: I suggest there are two solution for this.

*

*I assume that you have concrete implementation of ISomething. If you knew that that initialize that and pass it to parameter as parameter. This is short and sweet solution.

*Second solution is bit awkward.

*

*Default DI Container available in ASP.net Core does not support property injection.

*Instead of using Default DI Container try to use Autofac or some other DI Container that support property injection.
Update 1: Possible Solution. ( Using Default DI of ASP.net Core)
public class SomeRequirement : AuthorizationHandler<SomeRequirement>, IAuthorizationRequirement
{

    ISomething _something;
    public SomeRequirement(ISomething something)
    {
        _something = something;
    }

    protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, SomeRequirement requirement)
    {
        //TODO Do stuff
        return Task.CompletedTask;
    }
}

public interface ISomething
{

}

public class Something : ISomething
{

}

And In ConfigureService
services.AddSingleton<ISomething, Something>();
services.AddScoped(typeof(SomeRequirement));
services.AddAuthorization(options =>
            {
options.AddPolicy("RequireSomething", policy => policy.Requirements.Add(services.BuildServiceProvider().GetRequiredService<SomeRequirement>()));
            });


text:
Q: Big Data Load in Pandas Data Frame As I am new in Big Data Platform, I would like like to do some feature engineering work with my data. The Database size is about 30-50 Gb. Is is possible to load the full data (30-50Gb) in a data frame like pandas data frame?
The Database used here is Oracle. I tried to load it but I am getting out of memory error. Furthermore I like to work in Python.

A: pandas is not good if you have GBS of data it would be better to use distributed architecture to improve speed and efficiency. There is a library called DASK that can load large data and use distributed architecture.


text:
Q: How to Crop the visible portion of landscape video in android?
*

*I am working on Panning and cropping the landscape video using Texture     View.I am in a half way that I can pan the landscape video from left to right vice versa by using this example
https://github.com/crust87/Android-VideoCropView.

*FFMPEG can crop the particular portion of the video by using this command
ffmpeg -i /sdcard/videokit/in.mp4 -filter:v crop=720:1088:0:0 -c:a
copy /sdcard/videokit/out.mp4
How can I crop only the video which is visible in Texture View and save it local storage in Android.

crop=720:1088:0:0     is a hard coded width and height of the video and it is cropping fine.But how can I get the width and height of the visible video in Texture View to crop the visible video and Save it to the local storage in android.

public class MainActivity extends Activity {

    // Layout Components
    private FrameLayout top_frame;

    // Attributes
    private String originalPath;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.check);
        top_frame = (FrameLayout)findViewById(R.id.top_frame);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == 1000 && resultCode == RESULT_OK) {
            final VideoCropView mVideoCropView = new VideoCropView(this);
            mVideoCropView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {

                @Override
                public void onPrepared(MediaPlayer mp) {
                    mVideoCropView.start();
                }
            });
            top_frame.addView(mVideoCropView);
            Uri selectedVideoUri = data.getData();

            originalPath = getRealPathFromURI(selectedVideoUri);

            mVideoCropView.setVideoURI(selectedVideoUri);

            mVideoCropView.seekTo(1);
        }
    }

    public void onButtonLoadClick(View v) {
        top_frame.removeAllViews();
        Intent lIntent = new Intent(Intent.ACTION_PICK);
        lIntent.setType("video/*");
        lIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivityForResult(lIntent, 1000);
    }

    public String getRealPathFromURI(Uri contentUri) {    // getting image path from gallery.
        Cursor cursor = null;
        try {
            String[] proj = { MediaStore.Images.Media.DATA };
            cursor = getApplicationContext().getContentResolver().query(contentUri, proj, null, null, null);
            int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
            cursor.moveToFirst();
            return cursor.getString(column_index);
        } finally {
            if (cursor != null) {
                cursor.close();
            }
        }
    }

}

CropVideoView
public class VideoCropView extends TextureView implements MediaPlayerControl {
    // Constants
    private static final String LOG_TAG = "VideoCropView";
    private static final int STATE_ERROR = -1;
    private static final int STATE_IDLE = 0;
    private static final int STATE_PREPARING = 1;
    private static final int STATE_PREPARED = 2;
    private static final int STATE_PLAYING = 3;
    private static final int STATE_PAUSED = 4;
    private static final int STATE_PLAYBACK_COMPLETED = 5;

    // MediaPlayer Components
    protected Context mContext;
    private MediaPlayer mMediaPlayer;
    private Surface mSurface;
    private OnInfoListener mOnInfoListener;
    private OnCompletionListener mOCompletionListener;
    private OnErrorListener mOnErrorListener;
    private OnPreparedListener mOnPreparedListener;
    private OnTranslatePositionListener mOnTranslatePositionListener;

    // CropView Components
    private Matrix mMatrix;

    // MediaPlayer Attributes
    protected Uri mUri;
    private int mCurrentBufferPercentage;
    private int mSeekWhenPrepared;
    protected int mVideoWidth;
    protected int mVideoHeight;

    // CropView Attributes
    private float mRatioWidth;
    private float mRatioHeight;
    private float mPositionX;
    private float mPositionY;
    private float mBoundX;
    private float mBoundY;
    private int mRotate;
    private float mScaleX;
    private float mScaleY;
    private float mScale;

    // Working Variables
    private int mCurrentState = STATE_IDLE;
    private int mTargetState = STATE_IDLE;

    // Touch Event
    // past position x, y and move point
    float mPastX;
    float mPastY;
    float mTouchDistance;
    private Context context;

    // Constructors
    public VideoCropView(final Context context) {
        super(context);
        mContext = context;

        initAttributes();
        initVideoView();
    }

    public VideoCropView(final Context context, final AttributeSet attrs) {
        super(context, attrs);
        mContext = context;

        initAttributes(context, attrs, 0);
        initVideoView();
    }

    public VideoCropView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mContext = context;

        initAttributes(context, attrs, defStyleAttr);
        initVideoView();
    }

    private void initAttributes() {
        mRatioWidth = 1;
        mRatioHeight = 1;
    }

    private void initAttributes(Context context, AttributeSet attrs, int defStyleAttr) {
        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.VideoCropView, defStyleAttr, 0);

        mRatioWidth = typedArray.getInteger(R.styleable.VideoCropView_ratio_width, 3);
        mRatioHeight = typedArray.getInteger(R.styleable.VideoCropView_ratio_height, 4);
    }

    @Override
    protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) {
        int heightLayout;
        int widthLayout;
        widthLayout = MeasureSpec.getSize(widthMeasureSpec);
        heightLayout = MeasureSpec.getSize(heightMeasureSpec);
        setMeasuredDimension(widthLayout, heightLayout);

        /*if(widthMeasureSpec < heightMeasureSpec){

            int width = MeasureSpec.getSize(widthMeasureSpec);
            int height = (int) ((width / mRatioWidth) * mRatioHeight);

            setMeasuredDimension(width, height);

        }else{

            int width = MeasureSpec.getSize(widthMeasureSpec);
            int height =MeasureSpec.getSize(heightMeasureSpec);
            setMeasuredDimension(width, height);

        }
*/
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if(mCurrentState == STATE_ERROR || mCurrentState == STATE_IDLE || mCurrentState == STATE_PREPARING) {
            return false;
        }

        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                mPastX = event.getX();
                mPastY = event.getY();
                mTouchDistance = 0;
            case MotionEvent.ACTION_MOVE:
                if(mBoundX!=0 || mBoundY!=0) {
                    float dx = event.getX() - mPastX;
                    float dy = event.getY() - mPastY;
                    updateViewPosition(dx, dy);
                    mPastX = event.getX();
                    mPastY = event.getY();
                    mTouchDistance += (Math.abs(dx) + Math.abs(dy));
                }
                break;
            case MotionEvent.ACTION_UP:
                if (mTouchDistance < 25) {
                    if (isPlaying()) {
                        pause();
                    } else {
                        start();
                    }
                }

                mTouchDistance = 0;
                break;
        }

        return true;
    }

    @Override
    public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
        super.onInitializeAccessibilityEvent(event);
        event.setClassName(VideoView.class.getName());
    }

    @Override
    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
        super.onInitializeAccessibilityNodeInfo(info);
        info.setClassName(VideoView.class.getName());
    }

    public int resolveAdjustedSize(int desiredSize, int measureSpec) {
        Log.d(LOG_TAG, "Resolve called.");
        int result = desiredSize;
        int specMode = MeasureSpec.getMode(measureSpec);
        int specSize = MeasureSpec.getSize(measureSpec);

        switch (specMode) {
            case MeasureSpec.UNSPECIFIED:
            /*
             * Parent says we can be as big as we want. Just don't be larger
             * than max size imposed on ourselves.
             */
                result = desiredSize;
                break;

            case MeasureSpec.AT_MOST:
            /*
             * Parent says we can be as big as we want, up to specSize. Don't be
             * larger than specSize, and don't be larger than the max size
             * imposed on ourselves.
             */
                result = Math.min(desiredSize, specSize);
                break;

            case MeasureSpec.EXACTLY:
                // No choice. Do what we are told.
                result = specSize;
                break;
        }
        return result;
    }

    public void initVideoView() {

        mVideoHeight = 0;
        mVideoWidth = 0;
        setFocusable(false);
        setSurfaceTextureListener(mSurfaceTextureListener);
        mCurrentState = STATE_IDLE;
        mTargetState = STATE_IDLE;

    }

    public void setVideoPath(String path) {
        if (path != null) {
            setVideoURI(Uri.parse(path));
        }
    }

    public void setVideoURI(Uri pVideoURI) {
        mUri = pVideoURI;
        mSeekWhenPrepared = 0;

        MediaMetadataRetriever retriever = new MediaMetadataRetriever();
        retriever.setDataSource(mContext, pVideoURI);

        // create thumbnail bitmap
        if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
            String rotation = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION);

            try {
                mRotate = Integer.parseInt(rotation);
            } catch(NumberFormatException e) {
                mRotate = 0;
            }
        }

        retriever.release();

        openVideo();
        requestLayout();
        invalidate();
    }

    public void stopPlayback() {
        if (mMediaPlayer != null) {
            mMediaPlayer.stop();
            mMediaPlayer.release();
            mMediaPlayer = null;
            mCurrentState = STATE_IDLE;
            mTargetState = STATE_IDLE;
        }
    }

    public void openVideo() {
        if ((mUri == null) || (mSurface == null)) {
            // not ready for playback just yet, will try again later
            return;
        }
        // Tell the music playback service to pause
        // TODO: these constants need to be published somewhere in the
        // framework.
        Intent intent = new Intent("com.android.music.musicservicecommand");
        intent.putExtra("command", "pause");
        mContext.sendBroadcast(intent);

        // we shouldn't clear the target state, because somebody might have
        // called start() previously
        release(false);
        try {
            mMediaPlayer = new MediaPlayer();
            // TODO: create SubtitleController in MediaPlayer, but we need
            // a context for the subtitle renderers

            mMediaPlayer.setOnPreparedListener(mPreparedListener);
            mMediaPlayer.setOnVideoSizeChangedListener(mSizeChangedListener);
            mMediaPlayer.setOnCompletionListener(mCompletionListener);
            mMediaPlayer.setOnErrorListener(mErrorListener);
            mMediaPlayer.setOnInfoListener(mInfoListener);
            mMediaPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener);
            mCurrentBufferPercentage = 0;
            mMediaPlayer.setDataSource(mContext, mUri);
            mMediaPlayer.setSurface(mSurface);
            mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);

            mMediaPlayer.setScreenOnWhilePlaying(true);
            mMediaPlayer.prepareAsync();
            mMediaPlayer.setLooping(true);
            mCurrentState = STATE_PREPARING;
        } catch (IllegalStateException e) {
            mCurrentState = STATE_ERROR;
            mTargetState = STATE_ERROR;
            e.printStackTrace();
        } catch (IOException e) {
            mCurrentState = STATE_ERROR;
            mTargetState = STATE_ERROR;
            e.printStackTrace();
        }
    }

    private OnVideoSizeChangedListener mSizeChangedListener = new OnVideoSizeChangedListener() {
        @Override
        public void onVideoSizeChanged(final MediaPlayer mp, final int width,
                                       final int height) {
            mVideoWidth = mp.getVideoWidth();
            mVideoHeight = mp.getVideoHeight();

            if (mVideoWidth != 0 && mVideoHeight != 0) {
                requestLayout();
                if(mVideoWidth >= mVideoHeight)
                initVideo();
            }
        }
    };

    private OnPreparedListener mPreparedListener = new OnPreparedListener() {
        @Override
        public void onPrepared(final MediaPlayer mp) {
            mCurrentState = STATE_PREPARED;

            if (mOnPreparedListener != null) {
                mOnPreparedListener.onPrepared(mp);
            }

            mVideoWidth = mp.getVideoWidth();
            mVideoHeight = mp.getVideoHeight();

            int seekToPosition = mSeekWhenPrepared; // mSeekWhenPrepared may be
            // changed after seekTo()
            if (seekToPosition != 0) {
                seekTo(seekToPosition);
            }

            if ((mVideoWidth != 0) && (mVideoHeight != 0)) {
                if(mVideoWidth >= mVideoHeight) initVideo();

                if (mTargetState == STATE_PLAYING) {
                    start();
                }
            } else {
                // We don't know the video size yet, but should start anyway.
                // The video size might be reported to us later.
                if (mTargetState == STATE_PLAYING) {
                    start();
                }
            }
        }
    };

    private OnCompletionListener mCompletionListener = new OnCompletionListener() {
        @Override
        public void onCompletion(final MediaPlayer mp) {
            mCurrentState = STATE_PLAYBACK_COMPLETED;
            mTargetState = STATE_PLAYBACK_COMPLETED;

            if (mOCompletionListener != null) {
                mOCompletionListener.onCompletion(mMediaPlayer);
            }
        }
    };

    private OnInfoListener mInfoListener = new OnInfoListener() {
        public boolean onInfo(MediaPlayer mp, int arg1, int arg2) {
            if (mOnInfoListener != null) {
                mOnInfoListener.onInfo(mp, arg1, arg2);
            }
            return true;
        }
    };

    private OnErrorListener mErrorListener = new OnErrorListener() {
        @Override
        public boolean onError(MediaPlayer mp, int framework_err, int impl_err) {
            Log.d(LOG_TAG, "Error: " + framework_err + "," + impl_err);
            mCurrentState = STATE_ERROR;
            mTargetState = STATE_ERROR;

            /* If an error handler has been supplied, use it and finish. */
            if (mOnErrorListener != null) {
                if (mOnErrorListener.onError(mMediaPlayer, framework_err,
                        impl_err)) {
                    return true;
                }
            }
            return true;
        }
    };

    private OnBufferingUpdateListener mBufferingUpdateListener = new OnBufferingUpdateListener() {
        @Override
        public void onBufferingUpdate(final MediaPlayer mp, final int percent) {
            mCurrentBufferPercentage = percent;
        }
    };

    public void setOnPreparedListener(OnPreparedListener listener) {
        mOnPreparedListener = listener;
    }

    public void setOnCompletionListener(OnCompletionListener listener) {
        mOCompletionListener = listener;
    }

    public void setOnErrorListener(OnErrorListener listener) {
        mOnErrorListener = listener;
    }

    public void setOnInfoListener(OnInfoListener listener) {
        mOnInfoListener = listener;
    }

    private void release(boolean cleartargetstate) {
        if (mMediaPlayer != null) {
            mMediaPlayer.reset();
            mMediaPlayer.release();
            mMediaPlayer = null;
            mCurrentState = STATE_IDLE;
            if (cleartargetstate) {
                mTargetState = STATE_IDLE;
            }
        }
    }

    @Override
    public void start() {
        if (isInPlaybackState()) {
            mMediaPlayer.start();
            mCurrentState = STATE_PLAYING;

        }
        mTargetState = STATE_PLAYING;
    }

    @Override
    public void pause() {
        if (isInPlaybackState()) {
            if (mMediaPlayer.isPlaying()) {
                mMediaPlayer.pause();
                mCurrentState = STATE_PAUSED;
            }
        }

        mTargetState = STATE_PAUSED;
    }

    @Override
    public int getDuration() {
        if (isInPlaybackState()) {
            return mMediaPlayer.getDuration();
        }

        return -1;
    }

    @Override
    public int getCurrentPosition() {
        if (isInPlaybackState()) {
            return mMediaPlayer.getCurrentPosition();
        }
        return 0;
    }

    @Override
    public void seekTo(int msec) {
        if (isInPlaybackState()) {
            mMediaPlayer.seekTo(msec);
            mSeekWhenPrepared = 0;
        } else {
            mSeekWhenPrepared = msec;
        }
    }

    @Override
    public boolean isPlaying() {
        return isInPlaybackState() && mMediaPlayer.isPlaying();
    }

    @Override
    public int getBufferPercentage() {
        if (mMediaPlayer != null) {
            return mCurrentBufferPercentage;
        }
        return 0;
    }

    private boolean isInPlaybackState() {
        return (mMediaPlayer != null && mCurrentState != STATE_ERROR
                && mCurrentState != STATE_IDLE && mCurrentState != STATE_PREPARING);
    }

    @Override
    public boolean canPause() {
        return false;
    }

    @Override
    public boolean canSeekBackward() {
        return false;
    }

    @Override
    public boolean canSeekForward() {
        return false;
    }

    @Override
    public int getAudioSessionId() {
        return -1;
    }

    SurfaceTextureListener mSurfaceTextureListener = new SurfaceTextureListener() {
        @Override
        public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
            mSurface = new Surface(surface);
            openVideo();
        }

        @Override
        public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
            boolean isValidState = (mTargetState == STATE_PLAYING);
            boolean hasValidSize = (mVideoWidth == width && mVideoHeight == height);
            if (mMediaPlayer != null && isValidState && hasValidSize) {
                start();
            }
        }

        @Override
        public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
            if (mMediaPlayer != null) {
                mMediaPlayer.reset();
                mMediaPlayer.release();
                mMediaPlayer = null;
            }

            if (mSurface != null) {
                mSurface.release();
                mSurface = null;
            }

            return true;
        }

        @Override
        public void onSurfaceTextureUpdated(final SurfaceTexture surface) {

        }
    };

    @Override
    protected void onVisibilityChanged(View changedView, int visibility) {
        super.onVisibilityChanged(changedView, visibility);

        if (visibility == View.INVISIBLE || visibility == View.GONE) {
            if (isPlaying()) {
                stopPlayback();
            }
        }
    }

    public float getScale() {
        return mScale;
    }

    private void initVideo() {
        try {
                int width = getWidth();
                int height = getHeight();
                mScaleX = 1.0f;
                mScaleY = 1.0f;
                mPositionX = 0;
                mPositionY = 0;
                mBoundX = 0;
                mBoundY = 0;
                mMatrix = new Matrix();

                mScaleX = (float) mVideoWidth / width;
                mScaleY = (float) mVideoHeight / height;

                mBoundX = width - mVideoWidth / mScaleY;
                mBoundY = height - mVideoHeight / mScaleX;

                if (mScaleX < mScaleY) {
                    mScale = mScaleX;
                    mScaleY = mScaleY * (1.0f / mScaleX);
                    mScaleX = 1.0f;
                    mBoundX = 0;
                } else {
                    mScale = mScaleY;
                    mScaleX = mScaleX * (1.0f / mScaleY);
                    mScaleY = 1.0f;
                    mBoundY = 0;
                }

                mMatrix = new Matrix();
                mMatrix.setScale(mScaleX, mScaleY);
                setTransform(mMatrix);
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
    }

    public void updateViewPosition(float x, float y) {

        float nextX = mPositionX + x;
        float nextY = mPositionY + y;

        if(mScaleX == 1.0f) {
            x = 0;
        } else {
            if(nextX > 0) {
                x = -mPositionX;
                mPositionX = mPositionX + x;
            } else if(nextX < mBoundX) {
                x = mBoundX - mPositionX;
                mPositionX = mPositionX + x;
            } else {
                mPositionX = nextX;
            }
        }

        if(mScaleY == 1.0f) {
            y = 0;
        } else {
            if(nextY > 0) {
                y = -mPositionY;
                mPositionY = mPositionY + y;
            } else if(nextY < mBoundY) {
                y = mBoundY - mPositionY;
                mPositionY = mPositionY + y;
            } else {
                mPositionY = nextY;
            }
        }

        if(mOnTranslatePositionListener != null) {
            mOnTranslatePositionListener.onTranslatePosition(mPositionX, mPositionY, mPositionX * -mScale, mPositionY * -mScale);
        }

        mMatrix.postTranslate(x, y);
        setTransform(mMatrix);
        invalidate();
    }

//  public void setOriginalRatio() {
//      if(mVideoWidth != 0 && mVideoHeight != 0) {
//          int gcd = gcd(mVideoWidth, mVideoHeight);
//          setRatio(mVideoWidth / gcd, mVideoHeight / gcd);
//      }
//  }

    public int gcd(int n, int m) {
        while (m != 0) {
            int t = n % m;
            n = m;
            m = t;
        }

        return Math.abs(n);
    }

//  public void setRatio(float ratioWidth, float ratioHeight) {
//      mRatioWidth = ratioWidth;
//      mRatioHeight = ratioHeight;
//
//      int seek = getCurrentPosition();
//
//      requestLayout();
//      invalidate();
//      openVideo();
//
//      seekTo(seek);
//  }

    public float getRatioWidth() {
        return mRatioWidth;
    }

    public float getRatioHeight() {
        return mRatioHeight;
    }

    public float getRealPositionX() {
        return mPositionX * -mScale;
    }

    public float getRealPositionY() {
        return mPositionY * -mScale;
    }

    public int getVideoWidth() {
        return mVideoWidth;
    }

    public int getVideoHeight() {
        return mVideoHeight;
    }

    public int getRotate() {
        return mRotate;
    }

    public void setOnTranslatePositionListener(OnTranslatePositionListener pOnTranslatePositionListener) {
        mOnTranslatePositionListener = pOnTranslatePositionListener;
    }

    public void setContext(Context context) {
        this.context = context;
    }

    public interface OnTranslatePositionListener {
        public abstract void onTranslatePosition(float x, float y, float rx, float ry);
    }
}

FFMPEG for cropping particular portion

ffmpeg -i /sdcard/videokit/in.mp4 -filter:v crop=720:1088:0:0 -c:a copy /sdcard/videokit/out.mp4

public class SimpleExample extends Activity {

    String workFolder = null;
    String demoVideoFolder = null;
    String demoVideoPath = null;
    String vkLogPath = null;
    private boolean commandValidationFailedFlag = false;

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

        demoVideoFolder = Environment.getExternalStorageDirectory().getAbsolutePath() + "/videokit/";
        demoVideoPath = demoVideoFolder + "in.mp4";

        Log.i(Prefs.TAG, getString(R.string.app_name) + " version: " + GeneralUtils.getVersionName(getApplicationContext()) );
        workFolder = getApplicationContext().getFilesDir().getAbsolutePath() + "/";
        //Log.i(Prefs.TAG, "workFolder: " + workFolder);
        vkLogPath = workFolder + "vk.log";

        GeneralUtils.copyLicenseFromAssetsToSDIfNeeded(this, workFolder);
        GeneralUtils.copyDemoVideoFromAssetsToSDIfNeeded(this, demoVideoFolder);

        Button invoke =  (Button)findViewById(R.id.invokeButton);
        invoke.setOnClickListener(new OnClickListener() {
            public void onClick(View v){
                Log.i(Prefs.TAG, "run clicked.");
                if (GeneralUtils.checkIfFileExistAndNotEmpty(demoVideoPath)) {
                    new TranscdingBackground(SimpleExample.this).execute();
                }
                else {
                    Toast.makeText(getApplicationContext(), demoVideoPath + " not found", Toast.LENGTH_LONG).show();
                }
            }
        });

        int rc = GeneralUtils.isLicenseValid(getApplicationContext(), workFolder);
        Log.i(Prefs.TAG, "License check RC: " + rc);
    }

    public class TranscdingBackground extends AsyncTask<String, Integer, Integer>
    {

        ProgressDialog progressDialog;
        Activity _act;
        String commandStr;

        public TranscdingBackground (Activity act) {
            _act = act;
        }

        @Override
        protected void onPreExecute() {
            EditText commandText = (EditText)findViewById(R.id.CommandText);
            commandStr = commandText.getText().toString();

            progressDialog = new ProgressDialog(_act);
            progressDialog.setMessage("FFmpeg4Android Transcoding in progress...");
            progressDialog.show();

        }

        protected Integer doInBackground(String... paths) {
            Log.i(Prefs.TAG, "doInBackground started...");

            // delete previous log
            boolean isDeleted = GeneralUtils.deleteFileUtil(workFolder + "/vk.log");
            Log.i(Prefs.TAG, "vk deleted: " + isDeleted);

            PowerManager powerManager = (PowerManager)_act.getSystemService(Activity.POWER_SERVICE);
            WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "VK_LOCK");
            Log.d(Prefs.TAG, "Acquire wake lock");
            wakeLock.acquire();

            ///////////// Set Command using code (overriding the UI EditText) /////
            //commandStr = "ffmpeg -y -i /sdcard/videokit/in.mp4 -strict experimental -s 320x240 -r 30 -aspect 3:4 -ab 48000 -ac 2 -ar 22050 -vcodec mpeg4 -b 2097152 /sdcard/videokit/out.mp4";
            //String[] complexCommand = {"ffmpeg", "-y" ,"-i", "/sdcard/videokit/in.mp4","-strict","experimental","-s", "160x120","-r","25", "-vcodec", "mpeg4", "-b", "150k", "-ab","48000", "-ac", "2", "-ar", "22050", "/sdcard/videokit/out.mp4"};
            ///////////////////////////////////////////////////////////////////////

            LoadJNI vk = new LoadJNI();
            try {

                vk.run(GeneralUtils.utilConvertToComplex(commandStr), workFolder, getApplicationContext());

                GeneralUtils.copyFileToFolder(vkLogPath, demoVideoFolder);

            } catch (Throwable e) {
                Log.e(Prefs.TAG, "vk run exeption.", e);
            }
            finally {
                if (wakeLock.isHeld())
                    wakeLock.release();
                else{
                    Log.i(Prefs.TAG, "Wake lock is already released, doing nothing");
                }
            }
            Log.i(Prefs.TAG, "doInBackground finished");
            return Integer.valueOf(0);
        }

        protected void onProgressUpdate(Integer... progress) {
        }

        @Override
        protected void onCancelled() {
            Log.i(Prefs.TAG, "onCancelled");
            //progressDialog.dismiss();
            super.onCancelled();
        }

        @Override
        protected void onPostExecute(Integer result) {
            Log.i(Prefs.TAG, "onPostExecute");
            progressDialog.dismiss();
            super.onPostExecute(result);

            // finished Toast
            String rc = null;
            if (commandValidationFailedFlag) {
                rc = "Command Vaidation Failed";
            }
            else {
                rc = GeneralUtils.getReturnCodeFromLog(vkLogPath);
            }
            final String status = rc;
            SimpleExample.this.runOnUiThread(new Runnable() {
                public void run() {
                    Toast.makeText(SimpleExample.this, status, Toast.LENGTH_LONG).show();
                    if (status.equals("Transcoding Status: Failed")) {
                        Toast.makeText(SimpleExample.this, "Check: " + vkLogPath + " for more information.", Toast.LENGTH_LONG).show();
                    }
                }
            });
        }

    }

}

A: try to use getBitmap: TextureView.getBitmap for VideoCropView
it returns bitmap wanted resolution.
Then you can crop using Bitmap.createBitmap
like this
resizedbitmap=Bitmap.createBitmap(bmp, 0,0,yourwidth, yourheight);

A: Use this library to crop video with visible portion
Video Trimmer Library


text:
Q: read a char with space in C++ I'm doing a crud in C++, but in the data entry, I can't add space in the name, it bugs, I tried to use ignore and getline, it worked but the first letter disappears when reading the variable, using only getline, it doesn't work
class banca
{
private:
    char name[100];
    char email[100];
    char course_aluno[100];
    int semestre;
    int id;

public:
    friend istream& operator>>(istream& in, banca& p);
    friend ostream& operator<<(ostream& out, banca& p);
}

istream& operator>>(istream& in, banca& p)
{
    cout << "--------ALUNO--------\n";
    cout << "Name: \n" << endl;
    cin.ignore();
    cin.getline(p.name, 100);
    cout << "Email: \n";
    cin.ignore();
    cin.getline(p.email, 100);
    cout << "Course : \n";
    cin.ignore();
    cin.getline(p.course_aluno, 100);
    cout << "Semestre: \n";
    in >> p.semestre;
    cout << "ID: \n";
    in >> p.id;
}

A: You are basically running into an old problem, when working with input functions.
You need to learn about the difference between formatted and unformatted input.
The extraction and inserter operators >> and << are formatted input functions. They read or write a sequence of characters and format them. Example:
int i = 42;
std::cout << i;

This is an example of formatted IO. Although 42 has the binary representation of 101010 you will see the character sequence "42" on the screen.
Same is valid vice versa. If you want to read a number from the user, you typically use something like
int i;
std::cin >> i;

And, although you enter the characters '4' and '2' and ENTER ('\n') in the terminal, you will get the value 42 in your variable "i". The ENTER ('\n') is still in the input stream and has not yet been consumed. This is an additional problem that I will explain in a minute.
If you want to read a string, like "Peter Parker", and use
std::string name{};
std::cin >> name;

You will only get "Peter", because the formatted input functions (per default) stop converting after they hit a white space. So, after "Peter" has been read. The whitespace will not be consumed and will be still in the input stream.
For this reason you will use std::getline to read a string. This will not stop at a whitespace, but at a delimiter, per default at '\n'. So it will read a complete line.
From reading above, you may now see the problem. If there is a transition from formatted to unformatted input there is often the problem that there is still a whitespace (often the ENTER '\n', in your case the space) in the input stream. And you need to eliminate this whitespace.
You tried it with std::ignore, but there is a better possibility: std::ws. You may read here about it. This will often be the better approach. You may use it after the transition from formatted to unformatted input the eat away the non wanted white spaces. You can also use it in general if you want to eat up leading white spaces using unformatted input. (Beware: the formatted input functions like >> will skip the white spaces (per default)).
ignore is a unformatted input function and will actively wait for characters. It is an input function. It will not return until it read something. So, be careful. It will often be just used in error cases.
With the above knowledge, we could rewrite your code like the below:
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>

class banca
{
private:
    std::string name;
    std::string email;
    std::string course_aluno;
    int semestre;
    int id;

public:
    friend std::istream& operator >>(std::istream& in, banca& p);
    friend std::ostream& operator <<(std::ostream& out, const banca& p);
};

std::istream& operator>>(std::istream& in, banca& p)
{
    std::cout << "\n\n--------ALUNO--------\n";
    std::cout << "Name:\n";
    std::getline(in >> std::ws, p.name);

    std::cout << "Email:\n";
    std::getline(in, p.email);

    std::cout << "Course:\n";
    std::getline(in, p.course_aluno);

    std::cout << "Semestre:\n";
    in >> p.semestre;

    std::cout << "ID:\n";
    in >> p.id;
    return in;
}
std::ostream& operator <<(std::ostream& out, const banca& p) {
    return out << "\nName:\t\t " << p.name << "\nEMail:\t\t " << p.email << "\nCourse:\t\t "
        << p.course_aluno << "\nSemestre:\t " << p.semestre << "\nID:\t\t " << p.id << '\n';
}

int main() {
    banca b1,b2;

    std::cin >> b1;
    std::cout << b1;
    std::cin >> b2;
    std::cout << b2;
}

But beware. Input functions may fail. Check the return code of each input function. And if you have an error, then use ignore.
Example. If you expect a number and enter a string, then the formatted input function will fail, and all invalid characters will still be in the stream. Enter "abc" for the semester and you will see it.
Solution. Check result of IO function:
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include <limits>

class banca
{
private:
    std::string name{};
    std::string email{};
    std::string course_aluno{};
    int semestre{};
    int id{};

public:
    friend std::istream& operator >>(std::istream& in, banca& p);
    friend std::ostream& operator <<(std::ostream& out, const banca& p);
};

std::istream& operator>>(std::istream& in, banca& p)
{
    std::cout << "\n\n--------ALUNO--------\n";
    std::cout << "Name:\n";
    std::getline(in >> std::ws, p.name);

    std::cout << "Email:\n";
    std::getline(in, p.email);

    std::cout << "Course:\n";
    std::getline(in, p.course_aluno);

    std::cout << "Semestre:\n";
    in >> p.semestre;

    std::cout << "ID:\n";
    in >> p.id;
    return in;
}
std::ostream& operator <<(std::ostream& out, const banca& p) {
    return out << "\nName:\t\t " << p.name << "\nEMail:\t\t " << p.email << "\nCourse:\t\t "
        << p.course_aluno << "\nSemestre:\t " << p.semestre << "\nID:\t\t " << p.id << '\n';
}

int main() {
    banca b1,b2;

    if (std::cin >> b1)
        std::cout << b1;
    else {
        std::cerr << "\nError: Problem with input\n\n";
        std::cin.clear(); // unset failbit
        std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); // skip bad input
    }
    if (std::cin >> b2)
        std::cout << b2;
    else {
        std::cerr << "\nError: Problem with input\n\n";
        std::cin.clear(); // unset failbit
        std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); // skip bad input
    }
}


text:
Q: Can someone suggest a workflow for transcoding videos in iPhoto from Motion-JPEG to something smaller? I've shot a lot of video with "still" cameras over the years, and a lot of it is encoded with Motion-JPEG, which uses a lot of disk space per minute of video, compared to more efficient codecs such as H.264 or AVCHD, etc.
I'm not asking about the actual conversion, I know I could figure that out with ffmpeg or something like that. What I'm concerned about is converting the files but keeping them in-place in my iPhoto library, with all metadata intact. And even if there's a way to do so manually, that'd take way too much time — I need a way to automatically transcode Motion-JPEG videos "in place" without losing metadata.


text:
Q: How do I get out of fullscreen mode in Chrome with a Mac keyboard? Since F11 is volume, you can't just press it. Also, Shift+Cmd+F doesn't work either.

A: Press Fn+F11.
Fn will enable the actual F* keys instead of the media keys that are normally active.


text:
Q: Fastest way to list diagonal elements of a 2D array from a given point In a 2D array, for a given point what is the fastest way to get the diagonal elements in Scala? I understand that I can simply use a for loop to walk through the elements from a given point, but it feels very java-like. One of the ways I have come up with is to use a recursive function which accepts a function as an argument that calculates the next cell. However I feel such a method is very inefficient. What is the most idiomatic way in Scala to walk through a diagonal?

A: Fast functional code in Scala generally involves tail-recursive functions, and fast array access generally involves indexing.  So your options are limited.
In this case,
def diag(xss: Array[Array[Double]]): Array[Double] = {
  val ans = new Array[Double](xss.length)
  @annotation.tailrec def inner(i: Int) {
    if (i < xss.length) {
      ans(i) = xss(i)(i)
      inner(i+1)
    }
  }
  inner(0)
  ans
}

Personally, I find this less clear than the corresponding while loop
def diag(xss: Array[Array[Double]]): Array[Double] = {
  val ans = new Array[Double](xss.length)
  var i = 0
  while (i < xss.length) {
    ans(i) = xss(i)(i)
    i += 1
  }
  ans
}

but your preferences may vary.
There are optimization frameworks that will take higher-order index traversal (e.g. for (i <- xss.indices) ans(i) = xss(i)(i)) and change it into the while loop.  (ScalaBlitz is one.)

A: You can also use Tail recursion and Immutable data-structures like List as functional programming and immutability just go along very well. it offers two operations head and tail which takes constant time and Time-complexity of both operation is O(1).
 @annotation.tailrec
  def f(arr: List[List[Int]], res: List[Int] = Nil): List[Int] = {
    if (arr.isEmpty) res
    else
      f(arr.tail.map(_.tail), res :+ arr.head.head)
  }

  val x = List(List(1, 2, 3, 4), List(5, 6, 7, 8), List(9, 10, 11, 12), List(13, 14, 15, 16))

scala> f(x)
res0: List[Int] = List(1, 6, 11, 16)

A: Just for fun, some (arguably) more colloquial Scala, noticing that diagonal elements are issued from a rotation of lines, you may use code as follows. It'll be less efficient than a for loop though.
def diag(m: Array[Array[Int]]) = {
  val (m1, m2) = m.zipWithIndex.
    map{case (l, i) => val (l1, l2) = splitAt(l.size-i); l1 ++ l2}.
    transpose.zipWithIndex.
    map{case (l, i) => l.splitAt(i+1)}.
    unzip
  m1 ++ m2.init
}


text:
Q: How to solve error 'The invoke url for function could not be found' in Logic Apps? I added an action to my Logic App that was an Azure Function with blob trigger. When I tried to save, the next error popped:
Failed to save logic app (Logic App name). The invoke url for function '(url)' could not be found. Please check that the function app runtime supports integrating with logic apps and retry the operation.
Is it possible to integrate a blob trigger azure function in a Logic App?

A: It's not possible to use a blob triggered azure function in a logic app. Only HTTP triggered azure functions are allowed.

A: Agreed with Xavi Andreu
Click here for more details
Prerequisites
An Azure subscription. If you don't have an Azure subscription, sign up for a free Azure account.
An Azure function app, which is a container for Azure functions, along with your Azure function. If you don't have a function app, create your function app first. You can then create your function either outside your logic app in the Azure portal, or from inside your logic app in the Logic App Designer.
When working with logic apps, the same requirements apply to function apps and functions whether they are existing or new:
Your function app and logic app must use the same Azure subscription.
New function apps must use either the .NET or JavaScript as the runtime stack. When you add a new function to existing function apps, you can select either C# or JavaScript.
Your function uses the HTTP trigger template.


text:
Q: SonarLint for Visual Studio showing http 403 error We have a self-signed certificate for our SonarQube site. Certificate is issued on domain name.
Tools Version
1. SonarQube - 6.3
2. Visual Studio - 2015
3. SonarLint - 4.3.0.3718
Steps done for installing Certificate:
1. Copied the certificate and installed into Trusted store.
2. Import the certificate into Java Key Store.

On connecting SonarLint with SonarQube Server following error is coming:
Connecting to SonarQube server: https://mydomainname/
Connecting to SonarQube server: Validating credentials
Connecting to SonarQube server: Retrieving organizations
Connecting to SonarQube server: Detecting server plugins
SonarQube request failed: Response status code does not indicate success: 403 ( ).
Connecting to SonarQube server: Failed


text:
Q: the correct inline-SVG markup structure for animation purposes? Let's say i want to animate the vector that looks like this with Javascript.
Click Here .. ( Sorry my reputation Point bellow the requirement for image post)
then i divide it into 4 parts (head, body, 2 legs) and do some animation for each one of them..
What my question is, what is the correct markup structure for the vector above ??
from what I know .. there are 3 possibilities :

*

*Group
<svg>
  <g id='head'>...</g>
  <g id='body'>...</g>
  <g id='leg_1'>...</g>
  <g id='leg_2'>...</g>
</svg>

*Nested SVG
<svg>
  <svg id='head'>...</svg>
  <svg id='body'>...</svg>
  <svg id='leg_1'>...</svg>
  <svg id='leg_2'>...</svg>
</svg>

*SVG for each part
<svg id='head'></svg>
<svg id='body'></svg>
<svg id='leg_1'></svg>
<svg id='leg_2'></svg>
I know there are many libraries that can help us in making an SVG animation,
but that's not what I asked, what I want to know is how the markup structure should look ?
So it can be easier for us to manipulate them
is there anyone who can give me a lil enlightenment about this ?

A: Which of these structures you would use is not really determined by the fact that you want to animate them. The question you need to ask is, what is the most expressive way to formulate positioning, sizing and transformation properties for each of the parts, and for the relation to each other?

*

*If you use groups in a parent svg, coordinates are initially expressed relative to the viewport of the parent <svg> element.

*

*with a SVG transform attribute or a CSS transform property on the <g> element, you can move the parts around inside the parent. (By "move" I mean any afine transformation, including rotating, scaling, flipping and skewing)

*The coordinates the parts are expressed in would then be interpreted as sort of a "neutral" position within the parent.

*If you nest svgs, you establish new viewports for each part.

*

*For each part you define a rectangle within which it is to be to rendered with attributes x, y, width and height. preserveAspectRatio resolves the positioning of the viewBox within. SVG or CSS transform can be used to move these rectangles around.

*The coordinate system to express the child content in can be choosen with the viewBox attribute. Coordinates are then independent from any parent. Leaving the viewBox out, the result is equivalent to setting a translate transformation on a <g> element, using the respective x and y attribute values.

*If you use separate svgs, they are each positioned within the parent HTML following CSS rules.

*

*Remember, positioning properties expressed as percentages have different meaning in HTML and SVG. If you leave out the viewBox or the width/height properties on the <svg> element, there is a negotiation process to establish its size, and per HTML CSS rules, the sizes of parent elements may change.

*The coordinate system of the child content is defined by the respective viewBox attributes.

A question more specific in your case is whether you want to use CSS or SMIL animations. While SMIL is not implemented by Microsoft browsers, it has the richer syntax fot timing and stacking multiple animations on the same property/attribute. It also has the capability to react to events, and you can animate the XML attributes. (Not all of them, but all the positioining attributes mentioned here.) CSS has the capability to define a transform-origin for each transformation, which in SVG is only implemented for rotate transforms.
So, if you want to animate the positioning of the parts within the parent, choosing CSS animation might determine the structure so as to avoid using XML attributes for that positioning.


text:
Q: How to setup SSL on an IIS development server? Our team has a Windows 2008 server which is used primary for a common IIS dev box.
I want to enable SSL on one of the websites on IIS, so that it can only be accessed via HTTPS.
I created a self-signing certificate in IIS and installed it.  However when I access the website via the browser (Chrome, Firefox or IE - doesn't matter), it always gives the scary..."this is not secure" screen.  I've tried installing the certificate on my own computer, rebooting and I still get that screen.
One thing that I noticed is when I create a self-signed certificate, it adds the domain name to it...for instance, the name of the box is webIIS and our login domain is COMPANYDOMAIN.  So it will say that the certificate was created by webIIS.COMPANYDOMAIN.com.  This url resolves to nothing, since there is no such thing.
Am I going about it the wrong way?

A: I've answered a similar question here.
Few afterwords:

*

*Your server should have a dns name. If it is in a domain (Active directory or something) it surely does. Find it, use it in CN of the SSL certificate.

*CA that will issue SSL certificate should be trusted by clients accessing the server and by the server itself. Place CA certificate in Trusted Root Store (in LocalMachine store) on the server and all clients that will access it. If you have Active Directory it should be pretty simple to distribute it.

*CRL that CA has to issue in defined intervals (it's up to you if the CRL will be issued one a day, month, year or lifetime) has to be accessible by clients and server. Either place it at http url that you gave when issuing SSL certificate or manually place in each certificate store (in Trusted Root Store).


text:
Q: How can I create a list of all files in subdirectories while remaining the right order? I am trying to get a list of all the files in several subdirectories. However, it shuffles the order when I do so with this code:
os.chdir = "current working directory"

filelist = listdir(".")

newlist = []

for file in filelist:
    x = listdir(file)
    for file2 in file:
        path = join(getcwd(), file, file2)
        newlist.append(path)

sorted(newlist)

When I execute this code, I get the following output:

However, I would like to remain the order had in the files, like:

When I try to sort it by integer I get the following error:

ValueError                                Traceback (most recent call last)  in ()
  ----> 1 sorted(newlist, key=int) ValueError: invalid literal for int() with base 10: '/Users/michielaarts/Desktop/NEW DATASET TEST
  VERSION/13_01_2016_13_30_02_4191/1'

Anyone can help? Many thanks!


text:
Q: Tailwind Css Custom Animation on Hover I created an eye icon animation with tailwind however I could not make it on hover :( Could you please guide me on how can animate on hover? :)
Tailwind Eye-Icon-Animation
Thanks for your help!!

A: Extend animation in your config to support hover and group-hover variants

tailwind.config.js
const colors = require('tailwindcss/colors')

module.exports = {
  theme: {
    extend: {
      keyframes: {
      roll: {
          '0%, 10%, 20%, 30%, 40%, 60%, 70%, 80%, 90%, 100%': { transform: 'scale(1)'},
          '50%': { transform: 'scaleY(0)' }
        },

        movement: {
          '0%, 20%, 40%, 60%, 80%, 100%': { transform: 'translateX(0rem)' },
          '10%': { transform: 'translateX(2rem)' },
          '30%': { transform: 'translateX(-2rem)' },
          '50%': { transform: 'translateY(1rem)' },
          '70%': { transform: 'translateY(-1rem)' },
        }

      },
      animation: {
        roll: 'roll 3s infinite ',
        movement: 'movement 5s infinite'
      },
    },
  },
  variants: {
    extend: {
      animation: ['hover', 'group-hover']
    }
  },
  plugins: [],
}

Note: As your parent element has flex class, it has full width meaning that on hover of whole line (not only eye) hover effect has taken place. To prevent it, I've relocated h-36 and w-36 from 'eye' to a wrapper and add mx-auto to center it.


text:
Q: Java complex object to JSON with GSON I need to make a list of (sub)lists of objects (some MyBook) and save it to android internal storage. And each sublist has a name.
MyBook:
public class MyBook implements Parcelable{

String name;
List<String> authors;
String publisher;
Bitmap preview;
String description;
List<String> isbn;
List<String> isbnType;
//String isbn;
String imgLink="";
String googleLink ="";
String publishedDate;

ListOfMyBook (sublists):
public class ListOfMyBook extends ArrayList<MyBook>{
    public String listName;

    @Override
    public String toString() {
        // TODO Auto-generated method stub
        return listName;
    }

}

My current code for serialization and deserialization:
public static final String MY_LIST_FILE = "myList.json";
public static void exportToXml(Context context, List<ListOfMyBook> listListBook){
    Gson gson = new Gson();
    String json = gson.toJson(listListBook);
    Log.d("GSON",json);
    FileOutputStream outputStream;

    try {
      outputStream = context.openFileOutput(MY_LIST_FILE, Context.MODE_PRIVATE);
      outputStream.write(json.getBytes());
      outputStream.close();
    } catch (Exception e) {
        Log.d("exportToXml",e.toString());
      e.printStackTrace();
    }
}

public static List<ListOfMyBook> importFromXml(Context context){
    FileInputStream fis = null;
    try {
        fis = context.openFileInput(MY_LIST_FILE);
    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
     InputStreamReader isr = new InputStreamReader(fis);
     BufferedReader bufferedReader = new BufferedReader(isr);
     StringBuilder sb = new StringBuilder();
     String line;
     try {
        while ((line = bufferedReader.readLine()) != null) {
             sb.append(line);
         }
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
     String json = sb.toString();

    Type listType = new TypeToken<List<ListOfMyBook>>() {}.getType();
    Gson gson = new Gson();
    return gson.fromJson(json, listType);
}

This does not save the name of ListOfMyBook and it does not save empty ListOfMyBook. Any better implementation? Classes can be modified.

A: So I have actually came up with my own solution which is to not extend ArrayList<MyBook> but create a new class like this:
public class ListOfMyBook implements Parcelable{
    public String listName;
    public List<MyBook> listOfBook = new ArrayList<MyBook>();
}


text:
Q: JUNIT 5 report collapsing automatically When I'm running my tests on JUNIT 5, its report automatically collapses between one parameterized test and another during execution:

For example, when the 1st Device is running, the run report is opened like that. When the first test finishes and goes to the second run, all these lines collapses and I need to right-click the "TestCases" at the top and click on "Expand All" option.
Not sure if this is clear, I wish I could record a gif, but I'd like to know if there is an option to JUNIT do not collapse the executions automatically, because sometimes I want to follow the execution in real-time and see if any of the tests got an error, and not just at the end of the execution.

A: JUnit is just sending out "events" to your IDE about tests being started and finished. JUnit has no control over how the IDE will animate this stream of events.
So I recommend that you open a feature request for your IDE vendor.


text:
Q: How come that sum of two lines in a triangle equals the third line? I have been looking into this question and cannot understand how they came to a conclusion in their solution.
we know that : $$(1) :\overrightarrow{a} + \overrightarrow{b} + \overrightarrow{c} = 0 $$ and that :  $$\left|\overrightarrow{a}\right|=1 ,\left|\overrightarrow{b}\right|=2,\left|\overrightarrow{c}\right|=3   $$
so as we see here, these vectors are lines of a triangle because of fact (1) but we know that sum of length of two lines in a triangle is bigger than the third line but a+b=c !
they came to a conclusion that : the vectors a,b,c are  collinear and more specifically, the angle between vector a and vector b is zero and the angle between the vector c and a,b is pi (180 degres).
**Can someone explain me how they came to this conclusion and how that fact(1) does not contradict the reality? **

A: Hint : draw the base 3units and then try to draw other sides and try to make it a triangle and get to the conclusion for the angles.


text:
Q: Curvature tensor of 2-sphere using exterior differential forms (tetrads) $ds^2= r^2 (d\theta^2 + \sin^2{\theta}d\phi^2)$
The following is the tetrad basis
$e^{\theta}=r d{\theta}  \,\,\,\,\,\,\,\,\,\,    e^{\phi}=r \sin{\theta} d{\phi}$
Hence, $de^{\theta}=0 \,\,\,\,\,\, de^{\phi}=r\cos{\theta} d{\theta} \wedge d\phi = \frac{\cot{\theta}}{r} e^{\theta}\wedge e^{\phi}$
Setting the torsion tensor to zero gives: $de^a + \omega^a _b \wedge e^b =0$.
This equation for $a=\theta$ gives $\omega^{\theta}_{\phi}=0$. (I have used $\omega^{\theta}_{\theta}=\omega^{\phi}_{\phi}=0$)
The equation for $\phi$:  $\omega^{\phi}_{\theta} \wedge e^{\theta}=\frac{\cot{\theta}}{r} e^{\phi} \wedge e^{\theta} \implies \omega^{\phi}_{\theta}=\frac{\cot{\theta}}{r} e^{\phi}=\cos{\theta} d{\phi}$
$d\omega^{\phi}_{\theta}=-\sin{\theta} d\theta \wedge d\phi$
Hence $R^i_j = d\omega^i_j+ \omega^i_b \wedge \omega^b_j$ gives $R^{\phi}_{\theta}=-\sin{\theta} d\theta \wedge d\phi$ and $R^{\theta}_{\phi}=0$
Writing in terms of components gives $R^{\phi}_{\theta \theta \phi}=-\sin{\theta}$, and $R^{\theta}_{\phi \phi \theta}=0$
However this is wrong. I have done the same problem using Christoffel connections, and the answer which I know to be correct is
$R^{\phi}_{\theta \theta \phi}=-1$, and $R^{\theta}_{\phi \phi \theta}=\sin^2{\theta}$
Please could anyone tell mw what I am doing wrong? Any help will be appreciated?

A: $R^{\phi}_{\theta}=-\sin{\theta} d\theta \wedge d\phi$
So:
$R^{\phi}_{\theta}= - \frac{ e^\theta  \wedge e^\phi}{r^2}$
So:
$R^{\phi}_{\theta \theta \phi}= - \frac{1}{r^2}$
Then $R_{\phi\theta \theta \phi}= g_{\phi\phi}R^{\phi}_{\theta \theta \phi} = -sin^2\theta$
Then $R_{\theta \phi \theta \phi} = - R_{\phi\theta \theta \phi} = sin^2\theta$
Then $R^\theta _{\phi \theta \phi} = g^{\theta\theta}R_{\theta \phi \theta \phi}  = \frac {sin^2\theta}{r^2}$
Also, you could not have $\omega^\theta_\phi=0$, it is because $\omega^{ab}=−\omega^{ba}$ and the metrics is diagonal


text:
Q: Error, Unable to set the formulaArray property of the range class I've created the following formula:
=IFNA(LOOKUP(10^99,--MID(O2,MIN(IF((--ISNUMBER(--MID(O2,ROW($1:$25),1))=0)*ISNUMBER(--MID(O2,ROW($2:$26),1)),ROW($2:$26))),ROW($1:$25))),SUMPRODUCT(MID(0&RIGHT(N2,4),LARGE(INDEX(ISNUMBER(--MID(RIGHT(N2,4),ROW($1:$25),1))* ROW($1:$25),0),ROW($1:$25))+1,1)*10^ROW($1:$25)/10))

It looks at column "N" and bring through just the number string. If there is an N/A it will then do the same on column "O" which is ran as an array and it works fine.
Yet when I converted it to VBA code, I get the error mentioned in the title .
Range("L2").Select
    Selection.FormulaArray = _
        "=IFNA(LOOKUP(10^99,--MID(RC[3],MIN(IF((--ISNUMBER(--MID(RC[3],ROW(R1:R25),1))=0)*ISNUMBER(--MID(RC[3],ROW(R2:R26),1)),ROW(R2:R26))),ROW(R1:R25))),SUMPRODUCT(MID(0&RIGHT(RC[2],4),LARGE(INDEX(ISNUMBER(--MID(RIGHT(RC[2],4),ROW(R1:R25),1))* ROW(R1:R25),0),ROW(R1:R25))+1,1)*10^ROW(R1:R25)/10))"

What it going wrong?

A: thank you Dick for pointing me in the right directions and Rory for correcting my error
http://www.mrexcel.com/forum/excel-questions/853889-long-array-visual-basic-applications-issue.html


text:
Q: VBA color entire row base on Cell text example row B4 to AN4 to color green base on cell AF4 is ready as green , and in progress as yellow, and pending as red.
this applied for all rows

A: Highlight specific columns of rows based on the given criteria
Sub ColourChange()

    Dim MySht As Worksheet
    Dim MyRng As Range
    Set MySht = ThisWorkbook.Sheets("Sheet1")
    Set MyRng = MySht.UsedRange.Columns("AF")

    For Each cell In MyRng.Cells
        Set activeRow = Range("B:AN").Rows(cell.Row)
        Select Case cell.Value    '// you can add the filter here
            Case "Available", "Resell"
                activeRow.Interior.Color = XlRgbColor.rgbLightGreen
            Case "Deal", "Sold +Excl", "Sold Excl", "Holdback", _
                 "Pending", "Expired", "Sold CoX"
                activeRow.Interior.Color = XlRgbColor.rgbRed
            Case "Sold nonX", "Sold NonX"
                activeRow.Interior.Color = XlRgbColor.rgbBlue
        End Select
    Next
End Sub

A: Untested but something along these lines should work:
Sub Tester()
    Dim rw As Range, clr As Long
    Set rw = ActiveSheet.Range("B4:AN4") 'start row

    Do While Application.CountA(rw) > 0 'loop while there's data
        Select Case rw.EntireRow.Columns("AF").Value
            Case "ready": clr = vbGreen
            Case "in progress": clr = vbYellow
            Case "pending": clr = vbRed
            Case Else: clr = -1
        End Select

        If clr <> -1 Then
            rw.Interior.Color = clr         'apply fill
        Else
            rw.Interior.ColorIndex = xlNone 'no fill
        End If
        Set rw = rw.Offset(1, 0) 'next row
    Loop
End Sub


text:
Q: "android.intent.extra.STREAM" While doing some R&D I found a code using the following statement
Uri uri = (Uri) getIntent().getExtras().get("android.intent.extra.STREAM");

I have scanned the whole project to find whether the activity was called from any other activity, but did'nt find any. Can any one tell me what will this statement return and what is the statement "android.intent.extra.STREAM" doing in the code, whether it is a constant, if yes what is its value?
Thanks in advance.
Happy Coding

A: This statement will return the extra named "android.intent.extra.STREAM". Whatever activity issued the intent set that value, and there's no easy way to tell what that data is without seeing how it is used, or where/how it was set. Don't forget that the intent could be issued by any activity or application.
Found your answer:
public static final String EXTRA_STREAM                       Since: API Level 1

A content: URI holding a stream of data associated with the Intent, used with
ACTION_SEND to supply the data being sent.
Constant Value: "android.intent.extra.STREAM"

So, I would posit that it's the result of poor coding (using the value rather than the defined static constant) for an intent designed to share images. The intent includes the Intent.EXTRA_STREAM extra as the data stream for the image (in this case) to be shared. IMO, the code should have been:
Uri uri = (Uri) getIntent().getExtras().get(Intent.EXTRA_STREAM);

But regardless, it appears to be the documented/standardized way of attaching a binary datastream to an intent.
Continued research seems to indicate that it adds Campyre (a Campfire client) as a "Share" option. So from Gallery, if you choose to Share an image, Campyre shows up as one of the options.
Google and the Android dev site are your friends. It took me all of about 2 minutes total to get all that information.  Not as long as it took to type the replies and subsequent edits...
More elaboration:
Here is the relevant section from AndroidManifest.xml:
    <activity android:name=".ShareImage"
      android:theme="@android:style/Theme.Dialog"
      android:label="@string/app_name">
      <intent-filter>
        <action android:name="android.intent.action.SEND" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="image/*" />
      </intent-filter>
    </activity>

Which indicates that the Activity can handle Intents for sharing where the item being shared is an image.


text:
Q: Hive Error while running script I am getting the following error while running Hive query is as below. Please help.
Error: Error while compiling statement: FAILED: NumberFormatException For input string: "HIVE_DEFAULT_PARTITION" (state=42000,code=40000)


text:
Q: Which panel unit root tests should I use? Panel of 7 countries and 7 years I have a balanced data of 7 years and looking into 7 countries. There are many panel unit root tests to be used. I am looking at using the Fisher-type and IPS tests but there are more than that and I am not sure which test to choose as I have a sample of small N and small T.
I am a beginner at unit root tests and I will be using Stata for this test.


text:
Q: Button Responsiveness at UIScrollView I am dynamically creating a uiscrollview and i place some uiview's that contains some label and buttons inside to display some news. Every button inside the sub uiview calls a rest function to like, unlike or share the news. Some of the buttons opens overlay screens like comment news. I am assigning actions to buttons inside the main form that contains the uiscrollview.
When i click a button that opens an overlay screen. When i close the overlay screen and hit Like button, it does not respond to touches. After attempting one or two more times, it works.
Does anyone has any idea about this issue?

A: Are you using UITapGestureRecogniser for "Click action"? If yes, you propably want to set flag "cancelsTouchesInView = NO" for this recogniser.

A: Check to see if there is a clear view covering your button.  That view will consume your tap, so the button never sees it.


text:
Q: How to loop through all excel sheets while opening an excel file from Oracle Forms Builder? I want to reaf an excel file with the help of Client_OLE2 in my Oracle forms.
I succeed to do that if the excel just has one sheet because this sheet is the activesheet, but if I have several sheets in my excel,I am not able to read the desire sheet.
        ----------------Get the file to open        ---------------------------

v_fName := :upload.ti_file_name_upload;

IF ( v_fName IS NOT NULL ) THEN

 clear_form ( no_validate );

    --------------INITIATE EXCEL APPLICATION---------------------------

application := client_OLE2.create_obj('Excel.Application');
    client_OLE2.set_property(application,'Visible', 'false');

----------------GET WORKBOOKS FROM EXCEL APPLICATION---------------

    workbooks := client_OLE2.Get_Obj_Property(application, 'Workbooks');

    ----------------OPEN REQUIRED WORKBOOK-----------------------------

    args := client_OLE2.CREATE_ARGLIST;
    client_OLE2.add_arg(args,v_fName);
    workbook := client_OLE2.GET_OBJ_PROPERTY(workbooks,'Open',args);
    client_OLE2.destroy_arglist(args);

----------------OPEN REQUIRED WORKSHEET----------------------------

    worksheets := client_OLE2.GET_OBJ_PROPERTY(workbook, 'Worksheets');
    worksheet := client_OLE2.GET_OBJ_PROPERTY(application,'activesheet');

----------------Specify columns that must be read------------------

Thank you!

A: I replaced
worksheets := client_OLE2.GET_OBJ_PROPERTY(workbook, 'Worksheets');
worksheet := client_OLE2.GET_OBJ_PROPERTY(application,'activesheet');

with
args:= client_OLE2.create_arglist;
   client_OLE2.add_arg(args, 'Sheet Name');
   worksheet := client_OLE2.GET_OBJ_PROPERTY(workbook, 'Sheets', args);
   client_OLE2.destroy_arglist(args);
and now it works fine!