Is there a way to get the awesome robe enchantments on armor?

Question: As a mage there are some nice clothes out there. I'm wearing:
Master's Robes of Destruction
  +150% Magika Regen
  -22% magika cost for Destruction

Pretty awesome. But not wearing armor makes me incredibly vunerable to melee attacks. I often get one-hit killed.
Is there a way to get the awesome enchantments of clothes on armor? I have the enchantments but they don't work so well on armor. If I up my Enchanting skill will they ever be as good as clothes?
Comment: This is a perfectly valid question, which just has a bad title. Please take the time to read the question first, before voting to close. Do not just base it on the title.
Answer: The formula for enchanting apparel is
net magnitude = base magnitude * soul multiplier * skill multiplier *
                (1 + Enchanter perk) * (1 + specific perk modifier)

where
skill multiplier = 1 + 0.3 * ((skill - 10) / 100) ^ 2.

Therefore, the maximum magnitude (100 enchant, the appropriate perks, +32% Fortify Enchanting Potion) is:
skill multiplier = 1 + 0.3 * ((132 - 10) / 100) ^ 2 = 1.4465

net magnitude = base magnitude * 1 * 1.4465 * 2 * 1.25
              = base magnitude * 3.6163

Regen Magicka's base magnitude is 20% and Fortify School's is 8%, so that means at best you should be able to add about 72% magicka regen or 29% fortify school to a single enchantment on one piece of equipment. With Extra Effect, you could add both to a helmet, armor and ring, and fortify school to a necklace, which brings you to +216% magicka regen and +116% fortify school, on your choice of apparel. That means you can reach the armor cap fairly easily, which equals 85% damage reduction.
The best stuff you can find would be something like the following:
Head: Morokei - +100% magicka regen (note that you would have to replace this for Mage Armor perks to work)
Ring: Ring of Peerless [School] - +25% fortify [school]
- or - Ring of Recovery - +100% magicka regen
Chest: Master Robes of [School] - +150% magicka regen, +22% fortify [school]
Neck: Necklace of Peerless Magicka - +70 magicka (AFAICT necklaces can be enchanted with Fortify [School] but generally aren't found as such)
So with the above equipment, you'd wind up +44% (or +144%) more magicka regen, -69% (or -94%) less fortify school, and +70% magicka and almost no armor rating. That may look comparable, especially given the tradeoffs in putting perk points in enchanting or anything else. But consider the following:

The real benefits to armor become clear the more you have. That is, each additional point in armor adds more to physical durability than the previous point. With clothes equipped, you lose out on perks like Custom Fit/Well Fitted, Matching Set even if you get the best possible gauntlets and boots.
A school fortified 100% (i.e. 0% magicka cost) is better than all the magicka regen out there for that particular school. Most mages focus on only a few schools, and there are benefits to concentrating.
Answer: As a mage around level 30 you can cast ironflesh which gives 80 armor. With mage armor 2 around that level it increases it to 200 armor.
You should always be moving and not getting hit at all with melee.
With enchanting at 100, you are able to finally enchant your own gear that surpasses the Archmage Robes.
Comment: TIL about free spells, makes me feel stupid for leveling up magicka so many times @Raven
Comment: Yeah, Ironflesh could work. I am always moving but when there are 5 of them, it gets a bit hard. I'm working towards enchanting 100 with Extra Effect but, will in definitely provide >100% magika regen?
Comment: @Coomie even better - it will allow you to reach -100% School reduction, i.e., free spells!
Comment: Yeah, that means my 500 magika is a HUGE waste. Metal note, invest in Health!
Answer: Whether accidentally or by design, the Fortify School and Magicka Regen enchantment's 2nd effect, the Magicka Regen, will always remain limited to 10%. (Fortify starts at 5%, and goes up with skill / perks)
So I guess the question really is, which is the "awesome enchantments" you're trying to get in the first place? A simple way would just to be to make your way to 100 enchanting and pick the Extra Effect perk, which would let you apply the Magicka Regen and Fortify School enchantments to a single piece, allowing both to scale normally.
Alternatively, you may just want to keep the Fortify School and Magicka Regen in the meantime - after all, the greater the fortify, the less the cost on your spells (and thus, the less need for regen!).
The big thing to take note of is that enchanting with anything less than a Grand Soul gem will earn you a fractional portion of the potential magnitude (I believe petty soul gems go all the way down to 1/12th the base magnitude!).
Alternatively, there's a simpler solution to survival: spend more level-ups on health! Armor is more effective the more health it has to protect!
Answer: You can't get Enchantment high enough to create those +150% robes. Presumably, it's a balancing factor to keep wizards wearing robes instead of home-made heavy armour.
However, with high enough Enchantment, you can create four items that give -25% Magicka cost. Together, you will have -100% Magicka cost and all spells will cast for free.
Answer: Or you could level up enchanting use a potion and do fortify (school) on chest, head, ring, necklace and that school can be free.  If you can put two enchantments on one item you could have two free schools of magic.
Comment: and if you find the enchantment reduce all magic (something like that i cant remember) and then do two enchantments. Reduce all magic and resist all magic you can have an infinite amount of magic and never take damage from magic.
Comment: I have this. Just imagine shooting firebolts and doing close wounds and all other great spell for FREE!!!
Answer: If you cheat, you can do the alchemy/enchanting loop and get good enchants on various items to equal or surpass the archmage robe or grand master robe, and while there is no enchanted non-armor gloves in the game, you can enchant non-armor gloves easily. Even if you do not excel in enchanting, even a minor enchant on gloves as oppesed to no gloves would help immensely. The enchanting options for gloves are not that expansive, but they do exist.
Answer: I think that robes are truly the best solution for mages. I stick to the archmages robes, because I use every school of magic and not just one, the amulet of saarthal(-3% magicka cost for all spells) and the diadem of the savant(-5% magicka cost for all spells). that way I reduce the magicka costs for all spells by 23%, 1% more than the master robes do for one school, and get +100% magicka regen and +50 magicka(the diadem of the savant does NOT cancel the "mage armor" bonuses). Then one should probably wear the Ring of Recovery(+100% magicka regen) and has an empty gloves slot. as there are NO enchanted non-armor gloves in the game, one can decide between not wasting 6 skill points and being OP enough anyways, or get the 6 skill points in enchanter 1-5 and Insightful Enchanter and enchant some non-armor gloves with up to +70 Magicka


How to remove JWT authentication from an API?

Question: There are some APIs in abc.js file which require authentication and there are some which do not need.
Below is an API in abc.js which do not need to be authenticated. This API is placed above the JWT authentication code.
router.get('/callback',function(req,res)
{
    if(req.method === "GET"){
        console.log(req.query.abc);
        console.log(req.query.abc);
        return;
    }
});

However, when I tried to call the API above. It returns no access token. Below is how I write my JWT authentication:
router.use(function(req, res, next) {

    // check header or url parameters or post parameters for token
    var token = req.query["access_token"] ;

    // decode token
    if (token) {

        // verifies secret and checks exp
        jwt.verify(token, process.env.SECRETKEY, function(err, decoded) {
            if (err) {
                return res.json({ success: false, message: 'Failed to authenticate token.' });
            } else {
                // if everything is good, save to request for use in other routes
                req.decoded = decoded;
                next();
            }
        });

    } else {

        // if there is no token
        // return an error
        return res.status(403).send({
            success: false,
            error: 'No access token.'
        });

    }

});

Any APIs below the code above would need to insert access token into the parameter. How can I call the callback API above without the need to insert access token into the parameter ? Currently, it keeps returning no access token when I call it.
Answer: router.use is middleware. It will be ran before any requests processing. So previous idea won't work.
The best way is to define a no auth route :
router.use('/callback', function(req, res, next) {
   next()
}, function(req, res, next) {

// check header or url parameters or post parameters for token
var token = req.query["access_token"] ;

// decode token
if (token) {

    // verifies secret and checks exp
    jwt.verify(token, process.env.SECRETKEY, function(err, decoded) {
        if (err) {
            return res.json({ success: false, message: 'Failed to authenticate token.' });
        } else {
            // if everything is good, save to request for use in other routes
            req.decoded = decoded;
            next();
        }
    });

} else {

    // if there is no token
    // return an error
    return res.status(403).send({
        success: false,
        error: 'No access token.'
    });

}

});
See express JS docs
Comment: it is still returning the same error. The If statement for callback API did not run when I put a breakpoint.
Comment: /callback?access_token={{access_token}} << this API got run instead.
Comment: I see; Router.use is a middleware processed before requests
Answer: Use below way
exports.isAuthenticate = async (req, res, next) => {
  // check header or url parameters or post parameters for token
  var token = req.body.token || req.query.token || req.headers['x-access-token'];
  if (!token) {
    return sendUnauthorizedRes(res, 'Access Token not specified.');
  }
  jwt.verify(token, constants.JWTContant.SECRET_KEY, async (err, response) => {
    if (err) {
      return sendUnauthorizedRes(res, 'Invalid access token.');
    } else {
      // if everything is good, save to request for use in other routes
      req.userInfo = response;
      if (await authModel.verify(token, req.userInfo.user._id)) {
        next();
      } else {
        return sendUnauthorizedRes(res, 'Invalid access token.');
      }
    }
  });
};

For API with authentication
router.get('/api/user', jwtHandler.isAuthenticate, userController.getUserDetails);

For API with no authentication
router.post('/api/login/facebook', authController.facebookLogin);


An infinite group isomorphic to its own automorphism group, but not complete, part 1

Question: An example of a non-complete group isomorphic to its own automorphism group is the dihedral group of order $8$.
But, this question is about infinite groups (specifically, non-cohopfian groups).

Question: Do there exist (necessarily infinite) groups $G$ for which $\mathrm{Aut}(G) \cong G$ satisfying the following property?
The center of $G$ is trivial, but $G$ has some outer automorphisms (so the conjugation action $G \to \mathrm{Aut}(G)$ is injective but not surjective).

Clearly, if $G$ satisfies this property, then it cannot be cohopfian. In particular, $G$ must be infinite.
Update: The other case has been moved to Part 2 per user1729's comment below.
Comment: An example (namely, the infinite dihedral group) has already been provided for the first property. Could anyone also think of an example for the second property?
Comment: Yes so your question has been answered.
Answer: The infinite dihedral group is an example with property 1.
Comment: @Geoffrey you'd be better asking that in a separate question, linking back to this one.
Comment: Is there also an example satisfying property $2$?
Comment: OK, the other case has been moved to [Part 2](https://math.stackexchange.com/questions/4062249/an-infinite-group-isomorphic-to-its-own-automorphism-group-but-not-complete-pa).
Comment: For Part 2, I was going to suggest a similar example but with the infinite cyclic normal subgroup of the dihedral group replaced by the group $C(2^\infty)$.


fast graph partitioning for mpi parallel

Question: I am new to graph partitioning, but I think the question I am asking should already have a good answer. I just want to partition a huge network (billions of nodes) into a few sub-graphs. so when using MPI, each sub-graph is processed by different processors. I am currently using the adjacency list representation of the graph. what algorithms can do this? Thank you!
Answer: Yes you can do this and there are several open source tools available. The tool I use most frequently is parMETIS.
It is a MPI - based parallel library which provides a variety of functions including graph partitioning. How you use this library is entirely dependent on your application. Generally, I prefer feeding the input graph to parMETIS, obtaining the partition and then feed the partitions as an input to my MPI programs, however you could also call the functions from your application for graphs which change in realtime.


How can I bring fire when a waterfall is in the way?

Question: During my playthrough I came across a cave which had a waterfall blocking the only entrance. The cave had a burnable basket (containing resources), but since my only way to carry fire is via torch, and the waterfall automatically puts it out, I couldn't get the resources.
Am I missing a skill which allows you to carry fire some other way than a torch or through waterfalls and should come back later when I have it, or should there some other method to bring fire to the cave via torch and should I explore other ways to enter it?
Answer: No need to explore further, you are missing the equipment that allows you to ignite the torch by yourself without an external ignition source.
You pick up this piece of equipment in the Cliffside village area right before you return to the Mountain Village after the next section of the game, you will be able to return and get the precious resources then.


How do I make a clan?

Question: When I create a clan in the multiplayer menu, it says clan created but I cannot add or invite people to my clan.
I go to create a new one assuming the request was canceled or not entered correctly, it says clan name already exists as if someone else created it.
Is this a bug?
Did I do it wrong?
Or am I missing something?
I'm on the PS3.
Will this also happen on my Xbox 360 Version?
Comment: What was the clan name? I can check to see if it has truly been created and if you're the only member for you if you wish.
Answer:
Download the COD app. The Call of Duty app lets you keep track of your multiplayer progress and awards using your mobile devices. The Call of Duty app is available for iPhones/iPads, Android, and Windows Phones:
iTunes: https://itunes.apple.com/us/app/call-of-duty/id733712309?mt=8&ign-mpt=uo=4
Google Play: https://play.google.com/store/apps/details?id=com.activision.callofduty.mobile
Windows Phones: http://www.windowsphone.com/en-us/store/app/call-of-duty/30ba0114-493e-47c5-8b0b-0cdbf9c35281
Launch the app. After downloading and installing the app, launch it from your device. Tap its shortcut icon on your phone or tablet's home screen to open it.
Create and name your clan. Once the app is open, scroll down the screen and look for the "Create a Clan" section located at the bottom. Type in the name you want for your clan on the text field provided.

Remember, you can't put special characters in your clan name.
Once you've entered the name you like, tap on the button labeled "Create a Clan" located just below the text field you typed the clan name on.
Once you've tapped the "Create a Clan" button and your clan has been created, you'll be taken straight to the Clan screen. The Clan screen contains all the information about your clan such as Wins, Kill Ratios, Level, Unlocked Achievements, and more.

Hope this helped you!
Comment: @Timelord64 While yes, this is no longer relevant, it's likely this has been removed all together. Similar to the Army of Two mask maker, the WaW server monitoring, or even the complete removal of the Battlefield: Bad Company 2 servers. I could be mistaken, but it's a possibility.
Comment: this is no longer a valid answer, as the Call of Duty app has been taken down.
Comment: Quite possibly, @Ben. I couldnt find any evidence that the feature is still there, myself.
Answer: What you need to do is when you create a clan go to the Call of Duty app and create your logo and what your clan's clan tag is gonna be and then you should be able to invite people.
Answer: You Can't Make A Clan Without The App.
[1]https://www.callofduty.com/ghosts/features/clans
Comment: The link you sourced doesnt not actually say that anywhere. Could you perhaps provide a direct quote from where you read it?

How do I make a clan?


restrict function pointer member template to only derived classes

Question: I'm trying to limit template deduction only to objects from the same hierarchy.
The code below compiles
template<class T>
void RegisterAction(const string& actionId, bool(T::*f)())
{
    m_actions.emplace(actionId, std::bind(f, static_cast<T*>(this)));
}

but this code doesn't
template<class T, typename std::enable_if_t<std::is_base_of<BaseClass, T>::value>>
void RegisterAction(const string& actionId, bool(T::*f)())
{
    m_actions.emplace(actionId, std::bind(f, static_cast<T*>(this)));
}

m_actions is of type std::unordered_map<string, std::function<bool()>>
Here is the error from Visual Studio
'BaseClass::RegisterAction': no matching overloaded function found
error C2783: 'void BaseClass::RegisterAction(const string &,bool (__cdecl T::* )(void))': could not deduce template argument for '__formal'

This is how you would use the method:
void DerivedClass::InitActions()
{
    RegisterAction("general.copy", &DerivedClass::OnCopy);
    RegisterAction("general.paste", &DerivedClass::OnPaste);
}

Btw, I can't use static_assert because there I'm using c++14.
Doesn't anyone has any idea?
Comment: How are you calling `RegisterAction`? [mcve] please.
Comment: `template>` will never be selected. You either need `template>` or something like `template = 0>`
Answer: You're trying to introduce a new template parameter in order to cause a substitution error---which is correct---but your syntax is slightly incorrect. What you should write is:
template<class T, typename = std::enable_if_t<std::is_base_of<BaseClass, T>::value>>
                       // ^^^ this equal sign is crucial

When you write typename = foo, you're declaring an unnamed type template parameter (it's like writing typename unused = foo) and making the default value for that type foo. Thus, if someone tries to instantiate this template with T not derived from BaseClass, a substitution failure occurs in the default argument, causing deduction to fail.
Since you wrote it without the equal sign, typename std::enable_if_t<...> was interpreted as a typename-specifier, that is, the compiler thinks you're declaring a non-type template parameter whose type is typename std::enable_if_t<...>, which you have left unnamed. Consequently, when T is derived from BaseClass, the type of this template parameter is void. Since non-type template parameters cannot have type void (as there are no values of type void), a SFINAE error occurs here.
Interestingly, both GCC and Clang also fail to give a useful error message. They also complain that the unnamed template argument cannot be deduced, rather than pointing out that void non-type template parameters are invalid (or even just pointing out that it is a non-type template parameter of type void).
Comment: FWIW, [using a default template type argument comes with it's own problems](https://stackoverflow.com/questions/15427667/sfinae-working-in-return-type-but-not-as-template-parameter).  They can use `template::value, bool> = true>` instead to avoid the problem.
Answer: When it is intended to use RegisterAction to register only for those classes that are derived from BaseClass, is seems that it is better to state with static_assert explicitly why some T cannot be used with RegisterAction instead of just "hiding" the problem with SFINAE.
So
template<class T>
void RegisterAction(const string& actionId, bool(T::*f)())
{
    static_assert(
        std::is_base_of<BaseClass, T>::value,
        "T shall be derived from BaseClass for RegisterAction to work"
    );
    m_actions.emplace(actionId, std::bind(f, static_cast<T*>(this)));
}

will scream loudly and clearly about exact reason of why RegisterAction cannot accept some actions.
Comment: "it is better" -- I have to disagree. It depends on the situation. It's often a nicer solution to `static_assert`, but it's often necessary to SFINAE. SFINAE also does reveal the reason why the overload was rejected, it's just harder to decipher.


Naming conventions for MVVM?

Question: I'm struggling a little over naming classes for my MVVM application.
I have a TrainingCourse, which is called a TrainingCourseViewModel, but I can have many of these, so I have created a TrainingCourseViewManager to hold the list of courses and allow them to be added/removed. I also have an EmployeeViewController which has a reference to other view models as well as the TrainingCourseViewManager.
The EmployeeViewController essentially wraps all of the other view models and view managers and when its instantiated it gets the employee and in turn instantiates each of the view models and view managers.
The question is... What naming conventions are people using?
Should my TrainingCourseViewManager be called TrainingCoursesViewModel and should my EmployeeViewManager be called EmployeeViewModel?
Thanks
Answer: There might be a confusion over the role of view model.
Classes in your example (and in Orion's answer to that matter) seem more like actual data model. For example, it doesn't make sense for a view model to "hold the list of courses and allow them to be added/removed" - that's what data model should do. Add and remove operations on a view model wouldn't operate on the collection itself - instead, they would access and modify underlying data model.
Do properties of TrainingCourseViewModel class store actual data values, or wrap properties of some TrainingCourseDataModel class (with additional processing)? Or if you need to serialize data, would you serialize TrainingCourseViewModel objects? If former is true, you are binding directly to the data model, and there should be no 'ViewModel' suffix in names.

On the topic of naming conventions, if names become too complex, namespaces can help. For example:
namespace TrainingCourseView.ViewModel
{
class TrainingCourse {}
class Manager {}
class Controller {}
}
...
Data.TrainingCourse course;
new ViewModel.TrainingCourse(course);

Comment: My TrainingCourseViewModel is a wrapper for the TrainingCourseModel class. An employee can have many courses so I have to store each TrainingCourseModel in a list. I then have a list of TrainingCourseViewModels which exposes each Training Course. I bind to this list from the view. I have a class that allows a course (TrainingCourseViewModel) to be added/removed to the list , because otherwise it would have to add them directly to the Model, which means that I would have to expose the collection of TrainingCourseModels to the view and I wouldn't be able to format the data as I want it.
Comment: I want to format all of my data in the view model rather than using converters, as I don't want a mix of the two, so I've opted to expose all string properties in the view model that formats/converts to the correct value. If I don't do this then I would have to format in the model, which I don't want to.

I appreciate any help with this.
Comment: "because otherwise it would have to add them directly to the Model" - no, you'll have to add them to the collection of data model objects. This collection can well be temporarily, created in some function like:

DataCollection data = FilterData();
ViewModel vm(data);
view.DataContext = vm;
Comment: When you have multiple Views for the same ViewModel that last naming convention is not helping at all (TrainingCourseView.ViewModel)
Answer:
Should my TrainingCourseViewManager be called TrainingCoursesViewModel and should my EmployeeViewManager be called EmployeeViewModel?

What are your window classes called? (what is your .xaml file called?)
The naming convention goes, that you create one ViewModel class per View (a view is a .xaml/.xaml.cs pair)
If you have a single window which displays a list of Employees and Training Courses, then you'd have something like this:
namespace Models
{
  public class Employee : INotifyPropertyChanged { ... }
  public class TrainingCourse : INotifyPropertyChanged { ... }
}

namespace ViewModels
{
  // assuming you have TrainingWindow.xaml

  public class TrainingWindowViewModel : INotifyPropertyChanged
  {
    public ObservableCollection<TrainingCourse> TrainingCourses
    { get{ return m_trainingCourses; } }
    { set{ m_trainingCourses = value; RaisePropertyChanged("TrainingCourses"); } }

    ...
  }

  // so on and so forth
}

Naming conventions for MVVM?


order_by working fine in sqlite but not in postgres

Question: I have a model with replies and in template the replies with highest upvote should come first.
In my local machine its coming correctly however on server replies are filtered based on FK of upvote field.
Model:
class solution(models.Model):
    doubt=models.ForeignKey(doubts,related_name='answers')
    reply=models.TextField()
    snapshot = models.FileField(upload_to='support',null=True,blank=True)
    created = models.DateTimeField(auto_now_add=True)
    updated = models.DateTimeField(auto_now=True)
    user=models.ForeignKey(settings.AUTH_USER_MODEL,null=True,blank=True)
    upvote = models.ManyToManyField(User,related_name='upvoteuser')

    @property
    def total_upvotes(self):
        return self.upvote.count()

    def __str__(self):
        return str(self.doubt)

view
def ticketdetails(request,slug,pk):
    ticketis=doubts.objects.get(pk=pk)
    replies = ticketis.answers.all().order_by('-upvote')

    if request.method== 'POST':
        form=replyform(request.POST)
        if form.is_valid():
            new_form=form.save(commit=False)
            new_form.user=request.user
            new_form.doubt=ticketis
            new_form.save()
            form=replyform()
            return HttpResponseRedirect(reverse('ticketdetail',kwargs={'slug':ticketis.slug,'pk':ticketis.id}),messages.add_message(request, messages.SUCCESS,'Response submitted succesfully.'))
    else:
        form=replyform()
    return render(request,'ticketview.html',{'ticketis':ticketis,'replies':replies,'form':form})

Comment: What part of the upvote model are you trying to order on? does that have any ordering specified?
Comment: Upvote field with most upvotes count should be first.
Answer:
Upvote field with most upvotes count should be first.

This isn't what your ordering is doing, at all
From the docs:

If you try to order by a field that is a relation to another model, Django will use the default ordering on the related model, or order by the related model's primary key if there is no Meta.ordering specified.

If you're trying to order by the count of something then you'll need to annotate it first and then order based on that
Your view is talking about a different model to the one you've shown but the solution will still look similar to below
 Solution.objects.annotate(upvote_count=Count('upvote')).order_by('upvote_count')

Comment: Local machine works with your code either because it's pure luck or because you are using a lesser RDBMS. Postgresql is much closer to standard compliance and sqlite
Comment: @PulkitSharma - Pure luck.


Help with formatting HDDs and removing partitions that were used in Windows before

Question: I have a desktop computer with only Ubuntu 20.04 installed. I have a few HDDs inside for storage that were used in a windows system before and are showing small windows partitions that I'm not able to remove with the Disks app, there is an error every time I try. Does someone knows how to wipe completely these drives and have them like factory new? I really don't want to see these little partitions anymore. thanks in advance for your help! :)
Comment: If Windows fast start up is still on, the hibernation flag is set on the NTFS partitions. Then the Linux tools will not work on them to prevent damage to the hibernated systems. You may need to remove the hibernation flag. https://askubuntu.com/questions/843153/unable-to-mount-windows-10-partition-it-is-in-an-unsafe-state &
https://askubuntu.com/questions/145902/unable-to-mount-windows-ntfs-filesystem-due-to-hibernation
Comment: With Gparted, Device menu > New partition table (choose GPT because it's much better than the alternatives) it's a guaranteed way of cleaning everything. Then you can create new partitions. That said, I don't know what exactly you're talking about and I suspect the drives are maybe defective.
Answer: Gparted should be able to do this. It's pre-installed on a live USB but not the normal installation, but you can download it from Ubuntu Software. You should be able to see / resize / delete any partition that isn't currently mounted using Gparted. If you want to delete all partitions except for the one you are using (ie the live Ubuntu partition) then there is no risk ... obviously if there is anything on any of the partitions you might ever want, be very careful about which ones you select to delete.


How do I wire this ceiling lamp?

Question: I have this metal ceiling lamp but it have two earth wires, one for the holder on the ceiling and one for the cover of the bulb, and I don't know if I have to connect them to the house wires or just leave them... can you explain me what to do with them?
Comment: All those things need grounding.
Answer: You're meant to wire nut both fixture grounds together, and connected them to the 3rd wire ground on the circuit.

How do I wire this ceiling lamp?


how to debug coffeescript in node.js with webstorm 6 source maps

Question: I've set up the coffeescript file watcher like in this video
http://www.youtube.com/watch?v=Sl1Uk3zT5Fg
Which seems to work fine for an html project debugging with google chrome.  However, when I start debugging and set a breakpoint in the coffeescript file in a node.js project, it doesn't hit the breakpoint.  Setting a breakpoint in the generated js file does however get hit.
What do I need to do for the debugger to use the generated source maps and step through the coffeescript with node.js in webstorm 6?
Comment: Good question!  I am looking for this as well.
Comment: Follow [this issue](http://youtrack.jetbrains.com/issue/WEB-7091).
Comment: Hmm looks like the current workaround of moving the generated SourceMapping comment to the bottom of the file is cumbersome and unweildly
Comment: I have a similar question. http://stackoverflow.com/questions/14533885/which-ide-supports-coffeescript-debugging-source-mapping-breakpoints-call-st
Answer: The just released CoffeeScript 1.6.2 now has the annotation for the source map at the bottom as WebStorm expects so it now works as expected.
Answer: According to the issue that CrazyCoder mentioned, it looks like it is an issue with WebStorm expecting the <code>//@ sourceMappingURL=print.map</code> statement at the bottom of a generated JavaScript file rather than at the top which is where the coffeescript compiler currently puts it.
Manaually copying that line to the bottom of the generated script file on every save seems not a viable workaround so I think we'll have to watch that Webstorm issue  until it is resolved.


Please explain the foreign_key and local_key in Laravel ORM relationships

Question: I'm effectively trying to define the relationships between users (sender and recipient) and messages.
My Messages migration is:
<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMessagesTable extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
        Schema::create('messages', function($t){
            $t->increments('id');
            $t->integer('sender_user_id')->unsigned();
            $t->integer('recipient_user_id')->unsigned();
            $t->string('subject');
            $t->text('content');
            $t->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
        Schema::dropIfExists('messages');
    }

}

My Message model was straightforward:
<?php

class Message extends Eloquent{
    // link to sender user id
    public function from(){
        return $this->hasOne('User', 'sender_user_id');
    }
    // link to recipient user id
    public function to(){
        return $this->hasOne('User', 'recipient_user_id');
    }
}

But I'm unsure in defining the hasMany relationships in my User model.
The docs (http://laravel.com/docs/eloquent#relationships) shows the following:
return $this->hasMany('Comment', 'foreign_key');

return $this->hasMany('Comment', 'foreign_key', 'local_key');

Now, I'm confused which key is which in the latter hasMany relationship. Which is correct for my User model?
public function sentMessages(){
    return $this->hasMany('Messages', 'id', 'sender_user_id');
}

public function sentMessages(){
    return $this->hasMany('Messages', 'sender_user_id', 'id');
}

Answer: You have to set your relation like this:
public function sentMessages()
{
    return $this->hasMany('Messages', 'sender_user_id');
}

public function receivedMessages()
{
    return $this->hasMany('Messages', 'recipient_user_id');
}

Comment: Does Eloquent know to use id on User?
Comment: Yes. By default, primary keys are known by Laravel as id, if you have a different name for the primary key on User, you have to set it as the $primaryKey property on the User model. But, in the two cases, you don't have to set it in the hasMany function call as Laravel know to pick the default one or from the $primaryKey property of the model


How do i configure the live usb to install additional packages?

Question: I have saved all the packages from the directory /var/cat/apt/archives to Usb.
Is it possible to configure the live Usb to accommodate all these extra  packages /var/cache/apt/archives; so that it installs all of them during the fresh install / reinstall process.
I don't want to install each of the downloaded package manually.
Answer: There is a way to do this by using software like Ubuntu Builder (This is only one way be sure to explore others)
Ubuntu Builder allows you to create your own Ubuntu based distribution in clicks. You are free to choose your own desktop environment, window manager, packages etc, and customize Ubuntu the way you want. You can download the latest .deb files here.

Be sure to do more research and return here if you have any additional questions
Comment: @Exeleration-G  Saw the link you added.  I am happy to keep it there but my answer wasn't to advocate Ubuntu Builder.  It was to suggest to the OP to use something like Ubuntu Builder (being one option).  Thanks
Comment: Well, I just guessed that I could spare the AU'ers a Google search :-D
Answer: No, you can't have the Live USB install them automatically.
However once the installation is complete, you can open the USB in the terminal, go to the directory with the backed up files, and type the below to install them all:
sudo dpkg --install *.deb


Is there a difference in declaring instances of inherited classes in these different ways?

Question: If I have a class called "Animal", and a derived class "Bird : public Animal", I can create a Bird these two ways:
Animal *sparrow = new Bird;
Bird *sparrow = new Bird;

Both compile fine and work as expected. Are they equivalent? Should I prefer one over the other?
Answer: The line, in itself, doesn't demonstrate the difference. However, assume Bird declares a method Fly that doesn't exist on Animal. You wouldn't be able to do:
Animal* a = new Bird;
a->Fly();

on the other hand, this is legal:
Bird* b = new Bird;
b->Fly();

The distinction here is a result of the fact that C++ is a statically typed language. The static type of the variable is what the compiler cares about when it's verifying things like method calls. Since the static type of the variable a is Animal which doesn't have a Fly method, the compiler will not allow you to call Fly on it (not all animals are able to fly, so you'll have to explicitly cast to Bird: dynamic_cast<Bird*>(a)->Fly() is legal).
The expression new Bird will have the type Bird*. If you assign a value of a derived type to a variable of a based type, the compiler will not complain (all Birds are Animals, so it should always work). Basically, the compiler upcasts Bird* to Animal*. The reverse is not true. Not all Animals are Birds, so you'll have to take the responsibility and do the cast explicitly and tell the compiler that I know that object is really a Bird*. Only in that case the compiler will let you to use Bird-specific features. So, in general, if you need to use a Bird-specific member, you'd better use Bird* b = new Bird;.
Comment: I think I understand. A follow up to clear it in my mind:

Animal *A = new Animal;
Animal *B = new Bird;

With these declarations, is there any difference between A and B? (question asked before some edits above)
Comment: @Jarred: Yes, the object pointed by `A` is not really a `Bird` whereas the object pointed by `B` is still really a `Bird` and you simply decided not to care at the moment that it is (since your function applies to all animals equally and doesn't rely on anything specific to birds). Since `B` is a `Bird`, you can successfully downcast it to `Bird*` again and use `Bird` specific members. Casting `A` to `Bird*` won't succeed.


Document Viewer (Evince) fails to open hyperlinks in a PDF document

Question: While viewing a PDF document in evince, clicking on a hyperlink (a web link in this case) causes the cursor to change to a rotating 'busy' symbol and the browser is not launched. Using dmesg to view errors, I see the errors below. This began about a month ago. I'm not aware I have changed anything in my configuration. Ubuntu 21.10 fully updated. Brave browser (1.32.113) is default.
[32979.539575] audit: type=1400 audit(1638841732.708:94): apparmor="DENIED" operation="exec" profile="/usr/bin/evince//sanitized_helper" name="/opt/brave.com/brave/chrome_crashpad_handler" pid=39499 comm="brave" requested_mask="x" denied_mask="x" fsuid=1000 ouid=0
[32979.539807] traps: brave[39499] trap int3 ip:5616e1a1c3c1 sp:7ffe260ee8a0 error:0 in brave[5616dd77b000+9d5e000]

Answer: The answer by Riyan produced an error for me, but the following command worked:
sudo ln -s /etc/apparmor.d/usr.bin.evince /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/disable/usr.bin.evince

, see https://linuxconfig.org/how-to-disable-apparmor-on-ubuntu-20-04-focal-fossa-linux.
Answer: This is a known issue with apparmor and evince, and the gnome devs believe that since it is a problem with apparmor, it doesn't fall within their responsibilites. So it's upto the users/distros to set the apparmor profiles correctly.
See this issue on gnome's gitlab: https://gitlab.gnome.org/GNOME/evince/-/issues/1090
I had the same problem and either this post fixed it: https://askubuntu.com/a/1214362/1554738
or because I disabled the apparmor profile for evince
https://help.ubuntu.com/community/AppArmor
I used the following command from there to disable the apparmor profile:
Disable one profile

sudo ln -s /etc/apparmor.d/usr.bin.evince /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/profile.name

You have to restart your computer after.
Comment: I get `File /etc/apparmor.d/profile.name not found, skipping...` (Ubuntu 20.04)
Comment: The following worked for me:
`sudo ln -s /etc/apparmor.d/usr.bin.evince /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/disable/usr.bin.evince`, see https://linuxconfig.org/how-to-disable-apparmor-on-ubuntu-20-04-focal-fossa-linux.
Answer: You can use the apparmor-utils to debug and disable profiles. This package is available in Ubuntu 20.04 and also in some Debian releases such as Bulleye (where I'm testing).
sudo apt install apparmor-utils
sudo aa-complain /usr/bin/evince

Test the link in the PDF again. Rather than blocking the operation this time, it should open the link in your browser while logging to /var/log/syslog. This works for me and evince now fires URLs as expected.
Complain mode means that "violations to the policy will only be logged" (https://wiki.debian.org/AppArmor/HowToUse). You can also disable the policy for the application:
sudo aa-disable /usr/bin/evince

URLs should now fire without logging messages appearing in /var/log/syslog. Or you can re-enable the policy:
sudo aa-enforce /usr/bin/evince

I had to reload the PDF in evince for policy to be enforced again (URLs to be blocked).
You can check status of apparmor profiles and processes currently running with enforced or complain profiles (at any time during your testing) using:
sudo aa-status

More information: https://wiki.debian.org/AppArmor/HowToUse
Comment: Thanks @hgb. That looks like a good solution. What I had finally done was remove the instance of evince shipped with Ubuntu and installed the flatpak version. I don't believe it's been a problem since.
Answer: add the lines
  /usr/local/bin/** rix,
  /usr/local/lib/** rix,

around line 55 in /etc/apparmor.d/abstractions/evince (let's say, before # supported archivers)
Then apparmor_parser -R /etc/apparmor.d
Answer: (This answer is based on my understanding after researching the matter for about 20 min.)
Most answers here effectively disable AppArmor for Evince. But AppArmor is software that enforces an applications permissions on your system. Since pdfs that you open in Evince can contain all kinds of scripting, this is possibly unwise.
@am70's answer is more specific: it gives Evince the following permissions over all files in the given paths:

Reading (r),
Execution with inherited permissions (ix), i.e. Evince can call the apps living there and they will inherit Evince's permissions.

However, this answer did not work for me because those paths are not where my browser lives. I did which firefox (because Firefox is my default browser) and got the answer /usr/bin/firefox so after quitting Evince, I added the permission
  # allow firefox
  /usr/bin/firefox ixr,

to the file /etc/apparmor.d/abstractions/evince (after # supported archivers although I guess it does not matter) and then reloaded all the AppArmor policy files (I assume that's what they are) using
sudo apparmor_parser -R /etc/apparmor.d

Evince now opens links in Firefox when I click them.
Comment: It seems you need to rerun `sudo apparmor_parser -R /etc/apparmor.d` every session…


What does scripts "npm run dev" and "npm run watch" is used for?

Question: I'm new in vue, and a documentation says that every time I create a component I have to run npm run dev and npm run watch.
But don't know what their purpose is?
Can someone help me?
Answer: npm run dev combines all your Vue components and other JavaScript files into a browser-friendly combined file.
npm run watch does the same, but then it stays active and "watches" for updates to your .vue and .js files. If it detects a change, it'll re-build the browser-friendly file so you can just refresh the page.
Answer: Technically those will just run whatever scripts are defined in your package.json with the name dev and watch. Without seeing your package.json it's impossible to know exactly what they do.
For most project configurations those commands will compile your Vue components into raw javascript. The difference between dev and watch is the dev command will compile the code then exit while the watch command will compile the components then watch the files and recompile when one of them changes.
Comment: When writing 'run' in last sentence you probably refer to ,dev' as both commands contain 'run'?
Comment: @SimonThiel Correct, thanks. I've updated my answer. In the command `npm run watch` *npm* is the package manager, *run* is a specific command for the package manager to execute, and *dev* an the argument for the command. In this case it is telling *npm* to *run* the script called *dev/watch*.


Making function for checking is file name exist in external storage

Question: I have two Activities .
1.TestActivity : It show list of test document , when user clicks on a button will download the doc.
2.ShowDownloadedActivity: It shows list of downloaded files (list of file in external storage ).
In the TestRecyclerAdapter I need a method to check whether file already downloaded (in other word is file exist in external storage ?) or not ? if its already downloaded it has to show different text for user (some thing like "downloaded" ).
For achieve this I want to check whether the filename exists in the list of files ("External storage ").
This is the onCreate of ShowDownloadedActivity :
 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_show_downloaded_file);

        String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/my.package.name/files/downloaded".toString();

        File file = new File(path);
        File list[] = file.listFiles();

        if(file.listFiles() != null){
            for(int i=0; i<list.length ; i++){

                ModelShowFile modelShowFile = new ModelShowFile();
                modelShowFile.setTitle(list[i].getName());

                mylist.add(modelShowFile);
            }

            recyclerView = (RecyclerView)findViewById(R.id.recycler_ac_show_downloaded_file);
            recyclerView.setLayoutManager(new LinearLayoutManager(ShowDownloadedFileActivity.this));

            adapter = new AdapterRecyclerShowFile(ShowDownloadedFileActivity.this,mylist);
            recyclerView.setAdapter(adapter);
        }
        else {
            Toast.makeText(ShowDownloadedFileActivity.this , "Nothing yet !",Toast.LENGTH_SHORT).show();
        }
    }

Edit :
Guys I need one method in ShowDownloadedActivity with filename as string parameter to check , i.e file with passed fileName is already exists in external storage or not ? that's it .
Thanks :
Comment: Do you have a question?
Comment: what is the issue you are facing? and are you sure you want to use this line as is: "String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/my.package.name/files/downloaded".toString();" check android docs for more info on it
Comment: Your question not Clear. Please explain more
Comment: @яσѕρєяK I update the question
Comment: Have you tried implementing that or Just asking us to do it for you ??
Comment: @jankigadhiya , ummmmm no i tried .  i just want help !
Comment: Show us what you have tried we will surely help if you are facing any difficulty..!!
Answer: Try this it may be help to you
 public boolean checkDownload(String filenameWithExtension)
 {
    File extStore = Environment.getExternalStorageDirectory();
    File myFile = new File(extStore.getAbsolutePath() + filenameWithExtension);
    return myFile.exists();
 }


retrieving alphabetic based data from an Indexed array

Question: here is my question I have an Indexed array with n number of data I wanted to get data which starts from a particular letter.
array(
    1 => 'Jim'
    2 => 'Rao'
    3 => 'Mathew'
    4 => 'Raj'
    ...
)

eg: I need to get data starts from 'R'
any help will be really appreciated.
Thanks!
Comment: Do you need to retrieve only words that start with 'R' ?
Answer: foreach ($array as $value)
{
    // we compare the first letter of every word in the array to R
    if (substr($value, 0, 1) == "R")
    {
        // if the first letter is R, we put the value in a new array $result
        $result[] = $value;
    }
}


GitHub and VS 2012 synchronization

Question: Is it possible to sync my solutions of VS 2012 to directly merge with the repositories in GITHUB?
Like if I made a solution or project in VS 2012 will i be able to directly update it into a repository from VS 2012?Is there a additional plugin  available?
Answer: I got the solution just surfing on the web.The Link is here.Little details have been given below.
The Only issue is its for CodePlex not for GITHUB

Brian Harry made two major announcements today at the ALM Summit.
   1.Visual Studio will support Git
   2.Team Foundation Server will host Git repositories.   When we added Git to CodePlex back in March of last year a missing piece, for many
  customers, was having great Git tooling within Visual Studio.   With
  the CTP release of Visual Studio 2012 Update 2 plus the CTP of the Git
  VSIX you can now use Git within Visual Studio. The CodePlex team has
  been dogfooding the tools for the last few months and we look forward
  to getting public feedback.   Using VS Git with CodePlex   Since the
  Visual Studio Git client works with any Git remote you can easily
  configure it for your CodePlex Git projects.

GitHub and VS 2012 synchronization


How to get file creation date on server for jQuery/uploadify?

Question: I am using the jQuery Uploadify plugin on a web page to transfer files from the local computer to an ASP.NET MVC2 control action method. Is there a way to transfer the creation date/time of the file to the server?
I can get at the data in an Uploadify event on the client, but can not figure out how to "package" that data so it is moved to the server w/ the file.
Any thoughts appreciated.
Answer: Try using onSelect event to add values to the scriptData object.
UPDATE: The following is an ad-hoc view to pass the data to the action. It appears that modificationDate returns a Unix timestamp in it's time field and you'll have to convert it on the server side. I wasn't able to find any documentation on modificationDate property.
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <title>Home</title><link href="/Scripts/uploadify.css" type="text/css" rel="stylesheet" />

    <input id="file_upload" name="file_upload" type="file" />

In your action method, you can grab timestamp through the Request.Form["modifiedTimestamp"]. Check here on how to convert timestamp to the DateTime object.
Comment: Thanks Artem. This provides good info on how to approach the solution. I'll confirm after trying to implement it.
Comment: Finally got around to implementing this suggestion which worked well. One thing to note is the timestamp value is in milliseconds which is important when converting to the DateTime object. Also, modificationDate has regular date properties like .fullYear etc.


Get column names if column contains matching value (without VBA)

Question: Given a named range Table1, how do I return all names from the array Table1[#Headers] where a matching input value exist in that column?

a
b
c

1
2
3

4
5
2

6
1
2

For the above sample data, I would like to return

search_value
headers

1
a,b

2
b,c (or b,c,c)

3
c

With the above sample data, I can count the occurrences of a named search_value with the formula =SUM(--(Table1=search_value)). Given the existing True/False array from that formula, I've been trying to get relative cell mapping information. Sadly

XMATCH only evaluates on a 1-dimensional array
AGGREGATE is promising but I've so far been unable to evaluate CELL("address",{}) (or similar) such that it returns an array that I can use with AGGREGATE

The workbook in question is a shared workbook hosted in OneDrive so I'd like to avoid VBA if at all possible.
Answer: One way (with Office 365) would be:
=FILTER(Table1[#Headers],BYCOL(--ISNUMBER(MATCH(Table1,E2,0)),LAMBDA(x,MAX(x))))

where E2 is search value.

concatenated
Sorry - I just realized that you want a concatenated output:
=TEXTJOIN( ",", 1, FILTER(Table1[#Headers],BYCOL(--ISNUMBER(MATCH(Table1,E2,0)),LAMBDA(x,MAX(x)))) )

Another approach based on Excel for Web
This depends on SEQUENCE which is supported in Excel for Web. Hopefully, it works on Sharepoint. If not, then there is a (cumbersome) way to tease out sequences using ROW(), but it would be easier if you don't have to go there.
=TEXTJOIN(",",1,
     UNIQUE(IFERROR(INDEX(Table1[#Headers],
                    LARGE(IFERROR(MATCH(Table1,E2,0)*COLUMN(Table1[#Headers]),-1),
                          SEQUENCE(,COLUMNS(Table1),COLUMNS(Table1),-1))),
                    ""),
            1) )

Comment: Sure @PeterVandivier  - I have just picked up LAMBDA helpers and, honestly, don't think I know MAKEARRAY well enough to pull that off either. BYCOL, BYROW and SCAN are becoming my hammer. ;-)
Comment: I think you just saved me an hour of rubber-ducking with [`MAKEARRAY`](https://web.archive.org/web/20210727103412/https://support.microsoft.com/en-us/office/makearray-function-b80da5ad-b338-4149-a523-5b221da09097). TY!
Comment: Worth noting that the Excel web viewer (for SharePoint & OneDrive hosted docs) doesn't seem to support this at this time. But I imagine that's what you were communicating with the Office 365 comment.
Comment: @PeterVandivier - actually, I didn't know that. In this case, there is a non-LAMBDA approach, but I have to think about it.
Comment: @PeterVandivier - i am not sure if SP can support SEQUENCE, but it is supported for Excel for Web and that gives me hope. In any case, I added an another approach. I hope it works. I guess, this is what I meant by "BYCOL being my hammer". Once I know it exists, then the brain will take the path of least effort.
Comment: Can I suggest you post the `SEQUENCE` solution as a second answer? Firstly because it seems to have an off-by-one error as written. Secondly because I think my comment about the web viewer was inaccurate/incomplete. Looks like for whatever reason I got opted into some beta corporate licensing situation with my O365 download and those formulas weren't available on the machines of other folks on my same team.
Comment: Ah, no, not strictly an off-by-one. I was just starting my `Table1` in B2 instead of A1 so `COLUMN(Table1[#Headers])` is offsetting based on that. Using `(COLUMN(Table1[#Headers])-CELL("col",Table1)+1)` yields a more complete answer. It also contains the duplicate values (which is worth mentioning as an alt behaviour)
Comment: Hi @PeterVandivier - I see your point on duplicate answers. I did not think of it or test it. A good cure for that would be UNIQUE. I will put that in the answer above. I did not quite follow the point on the off-by-one, but I think you're saying it's OK now.


How to edit /etc/kubernetes/manifests/kube-apiserver.yaml (using minikube)

Question: I want to add those flags : --insecure-port=8080 and insecure-bind-address=0.0.0.0 so I need to edit this file :/etc/kubernetes/manifests/kube-apiserver.yaml. However, I've done some research and I've found out that I should run this command: minikube ssh. After that, when I found the file and when I try to edit it I get sudo: nano command not found .
vim didn't work as well although I tried to install them but i got a whole bunch of errors.
Answer: After running minikube ssh command and switching to sudo mode by sudo -i, you can install editor to the ubuntu base using:
sudo apt update && sudo apt install -y vim-tiny
P.S: For me vim-tiny worked well and then I could able to edit the /etc/kubernetes/manifests/kube-apiserver.yaml file using vim commands.
There is also a closed issue on Minikube on this topic.


Bifurcation analysis of subsystem

Question: I'm confused about a question in dynamical systems, and whether it can be done at all.
Say we consider the lorenz system
$
\dot{x} = \sigma(y-x)\\
\dot{y} = x(\rho-z)-y\\
\dot{z} = xy-\beta z
$
And we seek to do a bifurcation analysis, but we are for other reasons only interested in the bifurcation of the subsystem $\lbrace\dot{x},\dot{y}\rbrace$. How can we analyse this? Do we then consider $z$ to be a fourth parameter, which is time dependent?
Ideas are welcome
Answer: It really doesn't work like that: either $z$ "matters" or not, and in the first case it isn't possible to do what you want.

Luckily $z$ actually doesn't matter in this equation, at least a the origin, in the following sense:

When one linearizes the system, the third equation becomes $z'=-\beta z$. Since $\beta$ is usually assumed to be positive, this doesn't contribute to any bifurcation.
On the other hand, the linearization of the first two equation doesn't include the variable $z$ and you can check that there is a bifurcation at $\rho=1$ passing from a saddle to a sink.
This bifurcation is also (necessarily) present in the full linearization and so also in the original equation (because it goes from a hyperbolic equilibrium to a hyperbolic equilibrium).
Comment: Would it be possible to look at the dynamics in the poincare section spanned by the $xy$-phaseplane?
Comment: That's an entirely different question, how does it relate to **your** question?
Comment: Maybe my formulation was clumsy, I'm interested in the dynamics in the $\dot{x}\dot{y}$-phaseplane. In doing a bifurcation analysis of this subsystem.
Comment: Would you agree that I have already replied to **your** question?
Comment: I don't think so. I wanted to do a bifurcation analysis of the subsystem $\dot{x}\dot{y}$ and asked if this was possible, which you wrote wasn't. Then I asked if planting a poincare section in the $\dot{x}\dot{y}$-phaseplane and considering the dynamics in this poincare section wasn't excactly what I wanted to do?
Comment: OK, good luck then. Next time you might be more appreciative after getting a complete reply such as mine. Might get more attention... Also, you need to study, a lot.

Bifurcation analysis of subsystem


stoppropagation not working jquery mobile?

Question: stopPropagation not working with my JQuery Mobile mobile application..
My Code:
Html:

   <input type="checkbox" name="sortList" class="checkboxGroup" data-role="none">

js:
$(document).on("vclick","#tmpl li",function(){
alert("li clicked");
});

$(document).on("vclick",".favorite i",function(e){
alert("checkbox clicked");
e.stopPropagation();
});

css:
input[type="checkbox"] {
    display:none;
}

input[type="checkbox"] + i:before {
    content:'\e809';
    color:lightgray;
    font-family: "icon-font"; font-style : normal; text-shadow:none;
}
input[type="checkbox"]:checked + i:before {
    content:'\e809';
    color:red;
    font-family: "icon-font"; font-style : normal; text-shadow:none;
}

When try to click the checkbox getting alert as checkbox clicked after that immediately it alert as li clicked. But i need  checkbox clicked alert message only when i try to click checkbox.
and also tried use  $(document).on("vclick", ".favorite", function(e) {}) instead of $(document).on("vclick", ".favorite i", function(e) {});
this is working fine. but this method execute twice when it click.
Can u advice me how to solve this issue
lib

jquery-2.1.1.min.js
jquery.mobile-1.4.3.min.js
Answer: I had similer issue and it resolved with using stopImmediatePropagation() method instead of stopPropagation().
Please try to use
e.stopImmediatePropagation();

Instead of
e.stopPropagation();

Answer: You are triggering the function on the document, which makes is go all the way to the top of the DOM and then searches down the tree. Instead, trigger the vclick event directly on the elements.
Change you're code to:
$("#tmp li").on("vclick",function(){
    alert("li clicked");
});

$(".favorite i").on("vclick",function(e){
    alert("checkbox clicked");
    e.stopPropagation();
});

Also, check this DEMO
Comment: no he's not, the second arg he passes to on specify a selector that the event should be applied on


Is it true that $\inf\{\|x+y\|:x\in X, y\in Y\}\le\inf\{\|x\| +\|y\|:x,y\in X\}$?

Question: Let $(X,\|\cdot\|)$ be a normed space. Is it true that $\inf\{\|x+y\|:x,y\in X\}\le\inf\{\|x\| +\|y\|:x,y\in X\}$?
I need it in order to finish a proof. It seems easy, but I don't see the proof. Could anyone please help?
Comment: What is a closed normed space?
Comment: Seems to follow straight from triangle inequality.
Comment: @JoséCarlosSantos oops, my bad! I added more than I needed. I'll change it. It had to do with a closed subspace of a normed space, but I didn't remove the 'closed' for whatever reason.
Comment: If $X$ is a normed space, then both sides are $0$, so the inequality ${}\le {}$ is true
Comment: @PotemkinMetroCard Really? How can it be so direct?
Comment: this inequality holds trivially. I suggest checking your proofs for errors
Answer: Let $\nu=\inf \{\|x+y\|:x,y\in X\}$ and pick $x,y\in X$ arbitrary. Then $$\nu\leq \|x+y\|\leq \|x\|+\|y\|$$ This shows $\nu$ is a lower bound of $\{\|x\|+\|y\|:x,y\in X\}$. Therefore $$\nu \leq \inf \{\|x\|+\|y\|:x,y\in X\}$$ and we're done.
Comment: Oh, I see. Thank you for answering!


AttributeError: 'rare' is not a valid function for 'Series' object

Question: I guess the problem is with the "apply" function, but what should I change?:
def value(val,spec_1,spec_2,spec_3,spec_4):
    '''filtering Specific values'''
    if 'DOOm1' in val or 'DOOm2' in val:
        return spec_1
    elif 'DOOm3' in val:
        return spec_2
    elif 'DOOm4' not in val:
        return spec_3
    else:
        return spec_4
data['value'] = data.value.apply(value(val = data['value'],spec_1 ='Noted',spec_2= 'Noted',spec_3 = 'rare',spec_4 = 'DOOm4'))
data= data[data['value'] != 'rare']

Comment: Can you add some sample data, 3-5 rows?
Answer: I think you can use lambda function for pass values from value column like scalars:
data['value'] = data.value.apply(lambda x: value(x, spec_1 ='Noted',spec_2= 'Noted',spec_3 = 'rare',spec_4 = 'DOOm4'))


Javascript Jquery div .text assign value in javascript

Question: I am trying to change some can which depends in jQuery to pure JS and I was wondering how I can translate this one:
$("#mydiv .car span").text(myVariable);

What would the code above be in pure JS?
Comment: `document.querySelector("#mydiv .car span").textContent = myVariable;`
Comment: Have you done any research how to target elements using selectors and how to change the property? The comment above will work but if you want to learn from it you can read the documentation here: [**.querySelector()**](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector)  and [**.textContent()**](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent)
Answer: You can do it using document.querySelector() and textContent like this:
document.querySelector("#mydiv .car span").textContent = myVariable;

Or using innerText like this :
document.querySelector("#mydiv .car span").innerText = myVariable;

MDN Reference for document.querySelector()

Returns the first Element within the document that matches the specified selector, or group of selectors.

Which makes it similar to jQuery with the possibility of using this kind of selector.


Split graphs are GI-complete

Question: According to the Wikipedia article about the graph isomorphism problem, it's claimed that split graphs are GI-complete. Does it mean that any two (simple undirected connected) graphs $G_1, G_2$ can be transformed to two split graphs $S_1, S_2$ respectively so that $S_1\cong S_2$ iff $G_1\cong G_2$? If that's the case, how is that transformation from any graph to a split graph performed?
Answer: One possible transformation goes as follows. Given a graph $G$ with $n$ vertices and $m$ edges, we construct a split graph $S$ with $n+m$ vertices:

Begin with a clique on the same vertex set as $G$.
For each edge $vw \in E(G)$, create a new vertex $x_{vw}$ adjacent to $v$ and $w$ (and to no other vertices).

This is a split graph: the clique is created in step 1 and the independent set is created in step 2. Also, if we start with a graph $G$ on at least $4$ vertices, then vertices constructed in different steps are distinguished by degree: all vertices in the clique have degree at least $3$, and all vertices in the independent set have degree $2$. (We ignore graphs on fewer than $4$ vertices, since there's only a few and we can easily tell when they're isomorphic.)
Therefore, if we have two graphs $G_1, G_2$ and construct split graphs $S_1, S_2$ in this way such that $S_1 \cong S_2$, the isomorphism must induce a bijection between the degree-$\ge 3$ side of $S_1$ and the degree-$\ge 3$ side of $S_2$. This bijection is actually an isomorphism between $G_1$ and $G_2$, since two vertices are adjacent in $G_i$ if and only if they have a common degree-$2$ neighbor in $S_i$. So we conclude that $G_1 \cong G_2$.
(Going the other way, if $G_1 \cong G_2$, our construction makes it easy to find an isomorphism between $S_1$ and $S_2$.)
Comment: Yes; the construction you describe is called a [barycentric subdivision](https://en.wikipedia.org/wiki/Homeomorphism_(graph_theory)#Barycentric_subdivisions) of a graph; it's always bipartite, and two graphs are isomorphic iff their barycentric subdivisions are isomorphic. (Cycle graphs aren't a problem: the barycentric subdivision of a graph $G$ is isomorphic to $C_{2n}$ iff $G \cong C_n$. In all other cases for a connected component, the side of the barycentric subdivision corresponding to the edges can be identified as "the vertices at an odd distance from every vertex of degree $\ne 2$".)
Comment: I see. Makes sense to me that a similar logic could apply for bipartite graphs. Independent set 1 for the original vertices and independent set 2 for the edges.  The problem is when $n=m$ and the original graph is a cycle-graph, case that you would have to check beforehand. But besides that, following your same logic bipartite graphs would also be GI-complete.

Split graphs are GI-complete


How to run a cable raceway by doorway with raised floor?

Question: I need to run a coaxial cable (and one more cable like ethernet) by a doorway. The floor is raised approximately 0.65 inches.
I found D-line raceways, and also the floor raceways that are wide (so people don't trip on it). I'm not sure they will fit well because they are right by a raised floor.
I also found baseboard cord channel which might be better but I'm afraid they are taller than the raised floor.
Picture (only one cable is shown but there will be two running left to right):

Any experience with this? Any idea what would be the best solution here? Breaking the floor is not an option. It should be something that won't require construction.
Thank you.
Comment: It is often easier to go up one side, across the top, down the other side, and resume. That avoids all tripping potential, but takes more cable. Is that an option for you?
Comment: @DougDeden Technically possible but not wanted. We are looking for a floor based solution.
Comment: I think that you'll have tripping and toe subbing as people are trained throughout life that any floor height transitions will occur at the door rather than some distance away from it
Answer: Just to update with an answer: at the end only one cable was necessary, which helps. Solution still applicable if two cables were necessary (as originally stated): a plastic raceway of the right size is best in this case. I checked dimensions of all raceways I could find, and chose the one right the size I needed. That avoid extra wasted space and a tripping hazard. The photo might not tell that, but even with two cables it would not be a problem, it wouldn't be projected too far from the door to be unsafe.
The result is nice:


How to find package name for particular class of java from terminal

Question: for Example, lets say i want to use ArrayList so I've to use

import java.util.ArrayList;

in my java source. But in case i forgot that ArrayList is included in java.util package.
so how do i find a package name of ArrayList class ?

assuming i don't have internet
assuming i don't want to browse source
Comment: If you can install the docs, you can browse them. They're all HTML files in `/usr/share/doc/openjdk*`.
Comment: You can't even install the documentation?
Comment: @muru no i am just looking at terminal commands. I've all the doccs and source. just describing scenario at my college.
Answer: I'm not sure what you use for development, but I'm using IntelliJ IDEA and I never have to care about any import statement. I just start to type ArrL and IDEA will take care of the rest. It will suggest ArrayList<E> for autocompletion and fix the import statement instantly. It just knows what you want to do and you can concentrate on development and not on remembering package names:

Edit:
An easy way to do it in the command-line is to search the src.zip file which comes with the SDK. So if you try to find ArrayList then you can do
7z l src.zip | grep ArrayList

and you get
2013-03-26 21:10:27 ..... 42659 8916 java/util/concurrent/CopyOnWriteArrayList.java
2013-03-26 21:10:27 ..... 21547 5814 java/util/ArrayList.java

where you can see the package structure because it is similar to the sub-folders. I'm sure there are corner-cases where this doesn't work, but you can at least try.
Comment: Yes... Ide works fine... But i am talking about  -command line
Comment: @RohitKaradkar See my edit.
Comment: Yes that's something useful  for now
Answer: Assuming $JAVA_HOME is set properly.
$ find $JAVA_HOME -name *.jar -print | xargs -n1 jar -tf | grep "ArrayList.class"
com/sun/istack/internal/FinalArrayList.class
com/sun/xml/internal/messaging/saaj/util/FinalArrayList.class
com/sun/xml/internal/org/jvnet/mimepull/FinalArrayList.class
sun/swing/BakedArrayList.class
sun/awt/util/IdentityArrayList.class
java/util/concurrent/CopyOnWriteArrayList.class
java/util/Arrays$ArrayList.class
java/util/ArrayList.class
com/sun/javafx/UnmodifiableArrayList.class
org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils$UnmodifiableArrayList.class

Little helper function, still assuming JAVA_HOME is set and set properly
function jfind ()
{
    if [[ -z "$JAVA_HOME" ]]; then
        echo "Please set JAVA_HOME variable";
    else
        find $JAVA_HOME -name *.jar -print | xargs -n1 jar -tf | grep "$@";
    fi
}

More common solution
You can substitute JAVA_HOME by any path where desirable jars are located. For example your project path:
$ find some_folder_with_jars -name *.jar -print | xargs -n1 jar -tf | grep "Awesome.class"

Sources
Based on this answer


Does this idea generally true ?!

Question: Does $\int \limits_{a}^{b} f(t) dt \leq \int \limits_{a}^{b} g(t) dt \leq \int \limits_{a}^{b} h(t) dt$ Given that $f(x) \leq g(x) \leq h(x)$?
If the above is true, could we say that :
$f(b)-f(a) \leq \int \limits_{a}^{b} g(t) dt \leq h(b)-h(a)$ if $f'(x) \leq g(x) \leq h'(x)$ ?!
Comment: Respectively: yes, yes. The domination property is known in calculus. I should add that the domination must hold everywhere on the domination (or at least almost everywhere).
Comment: For the second inequality, you need some additional conditions.  What is $x$ (one needs more care mixing definite integrals and indefinite integrals)?  You could use $f(b)-f(a)$ on the LHS and $h(b)-h(a)$ on the RHS.
Comment: @MichaelBurr sorry, i will update the post
Comment: @MichaelBurr does it know hold true ?, i mean the second inequality
Answer: For the second inequality (assuming continuity and integrability where necessary and that $a\leq b$), since $f'(x)\leq g(x)\leq h'(x)$, we know that
$$
\int_a^b f'(x)dx\leq \int_a^b g(x)dx\leq \int_a^bh'(x)dx.
$$
Applying the fundamental theorem of calculus gives us
$$
f(b)-f(a)\leq\int_a^b g(x)dx\leq h(b)-h(a)
$$
as desired.  So, yes, your statement is correct.
Comment: Provided that $a \le b$, of course...
Answer: hint
Use the first Theorem of Calculus which states that
if

$f $ continuous at $[a,b] $.
$f $ differentiable at $(a,b) $.
$f'$ integrable at $[a,b] $

then
$$\int_a^bf'(x)dx=f (b)-f (a) $$

Does this idea generally true ?!


len(n) x len(m) array in NumPy

Question: n = ' AAADDDEEE'
m = ' AADDDEB'

How to create numpy of dimensions len(n) x len(m) where n is the first row, m is first column and all the other entries are empty
i.e.
  A A A D D D E E E
A [][][][][][][][][]
A [][][][][][][][][]
D [][][][][][][][][]
D [][][][][][][][][]
D [][][][][][][][][]
E [][][][][][][][][]
B [][][][][][][][][]

I was trying something along the lines of
import numpy as np
print np.array(list(n),list(m))

but it only takes on argument . . . i'm not sure how to exactly go about this.
Answer: >>> arr = np.empty((len(m), len(n)), dtype=str)
>>> arr.fill('')
>>> arr[0] = list(n)
>>> arr[:,0] = list(m)
>>> arr
array([['A', 'A', 'A', 'D', 'D', 'D', 'E', 'E', 'E'],
       ['A', '', '', '', '', '', '', '', ''],
       ['D', '', '', '', '', '', '', '', ''],
       ['D', '', '', '', '', '', '', '', ''],
       ['D', '', '', '', '', '', '', '', ''],
       ['E', '', '', '', '', '', '', '', ''],
       ['B', '', '', '', '', '', '', '', '']],
      dtype='|S1')
>>>

Comment: @O.rka If you don't want random value then use `numpy.full`: `np.full((len(m), len(n)), '', dtype=str)`, this will initialize an array with empty strings.
Comment: why does np.empty make random characters ?
Comment: because it doesn't initialize values, only maps memory. use `zeros` instead.

len(n) x len(m) array in NumPy


Fixed footer with right margin

Question: Can someone explain me why the first code does result in a fixed footer with a small margin on the right as I used an extra 'div' but that without this as seen in the second code it doesn't show a margin on the right? Thanks!
<!DOCTYPE html>

    <meta charset="utf-8">

Look in the right corner below!

            fixedfooterwithmargin-ontheright

Second code without an extra div.
<!DOCTYPE html>

    <meta charset="utf-8">

Look in the right corner below!

            fixedfooter NO hmargin-ontheright

Answer: Try right instead of margin-right:
footer {
    clear: both;
    position: fixed;
    bottom: 0px;
    text-align: right;
    width: 100%;
    background-color: fuchsia;
    right: 20px;
}

jsfiddle: http://jsfiddle.net/ashishanexpert/3eFPt/
Answer: Your footer tag is already taking 100% of the width.. So margin will be out of it.
It worked in the first case because you gave the width to the parent. so margin on the child worked. try to add 100% to footer in first case and even that wont work as required.

Fixed footer with right margin


Replace greedy elements with the appropriate

Question: I have such a following list:
import re
l = ['Part I,   Where I'M Coming From',
 'Part Ii,  Life Principles',
 'Part Iii, Work Principles']

I want a result,
l = ['Part I,   Where I'M Coming From',
     'Part II,  Life Principles',
     'Part III, Work Principles']

I tried:
In [19]: [re.sub(r'(?<=I)i+', 'I+', s) for s in l]
Out[19]:
['Part I,   Where I'M Coming From',
 'Part II+,  Life Principles',
 'Part II+, Work Principles']

It output 'Part II+, Work Principles' not 'Part III, Work Principles'
How to accomplish such a task?
Comment: What's the case for Part VI, Part IV, looks like?
Comment: @MenglongLi Good question, I've tried to address that in my answer.
Answer: One easy way to do this is to use re.sub with a callback function. The callback handles more complicated logic beyond simple substitution. In your case, you need to match all lowercase is following capital Is, figure out how many i's there are, and replace accordingly.
>>> re.sub('(?<=I)(i+)', lambda x: 'I' * len(x.group()), 'Part Iii,  Work Principles')
'Part III,  Work Principles'

The callback is not invoked (i.e., no replacement occurs) if there was no match.
If you're interested in a deeper understanding of what happens, here's the same callback as a function, with a couple of print statements.
>>> def replace(m):
...     print(*[m, m.group(), len(m.group())], sep='\n')
...     return 'I' * len(m.group())
...
>>> re.sub('(?<=I)(i+)', replace, 'Part Iii,  Work Principles')
<_sre.SRE_Match object; span=(6, 8), match='ii'>
ii
2
'Part III,  Work Principles'

You'll notice this prints out...
<_sre.SRE_Match object; span=(6, 8), match='ii'>
ii
2

...In addition to performing the replacement. The important thing to note is that it passes a match object to the callback function. You can then figure out what was matched, and decide what to replace it with accordingly.

Generalising to Arbitrary Roman Numerals
If your function has to match any roman numerals, then you can pass a pattern that finds those to re.sub, but your callback simplifies greatly:
>>> p = r'\bM{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})\b'
>>> string = 'Part viiI,  Work Principles'
>>> re.sub(p, lambda x: x.group().upper(), string, flags=re.IGNORECASE)
'Part VIII,  Work Principles'

Now, all you need to do is uppercase the matched string.
Comment: Thank you for taking the time to break everything down.
Answer: One option is to simply use re.split, apply str.upper, and then use str.format:
import re
l = ['Part I,   Where I'M Coming From',
'Part Ii,  Life Principles',
'Part Iii, Work Principles']
new_l = [re.split('(?<=Part)\s|,\s+', i) for i in l]
final_l = ['{} {},  {}'.format(a, b.upper(), c) for a, b, c in new_l]

Output:
l = ['Part I,   Where I'M Coming From',
 'Part II,  Life Principles',
 'Part III, Work Principles']


I need to know if a key was down (pressed) while the user clicked on a button

Question: In a Flutter Desktop app, I want to know if, when a user clicks on a button with the mouse, they were also holding down a key (like Shift, Control, Alt etc).
How can this be done?
EDIT
My initial question wasn't clear enough.
I have a dynamic list of checkboxes and I want to use SHIFT+click to select everything between the last selected one and the one that was selected with SHIFT down.
I have looked at FocusNode but that seems to only work for 1 element.
Answer: This can be done with a FocusNode.
You'll need a stateful widget where you can use initialize the node. You need to attach the node and define the callback that is called on keyboard presses. Then you can request focus from the node with requestFocus so that the node receives the keyboard events.
You'll also need to call _nodeAttachment.reparent(); in your build method. You should also dispose the node in dispose.
The example below prints true or false for whether the shift key is pressed when the button is pressed. This can be easily expanded to other keys like control and alt with the  isControlPressed and isAltPressed properties.

Full example:
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: MyWidget(),
        ),
      ),
    );
  }
}

class MyWidget extends StatefulWidget {
  @override
  _MyWidgetState createState() => _MyWidgetState();
}

class _MyWidgetState extends State<MyWidget> {
  late final FocusNode focus;
  late final FocusAttachment _nodeAttachment;

  bool isShiftPressed = false;

  @override
  void initState() {
    super.initState();
    focus = FocusNode(debugLabel: 'Button');
    _nodeAttachment = focus.attach(context, onKey: (node, event) {
      isShiftPressed = event.isShiftPressed;
    });
    focus.requestFocus();
  }

  @override
  void dispose() {
    focus.dispose();
    super.dispose();
  }

  Widget build(BuildContext context) {
    _nodeAttachment.reparent();
    return TextButton(
      onPressed: () {
        print(isShiftPressed);
      },
      child: Text('Test'),
    );
  }
}

You can still use this solution for your more specific problem. Wrap the above example around your list of checkboxes. You can do a bit of simple logic to get your intended behavior. If what I have here is not exact, you should be able to easily modify it to your needs. This proves that you can use this method for your need, however, even if some details in the logic are not exact:
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: MyWidget(),
        ),
      ),
    );
  }
}

class MyWidget extends StatefulWidget {
  @override
  _MyWidgetState createState() => _MyWidgetState();
}

class _MyWidgetState extends State<MyWidget> {
  late final FocusNode focus;
  late final FocusAttachment _nodeAttachment;

  bool isShiftPressed = false;

  List<bool> checkboxStates = List.filled(5, false);

  int lastClicked = -1;

  @override
  void initState() {
    super.initState();
    focus = FocusNode(debugLabel: 'Button');
    _nodeAttachment = focus.attach(context, onKey: (node, event) {
      isShiftPressed = event.isShiftPressed;
    });
    focus.requestFocus();
  }

  @override
  void dispose() {
    focus.dispose();
    super.dispose();
  }

  Widget build(BuildContext context) {
    _nodeAttachment.reparent();
    return Column(
      children: List.generate(checkboxStates.length, (index) => Checkbox(
        value: checkboxStates[index],
        onChanged: (val) {
          if(val == null) {
            return;
          }

          setState(() {
            if(isShiftPressed && val) {
              if(lastClicked >= 0) {
                bool loopForward = lastClicked < index;
                if(loopForward) {
                  for(int x = lastClicked; x < index; x++) {
                    checkboxStates[x] = true;
                  }
                }
                else {
                  for(int x = lastClicked; x > index; x--) {
                    checkboxStates[x] = true;
                  }
                }
              }
            }
            checkboxStates[index] = val;
          });

          if(val) {
            lastClicked = index;
          }
          else {
            lastClicked = -1;
          }

          print('Checkbox $index: $isShiftPressed');
        }
      )),
    );
  }
}

Comment: Thank you very much for your reply. I realize now I must have not stated my problem clearly enough. Please see the edit in my original question.
Comment: yes, saw your edit but didn't yet have the time to test it. I will let you know as soon as I implement it. Thanks.
Comment: Finally got the time to try this out, and it worked. Thanks. Marked your answer as the correct one.
Comment: I used this solution to watch keypresses. however it took me many hours to find out that this causes the state to be set as dirty and rebuild and layout when for example showMenu() is called, or a DropdownButton is clicked, triggers an entire widget rebuild.


Loud buzzing, pop, smoke and odor from oven

Question: I was using my electric oven last night baking something inside it and also using one burner to cook some food. The stove has 5 burners that I could use but I was only using one. While I was standing next to the oven, seemingly out of nowhere I heard a loud humming sound. This humming continued for about 5 seconds and got progressively louder. Eventually we heard a loud pop, the oven turned off immediately and then we smelled a burning smell. I saw a little bit of smoke and my girlfriend claimed she saw a small poof of fire momentarily when we heard the pop. Currently nothing works on the stove, not even the time display.
I was wondering if this could be a blown fuse within the stove. If it is a blown fuse, does that always mean that there is something else which caused the fuse to blow in the first place? Or could the fuse have gone bad by itself and simply replacing it would fix the issue.
Edit - The model number of the stove is is PLEFMZ99ECA.
Also as a side note, I have noticed that a GFCI outlet that is somewhat next to our stove seems to trip randomly over the past few weeks. We use a coffee maker on that plug and that seems to trip it and shut off power to the outlet. Not sure if this might be related.
Second Edit - So I just checked the circuit breaker panel and found that the range circuit tripped at the main panel to my house.
Comment: Providing the brand that model number goes with would be super helpful, too.
Comment: Model # of oven would help.
Comment: Classic blown element. I happened to see mine making happy yellow volcano action on itself after hearing the pop, and I turned off the oven (nothing tripped.)
Comment: Coffee maker tripping GFCI means almost definitely *bad coffee maker*. If you can use it for a while in a different GFCI receptacle (do NOT use it in a non-GFCI-protected receptacle) and it trips then coffee maker and if it doesn't then the first GFCI should be replaced.
Answer: There are actually three ways (besides "pull the plug") that an oven can shut off in an emergency:

Circuit breaker in your breaker panel. This trips if the oven uses too much power for too long - typically a short circuit, which can happen due to faulty components but more often due to components that wear out over time, including switches and heating elements.
Thermal fuse. Many ovens have a thermal fuse so that if the heating element runs for too long (e.g., controls stuck "on") or if there is a break in the oven such that heat can get from inside the oven to the outside, power shuts off.
Electrical fuse. All ovens should have electrical fuses protecting both the heating elements/entire oven and often also in the control panel to protect the electronic components separately. These fuses can blow if a heating element goes bad or a bad switch or (in the case of the control panel fuses) any component in the control panel fails.

So what happened here? The symptoms sound very much like a heating element burning up. That usually finishes fast enough that it will not trigger a thermal fuse but may result in a short circuit that triggers either an oven fuse or your circuit breaker. To figure it out:

If nothing works - control panel "dead", no digital clock, no burners work, etc. then this is either the circuit breaker or a main oven fuse (i.e., that protects everything in the oven + cooktop).
If some parts still work then you either have a blown fuse for part of the oven or you simply have a bad heating element. If broil works but not bake (or vice versa) then it is just the element.

Assuming nothing works:

Check the circuit breaker. If it has tripped then you definitely had a short and want to do some prep work first before turning it on.
If the circuit breaker did not trip then your oven circuit is still "live", but the problem is more than just the element, so turning off the breaker while you troubleshoot is a good idea.

Aside from fuses, which could be "anywhere" depending on design of the oven, the key thing is most likely the heating element. In most ovens the bake element and the broil element are easily accessible with at most a couple of screws holding them in. However, ovens with a flat bottom have the bake element underneath the visible bottom of the oven and additional work is needed to remove and replace it. However, if that's the case you generally wouldn't see the fire (but you'd still smell the smoke) when the element self-destructs.
More details will depend on the model #.
Comment: Fair points. I am going to pull the circuit board out of my oven and see if this was indeed the issue. I'm planning on seeing something burnt up on the board. If I do find that, I think I'll give this repair service a try and see what happens.
Comment: Awesome. Thank you so much again for the help. I think I will try to get the control board repaired since it is so cheap and then if that doesn't fix it, we will get a new stove.
Comment: Awesome answer! I never thought to check the house circuit breaker panel. I found that it  has tripped. I will keep the circuit off until I can find out where the short is. Are there any common areas where shorts occur in stoves? Would the bottom "bake" heating element burning out cause a short in and of itself?
Comment: I'd start with pulling out the burnt element and inspecting around it for damage. If everything else looks basically OK (wipe off the soot and no visible cracks, etc.) then safe to turn breaker back on and see if the rest (control panel, clock, cooktop) works. If all OK then turn off breaker, replace element and hopefully done.
Comment: Awesome thank you! If I pull out the burnt element and test it with a multimeter, should I be able to test for continuity? If there is no continuity then that would mean that the element needs to be replaced?
Comment: I would expect the element to show broken - i.e., no continuity. But depending on how it failed it might show continuity - i.e., shorted and tripped the breaker but never burned totally through, or it might show typical resistance or high resistance or no continuity at all. Bottom line, if it looks burnt up, replace it. http://www.appliance411.com/faq/test-element.shtml has some useful info.
Comment: Awesome, thank you very much for the help. You likely saved me from paying $800 for a new stove.
Comment: There is a *tiny* possibility that the problem is elsewhere, but the symptoms fit a classic "burned up element". On my previous oven (oven only, cooktop was (and is) separate), I replace one element and several years later was not successful replacing the other and ended up replacing the oven. But the oven was > 40 years old at the time, so it was time.
Comment: So I just troubleshot this a little more. I took the baking heating element out and tested it using a multimeter. There was continuity and the ohm resistance was about 20 which supposedly is within normal range. I also noticed when my girlfriend flipped the fuse on that the clock came on and the burners showed a "PF" error code. I researched it and it that code stands for power failure. When I tried to use the burner it showed an "F5" error code and never turned on. None of the burners or oven settings worked. I also noticed that the clock lit up but it showed all "8"'s and never changed.
Comment: Yikes! PF is typical and not a problem. But the rest of this is not a good sign. 20 Ohms is typical, indicating a nominally good element. Which points to a short or other problem that in turn zapped (at least partly) the control circuits. Which is not a good thing. Based on https://www.appliancepartspros.com/frigidaire-clock-timer-316418704-ap3776965.html which was someone with the same model and similar problem (F5), board replacement is needed. But the board is no longer made, which means eBay or send it for a repair - quick search showing in the $200 range (plus shipping). Ugh.
Comment: Yikes is right. The part seems tough to find especially from a reputable retailer. Looking like a new stove is in the cards for us!
Comment: I had some keypad problems on my double-oven, control board not available new any more, etc. Found a great repair place in Texas that specializes in that (they actually made a new keypad for a line of Kitchenaid ovens - same one for single/double with/without convection, etc.) and also did some other repairs - but it cost quite a bit by the time I was done, including a lot for fast shipping. In my case it was worth it because a double wall oven costs a lot more than a typical slide-in oven/cooktop - i.e., you've got more reasonably priced good options than I did. Though I've heard there are
Comment: COVID related supply issues. Chips...
Comment: https://www.bonanza.com/listings/Repair-Service-316418704-Oven-Control-Board/1009426395?goog_pla=1    - I found this repair service which seems to be a fairly good option to try before I go out and buy a new oven. What do you think?
Comment: On the surface it seems OK. About 1/3 the price of some others, which is VERY good. But a little odd because instead of their own site (like https://circuitboardmedics.com/316418704-oven-control-board-repair/ ) they are piggybacked on a generic shopping site.
Comment: I just wanted to make sure too, when the control board goes, could that itself make the popping sound and then burning smell? Or could there be something else wrong as well
Comment: Too many variables to say for sure. The original description sounded very much like an element burning out. So the unknown is whether this is: element burned out and took control board with it, control board had problem and sent (somehow) too much current to element or other components, or control board had problem and the popping and burning was from the control board. Anything is possible. It does not take much for a pop and smoke. A "poof of fire" is more indicative of an element burning out, but the question becomes *where* - from the element, from where the element connects (typically
Comment: in the back of the oven), from the control panel (which would definitely be "control board") or from someplace else. Hard to tell when these things happen so quickly and unexpectedly.
Answer: It's most likely the heating element in the oven blew. It's not going to be a blown fuse, they don't pop like that.  A heating element in an oven can fail with dramatic sound effects! LOL. If you're comfortable working with live circuits, remove the oven heating element and test for voltage at its connections.  If you have 240v or so, the element blew and you'll have to replace it (they are not expensive), if not, something else blew.  Sorry I can't be more helpful, but I"m not an appliance expert!  The "something else blew" will probably need a pro to fix.
Answer: Even if the element has continuity that doesn't mean that it's okay, I would error on the side of caution and discard an element that made a loud noise before smoke/fire came flowing out if it! They are not an expensive item, I would inspect the connection where it is attached to the circuit, where it is physically mounted and ensure there are no signs of damage or other causes for concern I would process to the next step of turning the circuit back on and checking to see if anything is working or if a portion or all of it is out of service. Please remember to always ensure the both the circuit breaker is turned off and then unplug the uni from the wall before looking for possible other causes such as blow fuses etc. Unless you have a lockout device to ensure the breaker can not be energized by anyone until you remove your personal padlock it's absolutely imparative that you also unplug the device to be 100% sure you won't suddenly be working with a live wire! At 240 volts a 40 amp circuit will easily provide enough current to fry you like a small fish in a big pot of boiling oil! In other words it's a shock you won't soon forget if you live to talk about it!


Nativescript: Validation doesn't work [disabled]="!RegisterForm.valid"

Question: I try to use this html code in Nativescript for Register user. I want to disable button register. If I put input I want to enable this button.
In this code I put: [ngClass]="{invalid: invalidCredentials}" and in button [disabled]="!RegisterForm.valid"
<GridLayout backgroundColor="#f1f1f1">
    <ScrollView>
        <StackLayout margin="10" verticalAlignment="center" [formGroup]="RegisterForm" backgroundColor="#FFFFFF"
            padding="15">
            <StackLayout class="input-field">
                <TextField formControlName="username" hint="Username" [ngClass]="{invalid: invalidCredentials}">
                </TextField>
            </StackLayout>
            <StackLayout class="input-field">
                <TextField formControlName="password" hint="Password " secure="true" [ngClass]="{invalid: invalidCredentials}">
                </TextField>
            </StackLayout>
            <Button class="btn btn-primary w-full" text="Register" [disabled]="!RegisterForm.valid" (tap)="register()"></Button>
        </StackLayout>
    </ScrollView>
</GridLayout>

In ts component I have this code:
loading: boolean = false;
invalidCredentials: boolean = false;

register() {
    this.loading = true;
    let newRegister = this.RegisterForm.value
    let user = new User(newRegister);
    this.ws.registergetdata(user).subscribe(
        result => {
              ....
            } else {
                this.loading = false;
                this.invalidCredentials = true;
           }
        });
     }

Works good but validation doesn't work.
Answer: disabled is not a known property, it supposed to be isEnabled.
Comment: Okay thank you! How to write this `[disabled]="!RegisterForm.valid"` ??
Comment: As simple as `[isEnabled]="RegisterForm.valid"`