SharePoint Online administrator is site collection administrator

Question: Is SharePoint Online Administrator is by default site collection administrator ?
Answer: No,You have to assign site collection administrator and if you add yourself as a site collection administrator(SharePoint Online Administrator), performing this action is known as taking ownership of a site.
So basically these are two separate administrative roles.
SharePoint Online administrator    Administrator of the SharePoint Online Administration Center; can create and manage site collections, designate site collection administrators, determine tenant settings, and configure Business Connectivity Services and Secure Store, InfoPath Forms Services, Records Management, Search, and User Profiles. In Office 365, a Global administrator is also a SharePoint Online administrator.
Site collection administrator    User with administrator permissions to manage a site collection. A site collection can have several administrators, but only one primary administrator. The SharePoint Online services administrator should assign permissions to the primary site collection administrator when creating a site collection and can add more administrators for the site collection afterwards.
Comment: Means if I belong to SharePoint Online administrator group and I have not added SPO admins group to site collection administrator. I will not be able to access or edit content at that site collection ? Just want to confirm my assumption.
Comment: Yes and you have to note that as soon as it creates team site automatically it assigns SharePoint Online administrator as a site collection administrator.But if you are creating your own site collection and not assigning SharePoint Online administrator as site collection administrator,he will not be able to access anything on that site.http://blogs.msdn.com/b/cloud_trails/archive/2013/03/05/permissions-in-sharepoint-online-faq.aspx
Comment: Thank you very much. It solves my confusion. Have a nice day !


Sampling the impulse response

Question: Given two IIR filters (one Low-Pass and one High-Pass) designed using Butterworth, how can I know if they can be obtained using sampling the impulse response?
Answer: short answer: you can (approximately) implement a lowpass filter by sampling its prototype continuous-time impulse response $h_c(t)$, but you cannot implement an ideal highpass filter that way, since the highpass filter is non-bandlimited; i.e., there will be unavoidable aliasing errors due to the definition of the highpass filter, but read on...
The technique of obtaning a discrete-time impulse response $h_d[n]$, from sampling a continuous-time prototype impulse response is called as the method of impulse-invariance: $$h_d[n] = T_s h_c(nT_s)$$ where $T_s$ is the sampling period, and $h_c(t)$ is the prototype continuous-time impulse response.
This operation is analogous to sampling, and their implications are the same: There will be aliasing at the resulting discerete-time spectrum of the converted filter if either 1-The continuous time filter is not bandlimited, or 2-The sampling rate is below the Nyquist rate associated with $h_c(t)$.
A continous-time ideal lowpass filter is by definition bandlimited (or a practical one will be sufficiently bandlimited), and we can always find a small enough $T_d$ to sample its impulse response while avoiding aliasing.
On the other hand, an ideal continuous-time highpass filter has an infinite bandwidth, and thus sampling period required is $T_s = 0$; i.e., it cannot be sampled. The technique is not applicable to such a system.
However, if you will be carefull enough, and if you can be sure about the bandwidth requirements of every stage in your signal processing chain, then you can replace the ideal highpass filter by an ideal bandpass one, (or one of its practical approximations). When such is the case, then you can apply the technique of impulse invariance to obtain a discrete-time band pass filter from its continuous-time prototype, by choosing a suitable sampling period $T_s$ to completely avoid (or practically minimize) the resulting aliasing errors...
Note that the method of impulse invariance produces an exact linear mapping from continuous-time to discrete-time frequency spectrum. It preserves all characteristics of the continuous-time filter, unlike the method of bilinear transform which warps the spectrum while mapping it.
Comment: Just to avoid confusion: a (causal and stable) continuous-time low pass filter is *never* band-limited. It's just that we can always find a sampling interval $T$ such that the aliasing error becomes acceptable. However, there will always be aliasing, also for low pass filters.
Comment: That's true Matt. But, for a low-pass filter it's good to consider that the information that I lose saying that it's band-limited is insignificant
Comment: yes that's right... I think I've mixed ideal filters with the practical ones...
Comment: @Euler: That's exactly the question: is the error insignificant? You can't just say that it is, you need to check it depending on the application, and there are many cases where you can't just ignore the aliasing error. That's especially true if the cut-off frequency is relatively close to Nyquist.

Sampling the impulse response


Is it possible to create self-extracted setup with InstallShield Limited Edition

Question: InstallShield Limited Edition comes as free addition to Visual Studio 2010 users. It has many options on how to configure installation package, but I am having an issue to figure out if is possible to create a self-extracting setup with LE. Alternative to this can be 7-zip SFX add-on, NSIS, etc.
Answer: I've since imaged a new dev machine and installed InstallShield 2010LE.  Through the standard Visual Studio (solution) Configuration Manager you have the choice of build CD-ROM, DVD-5 and Single Image ( self extracting EXE ).
Comment: Right click the solution and select Configuration Manager.  Then change the active solution configurate to single image.  When you build the solution it will build the single image solution configuration which will then in turn build your projects single image project configuration.
Comment: Thank you for your response. I have notice that as well, but was having problem with generating any output for Single Image. Can you provide any help on how to get this output.
Answer: Windows's own IExpress.exe can also be used for creating a self-extracting installer.
Comment: I've worked at a lot of companies over the years and you'd be suprised how much PowerBuilder, Delphi, VB6 and what not is still being used out there.
Comment: I think I had some issues with IExpress in the past, like if SFX was created by XP version of IExpress then it will throw error on Win98. Although I am not sure what will happen with setup build by InstallShield LE on Win98.
Comment: Are you really still supporting Win98? That's pretty hard to do if you use current tools.
Answer: I don't have InstallShield LE 2010 installed on this machine so it's hard to answer.  Why don't you install it and find out?   My guess is InstallShield supports this.  If anything it might not support an uncompressed MSI in order to try to prevent you from coloring outside of the lines.
Or you could just call them.  Worst that will happen is you'll get spam from them trying to get you to upgrade.


Analyzing posts on Facebook

Question: I want to figure out a way who have talked {view, like and comments) about a specific post on our Facebook's fan page. we want to examine the influence of the daily activities of fans on the timing and amount of a specific post. Influencers and the occurrence time of every "like" or "comment" should be collected. Is there any tool for modeling and clustering of post's data?
Thanks in advance.
Answer: This is definitely possible. I know this is not the forum to advertise a specific product, but I literally wrote this exact thing over the last couple months for our company. Check it out http://napkinlabs.com/apps/ it is called SuperFans.

Analyzing posts on Facebook


Failed to fetch updates

Question: <code>This may have been caused by external, manually added software repositories or a corrupted sources file.

W: GPG error: http://i-hate-farms.github.io/spores trusty InRelease: The following signatures were invalid: 2F3C3D45B6C9A4E9E22A1AE1F7F707E5B5329C31
E: The repository 'http://i-hate-farms.github.io/spores trusty InRelease' is not signed.
W: Updating from such a repository can't be done securely, and is therefore disabled by default.
W: See apt-secure(8) manpage for repository creation and user configuration details.
E: http://i-hate-farms.github.io/spores trusty InRelease is not (yet) available (The following signatures were invalid: 2F3C3D45B6C9A4E9E22A1AE1F7F707E5B5329C31)
</code>
Comment: https://elementaryos.stackexchange.com/a/7684/17853
Answer: You can just install "Software & Updates" from the app center & uncheck the appropriate repository. In this case, i-hate-farms.github
https://elementaryos.stackexchange.com/a/7684/17853

Failed to fetch updates


Why am I getting a "Memory Full" error with plenty of space left?

Question: I have an old Casio Exilim EX-Z75 digital point-and-shoot with a 32gb SDHC card. The camera has worked fine with this SD card for a couple years, but I recently started getting a "Memory Full" error whenever I try to take a photo (despite that fact that I have more than 16gb of space left). I can delete a photo and successfully take another one, but if I try to take another beyond that I get the memory error. Looking at the card on my computer shows it has 14907840 bytes used out of a total of 31689728 with 16781888 available. There are 2377 photos/videos in the 100CASIO directory on the card. On my computer I can create a text file in that directory and save it with no problem. According to Casio, this camera is supposed to support 32gb SDHC cards just fine.
Have I run into some kind of limit I'm not aware of with this camera? Or is it simply malfunctioning? Or do I have some kind of error on my SD card that only makes a difference on the camera and not the computer?
Comment: See http://photo.stackexchange.com/questions/29926/memory-card-is-almost-full-but-only-displaying-9-photos and http://photo.stackexchange.com/questions/17739/why-are-my-photos-taking-too-much-memory
Comment: @dpollitt: Thanks for the suggestions, but neither applies in my case. There are no other directories with additional photos, there are no other files anywhere on the card, and the space used/available I posted above comes straight from the OS (Linux's `du` and `df`), so there's definitely free space.
Comment: I would try another card. It is pretty common for them to fail. If you have the issue with other cards you have found the problem.
Comment: I formatted the card (using the camera), re-loaded the photos, and tried again. I was able to get one additional photo but after that ran into the memory errors same as before.
Comment: I had a very similar problem with an Olympus xD card once. I found that the problem was it's naming system. Basically it named it 001 to 999 and once it went over this, it created a second directory called _DCIM/101OLYMP_ (while the first one was _DCIM/100OLYMP_) so the naming system could start again. Didn't matter if the card was formatted in the camera, same thing. Deleting the second folder on a PC fixed the issue. Has it created any other directories? I suggest backing up and formatting the card within the camera.
Comment: @BBking: Interesting. No, there's definitely only one directory (`100CASIO`) containing all the photos/videos on the card. And I have backed up and formatted the card within the camera, but that didn't change anything.
Comment: @jrdioko But did you put the same images back on the card? Try taking the same amount after the format. I just have this feeling it's the naming convention/system.
Comment: @BBking: You're saying to format it and then manually take 2,377 pictures again? :)  It seems to me that if it was a naming issue it either would have caused problems much earlier or at least stopped on a more round number than 2,377.
Answer: I'm wondering if the issue isn't the space is full, but instead the File table is full.  FAT32 is supposed to allow 65,534 files in a directory,  but I've seen cases where the implementation of the hardware has more restrictive than the standard.
I have to ask, why do you want to carry over two thousand pictures in the camera?  My tendency is to get the pictures onto a reliable hard-drive, and backed up to another media as quickly as possible.  I've found that SD cards have a tendency to fail at the worst possible time, and are really easy to lose, so the sooner my images are on my computer, the better I feel.
Comment: That would make a little more sense, but wouldn't that also stop me from adding files via a computer's card reader and not just affect the camera? I do back everything up as often as possible, but I like to keep them on the card to show people when I'm traveling.
Answer: Electronic memory (Memory cards and Solid-State harddrives) are prone to failure over time.  Each bit of storage on the devices can only be written-to and read-from so many times before they fail. To combat this, the memory card or drive will usually have extra storage that's invisible to you. When a storage block dies, one of the extra blocks is allocated to take its place and so the total data you can write to the memory card remains the same.
Eventually, when all the extra storage blocks are used up, the memory card will start to lose capacity. Due to the nature of FAT32 format, it won't look like its losing space, but attempting to write data will fail.
The easiest solution is to get a new memory card, if you actually managed to wear it out its either a cheaper brand, or you'v been taking a lot of photos!
(I have run into this a few times when my USB thumb drives slowly lose storage from over-use. Most manufacturers add 11% extra capacity as an industry standard).
Comment: Interesting info, although I'm not sure that's it either. It's been very lightly used and isn't a complete off-brand (it's the highest-selling one on Amazon, I believe). And I tried again on my computer to write 250mb worth of data to the photos directory and then delete it, and it was copied successfully with no errors of any kind. I'll be replacing the card anyway, but this does seem to be something involving the camera and not the card.
Comment: The easiest way to verify memory when you get it is to plug the memory card into your computer. Create a .zip file just big enough to fill up the card (i usually copy the same photo over and over) and then copy this zip to the card. Remove the card and then put it back, try to extract the photos from the zip. If the card is bad, either the write will fail or the zip extract will fail. I hope it turns out to be the card and not the camera, good luck!
Answer: My card was also giving this error. I tried a workaround. i copied one picture at a time by opening source and destination folders in explorer in two different windows and dragged and dropped ONE PICTURE AT A TIME. I could atleast recover all the pictures which were important to me. Buying a new card can always happen, but our precious memories are what we want to get safely out. Thanks.


Explanation of fundamental filtering's consequences on signal

Question: Can anyone explain why exactly an "Overshooting" phenomena is observed when the fundamental harmonic is removed as seen on the figures? Is it technically right to call this "overshooting" at all ? If not, how is it referred to ?
Signals in time-domain:

Spectra:
Comment: Can you kindly label your plots. Also add more background to understand the context.
Comment: i don't really see any overshoot.  i would just call this a *"missing fundamental"*.
Comment: I'm not sure about overshooting phenomena, but if you remove a single frequency from a signal (with notch-stop filter) or apply a filter with sharp cut-off you will observe a ringing in your filtered signal.
Comment: The Green curve, is the same as the blue one, but lacks the first harmonic. The spectra are respectively shown.
Answer: As already mentioned by @Fat32 in the comments to your question what you're observing is not commonly referred to as overshoot.
As there are no units on both plots comparing the results in both figures is somewhat difficult. The following assumes that the horizontal axes in both plots are just the indices of either the time or frequency domain values (otherwise the graphs cannot be directly related without additional information and/or do not make sense).
The exact effects of what you're observing will generally depend on the frequency, amplitude and relative phase of the harmonics present in your signal.
A rough visual comparison of the green and blue lines in the first plot indicates that indeed the first harmonic has been removed. The difference between the green and blue lines is roughly a sine wave (phase zero) that fits into the window (i.e. no difference at the start, end and 1/2 of the window; largest difference at roughly 1/4 and 3/4 of the window).
Note that if the amplitude and/or phase of the first harmonic are different the time domain signal, resulting after subtraction of the first harmonic, will probably look completely different.
Comment: The first graph displays the time domain signals. x axis : time, y axis: u(t). The seond graph is the abs of the FFT of both signals. Would you please tell me how to explain the effect of the first harmonic loss on the time domain signal?
Comment: What effects do you observe that are not addressed in the above answer? What kind of explanation are you looking for that is not in the above answer?
Answer: I assume you used a filter to remove the harmonic. What you see in the second plot is the stop band ripple of this filter.
If you extended the time signal beyond the orginal length, you would also see a slight smudging, also caused by the filter. This smudging would be extreme, if you just manually set the frequency bin of the harmonic to zero, as this corresponds to a convolution with a very broad si-like function. If you want to go into detail, get a standard text book about signal processing, like "Signals, Systems and Inference" by Alan Oppenheim.


struct and arguments

Question: I am trying to modularize a function that used to add values to multiple structures in one call. Now I want to do one value addition per call, but I am not sure how to make a less specific argument reference.
func ( [?] *val )
{
}
Answer: If all structures start with the same "prefix", so you can reach the desired parts at the same offset, then you could make that prefix a struct of its own and pass a pointer to it -- a "poor man's version of inheritance".
If the desired portions are at different offsets in different structures you can't get away with passing just a pointer to the function (unless via an indirection layer, which can get even more complex) -- simplest may be to pass a pointer and offset, and use address arithmetic to reach the needed part.  It's hard to give more specific advice without knowing how your various structures are laid out and what part(s) of them the function needs to reach!

struct and arguments


Is it necessary to mention age on nikkah papers?

Question: If the girl is 4 years older than the boy. And they are getting married next month. But mentioning their age on the nikkah papers will make alot of people question them. Specially people who will be the witness. Is it important to write age on nikkah papers for both? Or if the age written is incorrect will the nikkah b valid?
Ps. The parents of both the party knows the age difference.
Comment: Maybe you should explain what you mean by nikah papers: As for a 'aqd an-Nikah what must or should be inside is: the agreement of the bride and her guardian the names of the bride her guardian and the fiancé and the conditions each of them may have and maybe also the amount of mahr/sadaq. Age or date of birth may play a role in civil marriage papers,
Answer: Islamically there's not need for a certificate or a piece of paper. The conditions for Nikah in Islam are as follows:

The groom and bride or their representatives should be present in the Nikah

The groom or bride should say that I have taken you in return for this much of Mahr and the other party should say that they accept and agree.

Two male witnesses or one male and two female witnesses should be present during the khutba of Nikah.

The witnesses should hear the whole transaction from start to end.

As for mentioning the age, it's not required neither on paper nor in words. I guess mentioning the name of the would-be couples, witnesses and the date on which the marriage takes place are enough for a marriage certificate-- unless the country you are in requires one's age to be on there as well.
Allah (SWT) knows best.


Start/Stop Music playing when power is supplied via the USB cable

Question: I'd like to use an old(er) Android phone as a Music Player left always connected in my car. I have an ignition controlled USB socket in the car, and would also connect the 3.5mm jack to the Aux In of the car. Is there a way to set a Music Player (e.g. MediaMonkey) to 'continue' playing when power is supplied to the USB charging cable, and then stop when power is disconnected?
The reason I'd like to do this is because the Infotainment system in my car (Mazda CX-5) is horribly slow to start up, and music on USB memory stick or played over Bluetooth from my phone takes 2-3 minutes to start up (whereas music connected via the Aux-In starts up almost immediately). I have Android Auto and that's even worse!
I've searched this (and other) forums without finding anything that does this simply.
Thanks!
Comment: I don't think that there is a music player that directly can start playing when USB is connected. But USB charging starts/stops is a global event which can be received by any app, therefore apps like tasker could be used to listen for this event and then send an command/intent to MediaMonkey to continue playing. Unfortunately MediaMonkey knowledgebase on that topic seems to be non-public. You could also create a post on for this topic https://www.mediamonkey.com/forum/
Comment: Thanks Robert. I'm a member over on media monkey, so I'll have alook around/ask on there.
Answer: Bixby Routines
If you have a newish Samsung device with bixby routines (found in advanced settings) then you can create a routine that triggers when the device begins charging that can send the OS's "play music" command, open specific apps, and call actions that those app registered with android. You might need to open the app, and then send the OS's "play music" command.
Automation apps
If you don't have a Samsung device, then there are apps that can likely solve your problem. An app called ITTT is a well known automation app that may solve your problem. It can detect when your device begins charging, and it can do one of three things: open an app, send the OS's "play music" command, or integrate with specific services, like Spotify, and use reliable platform specific commands such as playing a shuffled playlist.
If ITTT doesn't work, other automation apps may.
Comment: Thanks Grant, will have a play with Bixby as well. I'm making some progress now with Tasker, but it's great to have alternatives!


Cucumber - Capybara - Selenium for phones and tablets

Question: We currently have a lot of cucumber tests that we use to test our mobile web-app on desktop browsers. However, i recently heard a rumor that it is possible to use some sort of remote web-driver to run our tests on actual devices instead of just on the desktop browser. However when I look up the android or iPhone web-drivers, they seem to be deprecated and recommend me using selendroid or appium, which neither seem to support browser-testing.
Today, we are only able to use our cucumber-tests for acceptance testing and as a first line of defense when doing regression tests. We still have to spend countless hours doing manual testing on around 10-20 different devices with different OS versions and browsers. Being able to run our cucumber-tests on the actual devices themselves could save us tons of time, as we'd be able to run these tests in parallel with the manual tests, and only focus our manual tests on detecting visual issues instead of also having to test the functionality of each page in our web-app.
Is it possible to run our cucumber tests on phones and tablets, and in that case how?
Answer: I realize this is an old post, but in case this helps folks, here's some basic information:
Take a look at Appium, which provides automation (with cucumber) for Android and iOS applications or mobile-web and for real devices or emulation/simulation.
There's a decent setup tutorial here, for a web-app. Setup for a mobile-website is similar but not as easy to find. Take a look here if you want Appium on SauceLabs.
Most sites you visit will say "it's easy!". I found that not to be the case; you'll see many requests for help and the specific devices and versions that you're working with all make a big difference. This is especially true if you are working with older devices, in which case you'll need to look at Selendroid for Android.
Assuming you're working with more than just a small group, you'll need to become familiar with configuring Cucumber to work with different devices and configurations: profiles may become your new best friend. There's also some profile help in this post.


What are the types of Bhakti-Yoga?

Question: I wanted to know what types of Bhakti-Yoga are, and the appropriate one for me to follow and worship Sriman Narayana, as I love him very much.
Jaya Bhagavan
Answer: 'Nava' means nine, and 'vidha' means approach; when read as a whole it means nine approaches of Bhakti to reach Ishwara (īśvara). Why nine, why not just one? Before we dive into the 'why' let us make sure we understand what Bhakti is? Bhakti has no simple definition so please explore the concept of Bhakti and its fundamentals as explained by Sanātana Ḍharma (Hinduism) literature on this portal.
Why nine, why not just one? Creation and reality accommodate all, or rather, numerous possibilities of thoughts and approaches. Everyone is different in their mental propensities, and temperament influenced by the guṇa of Prakṛti, saṃskāra, and vāsanā. If there was one specific approach to devotion, then every individual's psyche would fit in that specific approach; or one would try to follow that approach. When we get some templates and borrowed vocabulary from other societies, and squeeze the vast Sanātana Ḍharma literature/culture, we are bound to find a siddhānta (regimen) that fits into that template. Does that limit Sanātana Ḍharma to that specific template? The profound composition of Patañjali's Yoga Sutra, translated by I.K Taimni says:

"A system which is meant to sub-serve the spiritual needs of different
types of individuals living in different ages and with different
possibilities and capacities could never prove very useful and could
not withstand the ravages of time if it demanded adherence to a rigid
and uniform course of discipline. The value of Patanjali's system of
Yoga lies in its elasticity and the capacity to sub-serve the needs of
different types of individuals" (I.K.Taimni. 1975)

In Śrīmad Bhagavātam (Śrīmad Bhagavāta Purana) Mahamuni Narada tells Pandavas how differently Sri Krishna (Kṛṣṇa) is worshiped. Mahamuni  Narada says Maharśi (sages) reach out to Śrī Kṛṣṇa with respect and devotion, Pandavas show their affection as a relative and as a friend, Gopikas try to reach Him with love and Kama, Sishupala constantly invites His attention by cursing Him out of hate and enmity; through different approaches, all reach Śrī Kṛṣṇa. Paundraka (also known as Srigala Vasudeva), another king during the Dwapara Yuga, also hated Śrī Kṛṣṇa; rather than saying hated, he mostly wanted to be like Him, he desired to dress, walk and talk like Śrī Kṛṣṇa. He believed himself to be the incarnation of Vasudeva (Sri Mahā Viṣṇu). He mimicked Śrī Kṛṣṇa's appearance and His gestures, and so constantly discussed Him with his staff and others. In a way, he was jealous of Śrī Kṛṣṇa and so wanted only himself to exist. When he went to war with Śrī Kṛṣṇa, even before they could fight, Śrī Kṛṣṇa burst into laughter and instead of fighting, He dissolved Paundraka's physical form and unified him with Himself. In a separate version of the same story, Srigala Vasudeva was not a trained warrior and so was unable to battle Śrī Kṛṣṇa. He did amuse Śrī Kṛṣṇa with vain attempts but was eventually defeated. By behaving like and constantly thinking about Śrī Kṛṣṇa, in the end, he became one with Śrī Kṛṣṇa. (Sadhguru Jaggi Vasudev. 2018)
The message in the above examples is 'all paths lead to one Iśvara'. No matter which path, destiny is the same; however, there are some paths that are considered preferable. Bhakti is one such path, wherein there are nine approaches.
What are the different types of approaches to fostering bhakti (devotion)?
There exist nine approaches as explained in Śrīmad Bhagavātam canto 7, chapter 5, and sloka 23:

'श्रवणं कीर्तनं विश्नोह स्मरणं पादसेवनं अर्चनं वन्दनं दास्यां सकयं
आत्मनिवेदनं' 'sravanam kirtanam visnoh smaranam pada-sevanam archnam
vandanam daasyam sakyam atma-nivedanam'

Shravanam: Meaning, to immerse oneself into listening to the accounts of īśvara, His forms, actions, manifestations, appearance, and more. The icon for such an approach was King Parikshit, the last descendant and grandson of the Pandavas. It was to him that Rishi Shuka:brahmā (Son of Vedā Vyāsa) narrated Śrīmad Bhagavātam.
Shukabrahmā narrating Śrīmad Bhagavātam to Parikshit and others (Opaque watercolor on paper. Rajasthan, India). (2011)
Kirtanam: Rishi Shuka:brahmā, son of Vyāsa, and the narrator of Śrīmad Bhagavātam became an exemplar of this approach. In this approach one constantly chants and narrates īśvara's accounts. It can be poetic or descriptive or both.
Smaranam: This approach is to constantly dwell in the thoughts of īśvara, recollecting īśvara's actions and beauty, and His glory. King Prahlada is the quintessence of this approach. Prahlada saw Śrī Mahā Viṣṇu everywhere and in everything; anything he saw or felt made him think about Śrī Mahā Viṣṇu.
Daasyam: Daasyam means to be in total servitude to īśvara. Servitude might sound negative but the meaning is to be totally servile to īśvara and submit oneself to Him. As Sadhguru profoundly says "to have no will of our own". The summit for such humbleness and servility is Hanuman. His strength and wisdom are unparalleled, yet he was humble and servile to Śrī Rama and Devi Sita. No wonder He is one among the seven Chiranjeevi (the seven immortals) and on His way to becoming the next Brahmā.
Archanam: This is a constant act to worship a deity with various titles/names of īśvara, recollecting their significance and the feats/acts leading to those titles. The icon for this approach is Pṛthu Maharaj, one of the many incarnations and manifestations of Sri Mahā Viṣṇu, from whom Earth got the name Pṛthivī.
Vandanam: Vandanam is a salutation to īśvara. Akrura (minister of King Kamsa), who was ordered by Kamsa to bring Śrī Kṛṣṇa and Balram to him, is considered an epitome of his Vandanam. Kindly read the topic of Namaskar to further explore its significance.
Sakhyam: Meaning to have a friendship with īśvara. Arjuna, before the Śrīmad Bhagavād Gita upadesha (dialog) at the beginning of the Maha Kuru:kshetra war, was very close to Śrī Kṛṣṇa as a friend; they shared so much frankness with each other. After understanding His supremacy, Arjuna urged Śrī Kṛṣṇa to forgive him for the liberty he took towards Śrī Kṛṣṇa – similar to a young child towards one's father. It is in this dialog between Śrī Kṛṣṇa and Partha (Arjuna) that Bhakti Yoga (one of four classifications of yoga) was explained.
Atma-Nivedanam: This approach is to present/surrender one's Ātman to īśvara an offering, making oneself a tool to īśvara, giving up complete ownership/will towards karma. The icon for this approach of bhakti is King Bali (grandson of King Prahalada). Since he submitted everything, including himself, to Vamana (one of the manifestations of Sri Mahā Viṣṇu) even though he had the option to say no, he attained Satyaloka and the position of Indra in the upcoming creation.
Padasevanam: Meaning to serve īśvara in content, unified with his charm and glory. Sri Maha Lakshmi (Lakṣmī) is the pinnacle of this approach. The Padmanabha posture of Sri Mahā Viṣṇu is usually depicted with Sri Lakṣmī seated at His feet, massaging them, while Sri Mahā Viṣṇu is in His Yoga Nidra (Tantram). It is Sri Lakṣmī who wishes to sit at His feet mesmerized by His charm, due to which Śrī Viṣṇu placed Her in His hridaya(m) as Her eternal abode.
Discourse by BrahmaSrichaganti
Source: Link

What are the types of Bhakti-Yoga?


There are so many Pokemon in the park across from my house... but 80% are Zubats. Why doesn't the park spawn different Pokemon?

Question: Does a location ever differentiate which Pokemon it spawns? Or am I destined to live across the street from Zubats forever?  Zubats are a special kind of hell for me, I always waste so many Pokeballs trying to capture them.
Answer: According to the official guide on catching Pokémon:

Some wild Pokémon appear only in certain environments and climates. For example, some Pokémon may appear only near lakes, oceans, or other bodies of water.

That may mean that a lot of Pokémon don't appear in your particular area, or more likely, Zubats just have an unusually high encounter rate there.  Walking around to different areas will probably diversify the types of Pokémon you are seeing.  Others and I have also observed that as you level up, you are more likely to see rarer/evolved Pokémon, so keep at it and you should see some new stuff when you are higher level.
You don't have to catch every Pokémon you come across, but if you have a bunch of extras, you can transfer them to get more Zubat candy (from the Pokémon menu, selected the Pokémon you wish to get rid of, then scroll down to "Transfer").  These can be used to evolve your best Zubat into a Golbat or to power up your Zubats or Golbats, assuming you also have the stardust.
I encounter quite a few Ratatas and I already have a maximum power Raticate so sometimes, I just let them go.  If the problem is that you are running low on Pokéballs, you can get more at Pokéstops or buy them from the store.
Comment: +1 although I would recommend catching the Ratatas (or whatever common Pokemon is in your area) anyways.  Unless you are getting low on Pokeballs or Pokemon slots, you can catch them and evolve them for easy exp, especially since Ratatas evolve so easily/quickly.
Answer: It is just how the game works. My house constantly spawns Pidgeys and Rattatas. I have heard that spawns are correlated to the amount of data used in an area.
Comment: FWIW, my house only seems to spawn Rattatas and Pidgeys as well, and at a very slow rate. Yet yesterday it spawned a wild Venasaur and Electabuzz within 5 minutes of each other. So don't lose hope it's at least somewhat random/varied.


Measure intermediate throughput when writing to OutputStream [or] Why is write() blocking, while read() is not?

Question: I need to measure the intermediate throughput of uploading and downloading a large file (via FTP using Apache Commons Net API).
Download: (No problems)
Everything is fine for downloading, which uses code like the following:
InputStream is = ftp.retrieveFileStream(filePath);
byte[] buffer = new byte[256 * 1024];
int read;

while ((read = is.read(buffer, 0, buffer.length)) != -1) {
    Log.v(TAG, "Read = " + read);
}

Here, the buffer is 256 KB in size, and the total size of the file being downloaded is 1 MB. Still each individual call to is.read() returns only about 2 KB. In this case read() does not block until the buffer is full. This enables me to measure intermediate download throughput. So far so good.
Upload: (Problematic)
Now comes the pain. When I allocate a similar sized buffer to write to an OutputStream, the call to write() blocks until the entire 256 KB is written.
Why does only write() block, whereas read() doesn't?
So I tried to use nio. Unlike Outputstream's write(), the write() method of WritableByteChannel returns the number of bytes actually written. So it must be non-blocking, right? No such luck. This write() also blocks until the whole buffer is written. Here is the code:
byte[] buffer = new byte[256 * 1024];
new Random.nextBytes(byteArray);

OutputStream os = ftp.storeFileStream(filePath);
WritableByteChannel channel = Channels.newChannel(os);
ByteBuffer byteBuffer = ByteBuffer.wrap(byteArray);
int written = channel.write(byteBuffer);

So how can I measure the intermediate throughput when the upload is blocking?
One way is to use Android's TrafficStats API. But it comes with its own set of frustrations. As per the documentation, these statistics may not be available on all platforms. Also it needs handling of scenarios like integer counter overflow (after 2GB), and counter reset bugs on some platforms when switching between 3G and Wifi.
Can someone show me a way out?
Answer:
Why does only write() block, whereas read() doesn't?

Because that's the way the underlying operating system behaves.


how do I route Asterisk dials from serverA to serverB?

Question: I'm trying to make an Asterisk server connect to a SIP provider (which offers PSTN origination and termination). I've been reading the great Definitive Guide, but am having a conceptual problem with this illustration:

Once Asterisk has determined how to handle the channel, it will pass
  call control to the correct context in the dialplan. The context
  parameter in the channel configuration file tells the channel where it
  will enter the dialplan (which contains all the information about how
  to handle and route the call).

The "telephone", in this case a softphone, is defined in sip.conf with easy to understand syntax.  A corresponding context in extensions.conf has the line:
exten => 101,1,Dial(Sip/000FFFF0002)

and the syntax of this seems to mean, to my understanding, to Dial the 000FFFF0002 hardphone.
Now, when it comes to dialing through a SIP provider, this just isn't covered as well, at least for me.
This seems to be crucial line:
exten => _6XXX,1,Dial(SIP/${EXTEN}@serverB)

Which, in my dialplan, is reflected as:
exten => _91999NXXXXXX,2,Dial(${TESTSIPTRUNK}/${EXTEN:2},,To)

yet the "dial" never seems to go to the other server -- in this case, a SIP provider.  I don't understand the mechanics of what's happening.  How do I even figure how or why it's not getting out, and, instead, returns " I am sorry that's not a valid extension..." from invalid.gsm playing.
The full log, the channels and extensions are in gists.  I'm more asking conceptually, what's supposed to be happening?  I appreciate that the calls are supposed to go through ServerB, in this case a SIP provider, but otherwise don't quite understand how to ensure that this actually happens.
see also:
asterisk peer with SIP provider through proxy
Answer: It answers you

it's not a valid extension

because it cannot find this extension in the given context. Maybe there is an error in what you're dialing vs what you got in the extension.conf
For example, it looks like you're dialing number starting with 91987 when in your extensions.conf I see only pattern to handle numbers starting with 91999. Are you sure there is a exten for 91987?


Is MySQL Replication on Windows reliable?

Question: We played a bit with postgresql and slony for a master-slave-slave replication setup on windows. But we hit a wall with failover/switchover which is very unreliable. How about MySQL? How reliable is the replication itself and failover/switchover?
Comment: afair mysql [ at least in 5.0, 5.1 ] does not provide switchover. you need to have failover mechanism on your client or script around some 'virtual ip' handover.
Answer: We use MySQL replication in part of our system and it seems to fail about 2-3 times a month.  I'm not sure if it's a network issue or MySQL issue.  I can say that it is quite annoying...
Most of our systems are in MS SQL and this replication is rock solid.  We have not had any issues related to MS SQL failing replication.  When there are issues, the alert/notification system lets you know immediately.
Answer: In what way was your PostgreSQL unreliable? There are a lot of people who use it reliably on Windows.
Comment: The replication itself is reliable. Its the switchover and failover that fails (tested with 8.2, 8.3, 8.4). Usually the final sync hangs, but sometimes its the subscribes...
Answer: You might consider using a multi-master arrangement rather than your current one, as it can solve most failover issues.
As for running on Windows, in my last role I ran a three way multi-master configuration with one on Linux and the other two on Windows, each in different parts of the country. In a bit over two years I never had a replication issue. Any one of those server could be off-line, relative to each other, at times for various reasons but would re-synchronise when they re-established contact with their peers.


What does "top through view" mean for MSOP pin assignment?

Question: Reading the datasheet for a USB switch IC, it says "top through view" for the pinout diagram (page 2). It seems like this means "looking from the top-down at the IC", where the notch is in the top left. Is that the correct assumption?
Answer: It means you are looking from the top view "down through" the part. Typically the word "through" is not used (and usually top view or top down or bottom view).
Answer: The convention is always CCW from top and CW from bottom with pin 1 indicated by a fiducial mark.
Answer: Shortly after writing this, I had another look through the datasheet and found that the physical dimensions on page 15 indicates the position of pin 1. Sharing in case someone else finds this useful.
So, I guess "top through view" means "top down view" or "top view". However, I'm unsure about the significance of the word "through" here as it's an SMD, not a through-hole mount.
Comment: "Through" probably means that the pins might not be be visible if looking from the top (as in QFP package). And this view is making it "transparent"
Comment: it may also be a translation server result
Comment: I agree with Eugene. The other packages are ones where the pins are not visible when viewing from the top. For these, "top through view" is appropriate, and necessary to distinguish from the view where you flip the chip over to see the pins. The notation was copied to the diagram for the MSOP package even though it isn't appropriate for that package.


Black Hole Containment

Question: Black holes are often featured in advanced sci-fi technology. A significant challenge for such technology is the safe containment of a black hole. Some stories have electrically charged black holes. I'm wondering about another containment method. If one could encase a black hole in negative mass, either by casimir plates or exotic matter, would this be able to contain the black hole?
In this context, I'm using "containment" to mean that 1) positive mass would need to break through the negative mass wall in order to fall into the black hole and 2) the positive mass wall (and the contained black hole) could be accelerated or otherwise moved to other locations.
Comment: You haven't described what "containment" actually means here, or said anything about the nature of your black hole. I also suspect that asking about hypothetical "negative mass" in a hard science question is a bit over-optimistic, especially as it isn't clear exactly what properties you're expecting such a material to have.
Comment: I'm a little confused. `encase a black hole in positive mass...` is not all mass positive (that we know of)? One way or another you have to choose which forces act on the black hole, and it's slim pickings.
Comment: No. Energy is Energy, a black hole should consume negative energy just as well as positive one. Its also worth noting that you cant shield against Gravity. Hence why gravitational waves pass through anything. I should also note adding any significant charge to a black hole is, due to the physics, very difficult.
Comment: @Kronimiciad then you are talking about negative energy but ok. I feel like you are on the edge of knowing just enough that you are overconfident. Saying "Negative energy could be used for Alcubierre" is a bit like saying "So yeah if magic happened". I forget the source but i know if you actually allow proper negative energy GR as a theory just does not work anymore. You have to make very specific assumptions for it to not break it
Comment: @BMF my mistake, I meant negative mass. I will edit the question.
Comment: @ErikHall energy may be negative or positive only relative to some reference quantity, but this is not the case with mass. In physics, negative mass is a hypothetical gravity "charge" complimentary to positive mass, somewhat similar to positive and negative electromagnetic charges. Notably, different mass charges are thought to repel each other (opposite of electromagnetic charges). Some papers have suggested that Alcubierre warp drives could be constructed using negative mass. Negative mass might not be possible, but hey, this is fiction, so a bit of artistic license is only fitting.
Answer: Sadly, this will not work with the negative-mass exotic matter the OP suggests. There are several fatal problems:

First, you need the exotic matter. That does not seem to be available: it's recently been shown that antimatter has positive gravitational mass.

Then you need enough exotic matter. You presumably want enough that the black hole is thoroughly confined and you can subject the assembly to acceleration without the black hole falling out. That means you need a reasonable fraction of the mass of the black hole. Since you presumably want a heavy enough black hole that it doesn't quickly evaporate as Hawking radiation, you need quite a lot of exotic matter.

Then you have a problem with confinement. Newton's shell theorem tells us that the net gravitational effect of a spherical hollow shell on things inside it is zero, and it seems intuitively likely that this also applies to negative gravity.

There is a way to do move black holes around if you have a lot of exotic matter available. I call it the "stellar bulldozer," and it consists of a flat plate of exotic matter, of a Jupiter mass or more. It's relatively easy to fly matter  to the edge of the plate if you come in sideways. Then you release it on the side opposite to the black hole, and it flies away under the negative gravity of the plate. This pushes the plate towards the black hole, and the negative gravity of the plate pushes the black hole away.
Yes, this breaks conservation of energy. Negative mass does that. That's one of the reasons it probably can't exist.
Comment: i feel like you should be more specific about what kind of "Exotic Matter" you are talking about. You are being very general in how it interacts with black holes, considering depending on what you mean it either doesnt interact at all or does normally.
Comment: @ErikHall: Made it clear that I'm talking about the same kind of exotic matter as the question.
Answer: It really depends on what you mean by "Containment". Lets get some basics out of the way first.
A Black Hole is just a region of spacetime where the escape velocity is faster than the speed of light, hence why it is black. This is also what we know as the Event Horizon, and shadow of a black hole. At or around the center we have the Singularity, or Ringularity. There are 3 standard forms of black hole exteriors we can describe. The Schwarzschild (Stationary in time and space, no charge), Kerr (no Charge, Rotating) and Kerr-Newman (Rotating and Charged) Black Hole. For most all applications, Kerr is the model we use because there is no natural way for a black hole to obtain significant net charge.
All Black holes are described by their Mass, Angular Momentum and Charge. It appears as if by Containment you mean the ability to manipulate it. As not a single external quantity of a black hole can be contained. Neither the Gravitational Well of the mass, the Ergo Sphere of the Angular Momentum nor the increased Gravitational Well and weird spacetime of the Charge are things you can wall off. It does not matter what kind of stuff you throw around it, due to your Tags. Neither exotic nor negative mass are real things.
Besides, manipulating a black hole by using the repulsive force of some imaginary matter is about as effective as trying to use a Gravitational tug. So not at all. A Black hole, of any size, has for all intend near infinite inertia and will not be impressed by you hovering some mass over it. Let alone anything of useful Mass.
The way to move a black hole is to exploit the fact quantities are conserved, on a local scale, even for said black hole. If you throw something really hard into the Event Horizon, the black hole will move the other way.
You can move a near non Rotating black hole by firing a laser or particle beam into it. I am saying non Rotating because in the rotating Kerr case, light does not fall into the Horizon following a straight line. So you want as close to 0 spin as possible. Of course this is a very slow way of changing anything. But with a sufficiently powerful laser / particle beam you can do it.

Black Hole Containment


using raspberry pi with two usb webcams

Question: I'm a semi-new user to the raspberry pi USB webcam world, although I'm used to the RPi camera. My question is, can I use two cameras taking pictures at the same time without the pictures being overwritten by the other camera? Would I be able to use the RPi command or do I have to use C or cron? Any help would be appreciated.
Answer: You can't use the RPi camera commands with a webcam. Those only work with the pi camera. However, there are other options for reading input from a webcam. One of the most commonly used tools for this is fswebcam. There are other options too, though.
Install fswebcam with sudo apt install fswebcam. Then, you can use it with command
fswebcam image.jpg --no-banner -i 0
To use the second webcam, just change the -i or --input switch to -i 1 instead of -i 0.
Fswebcam has some other options as well, such as the -r switch to change the resolution, or the -l switch to take an image every x seconds. You can find the fswebcam documentation here.
And yes, the cameras should work together. They should each mount at different files: /dev/video0 and /dev/video1.
Hope this answer helps!
Comment: I used the same but it shows error like this
`pi@raspberrypi:~ $ fswebcam image.jpg --no-banner -i 1
--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
Unrecognised input "1"`
I tried using fswebcam image.jpg --no-banner -i 2, but it shows same error.
What to do to run two webcam together? Thanks.
Comment: @NaseebGill `fswebcam` will not work with webcams which are not recognized by your system, for obvious reasons.
Answer:
try to unplug one webcam
use command ls /dev/video* to detect which are active/assigned (write down it)
plug the another webcam
repeat ls /dev/video* (write down and compare with previous list)

the first on both list is cam0, the first new number on second list (vs first list) is your second cam
example of my outputs and working commands..i waste one week figuring out this..
output step 2. Dev/vídeo[0,1,2,3,10,11,12,13,14,15,16]
output step 4. dev/vídeo[4,5,6]
working commands
fswebcam -d /dev/video0 -r 1280x720 --no-banner image1.jpg
fswebcam -d /dev/video4 -r 1280x720 --no-banner image3.jpg

using raspberry pi with two usb webcams


Why isn't there necessarily a direct sum of rings?

Question: I've just seen on Wikipedia that we can't speak of direct sum of rings. Let $R$ and $S$ be rings. It says we can't have a direct sum of rings because the direct sum $R\times S$ doesn't receive a natural ring homomorphism. I don't understand what it means by this, and why we need this natural ring homomorphism to have direct sum of rings.
Comment: Are you familiar with what "product" and "coproduct" mean in category theory? Did you see note #3, which was cited in the section you link to?
Comment: The problem is possibly with the definiion of "ring". The last sentence of the Wikipedia section speaks of a "rng", so we are hinted that their defiinition of "ring" is what some other authors might call "ring with unity" or similar. - Another problem is that the WP article lacks a clearly formulated definition of "direct sum" in the first place ...
Comment: @user42912 You can define *the coproduct* of rings in any context. You can form the "direct sum" of rings in any context as well. The point is that the coproduct is not the "direct sum" in the category of rings. I'm not sure if the category of rngs suffers the same problem. I have a feeling it's not just the preservation of identity that causes problems...
Comment: @anon yes I'm familiar with it. However I didn't understand why direct sum of rings *must* be the coproduct in the category of rings.
Comment: @HagenvonEitzen so if we work over the rings without unit we can define direct sum of rings in this context?
Comment: Re: "direct sum must be coproduct" - It's a definition, not a conclusion.
Answer: Some of this confusion stems from confusing uses of the terms product, direct sum, and coproduct. Hopefully reading this answer by Martin Brandenburg will help clear things up.
The general categorical definitions of a direct sum (coproduct) of two objects $R$ and $S$ is the object $R \oplus S$ equipped with inclusion maps $i_R \colon R \hookrightarrow R\oplus S$ and $i_S \colon S \hookrightarrow R\oplus S$ such that for any other object $C$ into which we have inclusions $c_R \colon R \hookrightarrow C$ and $c_S \colon S \hookrightarrow C$, there's a unique map $\phi \colon R \oplus S \to C$ such that $c_R = \phi i_R$ and $c_S = \phi i_S$. So in a sense, the direct sum of $R$ and $S$ is the "smallest" thing into which both $R$ and $S$ include.
We may wish that the object $R \times S$ is the direct sum $R \oplus S$, with the inclusion maps being given by $i_R \colon r \mapsto (r,0)$ and $i_S \colon s \mapsto (0,s)$, but ring homomorphisms must send $1$ to $1$, and neither of these maps do this. So a direct sum object $R \oplus S$ with the property required in the last paragraph may not exist as a ring.
Comment: the problem is you are assuming that the coproduct's maps are defined as $r\into (r,0); s\into (0,s)$, it can be a good guess but the question asks,  if we assume there is a coproduct as $R\times S$ with $f:R\to R\times S$ and $g: S\to R\times S$ which should not satisfy the universal property.
Answer: There is no natural ring homomorphism that maps $1$ to $(1,1)$ in the direct sum.
However projections onto the factors  are natural ring homomorphisms, as they map $(1,1)$ onto $1$.


Is it possible to use a Bluetooth dongle on a Windows 10 laptop that already has Bluetooth?

Question: I'm using a sensor that talks to my PC via serial over Bluetooth.  I've had trouble getting it to run on all but one type of Bluetooth dongle.  Now, I need to buy another laptop.  I would like to play it safe and get a laptop without Bluetooth and just use the same dongle as before.  But, I can't find any laptops that don't already have Bluetooth installed.  Is it possible to still use my old Bluetooth dongle on those?
Comment: I have done that with Windows 8.1, I don't know why it wouldn't work with Win 10.
Comment: Sure, why not? At the very least, if needed, you can disable the built in Bluetooth.
Answer: I use a bluetooth mouse dongle on my Windows 10 tablet which also has built-in bluetooth (which I use for the keyboard), so I'll say yes.  The best approach would probably be to borrow a similar model and try it yourself, though.


What is the random variable when we talk about high variance model or high bias model?

Question: I have read about what a high variance and high bias model is and everywhere the emphasis is more on the consequences of either. I am confused as to what the random variable is when we are talking about a model having high variance or high bias and how can i get different realizations of this random variable?
Answer: In the context of parameter estimation (where the expected squared estimation error is additively decomposed into variance and squared bias), the random variable would be the vector of derived parameter estimators that best characterize the true data generating process (DGP) in terms of the parameter estimators of the model (which need not correspond to the true DGP).
Note that it would not be the vector of parameter estimators for the so called "pseudo-true" model parameters defining the best population-level approximation of the DGP; such an interpretation would ignore the model bias (the difference between the functional form of the true DGP and the model).
For example, if the DGP is
$$
y=\beta_0+\beta_1 x_1+\beta_2 x_2+u
$$
while the model is
$$
y=\gamma_0+\gamma_1 x_1+v,
$$
the random variable would be an estimator of $(\beta_0,\beta_1,\beta_2)^\top$ expressed in terms of $(\hat\gamma_0,\hat\gamma_1)^\top$.
(It would not be simply $(\hat\gamma_0,\hat\gamma_1)^\top$.)

In the context of prediction (where the expected squared prediction error is additively decomposed into variance, squared bias and irreducible error), the random variable would be the squared prediction error.*
*This could be generalized to some other figure of merit (using the words of @cbeleites) in place of squared prediction error, but the decomposition is algebraically neatest for squared prediction error.
Comment: @MiloMinderbinder: different realizations when looking at parameters (the model itself) can result from using independent but IID training data. Variance and bias of prediction figure of merit can result from such variance + bias in teh model and of the figure of merit estimation procedure and the test data (again look at intependent but IID test samples)
Comment: @cbeleitessupportsMonica, edited to incorporate your suggestion (though not verbatim). I hope this is alright.
Comment: @MiloMinderbinder, 1. I was wrong; now edited. 2. The prediction (as well as parameter estimates) depends on the sample that is drawn from the population. There will be a distribution of predictions (as well as parameter estimates) over the different possible samples.
Comment: @MiloMinderbinder, I have though more about the issue and updated my answer again. Still struggling a bit with a precise formulation. Yours is a challenging question.
Comment: suggested edit: prediction: ... the random variable would be *a figure of merit such as* squared prediction error.
Comment: In the context of prediction, also the prediction itself is subject to bias and variance which are then consequence of the model parameter bias + variance.
Comment: 1. did you mean prediction where you wrote expected squared prediction error. 2 How do you achieve different realizations of this prediction? Each time it is going to predict the same probability only as i see it?
Answer: The high variance and/or high bias relates to a "statistic" you are using to evaluate your model compared to the ground truth. This statistic is generally a random variable (accuracy, precision, recall) or a posterior mean, median, mode.
The statistic, lets say accuracy, is determined by the data and parameters of the model. $$p(acc | X, y,\theta)$$
I see this as the random variable determining number of events predicted correctly (using the measure of your statistic - mean square error, mean absolute error, log loss, hinge loss or whatever you fancy)
Edit: if you have no ground truth like clustering, then the concept of high bias cannot occur
Answer: The random variable is not the mean square error of the prediction or the measure of model performance, the random variable is the model itself.
Since the training data is random (at least the outcome $y$ is), the model will be random too, and you can see this testing your model on a separate (test) set.
Of course statistical models don't seem to be "random variables", but in some sense they are, you can see this in two ways at least:

Prediction models can be seen as functions of predictors $f(x)$. This predicted outcome is random, and its MSE is the sum of its variance and its squared bias, as central to the famous trade-off argument. Predictions of the model are the random variable, but the model itself is a function that makes predictions.
If you are more concerned about inference, you may prefer to see your model as an equation that uses some parameters. Those parameters are random, and to minimise their MSE you may turn to trade-off argument, as before. Of course predictions depend on parameters, so reducing MSE of parameters reduces MSE of $f(x)$ too.


Visual Studio 2010 code analysis

Question: I am using code analysis tool of VS 2010..two things that i have noticed was not provided:

Proper casing of variable,method and properties names
xml comments for each method,event and other activities
Comment: ...and your question is?
Comment: Contrary to most of the answers so far, you *don't* need StyleCop for either of your problems.  See my answer!
Answer: Point - 2 can be address by Stylecop - enter link description here.  Assuming your using c#.
Answer: FxCop does handle one of those things.  Are you sure you've turned on all of the rules?
Under the Microsoft.Naming FxCop rules you have rules such as CA1702: "Compound words should be cased correctly."
Missing XML comments is actually a compiler wanring (warning 1591).  I suspect you have to turn on XML documentation generation in the project for that to occur, though.  Under the build tab of your project properties, make sure the "Xml documentation file" checkbox is marked.
Answer: If you have any money to spend, I'd recommend Resharper. If you don't have any to spend, download the trial anyway and give it a go.  It'll highlight casing as you code in accordance with configurable rules.
StyleCop will warn of public methods without sufficient comments.  There's a good answer on the difference between FXCop and StyleCop here: Stylecop vs FXcop
Answer: Code analysis only checks for good coding practise such as remembering to dispose disposable objects etc
StyleCop will help address the other two scenarios you outlined above.

Visual Studio 2010 code analysis


Using IntelliJ to for Arduino IDE

Question: I'm on Mac OS X and have a license for IntelliJ Ultimate. Is it at all possible to use IntelliJ as an IDE for Arduino projects?
Answer: You can now use Jetbrains' CLion to develop and run Arduino sketches. Just grab the Arduino plugin!
Open Clion and go to Configure/Settings/Plugins. Choose 'Browse Repositories' search for Arduino, and click install. (There are two. One is a fork of the other. I recommend picking the one that was updated more recently.) Then restart Clion.
You'll now see the option to create a new Arduino Sketch Project!
Comment: I think that Intellij IDEA Ultimate license doesn't cover CLion
Answer: I've opted for using XCode, managed to find some templates online. Way better than using the standard Arduino IDE.
Comment: Eclipse (On windows) with AVRDUDE works well, eclipse can run on Mac, though I'm not sure if the AVRDUDE plugin will.
Answer: You can use PlatformIO together with any IntelliJ product.
Here is an article about how to wire them together:
http://jandevblog.blogspot.com/2016/01/how-to-use-intellij-idea-to-develop-and.html
Answer: You will only get limited support. There is a plugin available for C/C++, which will help you with stuff like code completion and syntax highlighting (you will need to define the sketches file type as C files). You also can integrate external tools (in the global settings), to add support for e.g. compiling and uploading sketches.
But you won't get any specialized support (like choosing which board you have, or browsing sketches), you need to configure everything manually. If you can live with that, IntelliJ IDEA might even be better for day-to-day editing work. 8Note that I didn't try anyone of these things...)
Answer: A late answer, but perhaps of help to someone:
IntelliJ ReSharper C++ comes quite close to supporting Arduino.  Here's a ticket for the key tweak, supporting the .INO file extension:
http://youtrack.jetbrains.com/issue/RSCPP-5683
Answer: As was mentioned in a previous answer, the best bet for someone who is already familiar with the IntelliJ family of products is to use CLion with the Arduino and Serial Port Monitor plugins. Here are the steps to get started:
(Preliminary - if you are on Windows 8 or 10, make sure you have installed the Arduino IDE using the full-download from https://www.arduino.cc/download_handler.php. Do NOT install it via the Windows Store because it will not install the SDK at the expected location.)

Download CLion: https://www.jetbrains.com/clion/download/#section=linux-version
Start CLion and open up the Settings->Plugins dialog, then click on the "Browse Repositories" button.
Enter "Arduino" in the search field - this will result in two plugins being displayed: Arduino V2, and Serial Port Monitor. You will want to install both of them.
(Arduino plugin can be downloaded separately here: https://plugins.jetbrains.com/plugin/9984-arduino )
(SerialPortMonitor plugin can be installed separately here: https://plugins.jetbrains.com/plugin/8031-serial-port-monitor)
Restart CLion.

When you have completed these steps, you can create a new Arduino Sketch project which will automatically create a CMake file for you, which you can edit to configure the type of board you are using and the serial port, etc. Here is an example:
<code>cmake_minimum_required(VERSION 2.8.4)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/ArduinoToolchain.cmake)
set(PROJECT_NAME HelloArduino)
project(${PROJECT_NAME})

set(${CMAKE_PROJECT_NAME}_SKETCH hello_arduino.ino)

#### Uncomment below additional settings as needed.
# set(${CMAKE_PROJECT_NAME}_BOARD mega)
# set(${CMAKE_PROJECT_NAME}_PORT /dev/ttyACM0)
# set(mega.build.mcu atmega2560)
# set(mega.upload.protocol wiring)
# set(mega.upload.speed 115200)

generate_arduino_firmware(${CMAKE_PROJECT_NAME})
</code>

Using IntelliJ to for Arduino IDE


How can I determine what kind of power supply or battery I need for my four NEMA 23 stepper motors?

Question: I am trying to determine what current my power supply needs to have for my mini rover project. The NEMA 23 motor specs are as follows: Bipolar amp/phase is 2.8A and the bipolar resistance/phase is 1.13ohms. If I have 4 NEMA stepper motors, does this mean I need a power supply that can supply 2.8*4 = 11.2A of current drawn continuously? I heard on youtube that the 2.8A/phase is the max current, so would I simply round down to 10A of current drawn (or is this untrue)? Would I just purchase two 5Ah batteries and wire them in parallel to achieve 1 hour of operating time?
Comment: a 5 Ah battery is probably rated at 250 mA over a 20 hour time interval ... of you draw 5 A, then it will probably last for 40 minutes, or so .... check the manufacturer's datasheet to be sure
Answer: 2.8A is the maximum current, but actually nobody uses motors on maximal values. All stepper controllers have the possibility to set up maximum current on each motor depends on your requirements. In most cases, 50% is more than enough. For example, 3D-printers usually working on 1-1.5A current.
Additionally (for 3D-printing) Z-axis moves when other motors in idle state, so even with the maximum current you can save 25% of the expected power.


Test homogeneity in lmer models

Question: A reviewer is asking me to test for homoscedasticity with "appropriate tests", as opposed to visual inspection of residual plots. I haven't found any such test (I guess he wants a p-value). Does such a test exist and if not, is there something I can cite to justify not presenting a p-value?
Answer: Yes you could use for example Levene's test using the leveneTest() function from the car package. Here's an example with the Machines dataset from the nlme package:
library(lme4)
library(nlme); data(Machines)
library(car)

mod <- lmer(score ~ Machine + (1|Worker), data=Machines)

> leveneTest(residuals(mod) ~ Machines$Machine)

Levene's Test for Homogeneity of Variance (center = median)
      Df F value Pr(>F)
group  2  0.0811 0.9222
      51

Since the result is not significant, the assumption of equal variances (homoscedasticity) is met.
Also check ?leveneTest for more options.
Let's compare this with a boxplot of the residuals:
boxplot(residuals(mod) ~ Machines$Machine)

Since the reviewer seems to want a "formal test", it will probably be difficult to convince him accepting your visual inspection, despite, in my opinion, this would be the way to go. Maybe someone else has an actual reference why checking those assumptions visually is superior compared to "formal tests".
Edit to address comment by @D_Williams below:
A good and strongly cited paper by Zuur et al. 2010 may help to convince your reviewer regarding visual inspection of residuals to test for homogeneity of variances. Also here's is the link to the book Mixed Effects Models and Extensions in Ecology with R.
Comment: No problem. Brms uses same arguments as lme4. for unequal variances, suppose we have an interaction and we want to model the variances for each level of the interaction: y ~ x1 * x2, sigma ~ x1 * x2, where sigma...is for modeling the variances, or standars deviations. Very straightforward and highly recommended.
Comment: Yes, a great citation for just this is Zuur et al. generalized linear mixed models in ecology. It is a book. You might add that variances are always unequal to some degree. The question is the point at which this become problematic. I would suggest to use brms to fit a Bayesian model in which you can fit a so called unequal variance model. Then, compare this via LOO and posterior predictive checks to a model that assumes equal variances. I generally always fit the unequal variance model, because it makes the most sense.
Comment: @D_Williams Thanks for your comment! Yes, now that you mentioned Zuur et al, I also remembered they had a paper on statistical data analysis: http://onlinelibrary.wiley.com/doi/10.1111/j.2041-210X.2009.00001.x/full I will add this paper to my answer. It's highly cited and hence has some weight to it.
Comment: @D_Williams I am not familiar with Bayesian models but this is on my "to-do" list. Thanks for the comment!
Comment: Thank you both. I hope the citation will satisfy her/him. Most likely not, but fingers crossed. If you have any other relevant citations, please add them nonetheless.
Comment: @Stefan I've been unable to run the leveneTest function. R keeps saying not all arguments are the same length. My variable of interest (treatment) has two levels and both have the same number of rows. I build a model with just value ~ treatment + (1|ID) and used the same command as you before ( leveneTest(residuals(fit), data$treatment) )
Comment: @mariachi How does you exact code look like? Let's assume it's: `mod <- lmer(value ~ treatment + (1|ID), data = mydata)`, then Levene's test should work with `leveneTest(residuals(mod) ~ mydata$treatment)`. If you paste the R code from my answer into your R console, it work though, right?

Test homogeneity in lmer models


How to get total width of Vim with vertical splits?

Question: winwidth(0) returns the width of the current window.  However, if vim has multiple vertical splits, forming multiple windows, winwidth(0) would only return the width of the current window.
For example, let say the terminal has 80 columns across.  Without, any vertical splits, echo winwidth(0) would return 80.  If <C-W>v is used however, echo winwidth(0) would return a number less than 80, equal to the width of one of the split windows.
How can I get the full terminal width without forcing the cursor to jump through all vertical splits (for example, with windcmd l)?
Answer: The solution is the use &columns instead of winwidth(0) to get the width of the terminal window.


What if there is no eligible answer for awarding a bounty?

Question: I set a bounty on a question but no-one's answered. It says I have 23 hours to award a bounty. What happens next?
Answer: From the bounty help page:

If you do not award your bounty within 7 days (plus the grace period), the highest voted answer created after the bounty started with a minimum score of 2 will be awarded half the bounty amount (or the full amount, if the answer is also accepted). If two or more eligible answers have the same score (their scores are tied), the oldest answer is chosen. If there's no answer meeting those criteria, no bounty is awarded to anyone.

Basically, nothing happens. You have already given up reputation to set the bounty. Those reputation points simply disappear if there is no one to award the bounty to.
Bounties are more useful on StackExchange sites with lots of users and questions. On ours, I expect that regular users will see all new questions.
Comment: FWIW, on the Science Fiction and Fantasy SE, while bounties are sometimes used to draw attention (usually on an older question from years ago), the more common use-case is actually to reward answers after the fact. That said, it's a much more active site, so several of us routinely hit the 200 point daily cap, and have hundreds of thousands of fake internet points to throw around. :-D


Why is the melting point of BaCl2 > BeCl2 while CsCl<NaCl

Question: I'd think that increasing ionic character by increasing electronegativity difference would result in strong bonds but in the case of NaCl and CsCl(and the other chloride of the group) the case is different.
Comment: @Karl A bond does *not* imply directionality. An ionic bond is a perfectly valid bond whether you are discussing the 'real' ionic bond (with non-zero covalent/metallic character), or the ideal 'pure' ionic bond. Since this is an issue of chemical definitions, I refer you to the IUPAC Gold Book.
Comment: @Karl Ionic compounds have bonds, just constructed differently from those th things like water and methane.
Comment: Related: https://chemistry.stackexchange.com/questions/82246/which-has-the-highest-melting-point-naf-nacl-nabr-nai/82254#82254
Comment: Ionic compounds have no bonds. It's a question of efficient packing and electrostatics.
Comment: @OscarLanzi A "bond" implies directional connection. No such thing in sodium chloride. The term is simply not helpful in explaining the properties of ionic compounds, as can be see by the above question, where it has mislead the OP.
Comment: also https://chemistry.stackexchange.com/questions/65914/why-magnesium-has-the-lowest-melting-and-boiling-point-in-its-group?rq=1
Answer: Sodium chloride and caesium chloride are both primarily ionic compounds. Within ionic compounds, a greater melting point can be caused by a higher ionic charge or a higher charge density/better interaction. Since both have the same charge while sodium has a smaller ionic radius, the sodium-based crystal is held together better due to more interaction than the caesium based one.
When comparing barium chloride and beryllium chloride, you are essentially comparing apples and oranges since beryllium chloride is a primarily molecular compound. In its gas phase, it forms $\ce{BeCl2}$ monomers and $\ce{Be2Cl4}$ dimers. The intramolecular attractions in molecular compounds are typically rather strong with the intermolecular ones are weaker. For ionic compounds such as barium chloride, we cannot distinguish between the two since we cannot define molecular entities.
When comparing ionic compounds to molecules, the ionic compounds typically have a much higher melting point (with exceptions; both low-melting ionic compounds and high-melting molecular compounds).
Comment: Well a quick google suggests they have different crystal structures, CaCl2 taking a rutile structure, and BaCl2 being calcite or PbCl2. It's not easy to compare different structures, especially when coordination numbers change as in this case, so periodic trends such as MP will be hard to spot. In fact the most obvious periodic trend in the alkaline earth chlorides is the change from covalent to ionic behaviour, from covalent BeCl2 through the layered MgCl2 to the typical ionic structure of BaCl2.
Comment: Arright, that explains it for BeCl2 but what about CaCl2 (I don't think this dimerises, does it?) ? It's smaller but has a lower melting point it looks like (does CaCl2 even exist in a crystal lattice?)


DB schema for RBAC with multiple levels of roles

Question: I'm trying to come up with a DB schema for an RBAC, and I want to be able to create "departments" and "positions".  Positions will extend the generic privileges of departments.  Should I just create a single "roles" table, holding both the positions and departments?  Or should I create 3 tables: positions, departments, and roles, with the positions and departments table having a foreign key to the roles table?  Thx in advance for your help everyone!  Cheers.
Comment: I got confused.... can you explain a little bit more about your requirements.
Comment: @Starx, I'm just wondering what the standard DB schema is for an RBAC system.  The thing is that I want to create a hierarchy similar to a standard org structure, with departments, and job positions within those departments.
Answer: My experience while experimenting with a custom RBAC implementation is as follows:

You read a lot of the RBAC literature and think you understand it.  Then you go ahead and try to implement it, just to realize you didn't really understand it at all.  Eventually it will make sense as you move along in the project.
Based on your question, you already know the business domain to which you want to apply RBAC.  But forget about the actual business objects for now.  Your RBAC implementation should be generic, meaning that you have a DB schema consisting of Role, User, Permission, Operation, etc tables.  Then you will have objects which map to such tables (one-to-one relation).

Once you have this RBAC implementation, it can then be modeled to practically any business domain, such as a 'Deparment' that you have mentioned.
Just remember that it's not all perfect... I've enhanced/modified/derived from the actual RBAC literature in order to add custom features, enhance performance, etc.
I haven't worked on this for a while, so I hope I'm correct in the following:

User: Instances are created and saved to it's backing table.
Role: Instances are created and saved to it's backing table.  Roles will get assigned to users.
Permission: A permission basically is a combination of an Operation on an Object.  Permissions get assigned to roles.
Operation: An operation is simply anything you want.  It could be CRUD (create, read, update, delete) or it could also be 'print', 'search' or anything a human (or system) can perform on an object (or group of objects).
Object: This is basically all your objects which make up your business domain.

For even more power, you could implement constraints to apply an enormous amount of various restrictions.
With this framework, you should be able to map:

Who can assign users to a department
Who can remove them from departments
How many users can be in a department
What kind of users (based on their assigned roles) can be in a department
Which rolls can perform which operations to a department (create, read, update, delete them)
Etc.
Comment: Would love to see schema for this design.
Comment: @RobertPitt Here is my EER model: http://i.stack.imgur.com/X2OJC.png (please ignore act_session, act_provider and act_user_provider, those tables are for sessions and social logins).
Answer: Standards? This is an unanswerable question, as none such things exists. RBAC is always customized on the basis of the requirements.
You might want to see following resources:

http://www.sitepoint.com/forums/php-application-design-147/patterns-tutorial-series-part-1-rbac-domain-model-162027.html
http://csrc.nist.gov/rbac/rbac-std-ncits.pdf

Archived version of above link (https://web.archive.org/web/20110718210859/http://www.sitepoint.com/forums/php-application-design-147/patterns-tutorial-series-part-1-rbac-domain-model-162027.html)
Comment: The forum conversation is interesting indeed. Thank you.
Comment: FYI, Forum Link is *broken* and that is why Link-Only answer is not accepted on StackOverflow. Disappointed!! :(


How can I test a radiant heated driveway in warm weather?

Question: I'm buying a house which has a radiant heated driveway (for snow and ice abatement)
How can I go about testing it in warm weather?
Comment: What type of system is it?  Liquid or thermoelectric?  For liquid you just have to verify that the heater works that the loop is sealed and that flow rate is acceptable.  For thermoelectric you may need to use a meggar to verify insulation is good, a meter for continuity and resistance, and it may be a semiconductor type that functions as a sensor or have actual sensors, in which case you need to check the sensors.
Answer: Wait until night time, then turn it on and look at it with an infrared camera?
Comment: @P2000 solar gain will mess you up, so no. Really I would turn the electricity on at 1AM and check it at 5AM.  Otherwise the "solar gain" the pavement collected all day will throw off the reading.
Comment: Smart! Does it have to be night? How about cloudy?
Comment: Just stating the obvious: Since the property isn't owned by the OP, arrangements will have to be made with the current owner to turn it on at the appropriate time, and to be allowed onto the property early in the morning to do the infrared scanning. I suppose you could point the camera from the street... Just alert the owner & neighbors so they're not concerned about a prowler early in the morning.
Answer: Use a multimeter and check the resistance of the heating elements.
You will need to know how they are connected series , parallel or a combination.
Comment: How will the measurements change? Couldn't I, instead, use an ammeter to measure current through them?
Comment: Assuming your skill level from your questions, I suggest measuring the resistance as the power is off. If you want to measure current then the power will be on and you could get a shock - which might even be fatal. As for calue, assuming the elements are the same length then the resistance reading should be very similar, its the ones the are open circuit that will need more investigation. Also consider the use of the megger as suggested. @Matthew
Answer: You could wait for the sun to go down, then scrape the snow out of your freezer and spread it on part of the surface (maybe chalk a square) and on another surface that isn't heated, then turn the system on and watch and compare.
Comment: That's not particularly scientific. There are many reasons a bit of frost would melt more quickly in one area than another. Maybe ice cubes, with more mass....


problems with the isp using tor

Question: I know that if I use tor my isp can see it. Can this cause me any problems. Could it for example pretend some explanations or contact me about this issue?
Thank you for you precious help.
Comment: It is quite unclear to me what you are trying to ask. Could you rephrase your question or add explanation?
Answer: As a Tor user you're very unlikely to face any repercussions from your ISP, as long as you don't contribute to Tor by running a relay. Using Tor is not illegal in virtually all jurisdictions. Unfortunately, we don't know what will happen in the future and it is possible that someone records that you're using Tor today to use it against you tomorrow. The best defense is to get as many people as possible using Tor so that it becomes an even more normal thing to do.

problems with the isp using tor


nginx https redirect not working

Question: My config is as follows:
<code>    server {
      listen *:80;
      server_name example.com;
      return 301 https://$host$request_uri;
    }

  server {
      listen *:443 ssl;
      ssl_certificate /directory/of/cert/cert.pem;
      ssl_certificate_key /directory/of/cert/cert.pem;
      proxy_ssl_ciphers kEECDH+aRSA+AES:kRSA+AES:+AES256:!kEDH:!LOW:!EXP:!MD5:!aNULL:!eNULL;
      proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

      location / {
      proxy_pass http://localip:8080;

      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection $http_connection;
        }
    }
</code>
However, when I curl -v to example.com, I get a time-out
<code>curl -v http://host.example.com
* Rebuilt URL to: http://host.example.com/
*   Trying <public_ip>...
* TCP_NODELAY set
* connect to <public_ip> port 80 failed: Timed out
* Failed to connect to host.example.com port 80: Timed out
* Closing connection 0
curl: (7) Failed to connect to host.example.com port 80: Timed out
</code>
I've done some Googling and found this link: nginx redirect http to https not working
christofferp suggested that it could be the /sites-enabled/default config taking precedence and causing the problem, I've removed mine, but still having trouble.
I have tried a number of different config changes, but cannot seem to get it working.
Any ideas? Could it be something in my config that's wrong?
Comment: a timeout usually points toward a firewall problem. Apart from that, you've set `example.com` in your server config, but you try to connect to `host.example.com`.
Comment: Damnit! It was the firewall, thanks Gerald. As I read your comment I realised I never opened HTTP. It's working now.
Answer: Thanks Gerald Schneider, I forgot to open HTTP on the firewall! Solved my problem.

nginx https redirect not working


Show that every ideal of the ring $\mathbb Z$ is principal

Question: Let $\mathbb Z$ be the ring of integers. The question asks to show  that every ideal of $\mathbb Z$ is principal. I beg someone to help me because it is a new concept to me.
Comment: (I assume you mean $\mathbb{Z}$ the ring of integers, not only "a ring"...) An ideal is, in particular, a subgroup. Do you know what the subgroups of $\mathbb{Z}$ are?
Comment: "Let Z be a ring" is wrong. The question is about the _particular_ ring whose proper name is $\mathbb Z$, namely the ring of ordinary integers under ordinary addition and multiplication.
Comment: Well one thing is if you know that $\mathbb{Z}$ is an euclidean domain then it is automatically a PID.
Comment: There was a question on showing that every subgroup of a cyclic group is cyclic which might help (although largely focused on the finite case): http://math.stackexchange.com/q/6998
Answer: Goal: show that $\mathbb{Z}$ is a principal ideal domain (or PID).
Let $I$ be an ideal of $\mathbb Z$.
If $I={0}$ then $0$ generates $I$. And we are done.
Suppose $I\neq {0}$, and let $a$ be the smallest positive element in $I$.
Claim: $a$ generates $I$ i.e $(a)=I$.
To prove my claim, clearly $(a)\subset I$
Since $(a)$= {$ar :r \in \mathbb Z$}, $ar\in I$
Let $b \in I$ if $b=0$ then $b=a0 \in (a)$.
If $b\neq 0$, we may assume $b>0$, and by the euclidean algorithm we have
$$b=aq+r.$$
Moreover, $0\le r<a$, and of course $q,r \in \mathbb Z$.
Now, $r=b-aq \in I$ since $b,a \in I$. this implies $r=0$ since $r<a$ and $a$ is the smallest element in $I$.
So, $b=aq \in I$. Thus, $(a)=I$, meaning that $a$ generates $I$.
Comment: "we may assume $b>0$": There is no need to assume $b>0$, or even to treat $b=0$ as a separate case.
Comment: @Hassan The proof has a (minor) error in that it implicitly assumes $a$ is positive. Instead, it should say:  $I\ne 0 $ implies $I$ has a *positive* element. Let $a$ be the least *positive* element in $I$.
Comment: I am new to Ring theory, but is it OK to assume $\mathbb Z$ is an Euclidean Domain in which we can apply Euclidean Algorithm?
Comment: Remark that in $\mathbb Z$ it is a bit simpler to use (repeated) *subtraction*, versus *division* (with remainder) - see my answer. This corresponds to the subtractive (vs. divisive) form of the Euclidean algorithm.
Comment: @HassanMuhammad "let $a$ be the smallest element in $I$" without a further explanation it is not clear that in $I$, a subset of $\mathbb Z$, a smallest element exists.
Comment: @Jack Maney: Thanks for the edit.
Answer: $\textbf{Hint-}$Every ideal is an additive subgroup and every subgroup of cyclic group is cyclic. I hope this will help.
Answer: Suppose that $I$ is an ideal in $\mathbb{Z}$. If $I=(0)$, it's certainly principal, so assume that it contains a non-zero element. Since $I$ is a subgroup of $\mathbb{Z}$, if it contains a non-zero element, it must contain a positive element. Let $m$ be the smallest positive member of $I$. Show that $I=(m)$, the set of multiples of $m$.
HINT: Use the division algorithm and a proof by contradiction.
Answer: HINT $\ $ In $\rm\:\mathbb Z\:,\:$ descent via the Division (Euclidean) algorithm has especially simple form, viz.
LEMMA $\ \ $ If a nonempty set of positive integers $\rm\: M\:$ satisfies $\rm\ n > m\ \in\ M \ \Rightarrow\ \: n-m\ \in\ M$  then every element of $\rm\:M\:$ is a multiple of the least element $\rm\:m_{\:1} \in M\:.$
Proof $\ \: $ If not there is a least nonmultiple $\rm\:n\in M\:,$ contra  $\rm\:n-m_{\:1} \in M\:$ is a nonmultiple of $\rm\:m_{\:1}.$
REMARK $\ $ Note that the lemma depends only on the fact that $\rm M$ is discrete and closed under subtraction, so it applies much more generally, e.g. to $\:\mathbb Z$-modules $\subset \mathbb Q\:.\ $ The study of these "fractional ideals" essentially go back to Euclid, who studied the application of the Euclidean algorithm to "line segments" to determine their "greatest common measure". This leads quite naturally to the study of the continued fraction expansion of a real number.
Answer: Let $I \subset \mathbb{Z}$ be an ideal; we want to show that $I$ is generated by only one
  element of $I$, that is, it is a principal. If $I=0$, then $I= \langle 0 \rangle$.
  Let us assume then that $I \ne 0$, so there is a smallest positive number on $I$. We call
  this number $n$ and claim that $I = \langle n \rangle $.  Let us pick $m \in I$ and divide
  it by $n$ with remainder. The division theorem (a proof of Euclid's the division theorem
  is found in the link below:
 http://www.math.fsu.edu/~pkirby/mad2104/SlideShow/s5_1.pdf
  states that there should be a quotient $q$ and a remainder $r$ such that $m = q n + r$,
  with $0 \le r < n$.  We proof that $r=0$. We have that $r=m - q n \in I$, and since
  we assumed that $n$ is the smallest positive in $I$, then $r=0$. This means
  that every number on $I$ is of the form $q n$, and the set $\mathbb{Z}$ is PID.
We need to be careful here. Assume that we have the following ideal:
\begin{equation}
  I_{23} = \langle \{2, 3 \} \rangle = \{ 2 n + 3m : n, m \in \mathbb{Z} \}.
\end{equation}
That is the ideal consists of all the multiples of $2$ together with the multiples
of $3$, and their linear combinations. Then by choosing $n=0$ we get all multiples of $3$,
and by choosing $m=0$ we get all multiples of $2$. We could say that $2$ is the
smallest positive integer in the ideal $I_{23}$, but then that $3$ being in $I_{23}$ can
not be obtained from $2$ with an integer multiplication, so the proof above is wrong.
In fact that is not the case. We let you to prove that $I_{23}=\mathbb{Z}$,
and that in general $\langle \{ p, q \} \rangle$ is equal to
$\langle \{ o \} \rangle$, where $o=\text{gcd}(p,q)$. More generally,
for ideals in $\mathbb{Z}$, $\langle \{ p_1, \cdots, p_k \} \rangle = \langle \{ o \} \rangle$ with
$o=\text{gcd}(p_1, \cdots, p_k)$.
The same argument used here can be applied to polynomials in one variable $\mathbb{K}[x]$, over the field $\mathbb{K}$. For polynomials in two or more variables the property breaks.
Comment: Explanation with an example is really helpful.
Answer: If $I$ is an ideal of $\mathbb{Z}$, then, considering only the addition operator, $(I,+)$ is a subgroup of $(\mathbb{Z},+)$ (ie $I$ is an additive subgroup of $\mathbb{Z}$, when viewed as a group under addition).  Since $(\mathbb{Z},+)$ is cyclic, it follows that $(I,+)$ is cyclic (if you aren't convinced that every subgroup of a cyclic group is cyclic, you should sit down and prove it).
Therefore, $(I,+)$ as a group is generated by some $n\in \mathbb{Z}$.  So, for every $x\in I$, there exists $m\in \mathbb{Z}$ such that $$x=\underbrace{n+n+\cdots+n}_{m\textrm{ times}}$$ if $m>0$ or $$x=\underbrace{-n-n-\cdots-n}_{\vert m \vert \textrm{ times}}$$ if $m<0$ (and of course $x=0$ if $m=0$).  Thus, $I=\{nm\,\vert\,m\in \mathbb{Z}\}$, and now you only need show that,  as an ideal, $I$ is generated by $n$.
Answer: Let $d$ be the smallest integer in ideal $I \subseteq \mathbb{Z}$.
Assume for contradiction $\exists a \in I$ so that $a$ is not divisible by $d$. Then we can represent $a$ as $a = qd + b$, for $q \in \mathbb{Z}$ and $ 0 <b < d$. As $d$ is the smallest integer in $I$ and $d > b$, we know that $b \notin I$. As I is an ideal, we know that $qd \in I$. Therefore we have
\begin{align}
a = qd + b \in I \\
qd \in I \\
b \notin I\\
\end{align}
Because I is an ideal, we know that $I$ is a group under addition, which implies $-qd \in I$, and $a - qd = b \in I$, which contradicts the assumption that $b \notin I$.


Calendar Syncing

Question: I have several calendars on my mac laptop, Exchange, Yahoo and Google. I'm having trouble syncing my phone with my laptop all of the sudden. I haven't changed any settings.
The weird thing is certain appointments on my Exchange calendar show up on my phone but not others.
Or I'll move appointments on my laptop but it doesn't sync with my phone.
Any ideas?
Answer: The calendars on your laptop don't sync with your phone but sync to the originating sources and other devices have to poll and update themselves at regular intervals. Only iCloud and probably exchange calendars do a push sync.
In either case, the problem for you is NOT that the phone is not syncing with the laptop (it never does), but it is not syncing with the originating server (Yahoo, Exchange, Google etc). Try re-adding the calendar on the phone.

Calendar Syncing


Balancing XGboost still skews towards the majority class

Question: I have unbalanced dataset for multiclass classification and I tried to use the class weights option in XGboost and the classifier still tends to favor the majority class. I am not sure if I need to tune something else or how I should approach this.
If the algo was predicting all over the place I could still understand but not sure why it still skews towards the majority class. Any pointers?
Update: What I mean is that majority of the predictions are still for the major class which is roughly 30% in both test and train
Comment: What do you mean by the classifier still tends to favor the majority class?
Comment: Sorry if it was not clear..i mean overwhelming majority of the predictions are still for the major class...hope that makes sense
Answer: That is completely normal. You should remember that the model will basically learn a statistical function given by your data (Intuitively), and since your data is skewed, it will learn by the majority class.
To overcome that, you can treat the imbalance characteristic of data set using two types of approaches: sampling and cost-sensitive learning. Basically, in sampling techniques we have undersampling and oversampling, that is, we can reduce our data set to balance data or increase it with artificial methods. Some examples:

Random Oversampling: essentially, this technique increases minority class by randomly sampling it.
SMOTE: random oversampling has a overfitting problem as we are just replicating data considerably. To overcome that, smote works, in a simplified way, interpolating points on the feature space for nearest neighbors in minority classes.

For undersampling techniques:

Random Undersampling: this method simple undersample the majority class. We can loss information, but if points are close, it can give good results
NearMiss: In a simplified way, this model selects the closest points to the minority class.

In cost-sensitive learning techniques, we use cost matrix 'punishing' models that give wrongs score to a specific class. For example, let's say you want to give better results for class C1, you can create a matrix where the misclassification of C1 is higher than other classes.
In python we have two excellents libraries to deal with this problems:

https://imbalanced-learn.readthedocs.io/en/stable/api.html
https://wwwen.uni.lu/snt/research/sigcom/computer_vision_lab/costcla_a_cost_sensitive_classification_library_in_python

They have excellent tutorials on the topic so you can get a deeper overview of methods discussed and others ones. I hope it helps.
Comment: oh..so if I am understanding correct..the sample_weight attribute for xgboost will not necessarily handle the imbalance? I had tried SMOTE...let me explore teh cost classification route..
Comment: I think using sample weights _should_ help, and this answer doesn't seem to address that part of the OP (though what it _does_ address is helpful)...


If you lose your Bitcoin wallet Password, can you simply transfer private key to another bitcoin wallet provider?

Question: If you lose your Bitcoin wallet password, can you simply transfer private key to another bitcoin wallet provider?  I mean if I lost the password to the website where the wallet is stored, can I simply use the private key on a different wallet provider, and gain access to all the coins again?  Or, is the private key tied permanently to a certain wallet provider?
Answer: It depends. For standard addresses, the key should be sufficient to identify the funds you can spend and to spend them.
For more complex scripts the private key can be insufficient to rediscover the funds, if you don't have the means to reconstruct the script without information from your account.
Comment: What do you mean by scripts?  And how exactly do people recover the persons wallet, if they lost their password?  I mean do they get the wallet.dat or they just brute force?  Or what exactly?


Create Pi image from wireless headless Pi for distribution - remove SSID and password

Question: I want to create a Pi image that I can distribute to others. I have the basics down for doing this for myself, and it works. But for my own use, that fact that my WiFi SSID and password are included in the image is fine. That's not fine for distribution. I'm interacting with the source Pi in headless mode over WiFi.

What files, in what directories, do I need to edit to remove my SSID and Password so they won't be in the image?
Can can I do this and still access the Pi over WiFi while doing this and then restore the
values, or will I have to connect via ethernet?
Answer: My thanks to KLRicks over at the Raspberry Pi forum, who provided the answer:
Edit or remove /etc/wpa_supplicant/wpa_supplicant.conf
You will be connected to WIFI until next reboot.