text:
Q: convert tree to another tree with new format in Ocaml I want to convert on tree to another tree with different type ,about 1 week i tried the different solution but i didn't successful, please help me.
my code is :
type (a',b') Tree = Lead of a'| Noeud of b'*a'*(a',b')Tree list
type strTree = st of int | Leaf of String | Tree of string *Strin* strTree list
val Tree-strTree :(a'->string)->(b'->string)->(a',b')Tree -> strTree

let Tree-strTree p pp a =
   let rec mapA a' = match a' with
     | Lead _ -> Tree ("","",[])
     | Noeud (f,r,l)-> Tree(p f ,pp r ,fold_left(fun x y->x @ [mapA y])[] l)
   in
   mapA  a

Error: unbound value fold_left

I don't Know how i can use fold_left

A: There is a fold_left function in the List module. You just need to give the name of the module:
List.fold_left (fun x y -> ... )

However, as others have noted there are many other problems with your code, at least as you have shown it here.


text:
Q: Django the powerpoint generated using python-pptx library has error message I use python-pptx v0.6.2 to generate powerpoint. I read a exist powerpoint into BytesIO, then do some modification and save it. I can download the file successfully, and I'm sure the content can be write into the file. But when I open the powerpoint, it will popup a error message "Powerpoint found a problem with content in foo.pptx. Powerpoint can attempt to repair the presatation.", then I have to click "repair" button, the powerpoint will display as "repaired" mode. My Python version is 3.5.2 and Django version is 1.10. Below is my code:
with open('foo.pptx', 'rb') as f:
    source_stream = BytesIO(f.read())
prs = Presentation(source_stream)

first_slide = prs.slides[0]
title = first_slide.shapes.title
subtitle = first_slide.placeholders[1]
title.text = 'Title'
subtitle.text = "Subtitle"

response = HttpResponse(content_type='application/vnd.ms-powerpoint')
response['Content-Disposition'] = 'attachment; filename="sample.pptx"'
prs.save(source_stream)
ppt = source_stream.getvalue()
source_stream.close()
response.write(ppt)
return response

Any help is appreciate, thanks in advance!

A: It looks like you've got problems with the IO.
The first three lines can be replaced by:
prs = Presentation('foo.pptx')

Placing the file into a memory-based stream just uses unnecessary resources.
On the writing, you're writing to that original (unnecessary) stream, which is dicey. I suspect that because you didn't seek(0) that you're appending onto the end of it. Also it's conceptually more complicated to deal with reuse.
If you use a fresh BytesIO buffer for the save I think you'll get the proper behavior. It's also better practice because it decouples the open, modify, and save, which you can then factor into separate methods later.
If you eliminate the first BytesIO you should just need the one for the save in order to get the .pptx "file" into the HTTP response.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Querying nested elements in Firebase I am trying to make a query to a Firebase collection using swift.
My Collection is like this :
{
  "networks" : {
    "-KF9zQYGA1r_JiFam8gd" : {
      "category" : "friends",
      "members" : {
        "facebook:10154023600052295" : true
      },
      "name" : "My friends",
      "owner" : "facebook:10154023600052295",
      "picture" : "https://my.img/img.png"
    },
    "-KF9zQYZX6p_ra34DTGh" : {
      "category" : "friends",
      "members" : {
        "tototata" : true
      },
      "name" : "My friends2",
      "owner" : "facebook:10154023600052295",
      "picture" : "https://my.img/img.png"
    }
  }

and my query is like that :
let networksRef = ref.childByAppendingPath("networks")
                     .queryOrderedByChild("members")
                     .queryEqualToValue(true, childKey: uid)

Then I am populating a TableView using FirebaseUI.
the thing is that query doesn't return anything, I also tried using this kind of query :
let networksRef = ref.childByAppendingPath("networks")
                     .queryOrderedByChild("members")
                     .queryStartingAtValue(true, childKey: uid)
                     .queryEndingAtValue(true, childKey: uid)

And to be clear "uid" is the node name nested in the "members" node with true as value. (As on the picture)
I can't get all the nodes without filtering because of the amount of data to be downloaded.
I'm stuck on that for a day, and I'm going crazy.. :-)
If someone can help ?

A: The correct syntax would be:
let networksRef = ref.childByAppendingPath("networks")
                     .queryOrderedByChild("members/\(uid)")
                     .queryEqualToValue(true)

But note that you'll need an index for each uid for this to work efficiently:
{
  "rules": {
    "networks": {
      ".indexOn": ["facebook:10154023600052295", "tototata"]
    }
  }
}

Without these indexes, the Firebase client will download all data and do the filtering locally. The result will be the same, but it'll consume a lot of unneeded bandwidth.
A proper solution for this requires that you change your data structure around. In Firebase (and most other NoSQL databases) you often end up modeling the data in the way that your application wants to access it. Since you are looking for the networks that a user is part of, you should store the networks per user:
"networks_per_uid": {
  "facebook:10154023600052295": {
    "-KF9zQYGA1r_JiFam8gd": true
  },
  "tototata": {
    "-KF9zQYZX6p_ra34DTGh": true
  },
}

Adding this so-called index to your data structure is called denormalizing and is introduces in this blog post, the documentation on data structuring and this great article about NoSQL data modeling.


text:
Q: pyttsx3 not installing on windows(filenotFounderror)
ERROR: Command errored out with exit status 1:
       command: 'c:\users\kvvinod\appdata\local\programs\python\python38-32\python.exe'
  -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\kvvinod\AppData\Local\Temp\pip-install-7kf48pty\pyobjc-framework-Security\setup.py'"'"';
  file='"'"'C:\Users\kvvinod\AppData\Local\Temp\pip-install-7kf48pty\pyobjc-framework-Security\setup.py'"'"';f=getattr(tokenize,
  '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"',
  '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))'
  egg_info --egg-base
  'C:\Users\kvvinod\AppData\Local\Temp\pip-install-7kf48pty\pyobjc-framework-Security\pip-egg-info'
           cwd: C:\Users\kvvinod\AppData\Local\Temp\pip-install-7kf48pty\pyobjc-framework-Security\
      Complete output (15 lines):
      Traceback (most recent call last):
        File "", line 1, in
        File "C:\Users\kvvinod\AppData\Local\Temp\pip-install-7kf48pty\pyobjc-framework-Security\setup.py",
  line 20, in
          Extension(
        File "C:\Users\kvvinod\AppData\Local\Temp\pip-install-7kf48pty\pyobjc-framework-Security\pyobjc_setup.py",
  line 408, in Extension
          os_level = get_os_level()
        File "C:\Users\kvvinod\AppData\Local\Temp\pip-install-7kf48pty\pyobjc-framework-Security\pyobjc_setup.py",
  line 218, in get_os_level
          pl = plistlib.readPlist("/System/Library/CoreServices/SystemVersion.plist")
        File "c:\users\kvvinod\appdata\local\programs\python\python38-32\lib\plistlib.py",
  line 99, in readPlist
          with _maybe_open(pathOrFile, 'rb') as fp:
        File "c:\users\kvvinod\appdata\local\programs\python\python38-32\lib\contextlib.py",
  line 113, in enter
          return next(self.gen)
        File "c:\users\kvvinod\appdata\local\programs\python\python38-32\lib\plistlib.py",
  line 82, in _maybe_open
          with open(pathOrFile, mode) as fp:
      FileNotFoundError: [Errno 2] No such file or directory: '/System/Library/CoreServices/SystemVersion.plist'
      ----------------------------------------

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

A: It's a bug in pyttsx3 2.80: https://github.com/nateshmbhat/pyttsx3/issues/82. Not fix yet. Try downgrading to pyttsx3 2.71:
pip install -U pyttsx3==2.71


text:
Q: Solve the system of differential equations $\frac{dx}{dt}+\frac{-4x+2y}t=-9, \frac{dy}{dt}+\frac{x-5y}t=3$
Solve the system of differential equations
  $$\frac{dx}{dt}+\frac{-4x+2y}t=-9$$ $$\frac{dy}{dt}+\frac{x-5y}t=3$$
  in $t\ge 1$ subject to $x=0$ and $y=0$ at $t=1$.

It gives the hint
[powers of
$t$].
I have tried rearranging, differentiating and from the hint I thought to try series solution but nothing works.
Thank you for any help

A: Considering the following linear combinations:
$$\frac{dx}{dt}+\frac{dy}{dt}-\frac{3(x+y)}{t}+6=0$$
$$\frac{dx}{dt}-2\frac{dy}{dt}-\frac{6(x-2y)}{t}+15=0$$
Can you proceed?


text:
Q: Changes Required when moving a jqGrid from ASP.NET MVC to a WebForms project I have a JQGrid treegrid that I need to move from a ASP.NET MVC project to a WebForms project.
I've decided to use a webservice in the project to return the data for the grid as I don't have much experience writing custom handlers.
Here is my existing grid:
$("#TreeGrid").jqGrid({
                 url: '@Url.Action("GetSPTreeJSON", "Index")',
                 treeGrid: true,
                 datatype: "json",
                 mtype: "POST",
                 treeGridModel: 'adjacency',
                 postData: { currentUserGroup: currentUserGroup },
                 colNames: ["id", "partners"],
                 colModel: [
                        { name: 'id', index: 'id', hidden: true, key: true },
                        { name: 'partners', index: 'name', width: 500, sortable: false, classes: 'pointer' }
                ],
                 ExpandColumn: 'partners',
                 gridview: true
             });

And existing controller action:
    public JsonResult GetSPTreeJSON(string nodeid, string n_level, Guid currentUserGroup)
    {
        List<TreeNode> list = clientService.GetTreeNodeList(nodeid, n_level, currentUserGroup);

        var jsonData = new
        {
            page = 1,
            total = 1,
            records = 1,
            rows = (
                from TreeNode u in list
                select new
                {
                    cell = new object[] { u.Id.ToString(), u.name, u.level, u.ParentId, u.isLeaf, false }
                }).ToList()
        };

        return Json(jsonData, JsonRequestBehavior.AllowGet);
    }

Sample Json (for root node):
{
   "page":1,
   "total":1,
   "records":1,
   "rows":[
      {
         "cell":[
            "5a1a9742-300f-11d3-941f-036008032006",
            "root node",
            0,
            null,
            false,
            false
         ]
      }
   ]
}

My question is: What exactly is required to get this to work in an asp.net webforms project using json data and webservices?
What I have semi working so far:
Added or changed the following jqGrid options:
url: 'JQGridData.asmx/GetSPTreeJSON', //now points to the webservice
ajaxGridOptions: { contentType: 'application/json; charset=utf-8' }, //looks like it wont hit the webservice if this isn't included
serializeGridData: function (postData) { //looks like this is required because the webservice call will fail if not passed the correct parameters
                    if (postData.nodeid === undefined) postData.nodeid = null;
                    if (postData.n_level === undefined) postData.n_level = null;
                    return JSON.stringify(postData);
                },

WebService skeleton that needs to return the JSON:
 [WebMethod, ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string GetSPTreeJSON(string nodeid, string n_level, Guid currentUser)
        {

              List<TreeNode> list = clientService.GetTreeNodeList(nodeid, n_level, currentUserGroup);

            var jsonData = new
            {
                page = 1,
                total = 1,
                records = 1,
                rows = (
                    from TreeNode u in list
                    select new
                    {
                        cell = new object[] { u.Id.ToString(), u.name, u.level, u.ParentId, u.isLeaf, false }
                    }).ToList()
            };

JObject json = JObject.Parse(jsonData);
return = json.ToString();
        }

EDIT:
Following Olegs advice, I have edited my webservice method as follows:
 public class jqGridRecord
    {
        public Guid Id { get; set; }
        public string Name { get; set; }
        public int level { get; set; }
        public Guid? parent { get; set; }
        public bool isLeaf { get; set; }
        public bool expanded { get; set; }
    }

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class JQGridData : System.Web.Services.WebService
{
    private readonly ClientService clientService = new ClientService();

    [WebMethod, ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public JqGridData GetSPTreeJSON(string nodeid, string n_level, Guid currentUser)
    {
        List<TreeNode> list = clientService.GetTreeNodeList(nodeid, n_level, currentUser);

        List<jqGridRecord> data = new List<jqGridRecord>();

        foreach (var i in list)
        {
            jqGridRecord r = new jqGridRecord
            {
                Id = i.Id,
                Name = i.name,
                level = i.level,
                parent = i.ParentId,
                isLeaf = i.isLeaf,
                expanded = false
            };

            data.Add(r);
        }

        int recordsCount = data.Count;

        return new JqGridData()
        {
            total = 1,
            page = 1,
            records = recordsCount,
            rows = data
        };
    }
}

public class JqGridData
{
    public int total { get; set; }
    public int page { get; set; }
    public int records { get; set; }
    public List<jqGridRecord> rows { get; set; }
}

and added the following to the jqGrid options:
 colModel: [
                        { name: 'Id', hidden: true, key: true },
                        { name: 'Name', width: 500, sortable: false, classes: 'pointer' }
                ],
jsonReader: { repeatitems: false, root: "d.rows", page: "d.page", total: "d.total", records: "d.records" },

The following JSON is now returned for the root, and I can see the root node in the tree but cant click the + icon to expand it...it seems there is still some kind of problem with the jsonReader?
{
   "d":{
      "__type":"SSDS.iValue.JqGridData",
      "total":1,
      "page":1,
      "records":1,
      "rows":[
         {
            "Id":"5a1a9742-3e0f-11d3-941f-006008032006",
            "Name":"acsis Limited",
            "level":0,
            "parent":null,
            "isLeaf":false,
            "expanded":false
         }
      ]
   }
}

A: I see two clear errors:

*

*you should define some class for example TreeGrid which describes var jsonData object which you use in WebMethod.  You should remove manual conversion of the object to string. Instead of that web method have to return object TreeGrid instead of string. You can't return raw data from ASMX web service and .NET framework convert always the object to the string.

*.NET framework place the full response of the web method inside of d prpterty. So the response will be

{
    "d": {
       "page":1,
       "total":1,
       "records":1,
       "rows":[ ...]
}

So you should add the option jsonReader to jqGrid:
jsonReader: {
    root: "d.rows",
    page: "d.page",
    total: "d.total",
    records: "d.records"
}

By the way if you do decide to use ASHX handle instead of ASMX web service you can improve a little performance of your application. The example of the corresponding C# code you can find and download  in the answer.
    }


text:
Q: Angular6 rxjs 6 update Hi I appreciate these are a pain.
After updating Angular to version 6 and rxjs to version 6 we are getting a lot of browser errors that the system is unable to instantiate a number of packages.
We use a combination of node_modules and systemjs.config.server.js
without trying to start an argument on whether one is better than the other, If there are any improvements please let me know.
package.json
 {
      "version": "1.0.0",
      "name": "infrastructure-annual-reporting",
      "private": true,
      "dependencies": {
        "@angular/animations": "^6.0.0",
        "@angular/cdk": "^6.0.0",
        "@angular/common": "^6.0.0",
        "@angular/compiler": "^6.0.0",
        "@angular/core": "^6.0.0",
        "@angular/forms": "^6.0.0",
        "@angular/http": "^6.0.0",
        "@angular/material": "^6.0.1",
        "@angular/platform-browser": "^6.0.0",
        "@angular/platform-browser-dynamic": "^6.0.0",
        "@angular/router": "^6.0.0",
        "angular-date-value-accessor": "^0.0.2",
        "bootstrap": "^3.3.7",
        "core-js": "^2.5.6",
        "hammerjs": "^2.0.8",
        "ng2-bs3-modal": "^0.13.0",
        "ngx-accordion": "^0.0.17",
        "nodemailer": "^4.6.4",
        "rxjs": "^6.1.0",
        "rxjs-compat": "^6.1.0",
        "rxjs-tslint": "^0.1.3",
        "socks": "^2.2.0",
        "systemjs": "^0.21.3",
        "web-animations-js": "^2.3.1",
        "zone.js": "^0.8.26"
      },
      "devDependencies": {
        "@angular/cli": "^6.0.0",
        "@angular/language-service": "^6.0.0",
        "@types/hammerjs": "^2.0.35",
        "@types/jasmine": "^2.8.7",
        "@types/node": "^10.0.6",
        "codelyzer": "^4.3.0",
        "jasmine": "^3.1.0",
        "karma": "^2.0.2",
        "lite-server": "^2.3.0",
        "lodash": "^4.17.10",
        "protractor": "^5.3.1",
        "ts-node": "^6.0.3",
        "tslint": "^5.10.0",
        "typescript": "^2.8.3"
      },
      "keywords": [],
      "license": "MIT",
      "peerDependencies": {
        "@angular/core": ">=2.0.0",
        "@angular/common": ">=2.0.0",
        "@angular/compiler": ">=2.0.0",
        "@angular/platform-browser": ">=2.0.0",
        "@angular/platform-browser-dynamic": ">=2.0.0",
        "@angular/cdk": "6.0.1"
      },
      "repository": {},
      "scripts": {
        "build": "tsc -p src/",
        "build:watch": "tsc -p src/ -w",
        "build:e2e": "tsc -p e2e/",
        "serve": "lite-server -c=bs-config.json",
        "serve:e2e": "lite-server -c=bs-config.e2e.json",
        "prestart": "npm run build",
        "start": "concurrently \"npm run build:watch\" \"npm run serve\"",
        "pree2e": "npm run build:e2e",
        "e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
        "preprotractor": "webdriver-manager update",
        "protractor": "protractor protractor.config.js",
        "pretest": "npm run build",
        "test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
        "pretest:once": "npm run build",
        "test:once": "karma start karma.conf.js --single-run",
        "lint": "tslint ./src/**/*.ts -t verbose"
      }
    }

systemjs.config.server.js
(function (global) {
    // map tells the System loader where to look for things
    var paths = {
        'npm:': "https://unpkg.com/"
    };
    var map = {
        'app': "app", // 'dist',
        '@angular': "node_modules/@angular",
        'angular2-in-memory-web-api': "node_modules/angular2-in-memory-web-api",
        'rxjs': "npm:rxjs",
        '@angular/platform-browser/animations': "npm:@angular/platform-browser/bundles/platform-browser-animations.umd.min.js",
        "ngx-accordion": "npm:ngx-accordion@0.0.17/index.js",
        '@angular/common/http': "npm:@angular/common/bundles/common-http.umd.js",
        '@angular/animations/browser': "npm:@angular/animations@5.2.10/bundles/animations-browser.umd.js",
        'ng2-bs3-modal': "npm:ng2-bs3-modal/bundles/ng2-bs3-modal.umd.js",
        'hammerjs':"npm:hammerjs/hammer.js",

        // CDK individual packages
        '@angular/cdk/bidi': "npm:@angular/cdk/bundles/cdk-bidi.umd.js",
        '@angular/cdk/platform': "npm:@angular/cdk/bundles/cdk-platform.umd.js",
        '@angular/cdk/keycodes': "npm:@angular/cdk/bundles/cdk-keycodes.umd.js",
        '@angular/cdk/collections': "npm:@angular/cdk/bundles/cdk-collections.umd.js",
        '@angular/cdk/portal': "npm:@angular/cdk/bundles/cdk-portal.umd.js",
        '@angular/cdk/coercion': "npm:@angular/cdk/bundles/cdk-coercion.umd.js",
        '@angular/cdk/overlay': "npm:@angular/cdk/bundles/cdk-overlay.umd.js",
        '@angular/cdk/accordion': "npm:@angular/cdk/bundles/cdk-accordion.umd.js",
        '@angular/cdk/observers': "npm:@angular/cdk/bundles/cdk-observers.umd.js",
        '@angular/cdk/layout': "npm:@angular/cdk/bundles/cdk-layout.umd.js",
        '@angular/cdk/scrolling': "npm:@angular/cdk/bundles/cdk-scrolling.umd.js",
        '@angular/cdk/table': "npm:@angular/cdk/bundles/cdk-table.umd.js",
        '@angular/cdk/stepper': "npm:@angular/cdk/bundles/cdk-stepper.umd.js",
        '@angular/cdk/a11y': "npm:@angular/cdk/bundles/cdk-a11y.umd.js",
        '@angular/cdk/tree' : "node_modules/@angular/cdk@6.0.1/tree",
        'tslib': "npm:tslib/tslib.js",
        'rxjs/operators' : "npm:rxjs/operators/"
    };
    // packages tells the System loader how to load when no filename and/or no extension
    var packages = {
        'app': { main: "main.js", defaultExtension: "js" },
        'rxjs': { defaultExtension: "js" },
        'rxjs-compact': { defaultExtension: "js" },
        'angular2-in-memory-web-api': { main: "index.js", defaultExtension: "js" }
    };
    var ngPackageNames = [
        "animations",
        "common",
        "compiler",
        "core",
        "forms",
        "http",
        "material",
        "platform-browser",
        "platform-browser-dynamic",
        "router"

    ];
    // Individual files (~300 requests):
    function packIndex(pkgName) {
        packages["@angular/" + pkgName] = { main: "index.js", defaultExtension: "js" };
    }
    // Bundled (~40 requests):
    function packUmd(pkgName) {
        packages["@angular/" + pkgName] = { main: "bundles/" + pkgName + ".umd.js", defaultExtension: "js" };
    }
    // Most environments should use UMD; some (Karma) need the individual index files
    var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
    // Add package entries for angular packages
    ngPackageNames.forEach(setPackageConfig);
    var config = {
        paths: paths,
        map: map,
        packages: packages
    };
    System.config(config);
})(this);

the errors that we are seeing in the browser are

A: Follow this official guidance to properly update your angular project:
https://update.angular.io/
You just need to select which version you are migrating from and your package manager (npm/yarn).
Then you'll have a list of things to do or check in order to have all set.
update check list

A: in cmd : npm install rxjs-compat@6 --save
in systemjs.config :
packages: {
      app: {
        defaultExtension: 'js',
        meta: {
          './*.js': {
            loader: 'systemjs-angular-loader.js'
          }
        }
      },
      main_angular_upgrade:{
        defaultExtension: 'js'
      },
      rxjs: {
        defaultExtension: 'js', main: "index.js"
      },
      "rxjs-compat": { defaultExtension: 'js', main: "index.js" },
    "rxjs/operators": { "main": "index.js", "defaultExtension": "js" },
    "rxjs/internal-compatibility": { "main": "index.js", "defaultExtension": "js" },
    "rxjs/testing": { "main": "index.js", "defaultExtension": "js" },
    'rxjs/ajax': { main: 'index.js', defaultExtension: 'js' },
    'rxjs/webSocket': { main: 'index.js', defaultExtension: 'js' }
    }


text:
Q: How do I get the item from each row of a listview? I wanna get the data in the clicked row in listView.
This is my code , I want to access to "ID" Value in each row od list View.
How do I get the item from each row of a listview?
How do I get the item from each row of a listview?
public class ActivityBookMark extends Activity {

private SQLiteDatabase database;
private ListView lv;
private int ID;
public ArrayAdapter<String> adapter;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.book_mark);
    lv = (ListView) findViewById(R.id.BookMarkListView);
    Animation animation = AnimationUtils.loadAnimation(this,
            R.anim.translate);
    lv.setLayoutAnimation(new LayoutAnimationController(animation));
    ArrayList<String> data = geData();
    adapter = new ArrayAdapter<String>(this, R.layout.bookmark_item,
            R.id.TXTbookmarkItem, data);
    lv.setAdapter(adapter);
}

public ArrayList<String> geData() {
    // TODO Auto-generated method stub
    database = SQLiteDatabase.openDatabase(DBHelper.DB_PATH
            + DBHelper.DB_NAME, null, 0);
    Cursor localCursor = database
            .rawQuery(
                    "SELECT `rowid`,* FROM `TABLE1` WHERE 1=1 AND `FAV` LIKE '%TRUE%' ORDER BY `rowid` ASC LIMIT 0, 50000",
                    null);
    ArrayList<String> result = new ArrayList<String>();
    int TITLE = localCursor.getColumnIndex("TITLE");
  //↓ i want to access ID value onto OnClickUI method
    ID = localCursor.getColumnIndex("ID");
    for (localCursor.moveToFirst(); !localCursor.isAfterLast(); localCursor
            .moveToNext()) {
        result.add(localCursor.getString(TITLE));
    }
    return result;
}

public void OnClickUI(View v) {
    switch (v.getId()) {
    case R.id.DelFromBookMark: {
       //Code to retrive ID of each Row
 .... .

 Toast.makeText(ActivityBookMark.this,v.getViewTreeObserver()+"",      Toast.LENGTH_SHORT).show();
        database.execSQL("UPDATE TABLE1 SET FAV='FALSE' WHERE ID=" + ID
                + "");
        List<String> newItems = geData();
        adapter.clear();
        adapter.addAll(newItems);
        adapter.notifyDataSetChanged();
        Toast.makeText(getApplicationContext(),
                "از لیست نشان شده ها حذف شد!", Toast.LENGTH_SHORT).show();

    }

        break;

    default:
        break;
    }
}

}

A: You should implement onItemclicklistner
   lv.setOnItemClickListener(new OnItemClickListener()
   {
      @Override
      public void onItemClick(AdapterView<?> adapter, View v, int position,
            long arg3)
      {
            //in this method you get position and view of the item clicked the list

      }
   });


text:
Q: Build string to add a constraint to CP-SAT model I am building a solver CP-SAT model from Google OR Tools and want to add different constraints to the model.
A command to add a constraint to the model could look as follows:
model.Add(x + y + z == 100)

Now I have a large number of constraints. I am trying to extract these constraints of a given dataframe using the following code:
# Initiate a list to store constraints
final = []

# Iterate through dataframe to build the constraints
for col in df.drop(["weights"], axis=1).columns:

# Group by each column
group_df = df.groupby(by=[col])
for name, group in group_df:

    #Initiate starting string
    str_1 = "("
    str_2 = "("

    # Get unique index value and match number with dict
    for index in group.reset_index()["index"].unique():
        str_1 += f"dict[{df_new[col][index]}] + "
        str_2 += f"dict[{df_new[col][index]}] + "

    # Adjust string to remove last to chars and add
    ranges
    str_1 = str_1[:-2]
    str_2 = str_2[:-2]
    str_1 += "+ range >= "
    str_2 += "- range <= "

    # Add the weights the index values should match
    for weight in group["weights"].reset_index()["index"]:
        str_1 += f"weight_{weight} + "
        str_2 += f"weight_{weight} + "

    # Adjust string and add closing parentheses
    str_1 = str_1[:-3]
    str_2 = str_2[:-3]
    str_1 += (")")
    str_2 += (")")

    # Append one constraint to the list
    final.append(str_1)
    final.append(str_2)

One output in the list I created looks something like this:
'(dict[13] + dict[20] + dict[21] + dict[33] + range >= weight_13 + weight_20 + weight_21 + weight_33)'

I was naive enough to think I could just append one of these outputs to the model.Add() funtion. Of course its a string and does not consider the variable as a variable.
Any idea, how I can quickly transform the string so I can work with it in the model.Add function?
Thanks in advance! :)


text:
Q: How to add *or* update columns in a pandas DataFrame? I have an existing DataFrame, and a method that computes a few columns to add to that DataFrame. I currently use pd.concat([left, right], axis=1). When I call this method a second time, however, it adds the columns again (with the same name).
With the following sample data frames left and right:
left = pd.DataFrame({'one': [1, 2, 3], 'two': [2, 3, 4]})
print(left)

   one  two
0    1    2
1    2    3
2    3    4

right = pd.DataFrame({'one': [22, 22, 22], 'NEW': [33, 33, 33]})
print(right)

   one  NEW
0   22   33
1   22   33
2   22   33

I am looking for a foo method whose result is the following:
left = left.foo(right)  # or foo(left, right)
print(left)

   one  two  NEW
0   22    2   33
1   22    3   33
2   22    4   33

And, importantly, if I call left.foo(right) a second time, I want the result to stay the same.
pd.join raises an error when a column already exists, pd.concat doesn't overwrite existing columns, pd.update only overwrites existing columns but doesn't add new ones.
Is there a function/method to do what I want or do I have to write one myself?

Solution: The solution that worked for me, combined from the two answers below, is:
result = left.\
        drop(left.columns.intersection(right.columns), axis=1).\
        join(right)

A: Take intersection and drop columns then merge on index :
left = left.drop(left.columns.intersection(right.columns),1).merge(right, left_index=True, right_index=True)

print(left)
   two  one  NEW
0    2   22   33
1    3   22   33
2    4   22   33

A: Alternative solution, but it only add new columns, not overwrite:
left = pd.concat([left, right[right.columns.difference(left.columns)]], axis=1)

left = pd.concat([left, right[right.columns.difference(left.columns)]], axis=1)
print (left)
2   22   33
   one  two  NEW
0    1    2   33
1    2    3   33
2    3    4   33

A: This is a simple method that will update existing columns
or add new ones if needed:
left.loc[right.index, right.columns] = right
print(left)

   one  two  NEW
0   22    2   33
1   22    3   33
2   22    4   33

The index keys from right must be in left already, but the columns from right will be added if needed.

A: Thanks for the solution. I just wanted to add a simple change if right have more rows then left, the proposed solutions will not work. However the fix is simple just add how="right" to the join:
result = left.drop(left.columns.intersection(right.columns), axis=1).join(right, how="right")


text:
Q: Grails 3 application works locally, but unable to resolve view when deployed to a remote Tomcat I've created a Grails 3.1.1 app that uses a form to load a table with data. Running locally, everything works fine. When deployed to a remote Tomcat however, submitting the form results in a javax.servlet.ServletException error.
Typical error:
javax.servlet.ServletException: Could not resolve view with name 'stuckOrders' in servlet with name 'grailsDispatcherServlet'
Snippet from stuckOrders.gsp:
<html>
    <head>
        <meta name="layout" content="main"/>
        <asset:javascript src="application.js"/>
        <title>LPP Order Fixer</title>
    </head>
<body>
    <div id="orders" style="float:left;width:70%;height:90%;">
        <g:form name="stuckOrders" controller="lppOrderFixer" action="stuckOrders">
            <label>Location: </label>
            <input type="radio" id="locationReno" name="location" value="Reno"> Reno
            <input type="radio" id="locationGalion" name="location" value="Galion"> Galion
            <g:actionSubmit value="Locate Orders" action="stuckOrders"/>

LppOrderFixerController.groovy:
package lpporderfixer
class LppOrderFixerController {
    def lppOrderFixerService
    def location

    def index() {}
    def stuckOrders() {
        location = Location.valueOf(params?.location)
        List stuckOrdersList = lppOrderFixerService.fetchStuckOrders(location)
        [stuckOrders:stuckOrdersList]
    }
}

UrlMappings.groovy:
package lpporderfixer
class UrlMappings {
    static mappings = {
        "/$controller/$action?/$id?(.$format)?"{
            constraints {
                // apply constraints here
            }
        }
        "/"(view:"/lpporderfixer/stuckOrders")
        "500"(view:'/error')
        "404"(view:'/notFound')
    }
}

Project view layout:

I tried replacing [stuckOrders:stuckOrdersList] with render(view: 'stuckOrders', model:[stuckOrders:stuckOrdersList] in LppOrderFixerController.groovy, didn't seem to change anything.
Locally, the application starts at http://localhost:8080/. Submitting the form then populates the table, with the URL changed to http://localhost:8080/lppOrderFixer/stuckOrders.
On the remote Tomcat, the application is not at the root context, and so it starts at http://<remotehost>:8080/lpporderfixer/. Submitting the form results in the error, at the URL http://<remotehost>:8080/lpporderfixer/lppOrderFixer/stuckOrders.
I've spent the entire day trying to get this to work, and any suggestions would be wildly appreciated. Thanks in advance!

A: I suspect that this is happing because the GSPs are not being compiled and shipped in your war file.
Please add this to your build.gradle file if not already
apply plugin:'war'
apply plugin:'org.grails.grails-web'
apply plugin:"org.grails.grails-gsp"

Look for apply plugin:"org.grails.grails-gsp", you should already be having the first two.


text:
Q: Fetch DELETE method add unicode characters in URL I use fetch (in React) with the DELETE method, execute a query with line (api understands the given value)
name-%{[@timestamp]}-1970.01.01

fetch(`/api/apiname/name-%{[@timestamp]}-1970.01.01`, {
        method: 'delete',
        headers: {
            'Content-Type': 'application/json;charset=utf-8',
            Authorization: `Bearer ${Token}`
        }
    })

like this, but when requested, I get characters in query line
Request URL: http://localhost:3000/api/apiname/name-%%7B[@timestamp]%7D-1970.01.01

that prevent it from being executed, how can I fix this?
I tried to use decodeURI but it didn't help
P.S. I need the request to be
http://localhost:3000/api/apiname/name-%{[@timestamp]}-1970.01.01

but not
http://localhost:3000/api/apiname/name-%%7B[@timestamp]%7D-1970.01.01


text:
Q: Display contents of text file uploaded from device flutter Using the _localFile and readFile functions below I can choose the correct file and read it as bytes however I am unable to convert back to the correct text in the file. When using utf8 decode I get the following error

Unhandled Exception: FormatException: Unexpected extension byte (at offset 10).

The List of int I get from reading the file starts with
[80, 75, 3, 4, 20, 0, 8, 8, 8, 0, 135, 117, 116, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 95, 114, 101, 108, 115, 47, 46, 114, 101, 108, 115, 173, 210, 193, 74, 3, 49, 16, 6, 224, 123, 159, 98, 153, 123, 119, 182, 85, 68, 100, 179, 189, 136, 208, 155, 72, 125, 128, 144, 204, 238, 6, 155, 76, 72, 166, 90, 223, 222, 80, 10, 186, 80, 86, 193, 30, 51, 249, 231, 231, 35, 164, 221, 28, 253, 190, 122, 167, 148, 29, 7, 5, 171, 186, 129, 138, 130, 97, 235, 194, 160, 224, 117, 247, 180, 188, 135, 77, 183, 104, 95, 104, 175, 165, 68, 242, 232, 98, 174, 202, 78, 200, 10, 70, 145, 248, 128, 152, 205, 72, 94, 231, 154, 35, 133, 114, 211, 115, 242, 90, 202, 49, 13, 24, 181, 121, 211, 3, 225, 186, 105, 238, 48, 253, 236, 128, 110, 210, 89, 109, 173, 130, 180, 181, 43, 168, 118, 159, 145, 254, 215, 141, 158, 68, 91, 45, 26, 13, 39, 90, 198, 84, 182, 147, 56, 202, 165, 92, 167, 129, 68, 129, 101, 243, 92, 198, 249, 148, 168, 75, 51, 224, 101, 208, 250, 239, 32, 238, 123, 103, 232, 145, 205, 193, 83, 144, 75, 46, 5...

and has a length of 24596 where as the text file only has 5601 characters. How do I get the contents of the file I have read in?
Thanks
Future<List<int>> readFile() async {
    try {
      final file = await _localFile;
      // Read the file.
      List<int> contents = await file.readAsBytes();
      return contents;
    } catch (e) {
      print(e);
      // If encountering an error, return 0.
      return [0];
    }
  }

  Future<File> get _localFile async {
    final path = await FlutterDocumentPicker.openDocument();
    return File('$path');
  }

A: To convert the List<int> data correctly, you need to know how it was encoded. If you do not know, it may be useful to try to open the file with the Windows notepad and see which encoding offers you in the "Save as" window, and/or do some conversion tests with online tools (this is a practical approach, because it is not always possible to understand in retrospect which encoding was used).  Then you can proceed with the decoding:

*

*for UTF-8, you can use the built-in dart:convert package;

*for UTF-16 and UTF-32, you can use the utf package (it's discontinued, but I didn't find alternatives);

*for ANSI: ANSI characters after 128 change according to the country, so the exact charset ("code page") used must be identified. For example in Western Europe (for latin scripts), this can be Windows-1250 or Windows-1252. The only package I found that supports these encodings is charset_converter (it supports various charset, but it's available only for Android and iOS, because it relies on the native API of these systems, for example in Android on the API offered by Java).

Example for ANSI (which seems to be your case), for the "windows1250" code page:
(after including charset_converter in dependencies and importing it)
List<int> contents = await file.readAsBytes();
var decoded = await CharsetConverter.decode("windows1250", Uint8List.fromList(contents));

A: To read ANSI encoded files, the enough_convert package can read them and it works on all platforms!


text:
Q: Create vector with Farsi names. C++ I am aiming to create an std::vector<std::string>  with Farsi names. But as soon as I compile this I get this error:

This seems to be a unicode issue. Any suggestions how to fix this?

A: Microsoft's Visual C++ compiler does support Unicode source code files. Specifically it accepts UTF-8 (byte order mark required) or UTF-16:

Source code files
Unicode characters are now supported in identifiers, macros, string and character literals, and in comments. Universal character names are also now supported.
Unicode can be input into a source code file in the following encodings:
UTF-16 little endian with or without byte order mark (BOM)
UTF-16 big endian with or without BOM
UTF-8 with BOM

Note in particular that for UTF-8, the byte order mark is required. The dialog in your screen shot is the Visual Studio editor detecting that you have entered non-ASCII characters and asking you if you want to convert the source code file to UTF-8 or UTF-16 (not sure what the default is but I'd guess UTF-8). If you click Yes, it will save the file with a UTF-8 byte order mark (BOM) and all should be well.


text:
Q: Wrapfigure environment not placing figure within text (inside proof environment) I wanted to use the wrapfigure environment to wrap text around a figure, inside a adjustwidth environment inside a proofenvironment, but the following code
\begin{proof}
\begin{adjustwidth}{2em}{2em}
         [...]
[...] arctan a = \frac{\pi}{2} \,$.
%
\begin{wrapfigure}{L}{0.5\textwidth}
\begin{tikzpicture}[scale=3]
      [...]
\end{tikzpicture}

\caption{Angles $ \alpha,\beta,\gamma,\delta $} that correspond to $ a,b,c,d $ respectively.
\label{angles}
\end{wrapfigure}

If we try to ``escape'' the inequality by augmenting the difference between two angle [...]

puts the figure on the last page:

Any idea why? Has it something to do with the adjustwidth env?
Edit: full MWE
\documentclass[10pt,a4paper,usenames,dvipsnames]{article}

\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage[labelfont=bf]{caption}
\usepackage{tikz}
\usepackage{changepage}
\usepackage{wrapfig}
\usepackage{siunitx}
\usepackage{calc}
\usepackage{array}
\usepackage{pythonhighlight}
\usepackage{multirow}
\usepackage{listings}
\usepackage{framed}
\usepackage[symbol, perpage]{footmisc}
\usepackage{lmodern}
\usepackage{hyperref}

\lstset{
    basicstyle=\ttfamily,
    columns=fullflexible,
    frame=single,
    breaklines=true,
    postbreak=\mbox{\textcolor{red}{$\hookrightarrow$}\space},
}

\usepackage{float}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{array}

\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\usepackage{makecell}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{ragged2e}
\usepackage{amssymb}
\usepackage{longtable}
\usepackage{graphicx}

\usepackage{xcolor}

\usepackage{chngcntr}
\counterwithin{figure}{section}
\counterwithin{equation}{section}

\newcommand\ddfrac[2]{\frac{\displaystyle #1}{\displaystyle #2}}

\usetikzlibrary{calc}
\usetikzlibrary{quotes, angles, arrows}

\newcommand{\degre}{\ensuremath{^\circ}}

\definecolor{dbwrru}{rgb}{0.8588235294117647,0.3803921568627451,0.0784313725490196}
\definecolor{dtsfsf}{rgb}{0.8274509803921568,0.1843137254901961,0.1843137254901961}
\definecolor{wrwrwr}{rgb}{0.3803921568627451,0.3803921568627451,0.3803921568627451}
\definecolor{rvwvcq}{rgb}{0.08235294117647059,0.396078431372549,0.7529411764705882}
\definecolor{cqcqcq}{rgb}{0.7529411764705882,0.7529411764705882,0.7529411764705882}
\definecolor{dark blue}{HTML}{002663}
\definecolor{dark green}{HTML}{085e23}
\definecolor{plum}{HTML}{3d085e}

\hypersetup{
    colorlinks=true,
    linkcolor=dark blue,
    filecolor=magenta,
    urlcolor=cyan,
}

\begin{document}

If we now think of the elements in $ S $ as the \textit{angles} they map to (through the $ \arctan $ function), instead of their actual values, the inequality becomes intuitively evident.

\begin{proof} \ref{ineq}
\begin{adjustwidth}{2em}{2em}
    \ \\
    Let $ a $, $ b $, $ c $, $ d $ be elements in $ S $, where $ a>b>c>d $. Let $ \alpha \equiv \arctan a,\ \beta  \equiv \arctan b,\ \gamma \equiv \arctan c,\ \delta \equiv \arctan d$ (and therefore let $ \alpha>\beta>\gamma>\delta $).

    Since $ a,b,c,d $ are positive, the angles $ \alpha, \beta,\gamma,\delta $ belong to the first quadrant (or the third quadrant):
    \begin{equation*}
    \begin{gathered}
        0 < \theta < \frac{\pi}{2} \quad \mod \pi\\
        \forall \theta \in \{\alpha, \beta, \gamma, \delta\}\,.
    \end{gathered}
    \end{equation*}
    Now let us visualize these angles in the first quadrant\footnote{I'm picking just the first quadrant because $\quad \tan (\theta + k\pi) = \tan \theta \ \ \forall k \in \mathbb{Z} \;$.}; see fig. \ref{angles}. If we pick a set $ \{a,b,c,d\} $ such that $ \alpha,\beta,\gamma,\delta  $ are equally spaced, we can space them at most by $ \frac{\pi}{6} $, since there are $ 4-1=3 $ pairs of adjacent angles, and $ \frac{\pi}{2} \div 3 = \frac{\pi}{6}$. In fact, the difference between each adjacent angle can only be \textit{less} than $ \frac{\pi}{6} $, since there is no $ a\in \mathbb{R}^+ $ with finite value such that $\alpha = \arctan a = \frac{\pi}{2} \,$\footnote{Because $ \lim\limits_{\theta\rightarrow \frac{\pi}{2}\,^-} \tan \theta = \infty$.}.
    %
    \begin{wrapfigure}{L}{0.5\textwidth}
    \begin{tikzpicture}[scale=3]
        \coordinate (A) at (1,0);
        \coordinate (B) at (0,0);
        \coordinate (C) at ($ (0,0) +(30:1cm)$);
        \coordinate (D) at ($ (0,0) +(60:1cm)$);
        \coordinate (E) at ($ (0,0) +(90:1cm)$);
        %
        \draw (0,0) node [right=0.2cm, below=0.5mm] {\textcolor{blue}{$ \delta $}};
        \draw (A) -- (B) -- (E)
        pic [draw=red!50!black, fill=red!20, angle radius=2.4cm,
        "\textcolor{red}{$\alpha$}", pic text options={left=5.5mm, above=.3cm}] {angle = A--B--E};
        \draw (A) -- (B) -- (D)
        pic [draw=green!50!black, fill=green!20, angle radius=1.7cm,
        "\textcolor{dark green}{$\beta$}", pic text options={above=.1cm}] {angle = A--B--D};
        \draw (A) -- (B) -- (C)
        pic [draw=purple!50!black, fill=purple!20, angle radius=1cm,
        "\textcolor{plum}{$\gamma$}", pic text options={right=.05mm}] {angle = A--B--C};
        %
        \clip (-0.2, -0.2) rectangle (1.2,1.2);
        \draw (0,0) circle [radius=1cm];
        \fill [white] (0.95, -0.1) rectangle (1.05, 0.1);
        \draw (0, -0.2) -- (0,1.2);
        \draw (-0.2, 0) -- (1.2,0);
        \draw [thick] (A) -- +(90:0.5mm) -- +(270:0.5mm) node [below=.2mm, right=.1 mm] {$ 1 $};

        \draw [very thick, blue] (0,0) -- +(0:1cm);
        \draw [very thick, purple] (0,0) -- +(30:1cm);
        \draw [very thick, green] (0,0) -- +(60:1cm);
        \draw [very thick, red] (0,0) -- +(90:1cm);

        \draw [thick, dark blue] (C) arc [start angle = 30, end angle = 60, radius = 1cm] node [midway, sloped, above] {\small $ <\frac{\pi}{6} $};
    \end{tikzpicture}

    \caption{Angles $ \alpha,\beta,\gamma,\delta $} that correspond to $ a,b,c,d $ respectively.
    \label{angles}
    \end{wrapfigure}

    If we try to ``escape'' the inequality by augmenting the difference between two angles---say, for example, that we reduce $ \beta $ so that $ \alpha-\beta>\frac{\pi}{6} $---, we will be forcibly reducing the difference between another pair of adjacent angles---in our example, $ \beta-\gamma $ would be getting smaller---; so there will always be some pair of angles such that $ \theta_2 -\theta_1 < \frac{\pi}{6} $.
\end{adjustwidth}
\end{proof}

A:

*

*first i make from your mwe really mwe :-) (remove all not relevant packages from preamble, do you realy need all of them?)

*then i a little bit correct you tikz image. the most important is, that it had not contain blank lines.

*for inserting image like wrapfigure is used tex macro insbox. its syntax is:

\InsertBoxR{n}{< content>}[correction]
for box on the right side or

\InsertBoxL{b}{< content>}[correction]
where `n` is number of lines above box and `correction` number of lines needed for correction for box space (especial, when protrude into next paragraph).

for the box on the left side of text.

*

*tikzpicture is encapsulated together with caption in minipage environmet

*for caption is used \captionof{figure}{...} macro provided by caption package (can be used also capt-of package, but caption offer reach features for design captions)

*unfortunately \adjustwidth macro from package changepage, doesn't work with insbox (btw, correct name for package is changepage, chngpageis deprecated name). paragraphs, where is inserted \InsertBoxR{n}{< content>}[correction] doesn't obey changes of text width.

complete mwe:
\documentclass[10pt,a4paper,usenames,dvipsnames]{article}

\usepackage{graphicx}
\usepackage[skip=1ex, labelfont=bf, font=footnotesize]{caption}
\usepackage{amsmath, amssymb, amsthm}
\input{insbox}%%%%%%%%%%%%%% TeX macro,
\usepackage{tikz}
\usetikzlibrary{angles, arrows,
                calc,
                quotes,
                }
\usepackage{siunitx}    % to write units. also defines `\ degree`
%\newcommand{\degre}{\ensuremath{^\circ}} % beter use \si{\degree} or \SI{90}{\degree}

%\from defined colors are used only the following
\definecolor{dark blue}{HTML}{002663}
\definecolor{dark green}{HTML}{085e23}
\definecolor{plum}{HTML}{3d085e}

\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=dark blue,
    filecolor=magenta,
    urlcolor=cyan,
}

\begin{document}
If we now think of the elements in $ S $ as the \textit{angles} they map to (through the $ \arctan $ function), instead of their actual values, the inequality becomes intuitively evident.

\begin{proof} \label{ineq}% <--- \label{...} not \ref{ineq} ?!

    Let $ a $, $ b $, $ c $, $ d $ be elements in $ S $, where $ a>b>c>d $. Let $ \alpha \equiv \arctan a,\ \beta  \equiv \arctan b,\ \gamma \equiv \arctan c,\ \delta \equiv \arctan d$ (and therefore let $ \alpha>\beta>\gamma>\delta $).

    Since $ a,b,c,d $ are positive, the angles $ \alpha, \beta,\gamma,\delta $ belong to the first quadrant (or the third quadrant):
    \begin{gather*}
        0 < \theta < \frac{\pi}{2} \quad \mod \pi\\
        \forall \theta \in \{\alpha, \beta, \gamma, \delta\}\,.
    \end{gather*}

    \InsertBoxR{2}{\begin{minipage}{0.45\linewidth}\centering
    \begin{tikzpicture}[scale=3]
\coordinate[label=below right:1]    (A) at (1,0);
\coordinate[label=below right:
            \textcolor{blue}{$\delta $}] (B) at (0,0);
\coordinate                         (C) at ($(B)+(30:1cm)$);
\coordinate                         (D) at ($(B)+(60:1cm)$);
\coordinate                         (E) at ($(B)+(90:1cm)$);
%
\draw (A) -- (B) -- (E)
    pic [draw=red!50!black, fill=red!20, angle radius=2.4cm,
        "\textcolor{red}{$\alpha$}",
        pic text options={left=5.5mm, above=.3cm}]  {angle = A--B--E};
\draw (A) -- (B) -- (D)
    pic [draw=green!50!black, fill=green!20, angle radius=1.7cm,
        "\textcolor{dark green}{$\beta$}",
        pic text options={above=.1cm}]              {angle = A--B--D};
\draw (A) -- (B) -- (C)
    pic [draw=purple!50!black, fill=purple!20, angle radius=1cm,
        "\textcolor{plum}{$\gamma$}",
        pic text options={right=.05mm}]             {angle = A--B--C};
%
\clip (-0.2, -0.2) rectangle (1.2,1.2);
\draw (B) circle [radius=1cm];
\fill [white] (0.95, -0.1) rectangle (1.05, 0.1);
\draw (0, -0.2) -- (0,1.2);
\draw (-0.2, 0) -- (1.2,0);
\draw [thick] (A) +(0,0.5mm) -- + (0,-0.5mm);
%
\draw [very thick, blue]    (B) -- +(0:1cm);
\draw [very thick, purple]  (B) -- +(30:1cm);
\draw [very thick, green]   (B) -- +(60:1cm);
\draw [very thick, red]     (B) -- +(90:1cm);
%
\draw [thick, dark blue] (C) arc (30:60:1cm) node [midway, sloped, above] {\small $ <\frac{\pi}{6} $};
    \end{tikzpicture}
                   \captionof{figure}{Angles $\alpha,\beta,\gamma,\delta$ that correspond to $a,b,c,d$ respectively.}
                   \label{angles}
                   \end{minipage}%
                   }[5]
    Now let us visualize these angles in the first quadrant\footnote{I'm picking just the first quadrant because $\quad \tan (\theta + k\pi) = \tan \theta \ \ \forall k \in \mathbb{Z} \;$.}; see fig. \ref{angles}. If we pick a set $ \{a,b,c,d\} $ such that $ \alpha,\beta,\gamma,\delta  $ are equally spaced, we can space them at most by $ \frac{\pi}{6} $, since there are $ 4-1=3 $ pairs of adjacent angles, and $ \frac{\pi}{2} \div 3 = \frac{\pi}{6}$. In fact, the difference between each adjacent angle can only be \textit{less} than $ \frac{\pi}{6} $, since there is no $ a\in \mathbb{R}^+ $ with finite value such that $\alpha = \arctan a = \frac{\pi}{2} \,$\footnote{Because $ \lim\limits_{\theta\rightarrow \frac{\pi}{2}\,^-} \tan \theta = \infty$.}.

    If we try to ``escape'' the inequality by augmenting the difference between two angles---say, for example, that we reduce $ \beta $ so that $ \alpha-\beta>\frac{\pi}{6} $---, we will be forcibly reducing the difference between another pair of adjacent angles---in our example, $ \beta-\gamma $ would be getting smaller---; so there will always be some pair of angles such that $ \theta_2 -\theta_1 < \frac{\pi}{6} $.
\end{proof}
\end{document}

note: package hyperref had to be loaded last (with rare exceptions) in the preamble.


text:
Q: _InternalLinkedHashMap is not a subtype of custom class in type cast. Retrieving an array of maps from Firestore I am storing data from a custom class "PollOption" in firestore as an array of maps.  When I try to retrieve the data, I'm getting this error
_InternalLinkedHashMap<String, dynamic> is not a subtype of 'PollOption' in type cast.
My other data is retrieving fine.
My model that's being stored into a collection.  The PollOption is nested in this:
class Question{
  //single values
  final Timestamp askedOn;
  final String chosenAnswer;
  final String askedBy;
 ...

  //arrays
  final List<String> categories;
  final List<String> declinedUsers;
  final List<PollOption> pollOptions;
 ...

  Question({
    this.askedBy,
    this.askedByAvatar,
    this.askedByName,

...

    this.pollOptions,
    this.starredMessages,

...

  });

My PollOption Model:
class PollOption{
  final String option;
  final bool selected;
  final int optionNumber;
  final int votes;

  PollOption({this.option, this.optionNumber, this.selected, this.votes});
}

How I'm storing the data to Firestore:
Future createQuestion(Question data) async {
    ...

    List<Map> sterilizedPolls (){
      List<Map> polls = [];
      if(data.pollOptions != null){
      data.pollOptions.forEach((PollOption pollOption){
        Map option ={
          'option': pollOption.option,
          'votes': pollOption.votes,
          'optionNumber': pollOption.optionNumber,
          'selected': pollOption.selected,
        };
        polls.add(option);
      });

      }
      return polls;

    }

    return await questionCollection.add({
    'askedBy': uid,
...
    'declinedUsers': [],
    'pollOptions': sterilizedPolls(),

...

    });

  }

How I'm retrieving the data:
//Getting all the questions I want
Future<List<Question>> getOpenQuestions() async{
    final QuerySnapshot result = await questionCollection
      .where('locked', isEqualTo: false)
      .where('chosenAnswer', isEqualTo: '')
      .getDocuments();
    final List<DocumentSnapshot> documents = result.documents;
    final List<Question> openQuestions = [];
   documents.forEach((data){
     print('accessing database');
      openQuestions.add(
        Question(
          question: data['question'],

        )
      );
    });

    return openQuestions;
  }

//Creating list from snapshot
List<Question> _questionListFromSnapshot(QuerySnapshot snapshot) {

    return snapshot.documents.map((doc){

      return Question(
        askedBy: doc.data['askedBy'] ?? '',
        askedByName: doc.data['askedByName'] ?? 'Anonymous',

     ...

        pollOptions: List.from(doc.data['pollOptions']).cast<PollOption>() ?? [],

       ...

      );
    }).toList();

  }

//creating stream
   Stream<List<Question>> get openQuestionList {
     try {
      return questionCollection
      .where('locked', isEqualTo: false)
      .snapshots()
      .map(_questionListFromSnapshot);

     } catch (e) {
       return e;
     }

  }

And how I'm displaying the data:
class OpenQuestions extends StatelessWidget {
  @override
  Widget build(BuildContext context) {

    final openQuestions = Provider.of<List<Question>>(context) ?? [];

    return StreamBuilder<List<Question>>(
        stream: QuestionDatabaseService().openQuestionList,
        builder: (context, snapshot){
          if(snapshot.hasError){
            return Text('Error!');
          }
          if (snapshot.hasData){
              return ListView.builder(
                itemCount: openQuestions.length,
                itemBuilder: (context, index) {
                  return QuestionTile(question: openQuestions[index], context: context);
                },
              );
          }else{
            return Loading();
          }

        }

        );

//The QuestionTile Loaded

class QuestionTile extends StatelessWidget {

  final Question question;
  final context;

  QuestionTile({this.question, this.context});

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.all(10.0),
      child: Card(
        child: ListTile(
         ...
          title: Text(question.question),
          subtitle: question.poll == false ? Text(question.message) : Text('Poll'),
          onTap: (){
            _showBottomModal(context, question);
          },
        ),
      ),

    );
  }
}

//The bottom modal that pops up
void _showBottomModal(context, question)async {
  showModalBottomSheet(context: context, isScrollControlled: true, builder: (context){
    return Container(
      //color: Color(0xFF737373),
      child: Container(
        child: FractionallySizedBox(

//Where the problem widget is being called

          child: AnswerQuestion(question: question),
          heightFactor: 0.90,
          ),
        decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.only(
            topLeft: const Radius.circular(30.0),
            topRight: const Radius.circular(30.0),
          )
        ),

      ),
    );
  });
}

//AnswerQuestion widget where the error is occurring

class _AnswerQuestionState extends State<AnswerQuestion> {

...

  @override
  Widget build(BuildContext context) {

    return Container(

      child:Column(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
...
          Form(
            key: _formKey,
            child: Column(
              children: [
//Where the data is being displayed with error

                ConstrainedBox(
                constraints: BoxConstraints(
                 maxHeight: 300.0
                 ),
              child: Container(
               child: ListView.builder(
                    itemCount: widget.question.pollOptions.length,
                   itemBuilder: (BuildContext context, int index){

                   return ListTile(
                      title: Text(widget.question.pollOptions[index].option),
                     leading: Radio(
                     value: widget.question.pollOptions[index].optionNumber,
                      groupValue: _optionSelected,
                      onChanged: _handleRadioValueChange,
                   ),
                 );

                ...

Sorry if there is too much code (or not enough), I'm still learning Flutter and wanted to provide as much as possible to help with this error.

A: The problem is with the line:
pollOptions: List.from(doc.data['pollOptions']).cast<PollOption>() ?? [],

The value in doc.data['pollOptions'] is actually JSON data which is represented in dart as a Map<String, dynamic>.  Dart does not know how to automatically convert a Map into your object PollOption.
Consider this instead:
pollOptions: doc.data['pollOptions'].map((Map<String, dynamic> json) => PollOption.fromJson(json)).toList()

That is assuming that doc.data['pollOptions'] returns a List which is should do if its a JSON array.
And of course you need a fromJson factory constructor on your PollOption class:
class PollOption {
...
   factory PollOption.fromJson(final Map<String, dynamic> json) {
      return PollOption(json["optionkey"], etc);
   }
...
}


text:
Q: Is 'stolen' appropriate word? Somebody took my things without asking me, without my knowledge and didn't return them back to me.
Is 'stolen' word appropriate to represent this situation? (e.g. He stole my things.) If not, what would be the proper word?
EDIT: What incident actually took place: In my absence, someone took the duster and marker pens and never returned them back to me. So I was looking for a suitable word. I googled for meaning of stolen, but I felt it wouldn't be proper to say so.

A: Stolen is the past participle of steal which is:

to take (the property of another or others) without permission or right, especially secretly or by force.A pickpocket stole his watch.

So yes, stolen is an appropriate word to use when somebody took your things without asking you.

A: Yes, "stole" or "stolen" means this.

*

*to take something without the permission or knowledge of the owner and keep it or use it:

  ... He never paid me back, so basically he ended up stealing a hundred dollars from me.

-- Cambridge Dictionary
The only exception I can think of would be if it was a person in authority, who was authorized by law to take it.  This would not be considered stealing.

The police officer, under orders from a judge, took my things without asking me, without my knowledge and didn't return them back to me.
The tax authority took my things without asking me, without my knowledge and didn't return them back to me.

A: To say

Someone stole my things.

implies that the things were taken intentionally, not by mistake; that the things were taken with the intention of never returning them, but rather with the intent of keeping or selling or disposing of them; and that the things were taken with a malicious or criminal intention, not with any innocent purpose.
That may all be true, but perhaps not all of it is. By saying "stolen" one is taking a hard line, which may cause problems if the things were taken by mistake, or with the intention of returning them, or for some legitimate purpose.
One can soften the word. for example by saying:

It seems that my things were stolen.

or

I think that my things may have been stolen. No one asked to borrow them.

A: Technically, "stolen" is a suitable word.

However, depending on a number of factors, different people may use different words in different situations. Example: kleptomania is also stealing. (to be more precise, the result of kleptomania is stealing)
If confronted, the person might claim that it was a simple borrowing, but he did not have a chance to tell you or to return the object - yet.

Note: if that happened in an office (in other places also), using this word loudly, especially with several people present, will surely attract a bad energy on you, and it will destroy some of your reputation.
So in this case, it is much better (politically correct) to say: "took my things without asking me, without my knowledge and didn't return them back to me" - simply because "to steal" is a very strong word.

A: Yeah, in this situation the word 'stolen' is appropriate.


text:
Q: Can we install Windows on a Mac mini Can we install windows on Mac mini?
Also, is it possible to  Install Mac OS on PC's rather than Macs ?

A: Yes, Apple provides a Software (including the drivers) to install Windows a Macs: Bootcamp
Apple's EULA doesn't allow installing OS X on non Apple hardware. Although, some people have already done this (they call this Hackintosh) but it's tricky and you'll never have a fully functioning system (there are always bugs somewhere).


text:
Q: What is the proportional impact of different group sizes on a linear mixed model? I am working with a linear mixed model of species. My model has a random slope, and a fixed intercept, with the random effect being based on taxonomic group. I have 4000 data points in my dataset, and 2000 of those data points are made up by a single taxonomic group, because there are so many species for that group. Other groups have much smaller sizes, ranging between 20 to 300 species. Overall, there are 13 different taxonomic groups.
My concern is that, this one group will dominate my model. Really, I would like each group to be equally weighted, regardless of the sample size per group. I have read that linear mixed models are generally good at accounting for unbalanced random effects, but I worry that the extent of the unbalance in my own dataset is pushing the limits here. Would I be better off doing individual linear models for each group?


text:
Q: Laravel Eloquent ORM I have read the Laravel's documentation. It is very brief and compressed. How should I implement the following SQL query:
SELECT title FROM table WHERE `column1` = 5 AND `column2`

A: You can do it with query builder:
$results = DB::table('table')->where('column1','=',5)->where('column2','=',5)->get('title');

With eloquent you should have models defined and could use it like:
$users = User::where('column1','=',5)->where('column2','=',5)->get('title')

A: you can do it like this :
$users = User::where('column1', 5)->where('column2', 4)->get()->fetch('title')->all();


text:
Q: Upload images to heroku through delayed_job I'm trying to upload images to s3 bucket from Heroku using delayed job.
But it seems heroku delayed job isn't able to get the tmp image path.
Please let me know what I'm doing wrong or a better approach.
Here is my code of controller:
  if @post.save
    unless @post.post_type == 0
      image_a = image_b = ''
      if item_image_params['0'][:item_type] == "A"
        image_a = item_image_params['0'][:image]
        image_b = item_image_params['1'][:image]
      else
        image_a = item_image_params['1'][:image]
        image_b = item_image_params['0'][:image]
      end
      @post.delay.save_image(image_a.path, image_b.path)
    end
  end

My model code:
  def save_image(image_a, image_b)
    items.each do |item|
      if item.item_type == "A"
        item.build_item_image.image = File.open(image_a)
      else
        item.build_item_image.image = File.open(image_b)
      end
    end
    if self.save
      File.delete(image_a) if File.exist?(image_a)
      File.delete(image_b) if File.exist?(image_b)
    end
  end

I'm getting this error in delayed:
:save_image args: - /tmp/RackMultipart20150715-3-1qoy83r.jpeg - /tmp/RackMultipart20150715-3-if712h.jpeg
 last_error:
  "No such file or directory - /tmp/RackMultipart20150715-3-if712h.jpeg\n/app/app/models/post.rb:35:in

On line no 35 the code is:
 item.build_item_image.image = File.open(image_b)

A: Heroku dynos cannot access each other's local file systems.  If I'm understanding correctly, you have a web dyno writing to its local file system (/tmp) and then are trying to read it from a different (worker) dyno.
You are far better off having the upload go straight to S3.  I have used carrierwave_direct with good success or you can use something else or roll your own.
Uploading directly to S3 also has the advantage of not tying up your web dynos while uploads are in progress as well bypassing their timeouts.  If uploads go straight to heroku and take longer than the web dyno's timeout (because the file is large or the user's connection is slow) then the upload will simply fail.
I see you have tagged this question with paperclip.  You may find this article from Heroku to be useful, though it looks like it is not using the preferred approach of uploading directly to s3.  This blog post has some sample code for uploading directly to s3 with paperclip.


text:
Q: How to imbricate a command inside another command? I have the following PowerShell script which allows me to collect information about disks & volumes on Windows servers of the domain where the script is launched:
$ErrorActionPreference = 'SilentlyContinue'

Get-ADComputer -Filter 'OperatingSystem -like "*Server*"' -Properties * |
    Select-Object Name |
    ForEach-Object {
        if (Test-Connection $_.Name -Count 1) {
            Get-WmiObject -Class Win32_LogicalDisk -ComputerName $_.Name -Filter "DriveType=3" |
                Select-Object PSComputerName, DeviceID,
                    @{Name="Size /GB";Expression={[math]::Round($($_.Size / 1GB), 2)}},
                    @{Name="Free /GB";Expression={[math]::Round($($_.Freespace / 1GB), 2)}},
                    @{Name="Free %";Expression={[math]::Round($($_.Freespace/$_.Size)*100, 1)}}
        } else {
            Write-Nost $_.Name " Connection Error"
        }
    } |
    sort PSComputerName |
    Format-Table -AutoSize

I get the following result:

SRV01  Connection Error
SRV02  Connection Error

PSComputerName  DeviceID     Size /GB  Free /GB  Free %
--------------  -------- ------------ --------- -------
SERVER03        C:             125,51    105,59    84,1
SERVER04        C:              24,83      7,38    29,7
SERVER05        E:              14,65      7,36    50,2
SERVER06        C:              49,66     29,28      59

I want to add an additional column with the OS for each server.
I would like this column to be in second position, after the "PSComputerName" column. How can I get this result?
I think I use a nested command by adding a Get-WmiObject Win32_OperatingSystem | Select-Object caption in the Get-WmiObject -Class Win32_LogicalDisk ..., but I don't know which syntax to use and how to imbricate a command in another command.

A: Don't use -properties *... it's going to retrieve every single populated property which you don't need in this script.
Get-ADComputer has an operatingsystem property.
Not tested:
Get-ADComputer -Filter 'OperatingSystem -like "*Server*"' -Properties OperatingSystem  | ForEach-Object {
    $OS = $_.OperatingSystem
    If (Test-Connection $_.Name -Count 1 -Quiet){
        Get-WmiObject -Class win32_logicalDisk -ComputerName $_.Name -Filter "DriveType=3" |
        Select-Object pscomputername, @{Name="OS";Expression={$OS}} ,DeviceID,
            @{Name="Size /GB";Expression={[math]::Round($($_.size / 1GB), 2)}},
            @{Name="Free /GB";Expression={[math]::Round($($_.freespace / 1GB), 2)}},
            @{Name="Free %";Expression={[math]::Round($($_.Freespace/$_.Size)*100, 1)}}
    }
    else {
        Write-host $_.Name " Connection Error"
    }
} | sort pscomputername | Format-Table -AutoSize


text: Q: Бесконечный аякс запрос На странице несколько пользовательских фреймов. Есть аякс запрос (GET), который получает данные передаваемые сервером. Ответ сервер получает по сложной цепочке --от датчиков. Проблема в том. что само получение данных на клиенте может занимать до полуминуты, может быть ответа вовсе не будет. при этом все это время клиент ждет. (из -за этого тормозит окончательная прорисовка страницы с этим целевым фреймом) Вопрос в том как правильно реализовать способ показа пользователю возможности оставаться на странице и продолжать ждать выполнения. либо предложить ему загрузить  страницу без этого запроса


text:
Q: await not working for async wait fetch to redirect a page trying to direct to external url by fetch
front end side:
var params
urlFetch(new_url)
        .then(params=function() {
           var obj=decodeFormParams(params)
console.log("decode value is " + obj); ...

backend side:
export function urlFetch(url ) {
  console.log(url );
  const request = async () => {
    const response = await fetch(url, {
    method: 'POST', // *GET, POST, PUT, DELETE, etc.
    mode: 'no-cors', // no-cors, *cors, same-origin
    credentials: 'omit', // include, *same-origin, omit
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8 ',
       "Access-Control-Allow-Origin": "*"
    },

   // body: JSON.stringify() // body data type must match "Content-Type" header
  }).then(await function(Response)  {

    if (Response.ok) {
      return Response.text();

    }
    else {
      return Promise.reject("Fetch did not succeed");
    }
  } )
  }
}

CONSOLE.LOG IS:
https://icom.yaad.net/cgi-bin/yaadpay/yaadpay3new.pl?action=pay&PassP=pb&Masof=4500563228&sendemail=True&UTF8=True&UTF8out=True&ClientName=ASG&ClientLName=Shg&cell=&email=SGD&Amount=500&Info=%D7%91%D7%99%D7%AA%20%D7%97%D7%91%22%D7%93%20%D7%A7%D7%A1%D7%A8%20%D7%93%D7%99%D7%95%D7%95%D7%99&tmp=8&Coin=1&PageLang=HEB&Postpone=False&Tash=36&FixTash=True&SendHesh=True
returend value is function params() {
    console.log("returend value is " + _params);
    var obj = decodeFormParams(_params);
    console.log("decode value is " + obj);

AS YOU CAN SEE THE URL IS CORRECT AND SUPPOSE TO REDIRECT TO THAT PAGE BUT NOTING HAPPENDS AND THE FUNCTION DOESNT WAIT
If IT DIDNT WORK WhY IM NOT GETTING THE LOG OF THE ERROR:
else {
      return Promise.reject("Fetch did not succeed");

im sending parameters to a page for payment system and the user has to fill the card info there and if it succeeds i should get code=0 as results but nothing hapends


text:
Q: Analytics of application page in Google Play I have problem with analytics of my application page in Google Play. I have application, that have about 1000-2000 installs per day. I want to track views count of my application page and conversion to installs. Also, I want to know more about trafic sources. I linked my Google Play console and Google Analytics, but not integrated analytics into app (as I understand, it not required).
Now I see in analytics only 10-20 views of application page, but it's wrong (as I wrote, I have 1000-2000 installs every day).
What I'm doing wrong? Or may be Google Analytics for Google Play have any restrictions?


text:
Q: SwiftUI: scroll to in ScrollView of both axis I am making app with ScrollView of both axis, vertical and horizontal, and I have a lot of items in it. After clicking one of them I want to center it on screen. But classic ScrollViewReader with scrollTo function doesn't work as I want to.
This is code of test view:
struct Test2: View {
    var body: some View {
        ScrollView([.horizontal, .vertical]){
            ScrollViewReader { proxy in
                VStack(spacing: 100){
                    ForEach(1..<50){ i in
                        Button(action: {
                            proxy.scrollTo(i, anchor: .center)
                        }, label: {
                            Text("Number \(i)")
                        }).padding(.leading, Double(i)*50)
                            .id(i)
                    }
                }
            }
        }
    }

}

A: Seems a little bit like cheating but hey it works
ScrollViewReader { proxy in
        ScrollView([.horizontal, .vertical]){

            VStack(spacing: 100){
                    ForEach(1..<50){ i in
                        Button(action: {
                            proxy.scrollTo(i, anchor: .trailing)
                        }, label: {
                            Text("Number \(i)")
                                .frame(width: 100)
                        })
                        .padding(.trailing, (UIScreen.main.bounds.width / 2) - 50)
                        // just adapt here the measure of your view instead of ^^ 50 which is half of the text with
                        .padding(.leading, Double(i)*50)
                            .id(i)
                    }
                }

            } //: ScrollView
        } //: ScrollViewReader


text:
Q: How I can get medial player Duration and stop Chronometer? I am making a  android simple media player for playing a audio files and facing a problem with it.
I want to stop Chronometer and media player
When the current Duration of playing file  == total duration of file..?
Here is my demo code.
   private void playAudio() {
            mediaPlayer = new MediaPlayer();
            try {
                mediaPlayer.setDataSource(outputFile);
            } catch (IOException e) {
                e.printStackTrace();
            }
            try {
                mediaPlayer.prepare();
            } catch (IOException e) {
                e.printStackTrace();
            }
            mChronometer.setBase(SystemClock.elapsedRealtime());
            mChronometer.start();
            mediaPlayer.start();
            long totalDuration = mediaPlayer.getDuration();

            Log.i("MediaPlayer", String.valueOf(totalDuration));
        }

here is another code added from answer .
i add the listrner
mediaPlayer.setOnCompletionListener(CompletionListener);
 MediaPlayer.OnCompletionListener CompletionListener = new MediaPlayer.OnCompletionListener() {
        @Override
        public void onCompletion(MediaPlayer mp) {

            long totalDuration = mp.getDuration();

        }
    };

A: Use onCompletionListener to check when media player has reached end of the media file.
    mPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
    public void onCompletion(MediaPlayer mp) {
         // do your task
    }
});

For further reference see this link
Media Player


text:
Q: Align three divs side by side with css I had three divs inside a main div with id main_div and has css already as below

I just want to insert three divs in the main div as below

       Div One should be Left(breadcrumb_text)

       Div Two should be Center(dropdownlist)

       Div Three should be Right(Pagination)

So i want the div format to display the text like
breadcrumb_text             dropdownlist                   Pagination

I tried with different css by using position attribute and various css options but could n't able to align them in a  horizontal line with one div as left , one div as center and other div to right.
So can anyone let me know me know the css to place them in an horizontal line ?

A: This maybe help you Fiddle
#main_div > div {
    width: 33%;
    float: left;
}

A: I have modified your code little bit with spacing equally for each div and removed Position in the Main div.
Sometimes position will overlap with other div (position) based on z-index value. so if you really need use position unless not required.

#main_div{
  height:10px; line-height:50px; margin-top:1px;
  box-sizing:border-box;
}

#main_div > div{
width:31.1%;
  float:left;
  box-sizing:border-box;
  border:1px solid grey;
    margin-right: 10px;
  display:inline-block;
}

#main_div > div:first-child{
margin-left:10px;}

       Div One should be Left(breadcrumb_text)

       Div Two should be Center(dropdownlist)

       Div Three should be Right(Pagination)

A: I think this is what you are asking for
JSFiddle
CSS
body
{
  margin:0%;
}

.main_div
{
  display:block;
  margin:0% 5%;
  width:90%;/*Just random, modify as per your requirement*/
  height:300px;  /*Just random, modify as per your requirement*/
  background:#eee;
  position:relatve;
}

.left-div, .center-div, .right-div
{
   display:inline-block;
   height:100%;
   position:relative;
   float:left;
   width:33%;
   border:1px solid #000;
   text-align:center;
   padding-top:5px;
}

HTML

       Div One should be Left(breadcrumb_text)

       Div Two should be Center(dropdownlist)

       Div Three should be Right(Pagination)


text:
Q: Is this Evaluation of definite Integral correct? To Evaluate $$I=\int_{-1}^{1} \frac{dx}{x^2+x+1+\sqrt{x^4+3x^2+1}}$$
I rationalized the denominator getting as
$$I=\int_{-1}^{1}\frac{x^2+x+1-\sqrt{x^4+3x^2+1}}{2x(x^2+1)}$$ $\implies$
$$I=\int_{-1}^{1}\frac{dx}{2x}+\int_{-1}^{1}\frac{dx}{2(x^2+1)}+\int_{-1}^{1}\frac{\sqrt{x^4+3x^2+1}\:dx}{2x(x^2+1)}$$
First and Third integrals are zero as the Integrands are odd functions and hence
$$I=\int_{-1}^{1}\frac{dx}{2(x^2+1)}=\frac{\pi}{4}$$

A:
Is this Evaluation of definite Integral correct?

No.
Your final result is right, but we have
$$
\int_{-1}^{1}\frac{dx}{x}\ne0,\qquad \int_{-1}^{1}\frac{\sqrt{x^4+3x^2+1}\:dx}{x(x^2+1)}\ne0, \tag1
$$ each integral being divergent, it is the difference of the preceding integrals which vanishes, that is
$$
\int_{-1}^{1}\left(\frac{1}{x}-\frac{\sqrt{x^4+3x^2+1}\:dx}{x(x^2+1)}\right)dx=0. \tag2
$$To prove $(2)$, one may observe the integrand is an odd function over $[-1,1]$ and one may observe the integral is convergent, since the singularity of the integrand as $x \to 0$ is removable,
$$
\left(\frac{1}{x}-\frac{\sqrt{x^4+3x^2+1}\:dx}{x(x^2+1)}\right) \sim -\frac x2,
$$ the function being continuous elsewhere.


text:
Q: Form of Jensen's Inequality for Two Convex Functions Suppose two convex functions $f(x)$ and $g(x)$ that are everywhere strictly positive and are such that $g^{-1}(f(x))$ is also convex ($g$ is convex with respect to $f$). Let $x$ be a random variable in $L^1$. Jensen's inequality can be used to show:
$$\frac {E[f(x)]}{f(E[x])} \ge 1$$
I would like to show:
$$\frac {E[g(x)]}{g(E[x])} \ge \frac {E[f(x)]}{f(E[x])}$$
Is this true? If not, what about showing:
$$\frac {E[f(x^n)]}{f(E[x^n])} \ge \frac {E[f(x)]}{f(E[x])}$$
where $n > 1$?


text:
Q: (.Net) suggestions on making a config file for a program? I'm not necessarily referring to app.configs, but a custom configuration file that would store my program's state whenever a user hits a "save" button.
In my example, it's a UI builder that allows the user to choose which "fields" are to be displayed on the left and right columns in a two-column screen, along with the order of the fields in each column.  There's other stuff too, but you get the idea.
The user could open any configuration file they've saved and populate the UI builder appropriately.
I'm thinking this could be stored in an XML file, but I was wondering what sort of suggestions people would have on how to write it out, how to read from it (use LINQ maybe?) and other general approaches, including versioning etc.  I'm sure this has come up before and I'd like to hear about best practices.  Thanks!

A: Does it have to be somewhat human readable?  Or does the user not care... just save my settings... and let me reload them later?
If not, just create/design a bunch of objects with meaningful properties... create instances... and serialize (binary or soap or custom) the object to disk.  Then, you can always "re-hydrate" your object later from disk.
When possible, I always like to not reinvent the wheel.  Let the framework do the work.

A: The method I use for my program is to keep my configuration values in a class that uses a DataTable in a DataSet to store values. When I want to save it, I use DataSet.WriteXML() to whatever filename the user wants.
My current use is pretty simple (one DataTable with key, value columns) but it easily expands to multiple related DataTables with specific columns for various information.  The DataSet handles the file io.
Then it's a breeze to read back in with DataSet.ReadXML().
An advantage of this method over serializing classes is that it is much easier to handle files saved from a previous version of your program. You can set a value in the table for the version of the program used to save it, so your newer version will know the older file won't have any values added in the newer version - and it can set them appropriately to update the file version.
If you add new features to a class (values, methods) it's serialized file will be different than earlier versions - not sure how easy it would be to handle those older files.
Here is a simple example class.
Used like this, makes a file like this:
To create a new one:
      Dim UIcfg As UIsettings = New UIsettings("TestSettings.cfg")

      UIcfg.setGeneralValue("Version", "1.0.0")
      UIcfg.setGeneralValue("Author", "Bobs YourUncle")

      UIcfg.setFieldValues("FirstName", "Left", "1")
      UIcfg.setFieldValues("LastName", "Right", "1")
      UIcfg.setFieldValues("ShoeSize", "Left", "2")
      UIcfg.setFieldValues("ShoeColor", "Left", "3")

      UIcfg.Save()

To get values from it:
      Dim value As String = ""
      Dim values As String = ""
      value = UIcfg.getGeneralValue("Author")
      values = UIcfg.getFieldValues("FirstName")

Code is so much easier than trying to explain a concept. :-)


text:
Q: Issue with Do...Until Function VBA I have an issue with my VBA code. I try to go through a whole table that has a lot of data. I go through a first column with a first condition required. Once this condition is complete, I go through the column next to the first one but starting at the same position I stopped the previous one. Once the second condition is complete, I try to do a copy paste. But for some reasons I got the error "Subscript out of Range" Could you please help me?
Here is the code:
Sub Match()

Dim i As Integer
i = 0
Dim j As Integer
Do
    i = i + 1
Loop Until Sheets("Sheet1").Range("A1").Offset(i, 0).Text = Sheets("Sheet2").Range("I5").Text
j = i
Do
    j = j + 1
Loop Until Sheets("Sheet1").Range("B1").Offset(j, 0).Value = Sheets("Sheet2").Range("I11").Value

Sheets("Sheet1").Range("C1").Offset(j, 0).Copy
Sheets("Sheet2").Range("N11").Paste

End Sub

Thanks guys

A: This should do the same thing without any loops:
Sub Match()

Dim lastA As Long, lastB As Long
Dim i As Long, j As Long

With Sheets("Sheet1")
    last a = .Cells(.Rows.count, 1).End(xlUp).Row
    last b = .Cells(.Rows.count, 2).End(xlUp).Row
End With

i = WorksheetFunction.Match(Sheets("Sheet2").Range("I5").Text, Sheets("Sheet1").Range("A:A"), 0)
j = WorksheetFunction.Match(Sheets("Sheet2").Range("I11").value, Sheets("Sheet1").Range("B" & i & ":B" & lastB), 0)

Sheets("Sheet2").Range("N11").value = Sheets("Sheet1").Cells(j, 3).value

End Sub

A: I didn't get the same error as you but I changed the last line and it seems to work.
Sub Match()

Dim i As Integer
i = 0
Dim j As Integer
Do
    i = i + 1
Loop Until Sheets("Sheet1").Range("A1").Offset(i, 0).Text = Sheets("Sheet2").Range("I5").Text
j = i
Do
    j = j + 1
Loop Until Sheets("Sheet1").Range("B1").Offset(j, 0).Value = Sheets("Sheet2").Range("I11").Value

Sheets("Sheet1").Range("C1").Offset(j, 0).Copy Destination:=Sheets("Sheet2").Range("N11")

End Sub

I did notice that your code runs for ever if you do not get a match which is not good. You may want to add a solution to this. It can be as easy as adding
Or i > 10000 on the Loop Until lines.

A: I modified your code slightly:
Sub Match()

    Dim i As Integer
    i = 0
    Dim j As Integer

    Do
        i = i + 1
    Loop Until Sheets("Sheet1").Range("A1").Offset(i, 0).Text = Sheets("Sheet2").Range("I5").Text

    j = i
    Do
        j = j + 1
    Loop Until Sheets("Sheet1").Range("B1").Offset(j, 0).Value = Sheets("Sheet2").Range("I11").Value
    Sheets("Sheet1").Range("C1").Offset(j, 0).Copy Sheets("Sheet2").Range("N11")
End Sub

and it worked fine with data like:

In Sheet1.
Note the B match must be below the A match.


text:
Q: curl for get-pip.py does not work: Syntax Error When I try to run:
[root@pex appliance_ui]# curl https://bootstrap.pypa.io./get-pip.py | python

It returns:
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1603k  100 1603k    0     0  7006k      0 --:--:-- --:--:-- --:--:-- 13.2M
Traceback (most recent call last):
  File "<stdin>", line 20649, in <module>
  File "<stdin>", line 197, in main
  File "<stdin>", line 82, in bootstrap
  File "/tmp/tmpH39pcu/pip.zip/pip/_internal/__init__.py", line 42, in <module>
  File "/tmp/tmpH39pcu/pip.zip/pip/_internal/cmdoptions.py", line 16, in <module>
  File "/tmp/tmpH39pcu/pip.zip/pip/_internal/index.py", line 526
    {str(c.version) for c in all_candidates},
                      ^
SyntaxError: invalid syntax

Also,
[root@pex appliance_ui]# python get-pip.py --verbose

Output:
python: can't open file 'get-pip.py': [Errno 2] No such file or directory

Can anyone tell me why is this happening?
I have Python 2.6 and pip 9.0.1. My aim is to upgrade to python 3.5 soon on the whole project.

A: The version of Python you're using found at python doesn't support set comprehensions. I can see the same error trying to do {str('foo') for c in [1,2,3]} in Python 2.4 as opposed to 2.7 where it works.
Per the answer here and the note in this section of the pip installation documentation you should use this URL for get-pip.py on 2.6: https://bootstrap.pypa.io/2.6/get-pip.py
You can also see Python 2.7 is the oldest supported version listed here: https://pip.pypa.io/en/stable/installing/#python-and-os-compatibility
As for [Errno 2] No such file or directory, that's because curl puts the file contents on standard out, not on your file system. If you wanted to download the file you would use wget.


text:
Q: System.Data.SqlClient.SqlException: The transaction ended in the trigger. The batch has been aborted  protected void btnDelete_Click(object sender, EventArgs e)
 {
     foreach (GridViewRow gvrow in gvDetails.Rows)
     {
         //Finiding checkbox control in gridview for particular row
         CheckBox chkdelete = (CheckBox)gvrow.FindControl("chkSelect");
         //Condition to check checkbox selected or not
         if (chkdelete.Checked)
         {
             //Getting UserId of particular row using datakey value
             int usrid = Convert.ToInt32(gvDetails.DataKeys[gvrow.RowIndex].Value);

             using (SqlConnection con = new SqlConnection("Data Source=murugan-pc;Initial Catalog=rg_lava_software;User ID=sa;Password=123"))
             {
                 con.Open();
                 SqlCommand cmd = new SqlCommand("delete from emp where empid=" + usrid, con);
                 cmd.ExecuteNonQuery();
                 con.Close();
             }
         }
     }
     BindUserDetails();
 }
 }


text:
Q: What kind of expressions "="? Can you tell me why I get this error?
I don't think that used any kind of expressions "=" ?
SELECT *
FROM
    (SELECT
         ROW_NUMBER() OVER(ORDER BY
            CASE WHEN @SortType = '1' THEN mt.Ad END ASC,
            CASE WHEN @SortType = '2' THEN mt.Ad END DESC,
            CASE WHEN @SortType = '3' THEN mt.Fiyat END ASC,
            CASE WHEN @SortType = '4' THEN mt.Fiyat END DESC) AS RowNr, *
     FROM @MainTable mt
     WHERE mt.Fiyat > @MinPrice AND mt.Fiyat < @MaxPrice
       AND mt.MarkaId IN (CASE WHEN @BrandFilter != ''
                            THEN (SELECT bf.Data FROM dbo.Split(@BrandFilter, ',') bf)
                            ELSE (mt.MarkaId)
                          END )
    ) Result
WHERE
   RowNr > ((@PageNr-1) * 10) AND RowNr <= ((@PageNr) * 10)

SQL Server gives this error ;

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

My split function returns multiline table but I wrote IN not =
Thanks

A: The CASE WHEN @BrandFilter != '' THEN clause expects a single scalar value, but you are calling a UDF that could return multiple rows.

A: You cannot use CASE that way. It looks like the condition you're trying to code is this:
(@BrandFilter = '' OR
@BrandFilter != '' AND mt.MarkaId IN (SELECT bf.Data FROM dbo.Split(@BrandFilter, ',')))


text:
Q: How can I map some Visual Studio 2010 keybindings to nunit's DEBUG and RUN commands? Visual Studio has two default keybindings for unit testing :-
CTRL-R then CTRL-T : Debug the current unit test 'context'
                     (ie where the cursor is currently flashing).

CTRL-R then T : Run the current unit test 'context' (as above).

How can I rebind these to use nUnit? Currently, they only support MSTest.
I also have ReSharper installed, if that's any help.
I grab nUnit via NuGet. I don't manually install nUnit via some msi, fwiw.

A: I got this on Tool -> Options -> Environment -> Keyboard
Theres 2 resharper commands, search for contextrun and assign Ctrl+R, T and for contextdebug and assign Ctrl+R,Ctrl+T

A: Look in Resharper->Unit Tests menu. There are options to run tests. I use Run All Tests from Solution (Ctrl+R, Ctrl+U - for me R and U stand for Run Unit tests). If You have NUnit Tests it will run them. It will run MSTest tests also.
To change key bindings go to VS2010 menu Tools->Options. Then select Keyboard on left and enter 'runsol' in 'Show commands containing' textbox. Assign Your preferred key binding.


text:
Q: Regex to match "True" or "False" I need to create Regular Expression validator which will need to match a text "True" or "False" (Case Insensitive).
I have tried the following regex
^(True|False|TRUE|FALSE)$

Is this correct? but there is problem in Case Sensitive.
Edit
I have tried regex in following answers but it's not firing, because of ?i

A: I have checked all the answers in this post but nothing worked as expected.
I Guess ?i is not supported in Asp.Net RegularExpression validator.
Finally I used following regex.
^([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])$

It worked as expected.
This regex will be used for dynamically created Asp.net RegularExpressionvalidator.

A: With a small optimization:
^(?:tru|fals)e$

Since (?i) is not validating, we'll set the case insensitivity in the code.
For any future reader who needs the code:
Dim FoundMatch As Boolean
Try
    FoundMatch = Regex.IsMatch(SubjectString, "^(?:tru|fals)e$", RegexOptions.IgnoreCase)
Catch ex As ArgumentException
    'Syntax error in the regular expression
End Try

A: Use RegexOptions.IgnoreCase option and use the below regex:
^(true|false)$

or use ignore case modifer ?i
Like this:
^(?i:true|false)$

Another option would be to convert the string to lower case and just use ^(true|false)$

A: Another approach for words True or False:
If Boolean.TryParse(yourString, New Boolean) = true Then
    'ok
else
    'not ok
End If

If you want convert text to boolean variable and use it later:
Dim value As Boolean
If Boolean.TryParse(yourString, value) = true Then
    'Use value
else
    'Handle a wrong text situation
End If

Boolean.TryParse ignore case. trUe or TRUE parsed ok

A: Either use RegexOptions.IgnoreCase
or the inline ?i modifier
^(?i)(true|false)$


text:
Q: How to access to paypal credentials from database? I'm trying to find a optimal way to save and access my paypal credentials on laravel from my Database.
I know it is common to save this kind of data on the .env file or a config file, but I need the user to save his credentials instead of mine.
So what I really need is save the paypal credentials and give the opportunity to personalize their credentials and other data.

A: There are probably many ways to do this, but the most secure way in my opinion is to use a database. You can use Laravel's Eloquent to talk with your database. It is also a good idea to encrypt the user's PayPal credentials before storing them in your database.
Here is a sample of what I have done in the past to start my database. You will of course have to create the table in your database.

<?php

namespace Application\UserCredentials;

use Illuminate\Database\Eloquent\Model as Eloquent;

class Credentials extends Eloquent
{
    protected $table = 'credentials';

    protected $fillable = [
        'clientID',
        'clientSecret',
        'user_id'
    ];
}

Here is an example of what I have used to add this to your database.

<?php

use Credentials;

$userCredentials = Credentials->create([
            'clientID' => $clientId,
            'clientSecret' => $clientSecret
        ]);

This should get you started with what you can do with Eloquent in Laravel.


text:
Q: Reduce a list of tuples without losing information for ML model I have a streaming flow that is partially composed by a list of tuple4 that can have 1 or more elements, let's take some examples:
1)"st_li_list":[{"f0":3,"f1":4,"f2":1,"f3":12,"arity":4},{"f0":1,"f1":3,"f2":1,"f3":3,"arity":4},{"f0":15,"f1":12,"f2":1,"f3":180,"arity":4}]}'
2)"st_li_list":[{"f0":1,"f1":24,"f2":8,"f3":24,"arity":4},{"f0":50,"f1":11,"f2":1,"f3":550,"arity":4},{"f0":2,"f1":10,"f2":3,"f3":20,"arity":4},{"f0":15,"f1":10,"f2":1,"f3":150,"arity":4}, {"f0":4,"f1":6,"f2":2,"f3":24,"arity":4},{"f0":1,"f1":3,"f2":1,"f3":3,"arity":4}]}'
3)"st_li_list":[{"f0":15,"f1":12,"f2":1,"f3":180,"arity":4}]}'
As you can see the list1_ has 3 elements, list2_ has 6 and list_3 only one.  I would like to do some standardization or encoding that let me to create a vector that is a sort of "summary" but keep the same size all the time to feed an ML model without losing any information. The fact that list_1 has 3 element is definetly a useful information for the "summary vector" that would probably have "3" has a first element on the list, followed by....? (any length is fine, so even if it is 100 elements is okay)
I don't want to setup a specific range for each parameter because it would force a range that can be wrong.
Any super clever solution on how this can be achieved in Python would be super appreciated!! There are maybe some algos around that can do this?

A: Either you feed the whole sequence to a NN, or you need to summarize each sequence as a fixed-length vector of features. The way to do this depends on what the information represents, in general you could use:

*

*number of values

*minimum/maximum value,

*mean/median,

*standard dev.

*quantiles

But for example if the sequences represent an evolution, maybe calculating the average/overall increase/decrease rate makes sense.
If they represent some kind of coordinates between objects, maybe calculating average/overall distances makes sense. Etc.


text:
Q: BIRT Report Unable to run I'm completely new to BIRT, but I'm trying to integrate it into some testing software. I downloaded the all-in-one package from eclipse for BIRT reporting (Windows 7, 64 bit). I've just started on my first report and I can't get the preview tab to display anything nor the web viewer. The only content on my report is a simple label. Is there something I'm doing wrong?
Here's my source xml for the report:
    <?xml version="1.0" encoding="UTF-8"?>
    <report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.23" id="1">
        <property name="createdBy">Eclipse BIRT Designer Version 4.3.1.v201309091055 Build <4.3.1.v20130917-1035></property>
        <property name="units">in</property>
        <property name="iconFile">/templates/blank_report.gif</property>
        <property name="bidiLayoutOrientation">ltr</property>
        <property name="imageDPI">96</property>
        <styles>
            <style name="report" id="4">
                <property name="fontFamily">sans-serif</property>
                <property name="fontSize">10pt</property>
            </style>
            <style name="crosstab-cell" id="5">
                <property name="borderBottomColor">#CCCCCC</property>
                <property name="borderBottomStyle">solid</property>
                <property name="borderBottomWidth">1pt</property>
                <property name="borderLeftColor">#CCCCCC</property>
                <property name="borderLeftStyle">solid</property>
                <property name="borderLeftWidth">1pt</property>
                <property name="borderRightColor">#CCCCCC</property>
                <property name="borderRightStyle">solid</property>
                <property name="borderRightWidth">1pt</property>
                <property name="borderTopColor">#CCCCCC</property>
                <property name="borderTopStyle">solid</property>
                <property name="borderTopWidth">1pt</property>
            </style>
            <style name="crosstab" id="6">
                <property name="borderBottomColor">#CCCCCC</property>
                <property name="borderBottomStyle">solid</property>
                <property name="borderBottomWidth">1pt</property>
                <property name="borderLeftColor">#CCCCCC</property>
                <property name="borderLeftStyle">solid</property>
                <property name="borderLeftWidth">1pt</property>
                <property name="borderRightColor">#CCCCCC</property>
                <property name="borderRightStyle">solid</property>
                <property name="borderRightWidth">1pt</property>
                <property name="borderTopColor">#CCCCCC</property>
                <property name="borderTopStyle">solid</property>
                <property name="borderTopWidth">1pt</property>
            </style>
        </styles>
        <page-setup>
            <simple-master-page name="Simple MasterPage" id="2">
                <page-footer>
                    <text id="3">
                        <property name="contentType">html</property>
                        <text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
                    </text>
                </page-footer>
            </simple-master-page>
        </page-setup>
        <body>
            <label id="7">
                <text-property name="text">BRIEF PRODUCT TEST REPORT</text-property>
            </label>
        </body>
    </report>

A: Found the issue, seems like BIRT uses Internet Explorer to render the report and is apparently incompatible with Internet Explorer 11. Downgrading IE solved my problem