text:
Q: Problem getting my correct location with google chrome Javascript I have the following code which is responsible for the geographical location of latitude, longitude and the map of where one is:

<title>javascript-mobile-desktop-geolocation With No Simulation with Google Maps</title>
<meta name = "viewport" content = "width = device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;">

location GPS

Initializing...

the file geoPosition.js:
     var bb = {
        success: 0,
        error: 0,
        blackberryTimeoutId : -1
     };

     function handleBlackBerryLocationTimeout()
     {
     if(bb.blackberryTimeoutId!=-1) {
        bb.error({ message:     "Timeout error",
                   code:        3
               });
       }
     }
     function handleBlackBerryLocation()
     {
        clearTimeout(bb.blackberryTimeoutId);
        bb.blackberryTimeoutId=-1;
        if (bb.success && bb.error) {
                if(blackberry.location.latitude==0 && blackberry.location.longitude==0) {
                        //http://dev.w3.org/geo/api/spec-source.html#position_unavailable_error
                        //POSITION_UNAVAILABLE (numeric value 2)
                        bb.error({message:"Position unavailable", code:2});
                }
                else
                {
                        var timestamp=null;
                        //only available with 4.6 and later

  //http://na.blackberry.com/eng/deliverables/8861/blackberry_location_568404_11.jsp
                        if (blackberry.location.timestamp)
                        {
                                timestamp = new Date( blackberry.location.timestamp );
                        }
                        bb.success( { timestamp:    timestamp ,
                                      coords: {
                                            latitude:  blackberry.location.latitude,
                                            longitude: blackberry.location.longitude
                                        }
                                    });
                }
                //since blackberry.location.removeLocationUpdate();
                //is not working as described http://na.blackberry.com/eng/deliverables/8861/blackberry_location_removeLocationUpdate_568409_11.jsp
                //the callback are set to null to indicate that the job is done

                bb.success = null;
                bb.error = null;
        }
     }

     var geoPosition=function() {

        var pub = {};
        var provider=null;
        var u="undefined";
        var ipGeolocationSrv = 'http://freegeoip.net/json/?callback=JSONPCallback';

        pub.getCurrentPosition = function(success,error,opts)
        {
                provider.getCurrentPosition(success, error,opts);
        }

        pub.jsonp = {
            callbackCounter: 0,

            fetch: function(url, callback) {
                var fn = 'JSONPCallback_' + this.callbackCounter++;
                window[fn] = this.evalJSONP(callback);
                url = url.replace('=JSONPCallback', '=' + fn);

                var scriptTag = document.createElement('SCRIPT');
                scriptTag.src = url;
                document.getElementsByTagName('HEAD')[0].appendChild(scriptTag);
            },

            evalJSONP: function(callback) {
                return function(data) {
                    callback(data);
                }
            }
        };

        pub.confirmation = function()
        {
            return confirm('This Webpage wants to track your physical location.\nDo you allow it?');
        };

        pub.init = function()
        {
            try
            {
                var hasGeolocation = typeof(navigator.geolocation)!=u;
                if( !hasGeolocation ){
                    if( !pub.confirmation() ){
                        return false;
                    }
                }

                if ( ( typeof(geoPositionSimulator)!=u ) && (geoPositionSimulator.length > 0 ) ){
                        provider=geoPositionSimulator;
                } else if (typeof(bondi)!=u && typeof(bondi.geolocation)!=u  ) {
                        provider=bondi.geolocation;
                } else if ( hasGeolocation ) {
                        provider=navigator.geolocation;
                        pub.getCurrentPosition = function(success, error, opts)
     {
                                function _success(p) {
                                        //for mozilla geode,it returns the coordinates slightly differently
                                        var params;
                                        if(typeof(p.latitude)!=u) {
                                                params = {
                                                    timestamp: p.timestamp,
                                                    coords: {
                                                        latitude:  p.latitude,
                                                        longitude: p.longitude
                                                    }
                                                };
                                        } else {
                                                params = p;
                                        }
                                        success( params );
                                }

     provider.getCurrentPosition(_success,error,opts);
                        }
                } else if(typeof(window.blackberry)!=u && blackberry.location.GPSSupported) {
                        // set to autonomous mode
                        if(typeof(blackberry.location.setAidMode)==u) {
                            return false;
                        }
                        blackberry.location.setAidMode(2);
                        //override default method implementation
                        pub.getCurrentPosition = function(success,error,opts)
                        {
                                //passing over callbacks as parameter didn't work consistently
                                //in the onLocationUpdate method, thats why they have to be set outside
                                bb.success = success;
                                bb.error = error;
                                //function needs to be a string according to

     //http://www.tonybunce.com/2008/05/08/Blackberry-Browser-Amp-GPS.aspx
                                if(opts['timeout']) {
                                    bb.blackberryTimeoutId = setTimeout("handleBlackBerryLocationTimeout()",opts['timeout']);
                                } else {
                                    //default timeout when none is given to prevent a hanging script
                                    bb.blackberryTimeoutId = setTimeout("handleBlackBerryLocationTimeout()",60000);
                                }

     blackberry.location.onLocationUpdate("handleBlackBerryLocation()");
                                blackberry.location.refreshLocation();
                        }
                        provider = blackberry.location;

                } else if ( typeof(Mojo) !=u && typeof(Mojo.Service.Request)!="Mojo.Service.Request") {
                        provider = true;
                        pub.getCurrentPosition = function(success, error, opts)
    {
                            parameters = {};
                            if( opts ) {
                                 //http://developer.palm.com/index.php?option=com_content&view=article&id=1673#GPS-getCurrentPosition
                                 if (opts.enableHighAccuracy && opts.enableHighAccuracy == true ){
                                        parameters.accuracy = 1;
                                 }
                                 if ( opts.maximumAge ) {
                                        parameters.maximumAge = opts.maximumAge;
                                 }
                                 if (opts.responseTime) {
                                        if( opts.responseTime < 5 ) {
                                                parameters.responseTime = 1;
                                        } else if ( opts.responseTime < 20 ) {
                                                parameters.responseTime = 2;
                                        } else {
                                                parameters.timeout = 3;
                                        }
                                 }
                        }

                         r = new Mojo.Service.Request( 'palm://com.palm.location' , {
                                method:"getCurrentPosition",
                                    parameters:parameters,
                                    onSuccess: function( p ){
                                        success( { timestamp: p.timestamp,
                                                   coords: {
                                                        latitude:  p.latitude,
                                                        longitude: p.longitude,
                                                        heading:   p.heading
                                                    }
                                                });
                                    },
                                    onFailure: function( e ){
                                                        if (e.errorCode==1) {
                                                            error({ code:       3,
                                                                    message:    "Timeout"
                                                                });
                                                        } else if (e.errorCode==2){
                                                            error({ code:       2,
                                                                    message:    "Position unavailable"
                                                                });
                                                        } else {
                                                            error({ code:       0,
                                                                    message:    "Unknown Error: webOS-code" + errorCode
                                                                });
                                                        }
                                                }
                                    });
                        }

                }
                else if (typeof(device)!=u && typeof(device.getServiceObject)!=u) {
                        provider=device.getServiceObject("Service.Location", "ILocation");

                        //override default method implementation
                        pub.getCurrentPosition = function(success, error, opts){
                                function callback(transId, eventCode, result) {
                                    if (eventCode == 4) {
                                        error({message:"Position unavailable", code:2});
                                    } else {
                                        //no timestamp of location given?
                                        success( {  timestamp:null,
                                                    coords: {
                                                            latitude:   result.ReturnValue.Latitude,
                                                            longitude:  result.ReturnValue.Longitude,
                                                            altitude:   result.ReturnValue.Altitude,
                                                            heading:    result.ReturnValue.Heading }
                                                });
                                    }
                                }
                        //location criteria

                        var criteria = new Object();
                        criteria.LocationInformationClass = "BasicLocationInformation";
                        //make the call
                        provider.ILocation.GetLocation(criteria,callback);
                        }
                } else  {
                        pub.getCurrentPosition = function(success, error, opts) {
                                pub.jsonp.fetch(ipGeolocationSrv,
                                        function( p ){ success( { timestamp: p.timestamp,
                                                                   coords: {
                                                                        latitude:   p.latitude,
                                                                        longitude:  p.longitude,
                                                                        heading:    p.heading
                                                                    }
                                                                });});
                        }
                        provider = true;
                }
            }
            catch (e){
                if( typeof(console) != u ) console.log(e);
                return false;
            }
            return  provider!=null;
        }
        return pub;
      }();

In Internet explorer works correctly for me, but when I try it on Google Chrome it shows me the location of another city near my region. I'd like to be able to solve it, and let me show my correct location in google chrome.
I noticed that in internet explorer it takes a few seconds more to load to visualize the location, perhaps in the google chrome lacks some pre-load cleaning or some compatibility.
In Internet Explorer it is right:

but in google chrome the location shows me wrong:

My objective is to be able to obtain my location with the map in an exact way in different browsers with javascript or some type code on the client side.
If anyone knows, of course, I appreciate your attention.


text:
Q: Performance issues with intel graphics thinkpad x1 gen 8 Hi I recenly bought a thinkpad X1 gen8 and installed 20.04 lts. I have some issues which I suspect that has to do with my graphic driver when I am using an external monitor through hdmi cable but also when I use the built in monitor.

*

*I get scrolling stutter both in chrome and firefox

*I also get some frame issues on hd videos

*I cannot get more than 30 Hz refresh rate on 4k analysis but I think this the spec

here is my output for checking my graphics card
$ lshw -c video

  *-display
       description: VGA compatible controller
       product: UHD Graphics
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 02
       width: 64 bits
       clock: 33MHz
       capabilities: vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: irq:170 memory:e9000000-e9ffffff memory:c0000000-cfffffff ioport:3000(size=64) memory:c0000-dffff
WARNING: output may be incomplete or inaccurate, you should run this program as super-user.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to update pyxb tree-like object in a loop? For my current project I'm reading a xml config file using pyxb. But it should be possible to override some of the settings by giving command line arguments (parsed using argparse).
To get more readable code, I would like to use an universal approach and define an update method. The parameter update has to use a try-catch-block, because pyxb does validate the new value on assignment (check string against pattern in this case).
Here is what I tried:
def override_setup(exp, args):
    for param, arg in [[exp.param1, args.param1], [exp.param2, args.param2]]:
        if arg is None:
            continue

        # this doesn't work, because param just references the string object referenced by exp.param1?
        try:
            param = arg
        except Exception as e:
            print e

    # the following works
    exp.param1 = "stuff"

I'm creating a list containing the mapping of pyxb parameters to argparse command line arguments. I think this is where everything starts to get wrong.
I want some way to do this update using some kind of loop (so I don't need to repeat the try-catch-block for every element).
Unfortunately exp doesn't seem to be iterable. Each child of exp has a member _getDiagnosticName(), which returns a string I could use as a mapping to the arguments read by argparse.
I found an article describing how to get a dict of the argparse results. So the mapping  (pyxb element -> argparse argument value) isn't a problem anymore. The iteration is the problem.
Any ideas?

A: I found a possible, but a bit ugly solution. The main part is using vars() (as in the article I referenced in my question...):
def override_setup(exp, args):
    exp_dict = vars(exp)
    opts = vars(args)

    # iterate over node
    for key in exp_dict:
        cur_param = None
        for param in ['param1', 'param2']:
            # ugly workaround
            # keys are like __{XML-Namespace-URI}_parent__param1
            if key.endswith(param):
                cur_param = param

        if not cur_param or opts[cur_param] is None:
            continue

        try:
            exp_dict[key] = opts[cur_param]
        except Exception as e:
            print e

In my case exp_dict contained at least 6 elements representing internal pyxb stuff you shouldn't touch. That's one reason I don't really like this solution. But it's the best I have for now.

A: After searching some more, I finally found the solution I was looking for: setattr():
def override_setup(exp, args):
    opts = vars(args)

    for param in ['param1', 'param2']:
        if opts[param] is None:
            continue

        try:
            setattr(exp, param, opts[param])
        except Exception as e:
            print e


text:
Q: Python Lambda Function Parsing DynamoDB's JSON Format Python Lambda function that gets invoked for a dynamodb stream has JSON that has DynamoDB format (contains the data types in JSON).  I would like to covert DynamoDB JSON to standard JSON.  PHP and nodejs have Marshaler that can do this.  Please let me know if there are similar or other options for Python.
DynamoDB_format = `{"feas":
    {"M": {
        "fea": {
            "L": [
                {
                    "M": {
                        "pre": {
                            "N": "1"
                        },
                        "Li": {
                            "N": "1"
                        },
                        "Fa": {
                            "N": "0"
                        },
                        "Mo": {
                            "N": "1"
                        },
                        "Ti": {
                            "S": "20160618184156529"
                        },
                        "Fr": {
                            "N": "4088682"
                        }
                    }
                }
                ]
            }
        }
    }
}`

A: To easily convert to and from the DynamoDB JSON I recommend using the boto3 dynamodb types serializer and deserializer.
import boto3
from boto3.dynamodb.types import TypeSerializer, TypeDeserializer
ts= TypeSerializer()
td = TypeDeserializer()

data= {"id": "5000"}
serialized_data= ts.serialize(data)
print(serialized_data)
#{'M': {'id': {'S': '5000'}}}
deserialized_data= td.deserialize(serialized_data)
print(deserialized_data)
#{'id': '5000'}

For more details check out the boto3.dynamodb.types classes.

A: As taken from this blog, the following seems to be the simplest solution:
from boto3.dynamodb.types import TypeDeserializer, TypeSerializer

def unmarshall(dynamo_obj: dict) -> dict:
    """Convert a DynamoDB dict into a standard dict."""
    deserializer = TypeDeserializer()
    return {k: deserializer.deserialize(v) for k, v in dynamo_obj.items()}

def marshall(python_obj: dict) -> dict:
    """Convert a standard dict into a DynamoDB ."""
    serializer = TypeSerializer()
    return {k: serializer.serialize(v) for k, v in python_obj.items()}

A: Update: There is a library now: https://pypi.org/project/dynamodb-json/

Here is an improved version of indiangolfer's answer.
While @indiangolfer's solution works for the question, this improved version might be more useful for others who stumble upon this thread.
def unmarshal_dynamodb_json(node):
    data = dict({})
    data['M'] = node
    return _unmarshal_value(data)

def _unmarshal_value(node):
    if type(node) is not dict:
        return node

    for key, value in node.items():
        # S – String - return string
        # N – Number - return int or float (if includes '.')
        # B – Binary - not handled
        # BOOL – Boolean - return Bool
        # NULL – Null - return None
        # M – Map - return a dict
        # L – List - return a list
        # SS – String Set - not handled
        # NN – Number Set - not handled
        # BB – Binary Set - not handled
        key = key.lower()
        if key == 'bool':
            return value
        if key == 'null':
            return None
        if key == 's':
            return value
        if key == 'n':
            if '.' in str(value):
                return float(value)
            return int(value)
        if key in ['m', 'l']:
            if key == 'm':
                data = {}
                for key1, value1 in value.items():
                    if key1.lower() == 'l':
                        data = [_unmarshal_value(n) for n in value1]
                    else:
                        if type(value1) is not dict:
                            return _unmarshal_value(value)
                        data[key1] = _unmarshal_value(value1)
                return data
            data = []
            for item in value:
                data.append(_unmarshal_value(item))
            return data

It is improved in the following ways:

*

*handles more data types, including lists, which were not handled correctly previously

*handles lowercase and uppercase keys
Edit: fix recursive object bug

A: I couldn't find anything out in the wild.  So, I decided to port the PHP implementation of dynamodb json to standard json that was published here. I tested this in a python lambda function processing DynamoDB stream.  If there is a better way to do this, please let me know.
(PS: This is not a complete port of PHP Marshaler)
The JSON in the question gets transformed to:
{
   "feas":{
      "fea":[
         {
            "pre":"1",
            "Mo":"1",
            "Ti":"20160618184156529",
            "Fa":"0",
            "Li":"1",
            "Fr":"4088682"
         }
      ]
   }
}

def unmarshalJson(node):
    data = {}
    data["M"] = node
    return unmarshalValue(data, True)

def unmarshalValue(node, mapAsObject):
    for key, value in node.items():
        if(key == "S" or key == "N"):
            return value
        if(key == "M" or key == "L"):
            if(key == "M"):
                if(mapAsObject):
                    data = {}
                    for key1, value1 in value.items():
                        data[key1] = unmarshalValue(value1, mapAsObject)
                    return data
            data = []
            for item in value:
                data.append(unmarshalValue(item, mapAsObject))
            return data

A: import json
import boto3
import base64
output = []
def lambda_handler(event, context):
print(event)
for record in event['records']:
payload = base64.b64decode(record['data']).decode('utf-8')
print('payload:', payload)
    row_w_newline = payload + "\n"
    print('row_w_newline type:', type(row_w_newline))
    row_w_newline = base64.b64encode(row_w_newline.encode('utf-8'))

    output_record = {
        'recordId': record['recordId'],
        'result': 'Ok',
        'data': row_w_newline
    }
    output.append(output_record)

print('Processed {} records.'.format(len(event['records'])))

return {'records': output}


text:
Q: How do I change between cartesian and cylindrical coordinate systems? I have a vector $\textbf{D}=(x,3,5)$ in cartesian coordinates $(x,y,z)$ that I want to express in cylindrical coordinates $(r,\phi,z)$. Do I just plug the values for x,y,z into the expressions to get the new coordinates and thats it?
$$ \begin{align*}  \phi &= \arctan \frac{x}{y} \\ r &= \sqrt{x^2+y^2} \\ z &= z \end{align*}  $$

A: That is basically correct although you have to be careful with arctan. Cylindrical coordinates is the same thing as converting the $x,y$ plane to polar and keeping the $z$-axis unchanged. This wikipedia article explains the subtleties of the arctan conversion: https://en.wikipedia.org/wiki/Polar_coordinate_system#Converting_between_polar_and_Cartesian_coordinates.


text:
Q: When to write Unit Tests : Is there any or list of terms to take right decision To write Unit Tests we have to write extra bits of code.
For several projects we do Unit Tests and for several projects we do not.
As a Team Leader I face trouble to make the right decision.
Is there any or list of terms by which I can take the right decision whether we will do Unit tests or not?
EDIT: Please provide a comment while down voting the question. It will help me to improve my question.

A: As a rule of thumb I would argue that you should write unit tests for all code you write. There may be cases where you don't need to unit test something, but I would have thought these would be unusual and unlikely.
The advantage to having tests for your code is you know when some functionality changes, of course you need to have good coverage and well written tests that you have confidence in. Just having a test cover some code isn't a guarantee that your code is correct / flawless. In fact a bad test can be worse than no test at all. But that's really a different question.

I pity the fool who doesn't write unit tests
any tests are better than zero tests. And isn't unit testing just a barely more formal way of doing the ad-hoc testing we've been doing all along? I think Fowler said it best:
Whenever you are tempted to type something into a print statement or a debugger expression, write it as a test instead.
I encourage developers to see the value of unit testing; I urge them to get into the habit of writing structured tests alongside their code. That small change in mindset could eventually lead to bigger shifts like test-first development-- but you have to crawl before you can sprint.

A: The Way of Testivus says thus on the matter of when to write unit tests:

The best time to test is when the code is fresh
Your code is like clay.
  When it's fresh, it's soft and malleable.
  As it ages, it becomes hard and brittle.
If you write tests when the code is fresh
  and easy to change, testing will be easy
  and both the code and the tests will be strong.

The key thing to take away form this is that you write code early in the process when you can still think about what the code is doing.  When doing this, you think about what is testable and what isn't.  Another bit from the Way of Testvius...

Think of code and test as one
When writing the code, think of the test.
  When writing the test, think of the code.
  When you think of code and test as one,
  testing is easy and code is beautiful.

One thing that I like about The Way of Testivus rather than more dogmatic statements is it specifiably calls out dogma and says don't get stuck on it.  Writing the test is more important than following rules set in stone.
Write tests.
Write tests early.
A poor written test is better than no test.


text:
Q: Create Grouped UITableview in Xamarin.iOS How I can create grouped in UI Table View. Check image I want to implement same in xamarin.iOS.

A: You have to create a TableSource  -Class which is holding your data and sets the headers for the sections (they are called sections in iOS).
You need to override following methods:
    public override string TitleForHeader(UITableView tableView, nint section)
    {
        return SessionGroups == null ? string.Empty : SessionGroups[(int)section].Key;
    }

    public override nint NumberOfSections(UITableView tableView)
    {
        return SessionGroups == null ? 0 : SessionGroups.Count;
    }

    public override nint RowsInSection(UITableView tableview, nint section)
    {
        return SessionGroups == null ? 0 : SessionGroups[(int)section].Count;
    }

    public override string[] SectionIndexTitles(UITableView tableView)
    {
        return SessionGroups == null ? new string[0] : SessionGroups.Select(x => x.Key).ToArray();
    }

You can find more infos here. In the 'Adding an Index' and 'Adding Headers and Footers' section.
Edit
Important is also the datasource structure. You Need something like a keyedlist (or a dictionary with a list like showed in the above link).
protected IList<ObservableKeyedList<string, string>> SessionGroups;

// Just override the ItemsSource property (base class we use: MvxStandardTableViewSource)
public new IList<ObservableKeyedList<string, string>> ItemsSource
{
    get { return SessionGroups; }
    set
    {
        SessionGroups = value;
        ReloadTableData();
    }
}

The first string of the ObservableKeyedList is the key for your section/group. And the second string is the value you want to show on the UI: The second can also be a model with different properties.
So you just Need to order/group your data in the above structure and set the ItemsSource of your UiTableSource.. thats it =)
Heres the ObservableKeyedList we use:
public class ObservableKeyedList<TKey, TItem> : ObservableCollection<TItem>
    {
        public TKey Key { protected set; get; }

        public ObservableKeyedList(TKey key, IEnumerable<TItem> items) : base(items)
        {
            Key = key;
        }

        public ObservableKeyedList(IGrouping<TKey, TItem> grouping) : base(grouping)
        {
            Key = grouping.Key;
        }
    }


text:
Q: Phoenix Framework - jQuery connection I have problem with jquery connection to my Project on the Phoenix Framework. I have installed jQuery through npm install

npm i jquery

I add import to app.js.
import $ from 'jquery'

My dependencies at package.json
"jquery": "^3.4.1",
"phoenix": "file:../deps/phoenix",
"phoenix_html": "file:../deps/phoenix_html"

But in console I have error

Uncaught ReferenceError: $ is not defined

My js
<script>
    $("#login-btn").click(function(){
        console.log("Sign in button pressed");
    });
</script>

Please, help me.

A: You need to add this line to assets/webpack.config.js
const webpack = require('webpack');

plugins: [
  new webpack.ProvidePlugin({
    $: "jquery",
    jQuery: "jquery"
  })
]

and assets/js/app.js
import $ from 'jquery'
window.jQuery = $
window.$ = $

A: When you import jQuery, it is only available in that module. It doesn't get automatically set on the window object, which is where it gets searched in that script tag.
I am not sure if it's a good practice, but in your specific case you can try to do something like:
import {$, jQuery} from 'jquery';

window.$ = $;
window.jQuery = jQuery;


text:
Q: use function length for method overloading I got this code from here:
http://ejohn.org/apps/learn/#90
function addMethod(object, name, fn){
          // Save a reference to the old method
          var old = object[ name ];

          // Overwrite the method with our new one
          object[ name ] = function(){
            // Check the number of incoming arguments,
            // compared to our overloaded function
            if ( fn.length == arguments.length )
              // If there was a match, run the function
              return fn.apply( this, arguments );

            // Otherwise, fallback to the old method
            else if ( typeof old === "function" )
              return old.apply( this, arguments );
          };
        }

        function Ninjas(){
          var ninjas = [ "Dean Edwards", "Sam Stephenson", "Alex Russell" ];
          addMethod(this, "find", function(){
            return ninjas;
          });
          addMethod(this, "find", function(name){
            var ret = [];
            for ( var i = 0; i < ninjas.length; i++ )
              if ( ninjas[i].indexOf(name) == 0 )
                ret.push( ninjas[i] );
            return ret;
          });
          addMethod(this, "find", function(first, last){
            var ret = [];
            for ( var i = 0; i < ninjas.length; i++ )
              if ( ninjas[i] == (first + " " + last) )
                ret.push( ninjas[i] );
            return ret;
          });
        }

        var ninjas = new Ninjas();
        assert( ninjas.find().length == 3, "Finds all ninjas" );
        assert( ninjas.find("Sam").length == 1, "Finds ninjas by first name" );
        assert( ninjas.find("Dean", "Edwards").length == 1, "Finds ninjas by first and last name" );
        assert( ninjas.find("Alex", "X", "Russell") == null, "Does nothing" );

I understand 1)function length is the length of arguments in definition and 2) arguments refer to array of variables for outer function.
but What does the arguments refer to in the addMethod()? I think it is 0 and the addMethod won't work. But it works. Can you help me understand addMethod?

A: Function.length indicates the number of parameters expected by the function and it is 3 in the case of addMethod. And arguments refers to the array of arguments which are passed to addMethod.
So, the addMethod function checks if the expected number of parameters match the actual number of parameters passed.

*

*If they match, it simply executes the third parameter (which is expected to be a function).

*Otherwise, it executes the function by the name referred by the second parameter.

A: arguments is build-in JavaScript Array-like object which every function implicitly has. It contains array of passed arguments to the function. However arguments object is not an Array. It is similar to an Array, but does not have any Array properties except length.


text:
Q: Converting str object to int in dictionary I am currently making a scoreboard for a yatzhee game in python where I'm using a dictionary to associate where a player's points will be inserted into a table.
The dictionary looks like this from the start:
 self.lista={"aces":'',"twos":'',"threes":'',"fours":''}

When I associate for example the number 25 with "aces" I want it to be interpreted as an integer, so when the next time I add points to "aces" it adds them up with 25. Is there a way to this?

A: self.lista = {"aces":'',"twos":'',"threes":'',"fours":''}
self.lista['aces'] = 25 --> # 25
self.lista['aces'] += 25 --> # 50

OT (for the future reference):
You can initialize your dict with keys in this way:
keys = ['aces', 'twos', 'threes', 'fours']
self.lista = dict.fromkeys(keys)
print self.lista --> # {'aces': None, 'fours': None, 'twos': None, 'threes': None}


text:
Q: Can I use a property placeholder in a Spring 3 bean's id attribute in the XML configuration? I have an application that is in the process of being migrated to a new setup. The current interim is that the application is being deployed onto the same GlassFish server but with different configuration (property files, jndi, etc). In my Spring 3 configuration, I am using the task namespace for scheduling, but I want to know if there is a problem if all deployments of the application can have the same id for the scheduler, ie:
<task:scheduler id="appScheduler" pool-size="10" />
<task:scheduled-tasks scheduler="appScheduler">
    <task:scheduled ref="notificationSender" method="sendNotifications" cron="${email.time.cron}" />
</task:scheduled-tasks>

If not, is there a way to put a placeholder in the scheduler's id attribute so each application has its own, ie:
<task:scheduler id="${app.name}Scheduler" pool-size="10" />
<task:scheduled-tasks scheduler="${app.name}Scheduler">
    ...

I did try the above, but the error message kept coming back about not being able to find the referenced scheduler after the property was substituted. Thus raises the question, will Spring substitute a property inside the id attribute?


text:
Q: What's the difference between the -symbolic and -shared GCC flags? From the documentation's description, they seem to do the same thing except that "not all systems" support shared and "only some systems" support symbolic (it's unclear if these are the same set of systems):

-shared
      Produce a shared object which can then be linked with other objects to
  form an executable. Not all systems
  support this option. For predictable
  results, you must also specify the
  same set of options that were used to
  generate code (-fpic, -fPIC, or model
  suboptions) when you specify this
  option.[1]
-symbolic
      Bind references to global symbols when building a shared object. Warn
  about any unresolved references
  (unless overridden by the link editor
  option -Xlinker -z -Xlinker defs).
  Only a few systems support this
  option.

I suspect the difference is in the "Produce a shared object which can then be linked with other objects to form an executable" part, but that sounds like something that is true of any library. Does it mean that the resulting shared object can be linked statically too?

A: Summary: -symbolic prevents intra-shared object function interposition
Linking with shared objects allows for a feature called symbol interposition.  The idea is that you can 'interpose' a new definition of a global symbol so that it is called rather then the 'regular' definition.
One classic example is malloc().  In the most common case, malloc() is defined within libc.  But you can interpose your own version of malloc by loading a library that defines that symbol before you load libc (most runtime linkers allow you to use LD_PRELOAD to specific libraries to load before the executable).
By default, any function within a shared object that is not static is a global symbol.  Because of that, any functions within the shared object can be interposed on.  Consider a scenario where a shared object has function high_level() and low_level() and high_level() calls low_level() as part of it's implementation and neither high_level() nor low_level() are static functions.
It's possible to interpose low_level() such that high_level() is calling a low_level() from a different shared object.
This is where -symbolic comes in.  When creating your shared object, the linker will see that low_level() is defined in the same shared object as high_level() and bind the call such that it can't be interposed on.  This way, you know that any calls from one function in your shared object to another in the same shared object will never be interposed on.


text:
Q: Free/Open-Source Theme Frameworks as an Alternate to Thesis? What good free and open source alternatives exist to the Thesis theme  ??

A: I assume by "alternatives" you mean Theme Frameworks?  If yes, here's a list:

*

*Atahualpa

*The Buffet Framework

*Carrington

*Hybrid

*Sandbox

*Thematic

*WP Framework
UPDATE: I added a few more:

*

*ashford

*Basis

*Brave New World

*Buffet

*Imagination

*Naked

*OnePress

*Starkers

*Startbox

*Starter Theme Project

*Vanilla

*Whiteboard

*WordPreciousss

*wp-constructor
If that's not what you meant, please clarify.


text:
Q: xslt test with 2 parameters <xsl:if test="count($currentPage/..//$itemType) > 0">
I try to use the if statement with 2 param values and I get the error:
"unexpected token '$' in the expression..."
is it possible to do what I'm trying to ?

A: In XSLT, like in most programming languages (excluding macro languages), variables represent values, not fragments of expression text. I suspect $itemType holds an element name, and you are imagining that you can use it anywhere you could use an element name. If that's what you are trying to do, use ..//*[name()=$itemType].

A: This is invalid (and @Michael Kay explained it well):
//$varName

If I guess correctly what you are up to, then you may try this:
//*[name() = $varName]


text:
Q: How to programme constant current of a LED Driver for various current levels? I need to design a backlight unit that will change its duty cycle and constant LED current via a microcontroller. My supply is a SMPS with 12V - 20A output. I need to drive 16 * 16 = 256 LEDs(seperate 16 LED strings each combined of 16 LED). LEDs have 2.1 forward voltage and typical current is 60 mA.
Most of the LED Driver chip work in the same way. To output a reference voltage and let us to adjust constant current via an external resistor to flow from. Like this below:

However, once you put the resistor there you are not able to change the current. So, I draw this circuit:

driver chip is lm3410 and analog switch is NX3L1G3157G.

You see, I thought that I can switch between two external resistors via a deMUX this way I will be able to have at least two current levels. And then I can use few of the same configuration to get what I need.(Red circles are external resistors and the switch)
The thing is, I couldn't find any other switch that supports more than 350 mA and 100m Ohm resistance except NX3L1G3157G. And it has only 2 switch. Also, probably I will have to change the LEDs to another one with higher luminance and higher current flow so I will need a switch which can support up to 500 mA. Also, I need 5 current levels like 100% DT(Duty Cycle) - X mA, 50% DT - 2X mA, 33% DT - 3X mA, 25% DT - 4X mA and 20% DT - 5X mA. I could still have managed to do that if we don't need to care for the PCB area, but we do!
Also, I am aware of some LED driver chips provides limited current adjustment register like MC34844 but they do not let more than 30 mA to flow per each channel so useless for me.
So, since I had all my hidden answers from this forum, again, I ask help from other experienced engineers. Do you have any suggestion for my trouble? I need to adjust the current flow through LEDs to 500 mA (20% DT), 400 mA (25% DT), 300 mA (33% DT), 200 mA (50%DT) and 100 mA continuous. Regards.

A: If I understand your text you are asking how to control LEDs in the following scenarios:

*

*Continuous backlight dimmable.

*Strobed backlight where LEDs strobe in-synch with 3D lenses, also dimmable but at same average brightness as continuous mode.

You seem to think that you will have to use a different peak current for the two situations despite using PWM control. This is incorrect. What you do is set the max current of your system so that at, say, 40% PWM the LEDs are giving the required brightness. When you switch to 3D mode you pulse at 80% PWM but modulate the LEDs at the required strobe rate. Effectively you have a high-speed PWM controlling the average current to the LEDs and a low speed strobe synchronised with your camera.

Upper trace shows LED PWM current waveform during strobed mode. Note long on-time. Lower trace shows continuous LED lighting at half-current thus maintaining same average brightness on a longer time scale.


text:
Q: Cmake: only one configuration for a specific sub project, Debug&Release for all others In my root folder's CMakeLists.txt I have defined the possible configurations to be Debug and Release:
if(NOT CMAKE_CONFIGURATION_TYPES)
  set(CMAKE_CONFIGURATION_TYPES Debug Release)
  set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Reset the configurations to what we need" FORCE)
endif()

This works for most of the subprojects of the solution. However, I have two subprojects which don't differentiate between Debug and Release (they do some non-C++ stuff like Doxygen or Typescript compilation). In these subprojects' CmakeLists.txt I just wrote
project(typescript_compilation)

# Do not separate debug and release builds
set(CMAKE_CONFIGURATION_TYPES Release)

And this works if one first opens the Release configuration and then the Debug configuration in the IDE (Visual Studio). I then can switch between Release and Debug and the projects are available and only build once.
If, however, one opens the Debug configuration first after the Cmake generation, the sub-project cannot be loaded with the error

typescript_compilation.vcxproj : error: Cannot load project: project does not contain requested configuration Debug|x64. Please verify that the .sln file is valid and uses only existing project configurations.

So my way seems to be the wrong way to achieve this and the Debug mode only works if the Release mode has been opened and built first. What is the best Cmake way to build some projects only once?

A: Seems your IDE couldn't find the Debug configuration for those subprojects.
I suppose, set up the configuration types like what you've done to the root configuration should solved the issue:
set(CMAKE_CONFIGURATION_TYPES Debug Release)


text:
Q: SQL: not exist with openquery not working as expected I do have an oracle 8 database from which I want to fetch data to SQL Server 2005. The following statement works fine, if the table on SQL Server 2005 is empty. If I run with let's say one entry missing, it does not work. Please let me know, if any additional information would be usefull!
SELECT wdmsoracle.NO
FROM (Select * from OPENQUERY(msch,  'select
                                                actu.NO
                                                , actu.ANNOSEQUENT
                                                , replace(replace(dm.descript, ''Generated by modification request '', ''Modification request''), ''Pseudo ECR for WDMS-SAP interface'', ''New Drawing'')
                                                , actu.APPRDATE
                                                , actu.MADEDATE
                                                , actu.MAINDRW
                                                , actu.DESIGNGRP
                                                , actu.ITEMID
                                                , actu.ISSUE
                                                , actu.DESCRIPT
                                                , actu.DESCRIPT2
                                                , dr.PRODUCTCODE
                                                , mpaths.webpath as asdasd
                                                , vpaths.webpath
                                            FROM
                                                WDDRAWACTU actu
                                                , wddraw dr
                                                , wddvfilesiss vfiles
                                                , wddvpaths vpaths
                                                , wddmfiles mfiles
                                                , wddmpaths mpaths
                                                , wdanno dm
                                            WHERE actu.apprdate >= to_date(''01-01-05'',''dd-mm-yy'')
                                                and actu.itemid = dr.itemid (+)
                                                and actu.issue = dr.issue (+)
                                                and actu.annosequent = dm.sequent (+)
                                                and actu.itemid = vfiles.itemid (+)
                                                and actu.issue = vfiles.issue (+)
                                                and vfiles.pathid = vpaths.pathid
                                                and actu.annosequent = mfiles.sequent (+)
                                                and mfiles.pathid = mpaths.pathid')) as wdmsoracle
Where NOT EXISTS (
        SELECT wdmsoracle.NO
        FROM [DesignMessage_Workflow].[dbo].[WDMS] wdms, (Select * from OPENQUERY(msch,  'select
                                                actu.NO
                                            FROM
                                                WDDRAWACTU actu
                                            WHERE actu.apprdate >= to_date(''01-01-05'',''dd-mm-yy'')')) as wdmsoracle
        WHERE wdms.NO = wdmsoracle.NO)

A: with the help of this website I was able to solve it on my own:
SELECT wdmsoracle.NO
        FROM (Select * from OPENQUERY(msch,  'select
                                                actu.NO
                                                , actu.ANNOSEQUENT
                                                , replace(replace(dm.descript, ''Generated by modification request '', ''Modification request''), ''Pseudo ECR for WDMS-SAP interface'', ''New Drawing'')
                                                , actu.APPRDATE
                                                , actu.MADEDATE
                                                , actu.MAINDRW
                                                , actu.DESIGNGRP
                                                , actu.ITEMID
                                                , actu.ISSUE
                                                , actu.DESCRIPT
                                                , actu.DESCRIPT2
                                                , dr.PRODUCTCODE
                                                , mpaths.webpath as asdasd
                                                , vpaths.webpath
                                            FROM
                                                WDDRAWACTU actu
                                                , wddraw dr
                                                , wddvfilesiss vfiles
                                                , wddvpaths vpaths
                                                , wddmfiles mfiles
                                                , wddmpaths mpaths
                                                , wdanno dm
                                            WHERE actu.apprdate >= to_date(''01-01-05'',''dd-mm-yy'')
                                                and actu.itemid = dr.itemid (+)
                                                and actu.issue = dr.issue (+)
                                                and actu.annosequent = dm.sequent (+)
                                                and actu.itemid = vfiles.itemid (+)
                                                and actu.issue = vfiles.issue (+)
                                                and vfiles.pathid = vpaths.pathid
                                                and actu.annosequent = mfiles.sequent (+)
                                                and mfiles.pathid = mpaths.pathid')) as wdmsoracle
Where NOT EXISTS (
        SELECT wdms.NO
        FROM [DesignMessage_Workflow].[dbo].[WDMS] wdms
        WHERE wdms.NO = wdmsoracle.NO)


text:
Q: Sysprep - Win 10 1903 - language packs Microsoft in their infinite wisdom appear to have changed their approach to multi-lingual support in Windows 10. Whereas a normal user can install language packs via the language settings, this breaks Sysprep, as the user context appears to be used for the appx packages and not provisioning for the system. In 1809 and previous, we'd download the Language Pack ISO from Volume Licensing and use DISM to install the languages, but Microsoft has neglected to release this so far neither can I see any comms about when it might be out.
Can anyone provide any information on the method of injecting languages in 1903 for gold image deployment across multiple countries? Hopefully, they documented this somewhere and I've yet to find it...
Additionally, we have SCCM, so this is another option for an answer if you only have a solution via that.


text:
Q: How to solve issue with terminal screen shrinking while typing? I'm new to Linux and its terminal, so forgive my errors if any.
Issue
Whenever I type anything on my terminal the window keeps shrinking. However once the terminal window is maximized this issue never occurs.
Specifications (according to uname command)

*

*OS: GNU/Linux

*Kernel Version: #1 SMP Debian 4.6.4-1kali1

Edit
By terminal here I mean the gnome-terminal.
Only the width and height are affected and the SHIFT and CTRL keys do not affect the window. The only keys affecting the window are the character keys i.e. A-Z, 0-9, and other special symbols and punctuation as well as the TAB key.

A: Well I managed to solve the issue by reinstalling gnome-terminal through xterm.
The exact commands were:
aptitude remove gnome-terminal

Wait for it to uninstall then
aptitude install gnome-terminal

I really have no idea what the issue really was but would love to know.


text:
Q: Where can I find QEMU (TCG)'s / LLVM IR operational semantics? Is anyone aware pf any public QEMU's TCG operational semantics description?
I rather found something about LLVM, but I'm not sure if these two are quite similar? especially that TCGs use sometimes custom helper functions rather than micro-ops.
Any pointers would be appreciated.
Thanks.
Best regards,

A: tcg/README in the QEMU sources is the documentation for the various TCG ops. Note that the exact set and semantics of TCG ops are purely an internal implementation detail of QEMU -- they can and do change (mostly adding new ops, but occasionally clarifying or changing existing ones).
There's no relationship between LLVM IR and QEMU TCG, except that both are instances of the very common compiler design pattern of "use an architecture-agnostic intermediate representation".


text:
Q: I can't deploy to either iOS device or simulator in Xamarin Mac Whatever I choose from the platform-selection dropdown (Debug|iPhoneSimulator, Release|iPhone etc.) the target dropdown stays greyed out and just says "Default" meaning I can't choose either my connected iOS device (tried to connect two different devices) or any iOS simulator target. I know this used to work a couple of months back but since then many Xamarin updates have rolled in..
I have tried both stable and beta channels of Xamarin Studio. I have completely uninstalled Xamarin (using the uninstaller script) and re-installed it. I also updated to macOS Sierra so I've touched pretty many places.
There is an exception in the Xamarin log which I'm pretty sure is the cause of all this but I have no idea how to work around it. The exception is there whether I connect a device or not.
ERROR [2017-01-13 11:12:56Z]: Error while updating status of command: MonoDevelop.Ide.Commands.ProjectCommands.Run
System.InvalidCastException: Specified cast is not valid.
  at MonoDevelop.IPhone.IPhoneProjectFlavor.CreateExecutionCommand (MonoDevelop.Projects.ConfigurationSelector configuration, MonoDevelop.IPhone.IPhoneProjectFlavor appProject, MonoDevelop.IPhone.IPhoneProjectConfiguration appCfg, MonoDevelop.IPhone.IPhoneProjectFlavor targetProject, MonoDevelop.IPhone.IPhoneProjectConfiguration targetCfg, MonoDevelop.Projects.RunConfiguration runConfiguration) [0x0014d] in /Users/builder/data/lanes/3509/e606823f/source/md-addins/MonoDevelop.IPhone/MonoDevelop.IPhone/Project/IPhoneProject.cs:885
  at MonoDevelop.IPhone.IPhoneProjectFlavor.OnGetCanExecute (MonoDevelop.Projects.ExecutionContext context, MonoDevelop.Projects.ConfigurationSelector configuration, MonoDevelop.Projects.SolutionItemRunConfiguration runConfiguration) [0x0001a] in /Users/builder/data/lanes/3509/e606823f/source/md-addins/MonoDevelop.IPhone/MonoDevelop.IPhone/Project/IPhoneProject.cs:807
  at MonoDevelop.Projects.SolutionItemExtension.OnGetCanExecute (MonoDevelop.Projects.ExecutionContext context, MonoDevelop.Projects.ConfigurationSelector configuration) [0x00000] in /Users/builder/data/lanes/3509/e606823f/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItemExtension.cs:228
  at MonoDevelop.Projects.SolutionItemExtension.OnGetCanExecute (MonoDevelop.Projects.ExecutionContext context, MonoDevelop.Projects.ConfigurationSelector configuration, MonoDevelop.Projects.SolutionItemRunConfiguration runConfiguration) [0x00007] in /Users/builder/data/lanes/3509/e606823f/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItemExtension.cs:251
  at MonoDevelop.Projects.SolutionItem.CanExecute (MonoDevelop.Projects.ExecutionContext context, MonoDevelop.Projects.ConfigurationSelector configuration, MonoDevelop.Projects.SolutionItemRunConfiguration runConfiguration) [0x00000] in /Users/builder/data/lanes/3509/e606823f/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs:973
  at MonoDevelop.Projects.Solution.OnGetCanExecute (MonoDevelop.Projects.ExecutionContext context, MonoDevelop.Projects.ConfigurationSelector configuration, MonoDevelop.Projects.SolutionRunConfiguration runConfiguration) [0x0000d] in /Users/builder/data/lanes/3509/e606823f/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs:819
  at MonoDevelop.Projects.Solution+DefaultSolutionExtension.CanExecute (MonoDevelop.Projects.ExecutionContext context, MonoDevelop.Projects.ConfigurationSelector configuration, MonoDevelop.Projects.SolutionRunConfiguration runConfiguration) [0x00000] in /Users/builder/data/lanes/3509/e606823f/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs:1243
  at MonoDevelop.Projects.SolutionExtension.CanExecute (MonoDevelop.Projects.ExecutionContext context, MonoDevelop.Projects.ConfigurationSelector configuration) [0x00000] in /Users/builder/data/lanes/3509/e606823f/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionExtension.cs:79
  at MonoDevelop.Projects.SolutionExtension.CanExecute (MonoDevelop.Projects.ExecutionContext context, MonoDevelop.Projects.ConfigurationSelector configuration, MonoDevelop.Projects.SolutionRunConfiguration runConfiguration) [0x00007] in /Users/builder/data/lanes/3509/e606823f/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionExtension.cs:102
  at MonoDevelop.Projects.SolutionExtension.CanExecute (MonoDevelop.Projects.ExecutionContext context, MonoDevelop.Projects.ConfigurationSelector configuration) [0x00000] in /Users/builder/data/lanes/3509/e606823f/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionExtension.cs:79
  at MonoDevelop.Projects.SolutionExtension.CanExecute (MonoDevelop.Projects.ExecutionContext context, MonoDevelop.Projects.ConfigurationSelector configuration, MonoDevelop.Projects.SolutionRunConfiguration runConfiguration) [0x00007] in /Users/builder/data/lanes/3509/e606823f/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionExtension.cs:102
  at MonoDevelop.Projects.Solution.CanExecute (MonoDevelop.Projects.ExecutionContext context, MonoDevelop.Projects.ConfigurationSelector configuration, MonoDevelop.Projects.SolutionRunConfiguration runConfiguration) [0x00000] in /Users/builder/data/lanes/3509/e606823f/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs:732
  at MonoDevelop.Projects.Solution.CanExecute (MonoDevelop.Projects.ExecutionContext context, MonoDevelop.Projects.ConfigurationSelector configuration) [0x00000] in /Users/builder/data/lanes/3509/e606823f/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs:722
  at MonoDevelop.Ide.ProjectOperations.CanExecute (MonoDevelop.Projects.IBuildTarget entry, MonoDevelop.Core.Execution.IExecutionHandler handler) [0x00020] in /Users/builder/data/lanes/3509/e606823f/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs:993
  at MonoDevelop.Ide.Commands.RunHandler.CanRun (MonoDevelop.Core.Execution.IExecutionHandler executionHandler) [0x00015] in /Users/builder/data/lanes/3509/e606823f/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs:254
  at MonoDevelop.Ide.Commands.RunHandler.Update (MonoDevelop.Components.Commands.CommandInfo info) [0x00048] in /Users/builder/data/lanes/3509/e606823f/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs:242
  at MonoDevelop.Components.Commands.CommandHandler.InternalUpdate (MonoDevelop.Components.Commands.CommandInfo info) [0x00000] in /Users/builder/data/lanes/3509/e606823f/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandHandler.cs:42
  at MonoDevelop.Components.Commands.CommandManager.DefaultUpdateCommandInfo (MonoDevelop.Components.Commands.ActionCommand cmd, MonoDevelop.Components.Commands.CommandInfo info) [0x00079] in /Users/builder/data/lanes/3509/e606823f/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1518
  at MonoDevelop.Components.Commands.CommandManager.GetCommandInfo (System.Object commandId, MonoDevelop.Components.Commands.CommandTargetRoute targetRoute) [0x001cf] in /Users/builder/data/lanes/3509/e606823f/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1483

A: Seems that disabling these Unity Add-ins fixes this issue:

*

*Mono Soft Debugger Support for Unity

*Utilities for use with Unity

There is a bug report at https://bugzilla.xamarin.com/show_bug.cgi?id=51517


text:
Q: How do I find out which processes are causing the most disk activity? I am hoping to find a way to do more performance monitoring--specifically, I hope that monitoring disk activity on a per-process basis will help me decide which programs are causing the most trouble (aside from the AV).   I'd rather avoid a shotgun approach.
For windows XP, is there a process monitor that can give me a solid idea of which processes are slowing me down by causing the most page faults, etc?  Thanks!

A: Perhaps enabling the I/O reads and writes in the task manager (ctrl+shift+esc).  When looking at the processes in task manager select View then Select Columns.  Look for the I/O read optiona nd I/O write option and click them.
This is what I get:

A: While I prefer the accepted answer, there is another way with the existing task manager.

*

*Task manager > Performance (tab) > Resource Monitor (button) > Disk (tab)

A: I like the freeware Process Explorer.  It provides a bit more detail than the Windows Task Manager, including per-process I/O graphs.  Great for immediately spotting processes doing a lot of disk I/O.


text:
Q: Does rsync completely overwrite files with different timestamps? I've used a command similar to this to rsync files from macOS to Linux:
rsync -avz <ip-address>:/Backup/ Backup/

The folder Backup/ was previously copied from the same machine using scp, with no files changed. I thought that rsync would be a noop, but it started to overwrite all files (probably, because of different timestamps), causing a lot of disk writes. I've tried the same command with --size-only and it finished almost instantly. Does rsync completely overwrite the files that have different timestamps (i.e. not checking the difference)? Does it depend on the size of the files?

A: read the fine manual of rsync:
       It is famous  for  its
       delta-transfer  algorithm,  which  reduces the amount of data sent over
       the network by sending only the differences between  the  source  files
       and  the  existing  files in the destination.

I think you're getting read i/o, not write. Are you sure in rsync overwrite the files and not only scanning the content of them?


text:
Q: How to use xquery to find node and addChild to it? Is it possible to use xpath/xquery to query for a specific xml node, and then import/add a child node to it?
Example (code taken from http://codepad.org/gJ1Y2LjM , that was presented in similar question, but not the same):
1.
I want to add an array
$book = array('isbn'=>123456789099, 'title' => 'Harry Potter 3', 'author' => 'J K. Rowling', 'edition' => '2007');

2.
To an existing XML.
$doc = new DOMDocument();
$doc->loadXML('<?xml version="1.0"?>
<books>
    <book>
        <isbn>123456789098</isbn>
        <title>Harry Potter</title>
        <author>J K. Rowling</author>
        <edition>2005</edition>
    </book>
    <book>
        <placeItHere></placeItHere>
        <isbn>1</isbn>
        <title>stuffs</title>
        <author>DA</author>
        <edition>2014</edition>
    </book>
</books>');

3.
To do that it is used the following fragment.
$fragment = $doc->createDocumentFragment();
$fragment->appendXML("    <book>
<isbn>{$book['isbn']}</isbn>
        <title>{$book['title']}</title>
        <author>{$book['author']}</author>
        <edition>{$book['edition']}</edition>
    </book>
");

4.
But instead of appending it to the root node, has almost every example i found on internet:
$doc->documentElement->appendChild($fragment);

5.
I want to append it (p.ex) to the node found in /books/book/placeItHere and not using getElementbyId or tagName, but a xpath/xquery. I tryed
$xp = new domxpath($doc);
$parent = $xp->query("books/book/placeItHere");

to reach the node, but never managed to use it as the parent.
Question: How to use that location to appendChild $fragment? Is it possible?
**YOUR BEAUTIFUL MAGIC**

In the end I will just save it.
echo $doc->saveXML();

Thank you for any help you can give to me.

A: A couple problems:

*

*Your xpath expression should be /books/book/placeItHere (with the leading /).

*DOMXPath::query() returns a DOMNodeList rather than a DOMNode, so you'll need to grab your item() from it.

I rarely recommend using document fragments as playing fast and loose with raw XML regularly leads to problems. For example if your book title included an ampersand appendXML() would crap out with a parser error.
Instead I suggest createElement() and createTextNode(), which will handle transforming things like & into & automatically.

Example:
$xml = <<<'XML'
<?xml version="1.0"?>
<books>
    <book>
        <isbn>123456789098</isbn>
        <title>Harry Potter</title>
        <author>J K. Rowling</author>
        <edition>2005</edition>
    </book>
    <book>
        <placeItHere></placeItHere>
        <isbn>1</isbn>
        <title>stuffs</title>
        <author>DA</author>
        <edition>2014</edition>
    </book>
</books>
XML;

$book = [
    'isbn'    => 123456789099,
    'title'   => 'Harry Potter 3',
    'author'  => 'J K. Rowling',
    'edition' => '2007'
];

$dom = new DOMDocument();
$dom->formatOutput = true;
$dom->preserveWhiteSpace = false;
$dom->loadXML($xml);
$xpath = new DOMXPath($dom);

$placeItHere = $xpath->query('/books/book/placeItHere')->item(0);
$newBook = $placeItHere->appendChild($dom->createElement('book'));
foreach ($book as $part => $value) {
    $element = $newBook->appendChild($dom->createElement($part));
    $element->appendChild($dom->createTextNode($value));
}

echo $dom->saveXML();

Output:
<?xml version="1.0"?>
<books>
  <book>
    <isbn>123456789098</isbn>
    <title>Harry Potter</title>
    <author>J K. Rowling</author>
    <edition>2005</edition>
  </book>
  <book>
    <placeItHere>
      <book>
        <isbn>123456789099</isbn>
        <title>Harry Potter 3</title>
        <author>J K. Rowling</author>
        <edition>2007</edition>
      </book>
    </placeItHere>
    <isbn>1</isbn>
    <title>stuffs</title>
    <author>DA</author>
    <edition>2014</edition>
  </book>
</books>


text:
Q: how to display data horizontally in single table data using laravel and vue js
I have 2 table
table 1

________________
| name_id  name |
| 1       john  |
| 2      heaven |
|_______________|

table 2

_______________________
| id name_id  product |
| 1    1         bag  |
| 2    1       shoes  |
|_____________________|

I WANT TO DISPLAY IT LIKE THIS

__________________________
| # | name    |  product  |
| 1 |  John   | bag,shoes |
| 2 | Heaven  |           |
|___|_________|___________|

I dont know how to do it in my controller
Controller.php

       $data = DB::table('table1')
          ->leftjoin('table2','table2.name_id','=','table1.name_id')
             ->select('table1.*','table2.*')
          ->get();

    return $data

this how I display my data in table
Myvue js

methods:{

  loaddata(){

   axios.get('api/data').then(({data}){
  (this.alldata = data)
})

}

}

A: You left out ::table from DB
DB::('table1') => DB::table('table1')
$data = DB::table('table1')
            ->leftJoin('table2', 'table1.name_id', '=', 'table2.name_id')
            ->select('table1.*', 'table2.*')
            ->get();

A: You could try working with GROUP_CONCAT
For example like that:
DB::table('table1')
->leftjoin('table2','table2.name_id','=','table1.name_id')
->select('table1.*', DB::raw('GROUP_CONCAT(table2.product SEPARATOR ', ') AS products'))
->groupBy('table1.name_id')
->get();


text:
Q: Writing triggers for mcelog Just starting to look into mcelog for the first time (I've enabled it and seen syslog output before, but this is the first time I'm trying to do something non-default). I'm looking for information on how to write triggers for it. Specifically, I'm looking for what kinds of events mcelog can react to, how it decides which scripts to execute, and so on. Best I can make from the example trigger is that it sets a bunch of environmental variables before invoking the script. So does it just try to execute everything in the trigger directory (which is /etc/mcelog on RHEL) and let the script decide what it wants to act on?
I've seen other trigger scripts with names that look like MCE events, is that convention or does that have a special function? I created a trigger called /etc/mcelog/joel.sh which just sends a basic email to my gmail account. A few days ago apparently the trigger went off because I got an email from the script without manually running the script. I didn't think to pipe env output to the mailx command in joel.sh so I don't know what hardware event triggered the script execution or why mcelog picked joel.sh as the script to execute for it.
Basically, I'm looking for an answer that will give me a basic orientation with mcelog, it's triggering system, and how I can use it to monitor my hardware health. I'm pretty sure I can figure out the more advanced stuff once I get my bearings.

A: Looking at the sample mcelog.conf config file it looks to contain most if not all of the types of triggers it can deal with.
DIMMs
[dimm]
#
# execute these triggers when the rate of corrected or uncorrected
# errors per DIMM exceeds the threshold
# Note when the hardware does not report DIMMs this might also
# be per channel
# The default of 10/24h is reasonable for server quality·
# DDR3 DIMMs as of 2009/10
#uc-error-trigger = dimm-error-trigger
uc-error-threshold = 1 / 24h
#ce-error-trigger = dimm-error-trigger
ce-error-threshold = 10 / 24h

Sockets
[socket]
# Threshold and trigger for uncorrected memory errors on a socket
# mem-uc-error-trigger = socket-memory-error-trigger
mem-uc-error-threshold = 100 / 24h
# Threshold and trigger for corrected memory errors on a socket
mem-ce-error-trigger = socket-memory-error-trigger
mem-ce-error-threshold = 100 / 24h

Cache
[cache]
# Processing of cache error thresholds reported by Intel CPUs
cache-threshold-trigger = cache-error-trigger

Page
[page]
# Memory error accouting per 4K memory page
# Threshold for the correct memory errors trigger script
memory-ce-threshold = 10 / 24h
# Trigger script for corrected errors
# memory-ce-trigger = page-error-trigger

Triggers
Triggers can be controlled in this section.
[trigger]
# Maximum number of running triggers
children-max = 2
# execute triggers in this directory
directory = /etc/mcelog

Sample triggers
There are some sample triggers here on the mcelog github page.
Sample trigger script, dimm-error-triggers:
#!/bin/sh
#  This shell script can be executed by mcelog in daemon mode when a DIMM
#  exceeds a pre-configured error threshold
#
# environment:
# THRESHOLD     human readable threshold status
# MESSAGE   Human readable consolidated error message
# TOTALCOUNT    total count of errors for current DIMM of CE/UC depending on
#       what triggered the event
# LOCATION  Consolidated location as a single string
# DMI_LOCATION  DIMM location from DMI/SMBIOS if available
# DMI_NAME  DIMM identifier from DMI/SMBIOS if available
# DIMM      DIMM number reported by hardware
# CHANNEL   Channel number reported by hardware
# SOCKETID  Socket ID of CPU that includes the memory controller with the DIMM
# CECOUNT   Total corrected error count for DIMM
# UCCOUNT   Total uncorrected error count for DIMM
# LASTEVENT Time stamp of event that triggered threshold (in time_t format, seconds)
# THRESHOLD_COUNT Total umber of events in current threshold time period of specific type
#
# note: will run as mcelog configured user
# this can be changed in mcelog.conf

logger -s -p daemon.err -t mcelog "$MESSAGE"
logger -s -p daemon.err -t mcelog "Location: $LOCATION"

[ -x ./dimm-error-trigger.local ] && . ./dimm-error-trigger.local

exit 0

References

*

*mcelog / mcelog.conf

*mcelog - memory error handling in user space at Linux Kongress 2010 - paper

*mcelog - memory error handling in user space at Linux Kongress 2010 - slides

*Andi's recent papers and presentations

*andikleen/mcelog - github page


text:
Q: Extract data from power BI pbix file using SQL and R I want to extract data from a Power BI pbix file using R. The recently released pbixr package seems to offer the functions to do this but unfortunately there is hardly any documentation on how the extract data tables from a pbix file. I experimented with several functions and managed to retrieve the data tables. However, I fail to extract tables that are generated by Power BI using formulas (e.g. SUM etc). These are marked in Power BI with a calculator symbol in front.
At the office we have a simple piece of software that works very similar to the pbixr package when linking to and collecting data from a pbix file (i.e. using localhost: correct_port in combination with an SQL command), that is able to extract all data including the Power BI generated ones. This makes me think that this also should be possible by using the pbixr package but perhaps I am wrong.
Possibly the OlapR package from Microsoft also might do the trick but as this is not freeware and probably needs a specific version of R I do not want to use it. But I do welcome any other approaches to access the content of a pbix file.
A reproducible example:
install.packages("pbixr")
library(pbixr)

# Download example pbix file (also see pbixr vignette)
temp_dir <- "C:/users/dijk158/temp" # set your own temp dir
dir.exists(temp_dir)
sample_file_name <- "sample_vig.pbix"
path_file_sample <- file.path(temp_dir, sample_file_name)
url_pt1 <- "https://github.com/KoenVerbeeck/PowerBI-Course/blob/"
url_pt2 <- "master/pbix/TopMovies.pbix?raw=true"
url <- paste0(url_pt1, url_pt2)
req <- download.file(url, destfile = path_file_sample, mode = "wb")

At this point Power BI should be open and the example file sample_vig.pbix opened.
# Find port
connections_open <- f_get_connections()
connections_open$pbix <- gsub(" - Power BI Desktop", "",
                              connections_open$pbix_name)
correct_port <- as.numeric(connections_open$ports)

# Create the connection
connection_db <- paste0("Provider=MSOLAP.8;Data Source=localhost:",
                        correct_port, ";MDX Compatibility=1")

# Read tables
sql_table <- "evaluate TopMovies"
get_tables <- f_query_datamodel(sql_table, connection_db)
names(get_tables)
summary(get_tables)

get_tables only contains the pure data tables but not the Power BI generated ones such as Avg Rating, Avg Votes, etc.

A: The author of the pbixr package has provided a solution on the issues tracker section of the package website. See here.


text:
Q: Compliling Flash and publishing to iPad Is its currently possible to publish a Flash App to iPad? I see Flash CS5 has the ability to publish to iPhone/iPad - is Apple supporting this and will be able to be sold in the App store. It would be a lot simpler for me to code up my next project in flash as opposed to objective c and cocos2d.

A: The [Adobe FAQ][1] Steve posted certainly clearly says you can compile Air apps for the iOS (the O/S that the iPad runs:
http://labs.adobe.com/wiki/index.php/Packager_for_iPhone:Developer_FAQ#Which_Flash_Platform_tools_and_technologies_can_be_used_to_build_content_for_iOS.3F
It seems, from what I've read, that you can't run FLASH apps in the browser on the iPad, but perhaps you can run AIR apps (FLASH) natively.


text:
Q: Why col-4 and col-8 are not in the same line without any CSS?
I have two columns, col-4 and col-8 inside col-12 and row. But the two columns are not in the same row. I am not able to understand why this is happening even when I am not writing any CSS just the bootstrap grid.

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">

Home

About

Portfolio

Contact

A: The additional parent container of 12 grid is not needed.
The div which is required to remove

Also, attached working demo with snippet

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet" />

Home

About

Portfolio

Contact

A: Every column needs a row parent in Bootstrap.

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet"/>

Home

About

Portfolio

Contact


text:
Q: ActiveXObject works in IE, but not in Firefox new ActiveXObject("Scripting.FileSystemObject") this activex works in ie but not in firefox anybodies know the equivalents to firefox, chrome, safari, opera, etc?

A: You can't. ActiveX is an IE-only thing. If you need cross-browser support, you're gonna have to re-think what you're trying to do...

A: ActiveXObject only works in IE, maybe you should try and explain what you want to achieve?
I'm guessing it has something to do with file handling, more specifically I'm guessing it has something to do with uploading, in that case you probably want to do it in flash.

A: I have a newer implementation of an ActiveX host for Firefox & Chrome. The project is hosted on Google Code - http://code.google.com/p/ff-activex-host/.
It provides some security measures such as site and CLSID/PROGID locking, so that you can make sure no one can exploit it for running any ActiveX out there.
It's directed at web developers, not end users, as the plugin needs to be compiled with the correct security settings before distribution.
EDIT: You still won't be able to use IE-compatible JS/HTML code to create ActiveX objects, you'll need to use a slightly different notation. Just a bit more secure.

A: I think this site will help you better to understand the ActiveX because this is Microsoft Technology.
Even now they say goodbye to ActiveX object in new Windows 10.
Edge don't support the ActiveX object. Only Internet Explorer supports an ActiveX object.
Please check out this link for more information.
ActiveX Controls


text:
Q: Content Security Policy: The page's settings blocked the loading of a resource at inline ("default-src") I understand there are many similar questions. However, I'm still new to MERN and I am looking for a simplified answer to this problem.
I'm following a tutorial on the MERN stack, the application is a simple expense calculator and all the functionality worked great until we moved on to adding Express and Mongoose. Here's the server.js file so you can see my mess:
const path = require('path');
const express = require('express');
const dotenv = require('dotenv');
const colors = require('colors');
const morgan = require('morgan');
const transactions = require('./routes/transactions');
const connectDB = require('./config/db');

dotenv.config({ path: './config/config.env' });

connectDB();

const app = express();

app.use(express.json());

if(process.env.NODE_ENV === 'development') {
    app.use(morgan('dev'));
}

app.use('api/v1/transactions', transactions);

if(process.env.NODE_ENV === 'production') {
    app.use(express.static('client/build'));

    app.get('*', (req, res) => res.sendFile(path.resolve(__dirname, 'client', 'build', 'index.html')));
}

const PORT = process.env.PORT || 5000;

app.listen(PORT, console.log(`Server running in ${process.env.NODE_ENV} mode on port ${PORT}`));

I'm importing everything correctly in package.json so there's probably no need to spam the chat with that. I'm connected to Mongodb, though I'm sure that doesn't make a difference. Anyways, when I use the command to start it, (npm run start), the server goes up on localhost:5000 and I immediately see Cannot GET / on the html page.
In the console on Firefox I get the error:
Content Security Policy: The page's settings blocked the loading of a resource at inline ("default-src"). injectGlobalHook.js:513:49

On Chrome it says:
... it violates the following Content Security Policy directive: "default-src 'none'". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback.

Also in my terminal it shows GET / 404 2.201 ms - 139, but only when I refresh the page. So I know that the error has to do with CSP, and it's in a file I shouldn't touch and haven't touched, but I don't know how to fix it. I've had the error before, but I think I just gave up on that project. An answer would be nice, but an explanation as to why I'm getting this error would be better. Thanks!

A: The CSP can be defined either in your index.html (front-end) or in the web server (back-end).
In case of front end, you should find something like:
<html>
    <head>
        <meta charset="utf-8"/>
        <meta http-equiv="X-UA-Compatible" content="IE=11"/>
        <meta http-equiv="Cache-Control" content="no-cache"/>
        <meta http-equiv="Content-Security-Policy" content="default-src 'self'; style-src 'self';"/>
        <title>
        </title>
    </head>

According to your error message, you need to replace
default-src 'none'

by
default-src 'self'

As for the back-end, apparently there is no CSP reference in your NodeJS code.

A: I highly suggest to secure your headers with helmet library (https://helmetjs.github.io/), but you need to be careful because by default helmet will block your page scripts e.g. AJAX requests, so when using defaults you will get error such as: Content Security Policy: The page's settings blocked the loading of a resource at inline ("default/src") or similar, to fix this I needed to write helmet options manually.
In my project I was using the following configuration:
app.use(
    helmet.contentSecurityPolicy({
      useDefaults: false,
      "block-all-mixed-content": true,
      "upgrade-insecure-requests": true,
      directives: {
        "default-src": [
            "'self'"
        ],
        "base-uri": "'self'",
        "font-src": [
            "'self'",
            "https:",
            "data:"
        ],
        "frame-ancestors": [
            "'self'"
        ],
        "img-src": [
            "'self'",
            "data:"
        ],
        "object-src": [
            "'none'"
        ],
        "script-src": [
            "'self'",
            "https://cdnjs.cloudflare.com"
        ],
        "script-src-attr": "'none'",
        "style-src": [
            "'self'",
            "https://cdnjs.cloudflare.com"
        ],
      },
    }),
    helmet.dnsPrefetchControl({
        allow: true
    }),
    helmet.frameguard({
        action: "deny"
    }),
    helmet.hidePoweredBy(),
    helmet.hsts({
        maxAge: 123456,
        includeSubDomains: false
    }),
    helmet.ieNoOpen(),
    helmet.noSniff(),
    helmet.referrerPolicy({
        policy: [ "origin", "unsafe-url" ]
    }),
    helmet.xssFilter()

I disabled default to write everything manually, since I might have external scripts, requests etc. so I needed to define them additionally.
This configuration will solve blocked resource errors like:

*

*Content Security Policy: The page's settings blocked the loading of a resource at inline ("default/src")

*Content Security Policy: The page's settings blocked the loading of a resource at inline ("img/src")

*Content Security Policy: The page's settings blocked the loading of a resource at inline ("script/src")


text:
Q: How to check the memory available in LruCache of android? I want to use memory cache(LruCache) instead of DiskLruCache for caching the images. I have some doubts regarding the image Caching in android.
How can i check the available memory size in Lrucache?
What does happen when the caching request crosses the Available memory in Lrucache?
Is the LruCache object retain in dalvik heap memory? or caching done is kept in heap memory?

A: Answer to first question:
    private LruCache<String, Bitmap> mMemoryCache;
    //...
    ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    int availMemInBytes = am.getMemoryClass() * 1024 * 1024;

Answer to the second:
The Least Recently Used object(s) will be removed from the list. One or more objects will be removed till there will be enough space to put the new object.
About the third question I think I'm late since Dalvik is not anymore used for Android > 4.4.2. Maybe this video can help to figure out what happens with the new ART
https://www.youtube.com/watch?list=PLOU2XLYxmsIJDPXCTt5TLDu67271PruEk&t=47&v=R5ON3iwx78M
I hope it will help.


text:
Q: Can't load text file when debugging locally I'm creating a web page which parses a text file and outputs "important" line numbers as hyperlinks that can be clicked by the user and then taken to that line number of the inputted text file. Naturally this means that by clicking the hyperlink the browser must navigate to the text file. The problem lies with that part. When the hyperlinks are clicked, nothing happens. No errors, just nothing.
Here's the relevant cshtml code:

    @results

    @for (int i = 0; i < ViewBag.links.Count; i++)
    {
        if (ViewBag.links[i].isHyperLink == true)
        {
            {@ViewBag.links[i].text} //HYPERLINKS PRINTED TO PAGE HERE
        }
        if (ViewBag.links[i].isHyperLink == false)
        {
            @ViewBag.links[i].text;
        }
    }

Here's the relevant C# code:
        MatchCollection mc = Regex.Matches(output, @", [0-9]+?\)"); //find matches in txt file
        List<TextandHyperlink> links = new List<TextandHyperlink>(); //create list of hyperlink objects
        TextandHyperlink tempLink = new TextandHyperlink(); //create

        int length;
        string temp = "";

        // Get line numbers
        for (int i = 0; i < mc.Count; i++)
        {
            if (i > 0)
                tempLink = new TextandHyperlink();

            length = mc[i].Value.Length;
            temp = mc[i].Value.Substring(2, length - 3);
            tempLink.text = temp;
            tempLink.url = relativePath; //ASSIGN PATH TO TXT FILE HERE
            tempLink.isHyperLink = true;
            links.Add(tempLink);
        }
        ViewBag.links = links;

I've verified that relativePath is the correct path to the text file on my pc. Just in case, here's an example of a path I'm using:
relativePath = C:\Users\USER\PROJECT\Website\Website\Home\UploadFiles~/App_Data/Uploads/bloop.txt
Thanks in advance for any help!
edit: Here is the generated html:
--------
Summary
--------
Version             23.00.00.00
Error               2   at lines    (09/02/2014-06:13:32.607, 5662); (09/02/2014-06:15:10.756, 7397)
Timeouts                0
Inits               1   at lines    (09/02/2014-06:12:59.900, 2)

A: If you know for sure that your path and filename are correct, then Permissions will be another issue.  On a Windows Server machine for example, you will have to ensure that the same 'user' running the exe / web page / operation (could be a local account, network service account, etc) has at least explicit read rights on that file.  Accessing files from web pages is deliberately difficult as there has to be security mechanisms in place, permissions is one of them.
(Mind you - in your error messages - your file path does look dodgey...The floating tilda is suspicious)


text:
Q: Selecting name of the excel sheet while loading an excel file with tablib I have an excel file to load with 4 sheets.
I want to load a specific sheet from.
How can I choose the name of the sheet?
This doesn't help. I can't choose a specific sheet.
imported_data= dataset.load(file.read( ), format= 'xlsx')

A: You can try the following:
for dataset in imported_data.sheets():
    print(dataset.title)  # returns the names of the sheets
    print(dataset)  # returns the data in each sheet

A: I suggest you to use tablib.Databook()
imported_data = tablib.Databook()
imported_data.xlsx = file.read()
for dataset in imported_data.sheets():
    if dataset.title == 'name of the sheet':
       #do anything


text:
Q: Manage utorrent webui with a desktop app Is there a desktop application that lets you connect to a utorrent server?
It would be nice to manage my torrents away from my browser. Also it would be nice to just open a .torrent file and make it upload the file to the server and start downloading.
I tried to do some google searches but all it displays is how to setup webui...
Thanks!

A: For the second part of your question- I use dropbox to add torrents to my torrent box. While this won't let you monitor when a torrent is done, its a fairly seamless way of having torrents downloaded on another box, and it works anywhere.

A: BTW the answer is uRemote


text:
Q: Blade templating '@extends' and '@section' not working I'm trying out this new way of programming (It's new to me) which is Blade templating in combination with Laravel 5, now I've got it working without @extends('layouts.master') and @section('content') but when I try to add them, it doesn't work.
My master.blade.php file located in views/layouts:
<!DOCTYPE html>

        <meta charset="utf-8">
        <title>Untitled</title>

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

        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">

              <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                Toggle navigation

              </button>
              Brand

Link (current)

Link

                  Dropdown

Action

Another action

Something else here

Separated link

One more separated link

              <form class="navbar-form navbar-left" role="search">

                  <input type="text" class="form-control" placeholder="Search">

                <button type="submit" class="btn btn-default">Submit</button>
              </form>

Link

                  Dropdown

Action

Another action

Something else here

Separated link

    @yield('content')

My index.blade.php located in views:
@extends('layouts.master');
@section('content');

    <canvas id="demo-canvas"></canvas>

Hello

What am I doing wrong here?

A: You have an error in your index.blade.php on line 1 and 2.
The semicolon ; isn't allowed in blade templating
Do this:
@extends('layouts.master')
@section('content')

    <canvas id="demo-canvas"></canvas>

Hello

And it should work just fine.
Hope this helps!

A: You should use @yield command in the master.blade.php not in the index.blade.php.
Try this in your master.blade.php after the end of nav tag:
<content>
    @yield('content')
</content>

And remove from index.blade.php the ; characters from 1st and 2nd lines.
You can read the docs about blade templating.

A: Removing the semicolon in '@section('content');' worked for me. The semicolon is not allowed in blade templating.


text:
Q: A word for a person who struggles to alway come off as deep and smart The word should carry a sense of "pretending", "struggling" to sound deep, in terms of thoughts, especially using fancy words and/or belittling the ideas of others. Can you think of that word or something close?
Update:
This is the context I'm using the word in:

The way he spoke was not of a preacher's. It was devoid of pre-arrangement, fancy words, redundancy, over-used citations, dogmatism and pretention.

A: Perhaps you're looking for pedant:

pedant n
  1. a person who makes an excessive or inappropriate display of learning.
  2. a person who overemphasizes rules or details, esp. in teaching.
  3. a person who adheres rigidly to book knowledge without regard to common sense.

In place of pretention there you could substitute pedantry.
TheFreeDictionary, Random House
Me, I've always tended to refer to such people as pompous asses.

A: If you're looking for an adjective, try "pretentious".
Edit:
The word "pretentious" generally has negative connotations: it is used to describe someone who is trying to seem more important, educated, or cultured than he/she actually is. See the FreeDictionary definition.
Also, regarding the additional context you provided:  the sentence in your update gives me pause.  First, "the way he spoke was not of a preacher's" is not grammatically correct.  "Preacher's" is possessive (presumably modifying "way"), but you're also using it as the object of the preposition "of" (which also modifies "way"), so you wouldn't do both.  You could try "the way he spoke was not that of a preacher", or, better,  "he did not speak in the manner of a preacher".
Second, the word "preacher" may give the wrong impression.  When I think of "preacher", I think of someone who conducts religious services and, in the context of speaking, delivers sermons.  In the U.S., these sorts of preachers are not generally seen as pretentious or prone to using overly-complicated words, at least not by most Americans.  In other words, the second sentence does not support the first.
Third, you used "pre-arrangement" and "citations".  Citations don't have anything to do with a manner of speaking; a citation is generally a written thing.  And I'm not sure what "pre-arrangement" means in this context.

A: Perhaps the word sciolist would be useful? It's very uncommon though, so few people would understand you.
The adjective pretentious may be somewhat close as well. I don't believe english has one single word that conveys that exact meaning, at least not one well known.

A: Self-aggrandizing might suit what you are looking for: The act or practice of enhancing or exaggerating one's own importance, power, or reputation
It is not specifically about intelligence, but it might be what you need.


text:
Q: RecyclerView ItemTouchHelper Action Drag Started I've got RecyclerView with attached ItemTouchHelper, which I construct with
class ItemTouchHelperCallback(
        private val adapter: ItemTouchHelperAdapter
) : ItemTouchHelper.Callback() {
    override fun isLongPressDragEnabled(): Boolean {
        return true
    }
    ...
}

I am going to call vibration on every drag event start. In exact drag start moment.
To do it, inside ViewHolder I set touch listener. Then I tried to call vibration for the first ACTION_MOVE event. Unfortunately, it happens faster than item drag is possible. I want vibration and possibility to move items happen at the same time. To give user accurate haptic feedback, that he is able to drag and move items from now on.
I expected ItemTouchHelper or ItemTouchHelper.Callback to expose appropriate API. It doesn't.  But I noticed that inside ItemTouchHelper there's mActionState with value ACTION_STATE_DRAG  at the expected moment (inside onLongPress() So those 2 classes should know when drag starts! It's a pity they don't share their knowledge publicly.
Also, I've noticed very similar topic about action drag ended but I couldn't find solution to action drag started there.

A: You need to add this method to your callback
  override fun onSelectedChanged(viewHolder: ViewHolder?, actionState: Int) {
      super.onSelectedChanged(viewHolder, actionState)

        if (actionState == ACTION_STATE_DRAG) {
            //  your code here
        }
  }

This works well for me

A: I found hacky solution in the end, which is part of ItemTouchHelper.Callback(). getMovementFlags is called in almost the same moment like change mActionState to ACTION_STATE_DRAG. Inside onLongPress() of ItemTouchHelper`.
Called twice, so watch out for that ;-)
Tested on compileSdkVersion = 28
I'd like to see better solution though.


text:
Q: xcode error: program received signal SIGABRT, very simple program tho I'm trying to write a program that counts the number of wings my friend eats, while at the same time counting the amount of time that has passed. Fairly simple and I made the program with no errors compiling, but it gives me an error when I go to run it. this is the relevant error (I think):

2011-11-16 15:41:31.157 WingChallenge[5530:f803] * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key minutes.'

and here is the relevant code:
- (IBAction)wingPlus:(id)sender {

    wings +=1;
     NSString *wingsTemp = [[NSString alloc] initWithFormat:@" %i !", wings];
    self.wingsEaten.text = wingsTemp;

}
- (IBAction)clear:(id)sender {

    wings = 0;
    NSString *wingsClear = [[NSString alloc] initWithFormat:@"Back to zero!"];
    self.wingsEaten.text=wingsClear;
}

-(void)countup {
   seconds +=1;
   if (seconds >= 60) {
       seconds=0;
        minutescount +=1;

 }
    minutes.text=[[NSString alloc] initWithFormat:@"%i", minutescount];
    secondslabel.text=[[NSString alloc] initWithFormat:@"%i", seconds];
}

- (IBAction)startTimer:(id)sender {

   seconds=0;

    [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(countup) userInfo:nil repeats:YES];
}

And from the header files:
- (IBAction)wingPlus:(id)sender;
@property (weak, nonatomic) IBOutlet UILabel *wingsEaten;
- (IBAction)clear:(id)sender;
@property (weak, nonatomic) IBOutlet UILabel *minutes;
@property (weak, nonatomic) IBOutlet UILabel *secondslabel;
- (IBAction)startTimer:(id)sender;


text:
Q: Fetch react app via ajax request and execute it I have created a small react app with https://create-react-app.dev/ from facebook, and built it, so is ready to production.
My react app is shown after the user is authenticated, so I'm not loading it directly. Instead, I fetch the app with an ajax request, and I set the response html into a container like this:
var appContainer = document.getElementById("app-container");
appContainer.outerHTML = request.responseText;
eval(document.getElementById("main-script").innerHTML);

The thing here is that I don't know hot to execute the main script that renders the page, I don't know how to locate if in my compiled app build with https://create-react-app.dev/. If I were able to identify the main script that is executed when the page is loaded, I could fetch it with document.getElementById("main-script") and execute its content with eval function, as if I were loading the page normally instead of fetching if with ajax.
The main body of my react app looks like this:
You need to enable JavaScript to run this app.