text:
Q: Password don't match angularJs I don't seem to understand why ng-show is failing to display this validation when the passwords don't match. What am I missing?
<form name="myForm">

      <input ng-required="true" name="username" ng-minlength="3" ng-maxlength="10" ng-model="model.user.username" type="text" class="form-control" id="user-name" placeholder="Username">

Please pick a username between 3 - 10 characters.

      <input ng-required="true" name="password" ng-minlength="4" ng-model="model.user.password" type="password" class="form-control" id="password" placeholder="Password">

Password should contain atleast 4 characters.

      <input ng-required="true" name="verifyPassword" ng-minlength="4" ng-model="model.user.verifyPassword" type="password" class="form-control" id="verify-password" placeholder="Verify Password">

Passwords don't match.

 <button ng-disabled="myForm.username.$invalid || myForm.password.$invalid || myForm.verifyPassword" ng-click="model.register(model.user)" class="btn btn-success btn-block">Register</button>

  </form>

Thanks!!
I've reffered the other solutions, none of the existing questions are similar to what I am doing.

A: myForm.verifyPassword.value casing is different in your statement myForm.verifypassword.value
I made up an example as I didn't have your code

var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {

  $scope.myForm = {
    password: '',
    verifyPassword: ''
  };

  $scope.submit = function() {
    console.log('success');
  };

});

  Password:
  <input type="password" ng-model="myForm.password">

Verify Password:
  <input type="password" ng-model="myForm.verifyPassword">

Passwords don't match

  <button>Submit</button>

A: The myForm object doesn't have the input values, you can see that with {{myForm}}. Use the value from ngModel instead:

Passwords don't match

Also notice that if your input is not valid, ngModel won't set the value: user.model.verifyPassword != '' is going to be always true, since you set ng-minlength=4.
Another tip: ng attributes make sense only if you evaluate a scope variable, ng-required="true" is the same as required="required".


text:
Q: Cell with 2 labels always is 'unable to simultaneously satisfy constraints' I have a cell with 2 simple labels, and I have been working the last 6 hours to get it working (had it working before that and decided to tinker with it and lost my working version). I always get a Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Warning. Here is the warning I get when I use the recommended constraints:
    Try this:
        (1) look at each constraint and try to figure out which you don't expect;
        (2) find the code that added the unwanted constraint or constraints and fix it.
(
    "<NSLayoutConstraint:0x7f8fe8737520 V:[UILabel:0x7f8fe873d5a0'Label'(26)]>",
    "<NSLayoutConstraint:0x7f8fe8738ea0 UILabel:0x7f8fe873d7a0'Label'.top == UITableViewCellContentView:0x7f8fe873cf00.topMargin>",
    "<NSLayoutConstraint:0x7f8fe8739000 UILabel:0x7f8fe873d5a0'Label'.bottom == UITableViewCellContentView:0x7f8fe873cf00.bottomMargin>",
    "<NSLayoutConstraint:0x7f8fe8739110 V:[UILabel:0x7f8fe873d7a0'Label']-(NSSpace(8))-[UILabel:0x7f8fe873d5a0'Label']>",
    "<NSLayoutConstraint:0x7f8fe8743ac0 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7f8fe873cf00(43.6667)]>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7f8fe8737520 V:[UILabel:0x7f8fe873d5a0'Label'(26)]>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.

Here is my prototype cell in the storyboard (it is custom if you didn't already figure that out by now):

The small label in the bottom right is 'Sayer' and the larger one is 'Body'.
Edit: As a side note I do not want to constrain the height of body as it is a label whose height varies depending on the amount of text in it.
Edit 2: The warning disappeared using the solution provided by @siburb . But a new problem persists as shown in the above screen show body is a large UILabel for which I have set the lines property equal to 0 as that is supposed to allow the label to vary its size based on the amount of text input. When I run the program though (in screen shot below) I can only see the sayer UILabel. The body label has text in it (I tested it) so that is not the issue.

And in my RecentTableViewController.h (the file for this table view) I have included the method:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return UITableViewAutomaticDimension;
}

Which was supposed to dynamically size the UILabel, I had it working before in this exact setup but my constraints got messed up and not it is not working.
Edit 3: Here is the picture of the working version after adding the suggested edits to my code in the Edit section of @siburb response.

A: You need to reduce the "priority" on one of the constraints.
Try reducing the priority of the bottom constraint of "body" to 900 - this will mean that the height constraint of "sayer" won't be broken.
Also, it might help to reduce the "Vertical Content Hugging Priority" of the "body" UILabel to 1 - this will mean the "body" UILabel won't be so keen to stick to the height of its "intrinsic content size" (the size dictated by the content of the label).
EDIT: To fix the second issue, you may need to increase the "Vertical Content Compression Resistance Priority" of the "body" UILabel. For example, increase it to 999.
You also don't need to have the heightForRowAtIndexPath: method. Just include something like the following in your viewDidLoad: method:

self.tableView.estimatedRowHeight = 100;
self.tableView.rowHeight = UITableViewAutomaticDimension;

redpajama_set_name: RedPajamaStackExchange


text:
Q: Apache- How to search for files before directories? I have php file named tennis.php on my apache web server. my .htaccess, with the contents:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
This successfully works, and allows me to go to 'mywebsite.com/tennis' and access tennis.php. Then, I added a directory in the same location as the tennis.php file, named tennis, and when I go to 'mywebsite.com/tennis' it shows up as a directory listing. I want it to prioritize the files over directories. Any ways to do so? Thanks!

A: Yes, stop disabling your rule if the request exists as a directory:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php


text:
Q: Is $\mathrm d(PV)$ the same with work received OR produced? When I write energy conservation in thermodynamics problems, I write the internal energy before, the pressure energy before (so these two are the enthalpy) and then I add/substract the work and heat done, and equal to the same quantities after. Is this correct? Or is work equal to the pressure energy difference? I am a bit confused. Let's say we add work to the system, then $$U_1+P_1V_1+W=U_2+P_2V_2$$ Is that correct? Now let's say work is done by the system, then $$U_1+P_1V_1=U_2+P_2V_2+W$$Is that correct? I am afraid I may calculate the work twice.
In other words, I see $\Delta(U)=Q-W$, is that complete? I think it doesn't take into account the pressure energy of the system. But I see it online as 2nd Thermodynamic Law! Instead I think $\Delta(U)+\Delta(PV)=Q-W$ is complete. Any ideas?

A: The equation $\Delta U = Q - W$ is complete in itself.
The confusion arises in the definition of enthalpy. We tend to think that the "pressure energy" $PV$ and the work done by the system $W$ are somehow different. But the fact is that there isn't a well defined physical meaning to the $PV$ term. It is confusing because when we add $U$ and $PV$, we think that the $PV$ part is somehow missing in the $U$ and so needs to be added. That is not actually the case. Actually, we add it to remove a term that is already present, which is the work done on the system.
How? Well we must understand first that enthalpy is a quantity that is meant to be measured at constant pressure. It was defined in a way, so that at constant pressure, it would be a state function, and also easy to measure, since most chemical reactions are carried out at constant pressure, i.e. the atmospheric pressure. We first define $H=U+PV$. Now, we differentiate it and get:
$$\mathrm dH = \mathrm dU + P\,\mathrm dV + V\,\mathrm dP$$
Now, at constant pressure, $\mathrm dP=0$. Integrating the remaining part, we get:
$$\Delta H = \Delta U + P \Delta V$$
Now, see that if we replace $\Delta U$ by $Q-W$, remembering that at constant pressure $W=P\Delta V$, we see that:
$$\Delta H = Q - P\Delta V + P\Delta V = Q$$
The above equation shows that adding the term $P\Delta V$ removes the work term from the internal energy change $\Delta U$, leaving the heat supplied term $Q$.
That cleared out of the way, now if you want to calculate the change in enthalpy, you will write:
$$H_2 - H_1 = U_2 - U_1 + PV_2 - PV_1$$
and thus we arrive at the correct equation:
$$-H_1 + U_1 + PV_1 = -H_2 + U_2 + PV_2$$
remembering that the pressure remains constant. Clearly there is no work term in the above equation.


text:
Q: NPM does not update readme I released a module yesterday and made changes to the  readme soon after. The readme has not updated since the first release. How do I force an update?
The module:
https://www.npmjs.com/package/create-react-app-fullstack

A: I was experiencing the same issue and the following steps worked for me.

*

*npm cache clean --force

*npm version patch

*npm publish


text:
Q: Can I manipulate event listener using hooks in react app? is it possible to enable/disable event listener based on useState hook ?
I created a Hook:
const [ifClicked, setIfClicked] = useState(true);

and a functions :
const handleIfClicked = () => {setIfClicked(!ifClicked)};

const extendTreatments = () =>{
dropdownFB ? setDropdownFB(false) : setDropdownFB(true);
  handleIfClicked();
}

I've got li element with event listeners and function above:
<li className="nav-item"
    onMouseEnter={onMouseEnterFB}
    onMouseLeave={onMouseLeaveFB}
    onClick={extendTreatments}

I've tried to enable/disable event listeners by manipulating hook "ifClicked".
The main goal is to once element got clicked don't use event listener  "onMouseLeave" (turn it off).

A: Instead of adding/removing event listener, consider not running your function at all, if "ifClicked" is false.


text:
Q: UITableView selection state goes away in editing mode I have a UITableView where I select multiple rows.
I want to be able to swipe and delete few of them.
As soon as I swipe a cell, All my selected rows become unselected.

A: This can not be obtained by using default cell behaviour..
Alternate way is
Whenever you select any cell add that rownumber in an array. reselecting it must remove that index from the array. Soon after select change the background of the cell such that it looks as selected.


text:
Q: What if I want to build GNU m4 from zero without bootstrap from another release copy of GNU m4? Recently I'm writing a paper associated with open sources and GNU. I need to do some testings to simulate how the pioneers of GNU develop the GNU build system from zero in the early period. But I found one strange thing in README with the statement:

If GNU 'm4' is meant to serve GNU 'autoconf', beware that 'm4' should be fully installed prior to configuring 'autoconf' itself.
Likewise, if you intend on hacking GNU 'm4' from git, the bootstrap process requires that you first install a released copy of GNU 'm4'.

If we follow up this logic, what about the first released copy of GNU m4? Can anybody have clue or hint? Thank you.

A:
If we follow up this logic, what about the first released copy of GNU m4?

Retrocomputing SE would be a better forum for questions about computing history. From a technical perspective, however, it is obvious that the first version of GNU m4 could not have depended on an Autoconf build system if Autoconf also depended on GNU m4, not even if they were part of the same package. In fact, GNU's m4 is not the first or only m4, and it did not always have an Autoconf-based build system.  For its part, Autoconf did not always depend specifically on GNU m4.
Bear in mind, too, that

*

*configure scripts similar to those produced by Autoconf were originally written by hand or generated by other tools, and other, less automated approaches predated that.

*an Autoconf configure script itself does not ordinarily depend on Autoconf or m4.  This is by design.  As long as you have a complete distribution of an Autotools-based project (which, by definition, includes a configure script) you do not need to be able to run Autoconf or m4 to build the project.

The Autoconf manual has a chapter on the tool's history that might interest you.


text:
Q: How much overhead would Mongoose add to the node-mongodb-native driver? How much overhead does Mongoose add to the node-mongodb-native driver? If I just wanted to have a couple structurally similar queries on several collections, would it make more sense to just write everything using the driver directly? For example, I would need to do something as follows (in the driver language, as copied from here):
db.collection('test', function(err, collection) {
  collection.find({'a':1}, function(err, cursor) {
    *do something*
  }
}

Where I would just replace 'test' and 'a' with variables to hold the actual collection and key that I'm looking for.
I feel like it makes sense in this case to just write everything using the driver directly. Would there be any reason to use Mongoose itself? Is the overhead so negligible that I'm being silly by considering using the driver directly?
Best, and thanks,Sami

A: Depends how large your app is going to be.  If you're only doing a few queries it's probably not worth adding Mongoose to the mix but once your app starts to grow Mongoose can help keep it more maintainable. Dev time is usually more valuable than processing time.
Unless your app is going to be serving a LOT of simultaneous requests you probably won't notice the difference in performance.

A: Another good thing about using Mongoose is that you clearly define your Models (including defaults, validation, etc) up-front in your application, which both provides a lot of intrinsic documentation for your application, and dramatically reduces the possibility of inconsistencies when you deal with a relatively unstructured data model.
Relational databases have a lot of features for defining data types, defaults, indexes, etc. and will throw errors if you (for example) try and use a column that doesn't exist.
Mongo removes a lot of that overhead but it creates more work ensuring that a consistent data model is documented and maintained in the implementation code; Mongoose makes it a lot easier.
It also has a lot of useful features to keep your models in check, including an option to use strict Schemas (on by default as of v3) which means any values you haven't already defined don't get written to the database, 'virtual fields', which for example could combine first name and last name into a string as if it were stored in the database (but it doesn't have to be), and index management. For more details see the guide.


text:
Q: javafx Imageview load an image but not others I'm using ImageView ( javafx ), I tried to load an image (jpg), it works, and when i try to load another it is not (I tried gif, png, also another jpg). I also tried to change the name of the image loaded before, and same, it doesn't load.
It just work with the first image, with same name.
I declared this :
    @FXML
    private ImageView imageView;

AND this is the code that worked:
    InputStream is = this.mainApp.getClass().getResourceAsStream("..\\resources\\images\\facture\\recuBank\\2015\\22-12-2015\\12080351_10206938666998884_3823913475123618229_o.jpg");
    if(is != null)
    {
        Image img = new Image(is);
        this.imageView.setImage(img);
    }

AND this doens't worked :
    // I renamed the first image
    InputStream is = this.mainApp.getClass().getResourceAsStream("..\\resources\\images\\facture\\recuBank\\2015\\22-12-2015\\a.jpg");
    if(is != null)
    {
        Image img = new Image(is);
        this.imageView.setImage(img);
    }

Hope someone can help

A: WOW I solved it just by doing a REFRESH in folder "resources", in my project (in Eclise).
I was adding the images directly in the folder, so in my project, Eclise is not aware that any change happened.


text:
Q: Select doesn't work on IQueryable but does on IList I have two lines of code, one is
AllItems().Where(c => c.Id== id)
          .Select(d => new Quality(d.QualityType)).ToList();

and the other one
AllItems().Where(c => c.Id== id).ToList()
          .Select(d => new Quality(d.QualityType)).ToList();

The only difference is on the second statement ToList() is called after the Where statement. The second statment works just fine.
On the first statement, the default parameterless constructor is hit instead of the constructor with the parameter. so the list is created but the objects in the list are initialized with default values rather than with the d.QualityType.
you can see the full source of the file in question at (Method: GetBestQualityInHistory)
https://github.com/kayone/NzbDrone/blob/master/NzbDrone.Core/Providers/HistoryProvider.cs
**Edit: After further investigation, this seems to be a SubSonic bug, if the Last ToList is replaced by an OrderBy subsonic throws an The construtor 'Void .ctor(NzbDrone.Core.Repository.Quality.QualityTypes, Boolean)' is not supported.

A: If SubSonic works in the same way as Entity framework you cannot use constructors with parameters - you must use parameterless constructors and initializers. My very high level explanation of this is that the query is not executed as is - it is translated to SQL and because of that you must use property initializers so that expression tree knows which properties in the projected type should be filled by values. When using constructor with parameters, expression tree doesn't know where the passed parameter belongs to (it doesn't check content of the constructor). The real constructor (parameterless) is called once you execute Tolist and result set is materialized into QuantityType instances.

A: This isn't really an answer, and I was going to make it a comment, but needed more room for code snippet.
Judging by the SubSonic code, I'm pretty sure that in some cases where you get the "constructor not supported" errors, SS is for some reason trying to parse your new ...() statement into SQL. The offending method is part of the SQL Formatter, and looks like it only handles DateTime:
    protected override NewExpression VisitNew(NewExpression nex)
    {
        if (nex.Constructor.DeclaringType == typeof(DateTime))
        {
            // ...omitted for brevity...
        }
        throw new NotSupportedException(string.Format("The construtor '{0}' is not supported", nex.Constructor));
    }

I think that would normally be hit if you did something like:
someData
        .Where(data => data.CreatedDate <= new DateTime(2011, 12, 01))
        .Select(data => data)
Then that newDateTime would be translated to SQL.
So however you change the Linq to get that exception, I think that is what is happening.
I assume this is because if you add an .OrderBy() after the .Select() then you are no longer calling the OrderBy on the IQueryable of whatever AllItems() returns, but instead trying to order by what is returned by the .Select(), which is the enumerable of new Quality obejcts, so SS probably tries to turn all that into SQL.
I'm wondering if it would work right if you reversed it?
AllItems().Where(c => c.Id== id)
      .OrderBy(d => d.QualityType)
      .Select(d => new Quality(d.QualityType));


text:
Q: Ubuntu 18.04 BCM43142A0 bluetooth problem I have a problem with Bluetooth on my Laptop. It seems to get stuck on searching for devices.
I looked through AskUbuntu already and found a few great, detailed solutions, but I don't know what firmware I need. Here are the outputs of commands I found online:
dmesg | grep -i bluetooth

[   20.793040] Bluetooth: Core ver 2.22
[   20.793074] Bluetooth: HCI device and connection manager initialized
[   20.793081] Bluetooth: HCI socket layer initialized
[   20.793085] Bluetooth: L2CAP socket layer initialized
[   20.793095] Bluetooth: SCO socket layer initialized
[   21.153861] Bluetooth: hci0: BCM: chip id 70
[   21.154856] Bluetooth: hci0: BCM: features 0x06
[   21.170837] Bluetooth: hci0: BCM43142A
[   21.170844] Bluetooth: hci0: BCM (001.001.011) build 0000
[   21.449876] bluetooth hci0: Direct firmware load for brcm/BCM.hcd failed with error -2
[   21.449883] Bluetooth: hci0: BCM: Patch brcm/BCM.hcd not found
[   24.056776] Bluetooth: hci0: command 0x1003 tx timeout
[   24.058451] Bluetooth: hci0: unexpected event for opcode 0x1003
[ 5417.077645] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 5417.077649] Bluetooth: BNEP filters: protocol multicast
[ 5417.077657] Bluetooth: BNEP socket layer initialized
[ 5513.623521] Bluetooth: RFCOMM TTY layer initialized
[ 5513.623532] Bluetooth: RFCOMM socket layer initialized
[ 5513.623543] Bluetooth: RFCOMM ver 1.11
[ 5538.321869] Bluetooth: hci0: command 0x1003 tx timeout
[ 5538.323516] Bluetooth: hci0: unexpected event for opcode 0x1003
[ 5734.376654] Bluetooth: hci0: urb 0000000094ad7f77 failed to resubmit (2)
[ 5739.698606] Bluetooth: hci0: BCM: chip id 70
[ 5739.699750] Bluetooth: hci0: BCM: features 0x06
[ 5739.715784] Bluetooth: hci0: patryk-Lenovo-G50-45
[ 5739.715798] Bluetooth: hci0: BCM (001.001.011) build 0000
[ 5739.715927] bluetooth hci0: Direct firmware load for brcm/BCM.hcd failed with error -2
[ 5739.715934] Bluetooth: hci0: BCM: Patch brcm/BCM.hcd not found

lsusb

Bus 002 Device 004: ID 105b:e065 Foxconn International, Inc. BCM43142A0 Bluetooth module
Bus 002 Device 003: ID 5986:0652 Acer, Inc
Bus 002 Device 002: ID 0438:7900 Advanced Micro Devices, Inc.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 046d:c534 Logitech, Inc. Unifying Receiver
Bus 001 Device 003: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller
Bus 001 Device 002: ID 0438:7900 Advanced Micro Devices, Inc.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

As you can see it tries to load BCM.hcd firmware and while I found this repository on Github: https://github.com/winterheart/broadcom-bt-firmware I don't know which firmware I should use.


text:
Q: Is there an item that increases the rate at which you find shiny Pokémon? I remember back in Pokémon Black that when you beat the game and had a certain amount of Pokémon in your Pokédex, Professor Juniper would give the Shiny Charm. Is there an item like that in Pokémon Sun and Moon?

A: Yep! There's a Shiny Charm in Pokémon Sun and Moon. This article describes how to obtain it:

It is important that you need to complete the Alolan Pokedex before you can acquire the Shiny Charm. The move would have you capture 300 Pokemon and register them before you speak to the director in HeaHea City on Akala Island to get your Shiny Charm.

This article goes more in depth about where exactly he is located:

He's located in a building to the left of the Dimensional Research Lab up on the second floor and wearing a gray shirt with orange shorts. If this is the first time you're speaking to him, you'll have to initiate conversations with him several times in a row until he stamps every page of your passport. Eventually, he'll give you one final stamp for completing the entire Alola Pokédex. As a reward, he'll also give you the Shiny Charm.


text:
Q: Offline OpenLayers web app using offline OSM I'm trying to create map based web app which user can set landmark on the provided map. Boundaries of map is limited to a small city, and the client computer is always offline, no internet access at all. After a whole day of googling I've found that combination of OpenLayers and OpenStreetMap is a good choice.
The following example is provided by OpenLayers website:
<!doctype html>

    <link rel="stylesheet" href="http://openlayers.org/en/v3.0.0/css/ol.css" type="text/css">

    <title>OpenLayers 3 example</title>

My Map

This works fine, but needs an internet connected computer.
After couple of hours of googling, I found another website that provides offline OpenStreetMap data with .osm format.
Now I don't know is it possible to feed the OpenLayers with these .osm files or not, something like a local map server? the client computer is running IIS 8

A: For displaying a map offline with OpenLayers (or Leaflet) you will need raster tiles. A .osm file cannot get displayed directly because it contains raw vector data and has to be rendered first.
For generating tiles take a look at Maperitive or TileMill. Then import a country or area extract. Alternatively you could set up your own rendering server which requires a little more work.


text:
Q: iOS: Need advice on using keychain, NSUserDefaults/iCloud for auto-login and account creation I'm trying to remove the burden of users having to manually create usernames/passwords in order to login to a web service, so instead I automate the creation of usernames and password upon initial startup of the app.
So I'm using the SSKeychain to store passwords in the keychain
[SSKeychain setPassword: myPassword forService: @"com.xxx.xxx" account: username];

and generate UUID (for both username and password) using:
+(NSString *) GetUUID {
    CFUUIDRef theUUID = CFUUIDCreate(NULL);
    CFStringRef string = CFUUIDCreateString(NULL, theUUID);
    CFRelease(theUUID);
    return [(NSString *)string autorelease];
}

I want a single user to have access to these credentials across all their devices, so I'm thinking of using NSUserDefaults and iCloud to store the username so that when the user installs a fresh copy of the app on a new device, their username can be retrieved from iCloud and they can gain access to their credentials using the keychain, which will grant access to the web service.
Ideally I want the following functionality

*

*Upon first login the application automatically generates a username/password

*The user won't ever have to type in credentials, but simply get past the automatic account creation part of the app.

*After installing/re-installing the app across any device they'll have access to their credentials in the keychain using the "username" stored on NSUserDefaults/iCloud

So my problem is:

*

*Would storing the username on NSUserDefaults allow another user to alter the NSUserDefaults plist on their phone to access someone else's account? (From my understanding it's a yes)

*Is there another way to store the username so that another user can't alter the plist and auto-login into someone else's account?

*I'm a little confused with the concept of the keychain, so from my understanding the Keychain is shared across the entire app (so like a central database of encrypted data for all users worldwide(?)), so technically if another user has access to your credentials (i.e. they know your username and replace their own username on NSUserDefault with yours) they can use this to gain access to your data. Is this correct? (I thought that the keychain was similar to Mac, where it's a unique secured storage to each user).

I usually understand concepts quite well but the keychain got me a bit confused. I've read Apple's keychain concepts explanation but I can't comprehend the concept of whether it's a central repository of encrypted data accessed by all users or if each user has their own keychain storage and no one can access someone else's keychain storage, even if they had their username/password.


text:
Q: How can I set and retain attributes on characters in a Python 2 string? I would like to be able to add attributes to characters within a str or unicode string, chop the string and move pieces around, and have the attributes still be present at the end.
Would this be possible (and best) with a subclass of str, unicode or possibly basestring?
Example:
s = u"hello world"
s[6].foo = u'bar'
s2 = s.split(' ')
assert(s2 == u'world')
assert(s2[0].foo == u'bar')

Thanks for thoughts!

A: You can try using that as a starter:
class Mine(unicode):
    #
    def __init__(self, *args, **kwargs):
        super(Mine, self).__init__(*args, **kwargs)
    #
    def __setattr__(self, attr, value):
        try:
            super(Mine, self).__setattr__(attr, value)
        except AttributeError:
            self.__dict__[attr] = value
    #
    def __getattr__(self, attr):
        try:
            super(Mine, self).__getattr__(attr)
        except AttributeError:
            try:
                return self.__dict__[attr]
            except KeyError:
                raise AttributeError

    def __getitem__(self, item):
        obj = Mine(super(Mine, self).__getitem__(item))
        obj.__dict__ = self.__dict__
        return obj

Of course, you'll have to create a specific split method, where each item of the output list will be a Mine object:
def split(self, arg=' '):
    result = []
    for item in super(Mine, self).split(arg):
        i = Mine(item)
        i.__dict__ = self.__dict__
        result.append(i)
    return result

The generic idea is to overload every single method of the parent class (at least, the ones you're really interested in) so that it returns an instance of your class and inherits the __dict__ of the caller... That can be a lot of work.

A: str or unicode are built-in types, so you cannot set on them attributes without subclassing them anyway.
class CustomString(str): pass

obj = CustomString('a')
obj.attr = 1 #works
''.attr = 1 #AttributeError

That is for custom attributes on str.
However, this still doesn't help, because you still cannot change the string, as str and unicode are immutable.
The only option you get is to use bytearrays, which are mutable byte arrays. You'll have to encode unicode manually, though. (and you still have to subclass it to assign attributes!)


text:
Q: Can I pass in a dynamic price into my typeform? I'm trying to pass in a price into my typeform, and trying to implement a short of a payment flow with Stripe integration. The samples I have seen for this all involve static, hard-coded pricing coming from the Typeform itself; I would like to pass in the price as a hiddenfield parameter and have that be the item that is charged.
However, I am having a lot of trouble seeing examples of how to implement this. Does anyone have any guidance?
I know how to pass in parameters into the form - but how to implement the dynamic pricing based on those parameters seems to be... not possible?
Would love any input. TIA.

A: Typeform supports natively Stripe payments in their form. It lets you accept payments via credit card easily.
Unfortunately, if you want your price to be dynamic, you can't pass directly it as a parameter of the typeform (called Hidden field).
If your price depends on a calculation, like the number of items, you can use the calculator feature (help center article).
And ask those questions to determine the price to pay.
Here is a simple form to order pizzas at different prices depending on the type.
Here is how it was made on Typeform:
first: Setup a different price per pizza type

second: Update the total price depending on the number entered

Hope it makes sense :)


text:
Q: In rails 2.3, how can I retrieve a collection of objects from a second-order has_many association? I have a Partner model that has_and_belongs_to_many Projects, while each Project has_many Sites.  I want to retrieve all sites for a given partner (and am not interested in the projects in between at the moment).
I have accomplished what I need through a named_scope on the Site model, and a project.sites instance method that wraps a call to the Site named scope, as follows:
class Partner < ActiveRecord::Base

  has_and_belongs_to_many :projects

  def sites
    Site.for_partner_id(self.id)
  end

end

class Project < ActiveRecord::Base

  has_many :sites

end

class Site < ActiveRecord::Base

  belongs_to :project

  named_scope :for_partner_id, lambda {|partner_id|
    { :include=>{:project=>:partners},
      :conditions=>"partners.id = #{partner_id}"
    }
  }

end
Now, given a partner instance, I can call partner.sites and get back a collection of all sites associated with the partner.  This is precisely the behavior I want, but I'm wondering if there's another way to do this using only activerecord associations, without the named scope?

A: I had a similar deep nesting query/collection problem here (I had to threaten to repeat data before anyone would answer my 4 questions, clever):
Is it appropriate to repeat data in models to satisfy using law of demeter in collections?
The trick is this gem http://rubygems.org/gems/nested_has_many_through which can do something like this:
class Author < User
  has_many :posts
  has_many :categories, :through => :posts, :uniq => true
  has_many :similar_posts, :through => :categories, :source => :posts
  has_many :similar_authors, :through => :similar_posts, :source => :author, :uniq => true
  has_many :posts_of_similar_authors, :through => :similar_authors, :source => :posts, :uniq => true
  has_many :commenters, :through => :posts, :uniq => true
end

class Post < ActiveRecord::Base
  belongs_to :author
  belongs_to :category
  has_many :comments
  has_many :commenters, :through => :comments, :source => :user, :uniq => true
end

This has super-simplified my queries and collections.  I hope you find an answer to your problem, it's a tough one!


text:
Q: Html coding-Visual composer stm testemonials I need some help in html coding.
I am the owner of this site http://www.reussirlegmat.com/
In my home page, there is a section in the bottom of the page under the name of "Temoingnages". The section shows 2 testimonials in one row, and 2 arrows who help the visitor see the other testimonials.
I was to have 4 shown testimonials instead of 2, divided in two rows. which means 2 testimonials per row  plus the arrows to scroll to the other testimonials.
I have to clue how to do that. I am using visual composer and the testimonials section is added by an stm file. I can use ftp to access my html code.
Can you please help me to adjust the needed code and get what I want?


text:
Q: Why is Linux rebooting everyday at the same time? I have a weather station that sends data to a Raspberry PI, in which runs a linux server that takes that data and stores it. Everythings works fine except for one little thing. Raspberry is connected to the weather station indoor display, via usb cable.
The display is set to reproduce sounds whenever it powers up. So basically, every night at 3 am I am woken up by this sound.
I then connected via ssh to the Raspberry and entered this command to access log, to see what was happening at that time:
nano /var/log/syslog

And i found this line:
Jul 21 02:53:01 weatherstation CRON[25991]: (root) CMD (sudo reboot)

This repeats every day at the same time.
So, apparently I have something in crontab that keeps rebooting my raspberry. Obviously it's ok if the device reboot to just chill for a moment, but it's not ok to do it at 3am lol.
I then opened:
nano /etc/crontab

And I found these 4 lines:
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

So there is no clear sudo reboot, but I suspect that something inside /etc/cron.daily is executing that instruction. So I opened the folder cron.daily and inside I found these files:
apache2  apt-compat  aptitude  bsdmainutils  cracklib-runtime  dpkg  exim4-base  logrotate  man-db  passwd

The only file that seemed interesting for me was apt-compat. In there I found this:
# run daily job
exec /usr/lib/apt/apt.systemd.daily

The problem is, this file is too complicated for me. I don't know the programming language used inside it, and I don't know what is technically doing. So I want just to shift the reboot time from 3am to like 10am, but I can't understand how.
Thanks you all for your attention.

A: From the log message, we see it's run via cron (and not e.g. a systemd timer), and the command is exactly sudo reboot.
Most system-provided cron jobs would be in files within /etc/cron.d/, so that's a place to look.
Also there can be stuff in the root user's personal crontab too. The per-user crontabs should be viewed and edited with crontab -l and crontab -e, but they usually reside in /var/spool/cron/crontabs/ or some such directory. (That's the path on Debian, it might differ on other systems.)
Usually, you wouldn't see system-provided stuff there, though.
Then there's /etc/cron.daily and similar directories, the files there are just executable files (usually shell scripts), which some tool runs daily/weekly/monthly. Though these might give a different sort of log entry, since they don't run directly from cron.
In a pinch, you could always fall back to grep -re "sudo reboot" /etc/ /var/ and so.
Related: Differences between `/etc/crontab`, files under `/etc/cron.d/` and `/var/spool/cron/crontabs/root`? and I think I'll just link this here too: How can I see all cron records in CentOs7


text:
Q: menu :hover on IPAD I'm using the same menu design for iPad landscape that I'm using for Desktop, after that it turns to a mobile menu that has a link 'Menu' handle that toggles the menu open.
My problem is that when using an iPad I click on About and it shows the sub menu for a split second then goes off to the page, I need to make the sub menu show until the the user chooses a link with a double tap or something.
I'm using the following CSS to display the children when hovered:
#nav li:hover > ul {display:block;}


text:
Q: as_labeller with an expression in ggplot2 and facet_wrap There is an example provided here, but I just can't make it work. Here is my use case:
df <- as.data.frame(matrix(runif(9),8,8))
angles <- c(0.112, 2.633, 3.766, 5.687, 0.867, 7.978, 8.937, 4.652)
df$factor <- as.factor(angles)
df.m <- melt(df)
ggplot(df.m, aes(variable, value)) +
  geom_boxplot() +
  facet_wrap(~factor)

Now I want to display rounded angles with the degree symbol. So I tried this
new.labs <- as_labeller(paste(round(as.numeric(angles)), "degree"), label_parsed)
ggplot(df.m, aes(variable, value)) +
  geom_boxplot() +
  facet_wrap(~factor, labeller=new.labs)

But it produces empty strings.

A: I believe as.labeller is expecting either a function or a look-up table, not a variable name.
new.labs <- as_labeller(function(string) paste(round(as.numeric(string)), "*degree"), label_parsed)

ggplot(df.m, aes(variable, value)) +
    geom_boxplot() +
    facet_wrap(~factor, labeller = new.labs)

A: Not using as.labeller, but this is simpler:
df <- as.data.frame(matrix(runif(9),8,8))
angles <- c(0.112, 2.633, 3.766, 5.687, 0.867, 7.978, 8.937, 4.652)
df$factor <- as.factor(round(angles))
df.m <- melt(df)

ggplot(df.m, aes(variable, value)) +
    geom_boxplot() +
    facet_wrap(~factor, labeller = label_bquote(.(as.character(factor))*degree))


text:
Q: Using SDL2 on linux with g++?    #include "SDL2/SDL.h"

   int main(int argc, char* args[])
   {
       SDL_Init(SDL_INIT_EVERYTHING);

       SDL_QUIT();
       return 0;
  }

I have installed SDL2 through the debian repositories, and I am running
g++ -o test.cpp a.out -lSDL2

I get a whole lot of errors:
a.out:(.rodata+0x0): multiple definition of `_IO_stdin_used'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o:(.rodata.cst4+0x0): first defined here
a.out: In function `data_start':
(.data+0x8): multiple definition of `__dso_handle'
/usr/lib/gcc/x86_64-linux-gnu/4.7/crtbegin.o:(.data+0x0): first defined here
a.out: In function `_fini':
(.fini+0x0): multiple definition of `_fini'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crti.o:(.fini+0x0): first defined here
a.out: In function `_start':
(.text+0x0): multiple definition of `_start'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o:(.text+0x0): first defined here
a.out: In function `_init':
(.init+0x0): multiple definition of `_init'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crti.o:(.init+0x0): first defined here
a.out: In function `data_start':
(.data+0x0): multiple definition of `__data_start'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o:(.data+0x0): first defined here
/usr/lib/gcc/x86_64-linux-gnu/4.7/crtend.o:(.tm_clone_table+0x0): multiple definition of `__TMC_END__'
a.out:(.data+0x10): first defined here
/usr/bin/ld: error in a.out(.eh_frame); no .eh_frame_hdr table will be created.
collect2: error: ld returned 1 exit status

I have tried
g++ test.cpp $(pkg-config --cflags --libs sdl2)

and get:
test.cpp: In function 'int main(int, char**)':
test.cpp:6:14: error: '(SDL_EventType)256u' cannot be used as a function

I have no idea what is causing these errors.
The proper header files are present in the
/usr/include/SDL2/
directory. Am I doing something wrong?

A: // Bad:g++ -o test.cpp a.out -lSDL2
// Good: g++ test.cpp -lSDL2 (a.out implicit)
// Better: g++ test.cpp -g -pedantic -o test -lSDL2
I suspect the main problem might simply have been putting the g++ arguments in the wrong order.

A: The header must be: <SDL2/SDL.h>
The quit function:  SDL_Quit();
The command:        g++ teste.cpp -o filename -lSDL2

A: like Tietbohl said
SDL_QUIT is part of the enum  SDL_EventType
http://wiki.libsdl.org/SDL_EventType
you should use SDL_Quit();
http://wiki.libsdl.org/SDL_Quit


text:
Q: jquery accessing all elements who have id attribute I want to get all elements from a div who have id attribute, means i want to do something like:
$("div").find("*[id]").each(function() { alert(this.id) });

but this is not working , can anybody help me pls?

A: Your code works just fine, but you can remove the * from the selector.
Other valid options:
$("div").find("[id]").each(function() { alert(this.id) });

LIVE DEMO
Or this:
$("div *").filter("[id]").each(function() { alert(this.id) });

Live DEMO
Or this:
$("div [id]").each(function() { alert(this.id) }); // which I think is the best

Live DEMO


text:
Q: java ArrayList retrieving highest value Executing this code should outcome number 6 since i am only retrieving two values from Data.snapshot [3,6]. but i keep getting both of them in this form : [3,6].
Is there something i am doing wrong or my understanding of the extracted snapshot and the HashMap is not correct, and how could i get the highest value ?
     public void ratingCount(){
    Firebase ref = new Firebase("https://CLOUD_NAME.firebaseio.com/rating/"+UserID);
    ref.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot snapshot) {
            Map<String, String> ratings = (HashMap<String,String>) snapshot.getValue();
            Collection<String> BulkValues = ratings.values();
            ArrayList <String> values = new ArrayList<>();
            values.add(BulkValues.toString());
            Comparator<String> compare = new Comparator<String>() {
                @Override
                public int compare(String lhs, String rhs) {
                    return Integer.valueOf(lhs).compareTo(Integer.valueOf(rhs));
                }
            };
                textViewRatingValue.setText(Collections.max(values, compare));
        }
        @Override
        public void onCancelled(FirebaseError firebaseError) {

        }
    });
}

Applying Erans suggestion, the code is ;
             public void onDataChange(DataSnapshot snapshot) {
            Map<String, String> ratings = (HashMap<String,String>) snapshot.getValue();
            Collection<String> BulkValues = ratings.values();
            ArrayList <String> values = new ArrayList<>(BulkValues);
            Comparator<String> compare = new Comparator<String>() {
                @Override
                public int compare(String lhs, String rhs) {
                    return Integer.valueOf(lhs).compareTo(Integer.valueOf(rhs));
                }
            };
                textViewRatingValue.setText(Collections.max(values, compare));
}

and the Error :
 04-06 13:07:37.353 31832-31832/net.we4x4.we4x4 E/AndroidRuntime: FATAL EXCEPTION: main
                                                             Process: net.we4x4.we4x4, PID: 31832
                                                             java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String
                                                                 at net.we4x4.we4x4.MyInformation$7$1.compare(MyInformation.java:259)
                                                                 at java.util.Collections.max(Collections.java:1629)
                                                                 at net.we4x4.we4x4.MyInformation$7.onDataChange

Is it because it is still being treated as one single String [3,6] and cant be compared ? or because i am passing it to textView " textViewRatingValue " in a wrong way ?
Well, Thanks to Eran precise explanation, the retrieved data is "Long" thus it must be indicated as so, that was the second mistake i was doing, and doing so getting the max is simpler as following;
                Map<Long, Long> map = (HashMap<Long, Long>) snapshot.getValue();
            Map<Long, Long> ratings = map;
            Collection<Long> BulkValues = ratings.values();
            ArrayList<Long> values = new ArrayList<>();
            values.addAll(BulkValues);

            Long max = Collections.max(values);
            textViewRatingValue.setText(max.toString());
        }

A: You are adding a single element to values, which is the String representation of that Collection (the String "[3,6]" in your case) :
values.add(BulkValues.toString());

If you want to add all the elements, use :
values.addAll(BulkValues);

or just declare values as :
ArrayList <String> values = new ArrayList<>(BulkValues);

A: Here you are adding total array as a string (values.add(BulkValues.toString())). instead of that you need to  use addAll like this values.addAll(BulkValues);
See below example.
Map<String, String> map=new HashMap<>();
            map.put("one", "1");
            map.put("six", "6");
            map.put("three", "3");
            map.put("nine", "9");
            map.put("seven", "7");
             Map<String, String> ratings =map;
             Collection<String> BulkValues = ratings.values();
             ArrayList <String> values = new ArrayList<>();
             values.addAll(BulkValues);

             Comparator<String> compare = new Comparator<String>() {
                 @Override
                 public int compare(String lhs, String rhs) {
                     return Integer.valueOf(lhs).compareTo(Integer.valueOf(rhs));
                 }
             };

             System.out.println(Collections.max(values, compare));
            }

output:
9

Hope it will help you.


text:
Q: Finding files starting with variable given by users         System.IO.FileInfo[] fileNames = dir.GetFiles("*check*.*");

This returns me any files with name check. But what i want is return those file starting with string given by users.
Example
string word = Console.Readkey();
System.IO.FileInfo[] fileNames = dir.GetFiles("*word*.*");

I tried this
System.IO.FileInfo[] fileNames = dir.GetFiles("*"+word+"*".*");

But this didnt work

A: First of all, Console.ReadKey() reads a key which I think you don't intend it to do, so change it to Console.ReadLine().
That being said, if you want to use the variable word, you don't put within the string. Put it outside and either concatenate with the rest of the pattern or use String.Format().
So use this code:
string word = Console.ReadLine();
System.IO.FileInfo[] fileNames = dir.GetFiles(String.Format("{0}*.*", word));

A: You need to use this
public static string[] GetFiles(
    string path,
    string searchPattern
)

method from Directory class. The version with one string parameter accepts the path.

A: System.IO.FileInfo[] fileNames = dir.GetFiles(string.Format("{0}*.*", word));


text:
Q: FORM POST not passing input values I have a simple form that passes to an ASPX page to watch a video. The ASPX page uses a hidden field from the form to load the correct video.
This works for me, but a couple other people are the error message because it appears the value isn't being passed. I'm assuming it's a setting in IE... Anyone seen this or know how to fix? OR a better idea?
Simple form on "yourdomain.org"

<form action="http://www.mydomain.org/WatchVideo/Default.aspx" method="post" enctype="multipart/form-data">
    <input type="hidden" name="hidden" value="movie.flv" />
    <input type="submit" name="submit" value="Watch Video" />
</form>

The ASPX page on "mydomain.org"

    If Request.Form("hidden") IsNot Nothing Then
        lit.Text = Request.Form("hidden")
    Else
        Response.Write("Not Authorized. Video Not Passed.")
    End If

Sounds and loooks pretty straight forward. Not sure why the same version of IE would have different results. Any other thoughts on how to do this? I need to keep the "off site" coding simple and in HTML for non-technical folks.
Thanks.

A: It appears to be a setting inside of the browser. I couldn't narrow it down to a specific setting, but once we changed the "Internet" zone to medium from medium-high it began working. It has something to do with posting form data across domains.


text:
Q: Infinite groups such that $G/G'$ has odd order. Can someone give examples of an infinite group $G$ such that $G/G'$ has odd order.

A: Take the direct product of an infinite simple group (or infinite direct product of finite simple groups) with a cyclic group of order $p$ , an odd prime.

A: Free products
A different style of answer would be to take the free product $G$ of two groups $H$ and $K$ of odd order, so $G=H\ast K$. Then the abelianisation $G/G^{\prime}$ is $H\times K$ which has odd order. For example, take $H$ to be cyclic of order $3$ and $K$ to be cyclic of order $5$.
$$G=C_3\ast C_5\cong\langle a, b; a^3, b^5\rangle$$
Then $G$ has the following abelinisation.
$$\langle a, b; a^3, b^5, [a, b]\rangle$$
This is $C_3\times C_5$, which is cyclic of order $15$.
It is not clear that the group $G$ in my example above is actually an infinite group, unless you know something about free products. To see that it is infinite, you can investigate its action on the tree where vertices have degree $3$ or $5$, and no two adjacent vertices have the same degree. For more details on this idea, see this post of mine, from the $5^{th}$ paragraph from the top (I link to this not just because of the example, but because hopefully the rest of the post will convince you that this viewpoint is useful). For more general details on "free products", look up the books of Magnus, Karrass and Solitar and of Lyndon and Schupp; both books are entitled Combinatorial group theory, and are the classic texts in combinatorial group theory.
A torsion-free example
It would be nice if we could make $G$ torsion-free, as then be aren't simply piggy-backing on a finite group. The following group works (it is "borrowed" from something called Rips' construction). However, I am sure that a more elementary construction exists!
$$
\begin{align*}
G=\langle
a, b, x;\\
x^3&=abab^2ab^3ab^4\cdots ab^i\\
xax^{-1}&=ab^{i+1}ab^{i+2}ab^{i+3}ab^{i+4}\cdots ab^{j}\\
x^{-1}ax&=ab^{j+1}ab^{j+2}ab^{j+3}ab^{j+4}\cdots ab^{k}\\
xax^{-1}&=ab^{k+1}ab^{k+2}ab^{k+3}ab^{k+4}\cdots ab^{l}\\
x^{-1}ax&=ab^{l+1}ab^{l+2}ab^{l+3}ab^{l+4}\cdots ab^{m}
\rangle
\end{align*}$$
Take $i, j, k, l$ to be sufficiently large, with each one being at least $n$ orders of magnitude greater than the previous (for some $n>>1$). That the group $G$ is either infinite or torsion-free is not obvious. It relies on something called small cancellation theory. The best reference for this is the book combinatorial group theory by Lyndon and Schupp. The relevant facts are that small cancellation groups are always infinite, and that a small cancellation group contains torsion if and only if a relator is a proper power (and that is not the case here).
To see that the group $G$ has odd-order abelianisation, notice that if we kill the generators $a$ and $b$ we are left with a finite cyclic group. So that is the plan: kill $a$ and $b$. We will assume that the following hold (these assumptions do not affect the infinite-ness nor the torsion-free-ness of the group).

*

*$k-j=jp$.

*$m-l=(l-k)q$.

*$s_k=\sum_{t=1}^{k-j} j+t$ and $s_m=\sum_{t=1}^{m-l} l+t$ are coprime.

*$j$ and $l-k$ are coprime.
Now, the last four relations give four relators in the abelianisation of the form $a^rb^s$, where $r$ is one of $j$, $k-j$, $l-k$, $m-l$. As $k-j=jm$ with $j$ even, we see that $b$ has order dividing $s_k$ in the abelianisation (by combining $a^jb^{s_j}$ with $a^{k-j}b^{s_k}$). Similarly, the relators $a^{l-k}b^{s_l}$ and $a^{m-l}b^{s_m}$ combine to imply that $b$ has order dividing $s_m$. As $s_k$ and $s_m$ are coprime, $b$ is trivial in the abelianisation. Thus, $a$ has order equal to $\gcd(j, k-j, l-k, m-l)$ in the abelianisation. As $j$ and $l-k$ are coprime, $a$ is trivial in the abelianisation. Hence, the abelianisation of the group $G$ is cyclic of odd order, as required.


text:
Q: Reading Triangle Data Mesh With Object Files I need to load in the vertices of a .obj file in c++. I just copied over the verts from the object I downloaded so I didn't have to worry about texture mapping or anything. I was able to separate it into a single line and get rid of the v but am not able to isolate the x,y,z coordinates so I can assign it to three separate variables.
main.cpp

// ConsoleApplication3.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <memory>
#include <fstream>
#include <string>

using namespace std;

string pos1, pos2, pos3;

int main()
{
    string line;
    ifstream myfile("fox.txt");
    if (myfile.is_open())
    {
        while (getline(myfile, line))
        {

            line.erase(std::remove(line.begin(), line.end(), 'v'), line.end());
            cout << line << endl;
        }
        myfile.close();
    }

    else cout << "Unable to open file";

    return 0;

}

fox.txt
v 10.693913 60.403057 33.765018
v -7.016389 46.160694 36.028797
v 9.998714 51.307644 35.496368
v -8.642366 49.095310 35.725204

A: A simple way to read in the line
v 10.693913 60.403057 33.765018
and separate it into 3 different variables is to first read in a char, then read in three doubles:
ifstream fin("fox.txt");

vector <vector<double>> data; // holds sets of coordinates
double a, b, c;
char v;

while(fin >> v >> a >> b >> c){
    data.push_back({a, b, c});
}

If you wanted, you could also use std::stringstream to parse the input into doubles.

A: An easy way is to simply use std::stringstream and treat it like you would any other stream.
#include <sstream>
...
std::string pos1, pos2, pos3;
std::stringstream lineStream;
...
while (getline(myfile, line))
{
    /* Make a string stream out of the line we read */
    lineStream.str(line);

    char skip; // Temp var to skip the first 'v'
    lineStream >> skip >> pos1 >> pos2 >> pos3;

    /* Reset error state flags for next iteration */
    lineStream.clear();
}

Or you could avoid all that by using the >> operator on myfile directly.
std::string temp, pos1, pos2, pos3;

while (myfile >> temp >> pos1 >> pos2 >> pos3)
{
    ...
}

A: I'm going to figure you want to store this data in the likes of a std::vector. This is one way of doing it.
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>

const char* test_str = R"(
v 10.693913 60.403057 33.765018
v -7.016389 46.160694 36.028797
v 9.998714 51.307644 35.496368
v -8.642366 49.095310 35.725204
)";

struct data_item {
    double x;
    double y;
    double z;
};
using data_set = std::vector<data_item>;

int main()
{
    //std::ifstream myfile("fox.txt");
    //if (!myfile.is_open()) {
    //    std::cout << "Unable to open file\n";
    //    return -1;
    //}
    std::stringstream as_file;
    as_file << test_str;
    data_set set;
    for (; ;) {
        std::string dummy;
        data_item item;
        as_file >> dummy >> item.x >> item.y >> item.z;
        if (!dummy.size())
            break;
        set.push_back(item);
    }
    for (auto& item : set)
        std::cout << item.x << " " << item.y << " " << item.z << std::endl;
    return 0;
}

Don't do: using namespace std; It will save you a lot of headaches down the road. It also makes your code more readable to know stuff is out of the standard library.
When testing, it is sometimes more simple to use local data as I have with test_str. As pointed out in the comments, you could just let the stream do the conversion from text to doubles.
Note I've taken care of a failed file error in one place, the commented file stuff. Putting an else way down from the failure is not so clear and creates a large unneeded scope.


text:
Q: Is there any limit on the number of scheduled queries in Google BigQuery per project? I have scheduled few queries in Google BigQuery using Standard SQL but I want to know the maximum limit on number of queries that can be scheduled per project. I have used Schedule Query option in BigQuery to schedule my queries and currently I have scheduled around 20 queries, some of them run daily and some of them run weekly. Having knowledge on maximum limit would help me understand how many more queries I can schedule.

A: No such limit for scheduled query itself. But those queries run under your project, so please be aware of all of the BQ limits:
https://cloud.google.com/bigquery/quotas#query_jobs


text:
Q: What is the difference between kmemdup_nul() and kstrndup() in Linux? They are similar functions, but what is the exact difference between them? The Linux documentation states:

Note: Use kmemdup_nul() instead if the size is known exactly.

A: Both functions allocate the needed memory through kmalloc() and then place a NUL terminator at the end of the allocated buffer. The only difference between the two is that kstrndup() first calls strnlen() to calculate the length of the string and therefore the needed size, thus scanning the string.
You can see kmemdup_nul() as an optimized version of kstrndup(). If you already know the length of the string, you can avoid the initial scanning and just use kmemdup_nul() passing in the length as argument. This saves time since the string doesn't need to be scanned, and it's the reason why you see that note.
Moreover, kstrndup() saves space if the string is shorter than max, so in case you don't know the length of the string, even though kmemdup_nul() would work as well, you might want to call kstrndup() instead to potentially save space.
You can clearly see from the code that the only difference between the two functions is the call to strnlen(). Here's the source code, from mm/util.c:
/**
 * kstrndup - allocate space for and copy an existing string
 * @s: the string to duplicate
 * @max: read at most @max chars from @s
 * @gfp: the GFP mask used in the kmalloc() call when allocating memory
 *
 * Note: Use kmemdup_nul() instead if the size is known exactly.
 *
 * Return: newly allocated copy of @s or %NULL in case of error
 */
char *kstrndup(const char *s, size_t max, gfp_t gfp)
{
    size_t len;
    char *buf;

    if (!s)
        return NULL;

    len = strnlen(s, max);
    buf = kmalloc_track_caller(len+1, gfp);
    if (buf) {
        memcpy(buf, s, len);
        buf[len] = '\0';
    }
    return buf;
}
EXPORT_SYMBOL(kstrndup);

/**
 * kmemdup_nul - Create a NUL-terminated string from unterminated data
 * @s: The data to stringify
 * @len: The size of the data
 * @gfp: the GFP mask used in the kmalloc() call when allocating memory
 *
 * Return: newly allocated copy of @s with NUL-termination or %NULL in
 * case of error
 */
char *kmemdup_nul(const char *s, size_t len, gfp_t gfp)
{
    char *buf;

    if (!s)
        return NULL;

    buf = kmalloc_track_caller(len + 1, gfp);
    if (buf) {
        memcpy(buf, s, len);
        buf[len] = '\0';
    }
    return buf;
}
EXPORT_SYMBOL(kmemdup_nul);


text:
Q: Ternary vs. Logical Operators Apologies if this is a dupe, I've only seen an or || comparison.
If I want to set one variable's value based on a single condition, where b will always evaluate to true (not 0, null, undefined), why would I use the ternary operator a?b:c over the logical a&&b||c? They both appear to perform the exact same function, although tests on jsperf show the latter being slightly faster.
What is the purpose of the ternary operator if a very similar operation and syntax outperforms it at the same task? More curiously, what does it do that makes it slower?

A: What if you want to set a value conditionally to 0 or some non-zero value?
var x = condition() && 0 || 1;

That won't work, because 0 is falsy.
var x = condition() ? 0 : 1;

will work, because evaluation does not rely on the coerced boolean values.


text:
Q: Azure k8s dashboard does not open I have k8s cluster on Azure and can not access the dashboard.
To access it I was doing aks browse --resource-group <res_group> --name <cluster_name>
It does not open after accidentally deleted the kube-dashboard pod.
Error:
Couldn't find the Kubernetes dashboard pod.
Did try to enable-disbale dashboard add-on on Azure.
Re-install k8s-dashboard. (Azure did not allow)
Any ideas on how to solve the issue and restart the dashboard?

A: Did find the following solution that worked for me:

*

*Created another Azure k8s cluster. For each cluster Azure makes a dashboard
deployment.

*Copied the yaml files with the command:
kubectl get deployment -n kube-system <kubernetes-dasboard-xxx>
for each "deployment, replicaSet, service and pod related to dashboard"

*Recreated them into the old not working cluster.

*Upgraded-downgraded the cluster version to re-deploy the objects.

A: Depends on your k8s version, AKS doesn't enable dashboard while creating a new cluster. You can find details in below link.
https://learn.microsoft.com/en-us/azure/aks/kubernetes-dashboard
And I suggest you, can directly install dashboard from kubernetes dashboard page,   it is installing dashboard another namespace(it it better actually) and you can create and RBAC account to see all resources as an admin privileges.
https://github.com/kubernetes/dashboard
https://github.com/kubernetes/dashboard/blob/master/docs/user/access-control/creating-sample-user.md
And also you can use --enable-addons
https://learn.microsoft.com/en-us/azure/aks/kubernetes-dashboard


text:
Q: Adding Logic to SQL*Loader control file for loading a specific column I have a control file. I am trying to add logic for column "QUALIFYING":

*

*when the value is NULL, it needs to be set to 'F'.

*when the value is 'x' it needs to be set to 'T'

options (ERRORS=1000, SKIP=1)
load data
infile '/clients/vca2/data/API/ADHOC_LOAD/MASTER_VCA_Reminder_setup_references.csv'
replace
into table VCABARK_CDI_DV.MASTER_REMINDER_SETUP
fields terminated by '|'
OPTIONALLY ENCLOSED BY '"' AND '"'
trailing nullcols
(
VI_Reminder_Id FILLER,
 WW_Id,
  Ranking,
  WW_Desc ,
  VS_Desc FILLER,
  VCA_Client_Desc,
  Do_Not_Display ,
  Qualifying ,
  IsNull,
  Batch_Date expression "(SELECT RUNTIME FROM VCABARK_CDI_DV.RUNTIME_API)",
  Region CONSTANT "US"
 )

A: You could use CASE, such as in this example.
First, a sample table:
SQL> create table test (id number, qualifying varchar2(10), isnull varchar2(1));

Table created.

Control file:
load data
infile *
replace
into table test
fields terminated by "|" TRAILING NULLCOLS
(
id,
qualifying "case when :qualifying is null then 'F'
                 when :qualifying = 'x' then 'T'
                 else :qualifying
            end",
isnull
)

begindata
1||y
2|x|y
3|225|n

Testing:
SQL> $sqlldr scott/tiger@xe control=test05.ctl log=test05.log

SQL*Loader: Release 11.2.0.2.0 - Production on Pon O×u 25 16:49:56 2019

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

SQL*Loader-704: Internal error: ulconnect: OCIServerAttach [0]
ORA-12545: Connect failed because target host or object does not exist

SQL> $sqlldr scott/tiger control=test05.ctl log=test05.log

SQL*Loader: Release 11.2.0.2.0 - Production on Pon O×u 25 16:50:57 2019

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Commit point reached - logical record count 2
Commit point reached - logical record count 3

SQL> select * from test;

        ID QUALIFYING I
---------- ---------- -
         1 F          y
         2 T          y
         3 225        n

SQL>


text:
Q: Using the DetailView how do I get the selected row value on the DetailViewController.m file? I trying to save my plist after a simple detail change.
Here's the line that I need fixed.
[plist replaceObjectAtIndex:0 withObject:nameDictionary];

I need to replace the 0 with a variable that gets the row that was selected.  Remember, I'm using the codebase from the tutorial above.
something like indexPath.row would be great but I can't get it to work.
My array is no longer accessible on the detail view.

A: One easy way...
Create a NSInterger object in DetailsView.lets say mySelectedIndex
inside RootViewControlle didSelectRowAtIndexPath ..you can access mySelectedIndex
DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:[NSBundle mainBundle]];

dvController.mySelectedIndex = indexPath.row;

[self.navigationController pushViewController:dvController animated:YES];

inside DetailsView
[plist replaceObjectAtIndex:mySelectedIndex withObject:nameDictionary];

Second..
Singleton Variable to store the data and access it anywhere in the App.
Third..
Use NSUSerDefaults..


text:
Q: why i can't get adb shell top works? I'm testing an android app by my PC. I try to catch the CPU usage of it.
if I use
adb shell top -m 10 |tee aa.txt
it works fine.
but if i modify it like this
adb shell top -m 10 |grep myAPPname|tee aa.txt
it can not. Why and how to make it work again?

A: try the command below:
while true; do
  adb shell top -m 10 -n 1 | grep kso >> aa
done

-n means only show the current status instead of updating frequently.
However, I suggest you use Android Profiler which is a built-in function in Android Studio to achieve your monitoring work.


text:
Q: Type hinting for dynamic object variables I want to be able to add variables dynamically without having to declare them beforehand (mainly so I can declare them in middle of commands), So I decided to just use an empty object and create new variables through it, but my only problem is that type hinting doesn't work when accessing the the object properties, unlike when setting values for declared var. So is there some workaround to it so I could always get accurate type hinting based on what I set inside the property in the current scope?

const $: {[key: string]: any} = {}

$.some_variable = 5

A: No, this isn't possible. You can't mutate the type of a variable procedurally like this. As soon as you declare {[key: string]: any} then the properties of that object are unknowable to the type system.
You might think well, what if I used a function? But that would require Typescript to support type mutating functions, and it does not, with this quote from the Typescript team:

We think it's very valuable, but have no ideas on how to implement it without completely blowing up performance

If you wanted a solution that used immutable values and functions, this might work:
function add<
    T extends Record<string, unknown>,
    K extends string,
    V extends unknown
>(obj: T, key: K, value: V): T & { [key in K]: V } {
    return {...obj, [key]: value }
}

const a = {}
const b = add(a, 'some_variable', 5)
console.log(b.some_variable) // 5

Playground
But that's pretty cumbersome.

You can also declare a literal, and that get the type of it as an alias.
type TestType = typeof test

const test = {
    a: 1,
    b: 2,
    c: 'foo'
}

But you can't really build up an object key by key this way.

Wrapping up, you should not be afraid of the declare type, then use type pattern. It's simple, hard to screw up, and yes, also means writing code that feels like it duplicates itself. But as soon as you use that type in two places, then this investment pays off.


text:
Q: Passing parameters with express router correctly import express from "express";
const router = express.Router();

router.route("/:category").get(getProductsByCategories);
router.route("/:id").get(getProductDetails);

export default router;

In this code, I've added two routes with parameters. But this code doesn't work as expected. The first route get products by categories works. But the second one doesn't. Could someone help me to troubleshoot this code, please?

A: The problem
From the Express documentation here

Route parameters
Route parameters are named URL segments that are used
to capture the values specified at their position in the URL. The
captured values are populated in the req.params object, with the name
of the route parameter specified in the path as their respective keys.
Route path: /users/:userId/books/:bookId
Request URL: http://localhost:3000/users/34/books/8989
req.params: { "userId": "34", "bookId": "8989" }

With that info, we can say your 2 routes are actually the same. The name of parameters doesn't make them 2 different routes. What it changes is only how the req.params object is populated. As the consequence, all the requests will go to the first route.
Suggestion
You will need to change 1 of 2 routes, for example :

*

*To get the product by ID, you can keep it :

router.route("/:id").get(getProductDetails);

*

*To get products by category, you can change to :

router.route("/category/:category").get(getProductsByCategories);

A: your route actually same route
use query string
router.route("/").get(getProduct)

and in the product function
const {id,category} = req.query

don't forget to include the keyword in url request
{{url}}/product?id=1 // to get detail
{{url}}/product?category // to get product by category


text:
Q: UPSERT in PGSQL (version 11,)does the unique constraint be maintained always? For ON CONFLICT(col) clause in UPSERT, should there be unique constraint for the column or combination of columns.
for eg:
if I have a simple table create table test(id integer ,name  text ),Will I not be able to do UPSERT ?the UNIQUENESS constraint have to be enforced ?
Please help as I am confused.

A: A unique constraint must be fulfilled at the end of a transaction. So it can't become non-unique - you would get an error and the transaction would be rolled back. UPSERT can't fail:

ON CONFLICT DO UPDATE guarantees an atomic INSERT or UPDATE outcome;
provided there is no independent error, one of those two outcomes is
guaranteed, even under high concurrency. This is also known as UPSERT
— "UPDATE or INSERT".


text:
Q: Copy graphical style of Slider2D Slider2D@{.5,.5} makes a draggable orange point with gray lines in a square.

I want to use that dot in my plots.  I also want to use that color and thickness of gray line.  I could extract all of this information approximately from the image.  But I think there's a way to get the pieces used to construct that object in a way analagous to FullForm@Slider2D@{.5,.5} (this code of course does not yield a list of lines, other graphics primitives etc.).  Perhaps the solution involves FullGraphics or AbsoluteOptions or AbsoluteCurrentValue.

A: The orange png image used as slider thumb:
slider2dThumb = Import["C:\\Program Files\\Wolfram Research\\Mathematica\\11.3\\SystemFiles\\FrontEnd\\SystemResources\\\
Bitmaps\\Typeset\\Slider2D\\ThumbLarge.png"]

GrayLevel graphics objects:
FrontEndResource["SliderThumb2D"] // Short

RawBoxes /@ {FrontEndResource["SliderThumb2D"],
  FrontEndResource["SliderBackground2D"],
  FrontEndResource["SliderBar2DHorizontal"],
  FrontEndResource["SliderBar2DVertical"]}

A: I don't think this is actually made with Wolfram graphics primitives, but you can still find the image it uses! Open the application package and navigate to Contents > SystemFiles > FrontEnd > SystemResources > Bitmaps > Typeset > Slider2D. (That's where the orange disk is on a Mac, anyway.) You have a choice of different sizes.
I found what might be the rest of the information in the file Contents > SystemFiles > FrontEnd > TextResources > Controls.tr. If you find Slider2D in that document, you can see that the resource SliderBar2DHorizontal, for example, is given as
GraphicsBox[{GrayLevel[0.65], AbsoluteThickness[1.5],
  LineBox[{{0, 0}, {4, 0}}]}, PlotRange -> {{-0.25, 4.25}, {-0.3, 0.3}}]

GraphicsBox is a lower-level undocumented form of Graphics that represents graphics as an expression per se, so applying ToExpression or, to be more precise, RawBoxes, works.
Edit: Also see @klgr's answer for a demonstration of using FrontEndResource within Mathematica to get this information! :)


text:
Q: Parse query not loading in descending order For some reason when I add an image to a tableView with Parse, it is pulling file from Parse fine, but is not loading in descending order...not sure why?
Thanks for any help!
class HomePageViewController: UIViewController, UITableViewDelegate {
@IBOutlet var homePageTableView: UITableView!

var albumImageFiles = [PFFile]()
var imageText = [String]()

override func viewDidLoad() {
    super.viewDidLoad()

    // Do any additional setup after loading the view.
    var query = PFQuery(className: "Posts")
    query.orderByDescending("createdAT")
    query.findObjectsInBackgroundWithBlock { (posts:[AnyObject]?, error: NSError?) -> Void in

        if error == nil {
            //success fetching objects

            for post in posts! {
               self.albumImageFiles.append(post["imageFile"] as! PFFile)
                self.imageText.append(post["albumText"] as! String)

            }

            /*reload the table*/
            self.homePageTableView.reloadData()

        } else {
            println(error)

        }

    }

}

A: query.orderByDescending("createdAT")

should be
query.orderByDescending("createdAt")


text:
Q: Automatically add link to pull request to JIRA We have a setup with Bitbucket GIT linked to JIRA issue tracker. It is possible to add special comments to GIT commit messages to update JIRA issues automatically.
However, is it possible to put the link to the Pull Request, when it is created, to the corresponding JIRA issue? JIRA issue knows the name of the branch, so it should also have information on the pull requests.

A: If you reference your issue keys in your commit messages, branches and pull requests then this information will automatically appear in your issue's development panel.
This requires that you have an application link configured between JIRA and Bitbucket.
This is how it should look:

More info is available on the Development Information documentation page.


text:
Q: How to Install New Assemblies From NuGet Packages On Offline Mode I do not have access to Internet for couple of hours and I need to start a project using VS 2015 community version.

*

*Newtonsoft.Json

*Esri.ArcGISRuntime.WPF

I already have theses two assemblies on previous projects so can you please let me know how I can use those existing assemblies on my new project? or is there any way to add them to my new project in offline mode?


text:
Q: css drop-down with border I am trying to make a drop-down like in this link: http://k-prim.biz/ttpm/workspace-04d.png
The trick here is that the background is semitransparent and I have a gray border over the name and the drop-down menu. Any ideas to make this with css only?
to be more clear - I want to avoid this part of the border - under the username: k-prim.biz/ttpm/screen.png
Thank you in advance!

A: It is posible, but you need to change your HTML a little bit
HTML

      ljubo_v

          myhomecork

css
#user{
  position:absolute;
  right:50px;
  top: 8px;
  cursor:pointer;
  text-align:right;
  width: 202px;
  overflow:
  hidden;
  z-index:0;
}
#username{
    border: solid 1px transparent;
    padding-top: 5px;
    padding-right: 5px;
    padding-bottom: 2px;
    padding-left: 8px;
    text-align:right; z-index:5;
    right:0;
    position: relative;
    border-bottom: none;
    line-height: 1em;
    float: right;
}
#user:hover #username::after{
    content:'';
    height: 1px;
    width:100%;
    position: absolute;
    border-left: solid 202px #999;
    right: 0;
    bottom: 0;
}

#userarrow{
    float:right;
    display:block;
    width:9px;
    height:7px;
    margin-right:5px;
    background-image: url(../images/interface/sort-down.png);
    background-repeat: no-repeat;
    clear: right;
    margin-top: 5px;
}

#user:hover > #username{
    border-top-width: 1px;
    border-right-width: 1px;
    border-bottom-width: 1px;
    border-left-width: 1px;
    border-top-style: solid;
    border-right-style: solid;

    border-left-style: solid;
    border-top-color: #999;
    border-right-color: #999;
    border-left-color: #999;
    background-image: url(../images/interface/black50.png);
    background-repeat: repeat;
}

#userdrop{
    background-image: url(../images/interface/black50.png);
    background-repeat: repeat;
    display: none;
    width:200px;
    height:433px;
    float: right;
    margin-top: -12px;
    text-align:left;
    font-size:13px;
    border: solid 1px #999;
    border-top: none;
}
#user:hover #userdrop{display:block;}

A: Transparent background (CSS3): background: rgba(0,0,0,0.6); with Parameters being (red, green, blue, opacity) (0.00 for 0% through 1.00 for 100%).
To overlap items, make your main menu item position: relative; (which is required for the following to work properly): make the sub navigation position: absolute;. it will be absolute, but relative to the top menu item. you can use negative position values to overlap the element.


text:
Q: return undefined instead of the wanted value React-Redux and Redux toolkit I created a slice with createSlice using the redux toolkit.
import { createSlice } from "@reduxjs/toolkit";

export const selectAppColorChange = state => state.lightMode;

const appColorChangeSlice = createSlice({
    name: 'appColorChange',
    initialState: {lightMode: true},
    reducers: {
        changeState: state => {
            state.lightMode = state.lightMode ? false : true;
        }
    }
});

export const { changeState } = appColorChangeSlice.actions;
export default appColorChangeSlice.reducer;

Then I created a button with the initial state as the sun image which will change itself to the moon image when clicked and opposite.
import Sun from '../../images/icon-sun.svg';
import Moon from '../../images/icon-moon.svg';
import { useSelector, useDispatch } from 'react-redux';
import { selectAppColorChange, changeState } from '../App/appColorChangeSlice';

export function TodoHeader(){
    const dispatch = useDispatch();
    const buttonIconBool = useSelector(selectAppColorChange);
    function changeBackground () {
        dispatch(changeState());
        console.log(buttonIconBool);
    }
    return (

TODO

    )
}

But an error occur that the moon always appears and when I clicked on the moon it stays remained, to find out more and fix the problem I console.log(buttonIconBool) to the console. Instead of giving the boolean value that I want it returns undefined.
How can I fix this? Thanks for answering my question!

A: Looks like you have the wrong selector.
Assuming your have given appColorChange in your store.js like this,
import appColorChange from "******/appColorChange**.js";

export const store = configureStore({
    reducer: {
       appColorChange: appColorChange
    },
})

then the selector should be,
export const selectAppColorChange = state => state.appColorChange.lightMode;

or
const buttonIconBool = useSelector(state => state.appColorChange.lightMode);

The selector will be called with the entire Redux store state as its only argument.

Reference: https://react-redux.js.org/api/hooks#useselector


text:
Q: tab view controller with dynamic width and height I working with swift 4 for macOS.
I have a tabView Controller with three tab view items.
All item view controllers have different size (width / height)
Now I would like to realize, that the tabview controller will change his own size animated to the content size of the selected tab view item.
But I don't know, how I can realize that?

A: I created a quick demo code for your case. Basically you need to remember the original size of each view item. When tab selected, just resize the window.
import Cocoa

class MyViewController: NSViewController {
var originalSize: NSSize

init(originalSize: NSSize) {
    self.originalSize = originalSize
    super.init(nibName: nil, bundle: nil)
}

required init?(coder: NSCoder) {
    fatalError("init(coder:) has not been implemented")

   }
}

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate, NSTabViewDelegate {
@IBOutlet weak var window: NSWindow!

func applicationDidFinishLaunching(_ aNotification: Notification) {
    // Insert code here to initialize your application
    // Tabview
    let tabView = NSTabView()
    tabView.delegate = self
    tabView.translatesAutoresizingMaskIntoConstraints = false
    self.window.contentView?.addSubview(tabView)
    self.window.contentView?.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|[tabView]|", options: [], metrics: nil, views: ["tabView": tabView]))
    self.window.contentView?.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|[tabView]|", options: [], metrics: nil, views: ["tabView": tabView]))

    // Tab item views
    let firstVC = MyViewController(originalSize: NSSize(width: 200, height: 200))
    firstVC.view = NSView()
    let firstView = firstVC.view
    firstView.wantsLayer = true
    firstView.layer?.backgroundColor = NSColor.red.cgColor
    let firstItem = NSTabViewItem(viewController: firstVC)
    tabView.addTabViewItem(firstItem)

    let secondVC = MyViewController(originalSize: NSSize(width: 300, height: 300))
    secondVC.view = NSView()
    let secondView = secondVC.view
    secondView.wantsLayer = true
    secondView.layer?.backgroundColor = NSColor.yellow.cgColor
    let secondItem = NSTabViewItem(viewController: secondVC)
    tabView.addTabViewItem(secondItem)

    let thirdVC = MyViewController(originalSize: NSSize(width: 400, height: 400))
    thirdVC.view = NSView()
    let thirdView = thirdVC.view
    thirdView.wantsLayer = true
    thirdView.layer?.backgroundColor = NSColor.green.cgColor
    let thirdItem = NSTabViewItem(viewController: thirdVC)
    tabView.addTabViewItem(thirdItem)
}

func applicationWillTerminate(_ aNotification: Notification) {
    // Insert code here to tear down your application
}

// Delegate
func tabView(_ tabView: NSTabView, didSelect tabViewItem: NSTabViewItem?) {
    if let selectedVC = tabViewItem?.viewController as? MyViewController {
        print("Selected view size is : \(selectedVC.originalSize)")

        var frame = window.frame
        frame.size = selectedVC.originalSize

        window.setFrame(frame, display: true, animate: true)

       }
    }
}


text:
Q: What is the Ember Octane replacement for `didInsertElement`? I'm trying to fire a callback passed down from a parent component. Our old pattern for handling this was to call the function in didInsertElement. In Octane, I see that we can use the did-insert modifier but that seems weird for this use case since we're not updating the DOM element that we'd use to call did-insert. I've also seen onRender being used in a few cases but I don't see documentation on that and it's not firing for me. Any suggestions?
For this specific use case, we have a parent component that can have one of many child components. And for each child component we have specific text that gets displayed in the parent component and we want the child component to be the owner of that text.

A: Your instinct that did-insert  isn't the right solution here is, I think, correct. In general, modifiers should only be used when the element they're going to be attached to is used in some way—that is, for managing interactions with the DOM. In general, we prefer one-way data flow otherwise. However, the scenario you've outlined looks similar to a "registration" pattern, where when a child is instantiated, it tells its parent "Hey, I'm here, here's the info you need about me."
There are a couple reasonable options in this case:

*

*Rethink whether the child component should in fact own that data. I don't doubt you have a good reason for the child component owning the data, but the fact that the parent is already responsible for deciding which child to render may suggest that a mapping which includes both the component to render and the associated text could be a good solution in this space. That would cleanly solve this issue.

*Given that per your description you currently do want to avoid having the parent own that data, you could also consider having the child yield the data. However, this usually only works if the DOM relationship for it makes sense. If it does, you could choose to do something like this:
{{yield (hash block='data' text=this.theText)}}

  {{yield}}

<ChildComponent as |child|>
  {{#if (eq child.block 'data'}}

{{child.text}}

  {{/if}}

  {{child}}
</Child>

(You can see this strategy working here—in particular, see the resulting DOM!)
While that's very powerful, again, it only works if your DOM layout supports it.

*Finally, and perhaps most simply for the use case you have, you can  (though not necessarily best, as I think the other options above are usually better when available), you can 'register' the value for the component by calling an action passed into your component during the constructor. Now, using a component's constructor this way for component behavior can be a problem in that it only runs once, when the component is first instantiated, and Glimmer and Ember keep the component instance stable and just change the values passed to them over time as much as possible, so if the value you're passing back up depends on the argument you pass to it, the constructor won't work. If it's always stable and does not depend on the arguments to a component, this does work, and it's often appropriate for a 'registration' pattern, where the child component simply needs to pass a single piece of data to the parent when instantiated.


text:
Q: Can wizards lift and move very heavy objects with magic? Students at Hogwarts learn to levitate small objects using Wingardium Leviosa, and we see a handful of other spells through the series that have similar (mostly minor) effects.
We also see some vehicles enchanted for flight: mainly brooms, but also Hagrid's Harley, Mr. Weasley's car, and the ship and carriage that brought the contestants in for the Triwizard Tournament.
Do we know if (sufficiently advanced) wizards can lift and move very heavy random objects? (Like rocks, trees, etc.)
For example (inspired by this question) if Ron's car had killed the Whomping Willow, could Professor Sprout have found one somewhere in the wild, dug it up, and flew it in?
Would she have done so via Leviosa-style spells? Or by enchanting it to fly on its own, like the car? Or by using magical flying beasts of burden?
Related question: Do we know how large structures, like Hogwarts, were built? Were the rocks magically lifted or teleported into place? Is "magical construction worker" a profession in the wizarding world?

A: Three examples I can think of offhand:

*

*As you already mentioned, the Weasley's car. The curb weight of a Ford Anglia was 1,624 pounds. There are numerous heavy objects that have been bewitched to be able to fly throughout the books, such as the flying Carriage in the 4th book.

*In the final movie, Voldemort was able to move the body of a giant out of his way during the Battle of Hogwarts wandlessly and nonverbally.

*Wingardium Leviofa apparently summoned a buffalo instead of levitating objects, so you could apparently at least summon large objects. Harry also considers summoning a breathing apparatus for the 2nd task but was concerned that he'd get in trouble for compromising secrecy if Muggles noticed. Note that the reasons he gave for not doing that had nothing to do with the object being too large.

A: There can be one more angle to this question. In book 3, when Harry left Privet Drive after the Marge's incident and was out in the street with his trunk and everything, he himself thought of magicking himself out of the mess before any Police officer sees him.
It is mentioned in the book that Harry thought of making his trunk lighter using magic and then tying it to the broomstick and then fly to Leaky Cauldron. If a second year student can think of magicking the trunk and making it lighter, I am sure fully qualified wizard and likes of Dumbledore can make a lot bigger objects light by magic and then can easily move/shift them wherever needed.
Where Wingardium Leviosa & Locomotor are not a perfect fit, the above approach can also be tried with significant and pretty much same results.

A: Locomotor can move somewhat heavy objects.
Tonks moves Harry's trunk, with all his school supplies in it, using Locomotor.

"Ah well … wand still in your jeans? Both buttocks still on? OK, let's go. Locomotor trunk.'
Harry's trunk rose a few inches into the air. Holding her wand like a conductor's baton, Tonks made the trunk hover across the room and out of the door ahead of them, Hedwig's cage in her left hand. Harry followed her down the stairs carrying his broomstick." - Harry Potter and the Order of the Phoenix, Chapter 3 (The Advance Guard)

Flitwick also uses it to move Trelawney's luggage back to her room.

"Professor Flitwick went scurrying after them, his wand held out before him; he squeaked 'Locomotor trunks!' and Professor Trelawney's luggage rose into the air and proceeded up the staircase after her, Professor Flitwick bringing up the rear." - Harry Potter and the Order of the Phoenix, Chapter 26 (Seen and Unforseen)

Wingardium Leviosa can also move somewhat heavy objects.
Harry used it to lift a motorcycle sidecar with himself in it.

"There was a deafening bang and the sidecar broke away from the bike completely: Harry sped forwards, propelled by the impetus of the bike's flight, then the sidecar began to lose height –
In desperation Harry pointed his wand at the sidecar and shouted, 'Wingardium Leviosa!" - Harry Potter and the Deathly Hallows, Chapter 21 (The Tale of the Three Brothers)

Ron also used it to lift a troll's club that was heavy enough to knock the troll out.

"Hermione had sunk to the floor in fright; Ron pulled out his own wand – not knowing what he was going to do he heard himself cry the first spell that came into his head: 'Wingardium Leviosa!'
The club flew suddenly out of the troll's hand, rose high, high up into the air, turned slowly over – and dropped, with a sickening crack, on to its owner's head. The troll swayed on the spot and then fell flat on its face, with a thud that made the whole room tremble." - Harry Potter and the Philosopher's Stone, Chapter 10 (Hallowe'en)

The Hover Charm can as well.
Hermione used it to lift a heavy chest of drawers.

"Ron was buried deepest: Harry and Hermione climbed, as quietly as they could, over all the wreckage to where he lay, trying to prise a heavy chest of drawers off his legs. While Xenophilius's banging and scraping drew nearer and nearer, Hermione managed to free Ron with the use of a Hover Charm." - Harry Potter and the Deathly Hallows, Chapter 21 (The Tale of the Three Brothers)

Xenophilius Lovegood also tried using it to move a printing press.

"The printing press blocking the stairs was vibrating: Xenophilius was trying to shift it using a Hover Charm. Harry did not know what Hermione was waiting for." - Harry Potter and the Deathly Hallows, Chapter 21 (The Tale of the Three Brothers)

A tree is moved using a spell called Mobiliarbus.
On one occasion, Hermione moves a Christmas tree using Mobiliarbus. It worked - so this was effective at moving a tree. In addition, the incantation (from Latin words meaning move and tree) and its subsequent effect imply that it's specifically meant for moving trees. It's only ever used once, so it's not clear if it would work on a tree as big as the Whomping Willow, but it's a possible candidate for tree moving.

"Somewhere above him, Hermione whispered, 'Mobiliarbus!'
The Christmas tree beside their table rose a few inches off the ground, drifted sideways and landed with a soft thump right in front of their table, hiding them from view." - Harry Potter and the Prisoner of Azkaban, Chapter 10 (The Marauder's Map)

Large structures may be built similar to how they're repaired in Fantastic Beasts.
In the Fantastic Beasts and Where to Find Them movie, Aurors repair the broken buildings of New York with magic.

"Aurors move through the streets, performing Repairing Charms to rebuild the city: buildings and cars are reconstructed and streets are returned to normal." Fantastic Beasts and Where to Find Them: The Original Screenplay

It's possible that wizards could do something similar to build new buildings, although they wouldn't already know what the final building is supposed to look like as exactly as when fixing already-existing buildings.


text:
Q: Installing Python on RHEL6.9 - No Internet, No Yum, No Pip I have a super barebones airgapped machine.
It has the Python3.6.6.tar.gz from the website.  It has no access to outside sources. It has no ability to use yum or pip as they're not on here.
What is the best method for getting Python3.6 installed onto here without having to transfer files over?
Edit -
I've tried
./configure
make ( or make install or make altinstall )

When I go to run python3.6 I get
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

I've tried changing export PYTHONHOME to /usr/local/ with no luck, though that did clear up a previous error related to it


text:
Q: SharePoint 2013 Server Search status stuck on "Unprovisioning" I am having some problems with search. I had stopped it because I had to perform an update. After the update it did not want to start again. So, I tried to start the search service using powershell:
Get-SPEnterpriseSearchServiceInstance -Local | Stop-SPEnterpriseSearchServiceInstance

Now status is stuck on "Unprovisioning".
TypeName    : SharePoint Server Search
Description : Index content and serve search queries
Id          : eb9f4c5d-b9d4-4cdb-a92f-2e4d8d0eda1a
Server      : SPServer Name=ABC02
Service     : SearchService Name=OSearch15
Role        : None
Status      : Unprovisioning

I added search service account in the local administrators group.
I have restarted SharePoint Administration, SP Search, SP Timer, SP Search Host controller services.
Nothing so far.
Anything else I should do now to stop it and fix this issue?

A: I suggest you re-provisioning the Search Service Application using PowerShell command:

*

*Find the service which need to be provisioned.

Get-SPServiceInstance -All

*Then run the commands to provision:
$service = Get-SPServiceInstance -Identity [paste in the GUID for the service]
$service.provision()
$service.update()
iisreset /noforce


text:
Q: Lemma in Proof of Area Theorem for Conformal Mappings There is a theorem called the area theorem for conformal mappings, q.v. https://en.wikipedia.org/wiki/Area_theorem_(conformal_mapping)
Setup:
Let $g(z) = z + b_0 + b_1 z^{-1} +b_2 z^{-2} + ...$ be holomorphic and injective on $\mathbb{C}\setminus \bar{\mathbb{D}},$ where $\bar{\mathbb{D}}$ is the closed unit disk in $\mathbb{C}.$ Define $$E = \mathbb{C} \setminus g(\mathbb{C} \setminus \bar{\mathbb{D}})$$ to be the omitted set of $g.$ Let $C_r = g(\{z : |z|=r\}),$ for $r>1.$  By the Jordan curve theorem, $\mathbb{C} \setminus C_r$ consists of two connected components, one bounded and the other unbounded. Let $E_r$ be the bounded of these two regions.
Question: why do we have $E \subset E_r$?

A: Since $g$ fixes $\infty$, $g$ obviously sends the exterior of the $r$-disc into the complement of $E_r$, so in particular all the values not taken by $g$ must be inside $E_r$ and since $r>1$ they cannot be on the boundary since that is also taken by $g$ by its definition


text:
Q: Console error while running react js sample web app I am new to React js and was trying my hands on a very simple hello react kinda web app. But while running, ended up at below error in console.
Calling Element.createShadowRoot() for an element which already hosts a shadow root is deprecated. See https://www.chromestatus.com/features/4668884095336448 for more details.
Browser: Chrome version 46.0.24
html code:
<!DOCTYPE html>

        <meta charset="UTF-8"/>

Can anyone please point out what could possibly be going wrong.
Thanks in advance.

A: First of all, the cdns you are using for the library files are unreachable.

From the React Docs page these are the working links for the cdn:
https://npmcdn.com/react@15.3.1/dist/react.min.js
https://npmcdn.com/react-dom@15.3.1/dist/react-dom.min.js
https://npmcdn.com/babel-core@5.8.38/browser.min.js
Second, there should be comma after
Hello React!
 that separates what should be rendered to where .
So your code should look like this:
<!DOCTYPE html>

        <meta charset="UTF-8"/>

A: You links are broken. Use these updated links
Use domain cdnjs.cloudflare.com instead of cdnjs.cloudfare.com
https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.js
https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react.js
https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react-dom.js