Xamarin installation issues - MAC

Question: I've installed the android sdk. Xcode 5.1.1 is installed. I am not sure why the universal installer is not working? Thank you for your time!
[2014-06-05 20:34:18.190] [Info] Installation ID: dd344913-5804-4125-bfe5-a09cc1b2c0ea
[2014-06-05 20:34:18.195] [Info] Operating system: Mac OS X v10.9.3 (10.9.3; Mac OS X 10.9.3 (10.9.3 build version: 13D65)), 32-bit
[2014-06-05 20:34:18.197] [Info] Installer product: Xamarin
[2014-06-05 20:34:18.197] [Info] Installer version: 184.108.40.206 (detached from 04514fb) (04514fb54a5884a2182d80bc299383c8d747ed76 on 23/05/2014 14:03:07)
[2014-06-05 20:34:18.197] [Info] Status: in progress
[2014-06-05 20:34:20.616] [Debug] Waiting for manifests to finish downloading.
[2014-06-05 20:34:20.617] [Debug] Initial task executing (WaitingForActivation). Waiting for it to finish.
[2014-06-05 20:34:21.424] [Info] Retrieving installation manifest.
[2014-06-05 20:34:21.424] [Info] Downloading from 'http://xamarin.com/installer_assets/v3/Mac/Universal//InstallationManifest.xml'.
[2014-06-05 20:34:21.426] [Debug] Setting download timeout for 'http://xamarin.com/installer_assets/v3/Mac/Universal//InstallationManifest.xml' to 60s
[2014-06-05 20:34:21.527] [Info] Retrieving installation size manifest.
[2014-06-05 20:34:21.527] [Info] Downloading from 'http://xamarin.com/installer_assets/v3/Mac/Universal//InstallationSizes.xml'.
[2014-06-05 20:34:21.528] [Debug] Setting download timeout for 'http://xamarin.com/installer_assets/v3/Mac/Universal//InstallationSizes.xml' to 60s
[2014-06-05 20:34:21.629] [Info] Installation size manifest not found online, using the bundled copy
[2014-06-05 20:34:21.629] [Info] Installation size manifest: reading from assembly.
[2014-06-05 20:34:21.630] [Info] Determining list of software items to install.
[2014-06-05 20:34:21.731] [Debug] Processing update nodes from the manifest.
[2014-06-05 20:34:21.731] [Debug] Creating and initializing software item 'Mono Framework'
[2014-06-05 20:34:21.933] [Debug] Creating and initializing software item 'Java SDK'
[2014-06-05 20:34:21.933] [Debug] Creating and initializing software item 'Android SDK'
[2014-06-05 20:34:21.935] [Debug] Creating and initializing software item 'Xamarin Studio'
[2014-06-05 20:34:21.935] [Debug] Creating and initializing software item 'Xamarin.Android'
[2014-06-05 20:34:21.935] [Debug] Creating and initializing software item 'Xamarin.iOS'
[2014-06-05 20:34:21.935] [Debug] Detecting software item 'Mono Framework'
[2014-06-05 20:34:21.935] [Info] Checking whether Mono needs update/installation
[2014-06-05 20:34:22.036] [Info] Mono runtime found in /Library/Frameworks/Mono.framework/Versions/3.4.0
[2014-06-05 20:34:22.037] [Info] Mono version 3.4.0 was found in /Library/Frameworks/Mono.framework/Versions
[2014-06-05 20:34:22.038] [Info] Status: successful
[2014-06-05 20:34:22.039] [Info] Component 'Mono Framework' v. 3.4.0 present
[2014-06-05 20:34:22.039] [Info] Software item 'Mono Framework': up to date
[2014-06-05 20:34:22.039] [Debug] Detecting software item 'Java SDK'
[2014-06-05 20:34:22.039] [Info] Checking whether Mac JDK needs update/installation
[2014-06-05 20:34:22.039] [Info] Status: successful
[2014-06-05 20:34:22.039] [Info] Component 'Java SDK' v. 1.6.0 present
[2014-06-05 20:34:22.039] [Info] Software item 'Java SDK': up to date
[2014-06-05 20:34:22.039] [Debug] Detecting software item 'Android SDK'
[2014-06-05 20:34:22.040] [Info] Checking if Android SDK needs to be updated/installed
[2014-06-05 20:34:22.040] [Info] Fetching Android SDK manifest.
[2014-06-05 20:34:22.040] [Info] Manifest URL: http://dl.google.com/android/repository/repository-8.xml
[2014-06-05 20:34:22.040] [Info] Using default samples:
[2014-06-05 20:34:22.040] [Info] Downloading from 'http://dl.google.com/android/repository/repository-8.xml'.
[2014-06-05 20:34:22.040] [Debug] Setting download timeout for 'http://dl.google.com/android/repository/repository-8.xml' to 25s
[2014-06-05 20:34:22.141] [Info] AVD 'MonoForAndroid API 15' needs to be created.
[2014-06-05 20:34:22.141] [Info] AVD 'MonoForAndroid API 14' needs to be created.
[2014-06-05 20:34:22.141] [Info] AVD 'MonoForAndroid API 12' needs to be created.
[2014-06-05 20:34:22.141] [Info] AVD 'MonoForAndroid API 10' needs to be created.
[2014-06-05 20:34:22.142] [Info] AVD 'MonoForAndroid API 8' needs to be created.
[2014-06-05 20:34:22.142] [Info] AVD 'MonoForAndroid API 7' needs to be created.
[2014-06-05 20:34:22.142] [Info] Status: failed.
[2014-06-05 20:34:22.142] [Exception] Failed to detect component 'Android SDK'
[2014-06-05 20:34:22.142] [Exception] System.NullReferenceException: Object reference not set to an instance of an object
[2014-06-05 20:34:22.142] [Exception] at Xamarin.Web.Installer.Installer.AndroidSoftwareItem.Detect () [0x00000] in <filename unknown>:0
[2014-06-05 20:34:22.142] [Exception] at Xamarin.Web.Installer.Installer.AndroidSoftwareItem.NeedsUpdate () [0x00000] in <filename unknown>:0
[2014-06-05 20:34:22.142] [Exception] at Xamarin.Web.Installer.TasksManager.ComponentDetector (ISoftwareItem si) [0x00000] in <filename unknown>:0
[2014-06-05 20:34:22.142] [Error] No selected SDK, cannot enqueue downloads
[2014-06-05 20:34:22.142] [Debug] Detecting software item 'Xamarin Studio'
[2014-06-05 20:34:22.142] [Info] Checking whether Xamarin Studio needs installation/updating
[2014-06-05 20:34:22.142] [Info] Xamarin Studio installation check: app directory does not exist.
[2014-06-05 20:34:22.142] [Info] Xamarin Studio not detected.
[2014-06-05 20:34:22.143] [Info] Xamarin Studio 5.0.0 needs to be installed.
[2014-06-05 20:34:22.143] [Info] Status: successful
[2014-06-05 20:34:22.143] [Info] Software item 'Xamarin Studio': not up to date
[2014-06-05 20:34:22.143] [Info] Component 'Xamarin Studio' v. 5.0.0 absent
[2014-06-05 20:34:22.244] [Debug] Detecting software item 'Xamarin.Android'
[2014-06-05 20:34:22.245] [Info] Checking whether Xamarin.Android SDK needs installation/updating
[2014-06-05 20:34:22.246] [Info] Xamarin.Android build files not found.
[2014-06-05 20:34:22.246] [Info] Base Xamarin.Android directory not found.
[2014-06-05 20:34:22.247] [Info] Xamarin.Android SDK 4.12.4 requires installation.
[2014-06-05 20:34:22.247] [Info] Status: successful
[2014-06-05 20:34:22.247] [Info] Software item 'Xamarin.Android': not up to date
[2014-06-05 20:34:22.247] [Info] Component 'Xamarin.Android' v. 4.12.4 absent
[2014-06-05 20:34:22.247] [Debug] Detecting software item 'Xamarin.iOS'
[2014-06-05 20:34:22.247] [Info] Checking whether Xamarin.iOS needs update/installation
[2014-06-05 20:34:22.248] [Info] MonoTouch base directory not found.
[2014-06-05 20:34:22.248] [Info] Xamarin.iOS 184.108.40.206 needs to be installed.
[2014-06-05 20:34:22.248] [Info] Status: successful
[2014-06-05 20:34:22.248] [Info] Software item 'Xamarin.iOS': not up to date
[2014-06-05 20:34:22.248] [Info] Component 'Xamarin.iOS' v. 7.2.3 absent
[2014-06-05 20:34:22.248] [Info] Detection complete
[2014-06-05 20:34:22.248] [Info] Initial task completed successfully
[2014-06-05 20:34:22.249] [Debug] Detection complete on the introduction page, determining the next step.

Comment: For install issues you would be better off asking on forums.xamarin.com
Comment: Thanks, I'll do that.
Answer: [2014-06-05 20:34:22.142] [Exception] Failed to detect component 'Android SDK'
[2014-06-05 20:34:22.142] [Exception] System.NullReferenceException: Object reference not set to an instance of an object
[2014-06-05 20:34:22.142] [Exception] at Xamarin.Web.Installer.Installer.AndroidSoftwareItem.Detect () [0x00000] in <filename unknown>:0
[2014-06-05 20:34:22.142] [Exception] at Xamarin.Web.Installer.Installer.AndroidSoftwareItem.NeedsUpdate ()   [0x00000] in <filename unknown>:0
[2014-06-05 20:34:22.142] [Exception] at Xamarin.Web.Installer.TasksManager.ComponentDetector (ISoftwareItem si) [0x00000] in <filename unknown>:0

The installer throws a NullReferenceException. Try a different version of the installer maybe. You can find an archive of available installers on xamarin.com after you log in to your account.
Alternatively you could try installing the Android SDK before attempting to install the Xamarin SDK. You will find the downloader under SDK Tools Only on the Android developer download page.

Xamarin installation issues - MAC


Basics for the positive support vectors in the support vector machine

Question: Can anyone explain in detail why $wx^++b=1$ for positive support vectors in SVM and $wx^-+b=-1$ for negative support vectors in SVM?
Answer: The decision boundary of SVM is $wx+b=0$. When you shift this line to positive and negative sides by some amount, you'll get parallel lines of the form: $wx+b=\pm d$. $wx+b=d$ will hit positive SVs and $wx+b=-d$ will hit negative SVs. Instead of using a third variable ($d$) here, we could scale $w$ and $b$ such that our line does not change. For example, $2x+3y=0$ and $4x+6y=0$ are still the same. Similarly, one could search for $w$ and $b$ such that $wx+b=\pm1$ at SVs without loss of generality.
Comment: Hi, so according to what you wrote, 2x+2 and 4x+4 are the same line? And could you given an example of expressing the same line in the 3 forms you showed?


Deploy NodeJS app to Azure from VS Code

Question: Created simple nodejs app in VS Code (Linux). Also created NodeJS app in Azure. How to deploy app from VS Code to this Azure app now? AZ CLI installed. I've downloaded some MyApp.PublishSettings file however seems it used in VS not VS Code. What is the best way to deploy then with or without git (github)?
Answer: Local Git deployment from command line (or VS Code terminal):
git remote add azure https://<username>@<app_name>.scm.azurewebsites.net/<app_name>.git
git push azure master

If empty application already there use force flag:
git push azure master -f

Useful links deploying Bot Framework To Azure On Linux:

https://code.visualstudio.com/tutorials/nodejs-deployment/deploy-website
https://blog.botframework.com/2017/04/27/Deploying-Botframework-To-Azure-On-Linux/

P.S. Could be outdated since 2017.

Deploy NodeJS app to Azure from VS Code


Does weight and/or body frame have anything to do with singing?

Question: Does a small body frame (meaning small bones and possibly small organs) or low weight affect the "power" of a singing voice?? Does a higher weight creates some sort of "pressure" or something that makes the voice sound more powerful? Is a person with a small body able to take as much air as others?
This came to my mind after watching some (about 20) videos of some singers, most of them were opera singers, but there were others like Mariah Carey. I noticed lot of them are on the "thick" side, and well, I wanted to know if there was some sort of science behind that or just coincidence.
Comment: The English is excellent, and the only thing we care about here is good questions! I'm going to edit out the extraneous parts of this, since they won't have any effect on how we answer the question.
Comment: Pat Benatar is a counter example to your "thick" argument. :)  She's a tiny little thing with a rich, powerful voice.
Comment: @JimR Another great example of a smaller body but very large voice is professor Thomas Quasthoff.
Answer: On average, taller people have lower voices because of longer throat and vocal chords, just like taller people have larger hands on average.
When people get fatter or thinner, it often causes changes in their voice tone and may make a slight difference in range. The same thing is true of aerobic conditioning. Of course, vocal practice will likely make more difference than either of these.
(This is based on personal observation and not research.)
Answer: My personal opinion: In my 35 years of experience in singing, what I have observed is that every individual is unique. Some quite small people sing with a huge voice, and some quite large people have small voices. On average, perhaps, there might be a correlation between the mass of the person and the size of the voice, but I think this is largely meaningless to any individual.
I suspect that the "size" of the singing voice is mostly something that one is born with and has to do with the physiology of that particular person's larynx. Beyond that it's possible to develop the character and "size" of the voice a great deal with the proper training and practice. But ultimately I believe you are either born with a big voice or you are not, and it's mostly independent of the size of your body frame or your mass.
Answer: I cannot refer to any scientific research. However I've heard tiny (short and thin) women sing with a strong powerful loud voice with a full rich timbre that would amaze most people, and I'm sure there are large people with really weak voices. So if there is a correlation between body frame size or body weight and singing voice power the correlation coefficient is probably not too large. I'd guess that internal body construction and musculature is more important than actual external size. Not to mention training.
Regarding air supply there is certainly some correlation between body height and lung size. I don't know but I don't think it is a very important factor for your singing ability.
(Regarding voice range I'm fairly certain that the size or length of the vocal folds constitutes the main factor for what singing range a person has. Although there is likely some correlation between body length and vocal folds length it's not a one to one relation. For example the bass singer Anders Jalkéus of the á capella group The Real Group I believe is at most of average height but he can  sing several notes in the contra octave below C2 and that's definately below average. Further I've sung with rather tall tenors.)
I'd really like to hear about scientific research regarding this though.
Answer: Someone more knowledgeable about singing will no doubt be able to provide more detail, but in short, yes your body does very much affect the timbre of your voice - your weight, less so.
Think of your body as the body of a guitar or violin - your chest, throat and lungs are like the sound box that helps sound to resonate. So yes, you'll notice bass singers tend to have a larger frame (note: being obese doesn't really add much, they just tend to be larger than the average), as will anyone with a "big" voice.
Compare women and girls - their voice doesn't 'break' when they go through puberty like a man's does, but you can still tell the difference beteen a young girl and adult woman just by listening to the way they sound.
Comment: Do you have any sources for this information because I've seen many examples contradicting the body size reference.
Comment: [This thesis](http://www.st-andrews.ac.uk/~wtsf/thesis.pdf) is interesting but you're right there isn't anything conclusive in existing data - i.e. not all Pavarotti look-a-likes are guaranteed to have deep voices. But intuitively, a larger body means a better chance of a larger vocal tract & lungs. A larger vocal tract with more air means a better chance to resonate those deeper notes when "singing from your belly".
Comment: What's odd is that Pavorati was a tenor.  Samuel Ramey is a very slender man and one of the best basses in opera. Go figure!
Answer: The only way that I know of that weight has to do with singing is about endurance. If you are going to sing a 3 hour opera, you had better have some extra weight on you at the start, because you are going to lose multiple kilos of weight during your performance. Just like boxers and other athletes. The kind of singing that is done in opera is very, very athletic.
With opera singers specifically, there is a tradition of rich food and wine in opera culture, just like there is a tradition of marijuana in the cultures of some other musical styles. And I don't think the opera audience or critics judge an opera singer based on their weight, which is very contrary to singers in other musical styles. In opera, it is all about bringing the goods vocally. In other styles, it can sometimes be a modeling show where some singing also goes on. So generally speaking, opera singers may be a little heavier than other singers.
Regarding the physics of the voice, you can be a very small person and have a large vocal instrument, or a very large person and have a small vocal instrument. The size of your sinus cavity has a lot to do with the resonance and size of your voice, and there are very small people with big noses and large people with small noses. When you put all the variables together, I don't think you can make any assumptions about physical size and especially not about gender. If you were holding auditions and a tiny woman walks in, you should definitely not be surprised if she blows your hair back with her vocal power. I have seen that again and again in my own experience. Also don't be surprised if a giant man comes in and has no power at all. Also very common.
A big part of a powerful voice is training. If you learn how to sing powerfully from the diaphragm with a relaxed and resonant vocal instrument, you will generate your maximum power. And generally speaking, that will be much more power than an untrained singer. (Keep in mind, though, some people train at church or at home — you don't have to have gone to college to be trained.) Learning how to project the voice is a big part of generating volume and power, and the instant identifier of an untrained singer is they can't project the voice. And then once you are trained, you have to practice regularly to keep everything in shape, just like an athlete.
So the way to judge if a person has a powerful voice is to just to hear them sing.
Answer: It doesn't, the weight, power and range of your voice are dependent on the size+ shape of your larynx plus the thickness+length of the vocal cords themselves, all determined by genetics, your body (height and weight) has little to no impact. There are plenty of large people with light voices just like there are plenty of small people with big voices, you either have powerhouse vocals or you don't.
Answer: Singers like Mariah Carey and Jennifer Hudson who have larger builds actually have small voices, both are light lyric sopranos, the smallest female voice. Jennifer Hudson sounds bigger than her voice is at times because of incorrect technique while Mariah's voice doesn't have a whole bunch of power behind it, her agility is far superior compared to her power, Whitney Houston and Celine Dion on the other hand have large voices and are vocal powerhouses, Whitney was a spinto soprano while Celine is a full lyric soprano.
Answer: I found this article if someone is able to find the full text:
Weight, Loss, and Opera: Deborah Voigt and the Little Black Dress
Bernard, Hope.The Projector; Bowling Green Vol. 10, Iss. 2,  (Fall 2010): 42-50.
<code>https://search.proquest.com/openview/8fd8a590552ed8a3a36b6b5319344c91/1?pq-origsite=gscholar&cbl=2049648
</code>
To my experience, there are multiple sizes of people and it is difficult / impossible (& not even necessary) to say, which voice type or range a person has based on their body shape. I have also heard that taller people tend to be basses (but I have likewise seen tenors who are 2m tall). You can also look up the little person, professor Thomas Quasthoff, who is a classical singer with a large bass-baritone voice.
It is definitely true that weight loss affects your voice. You have to adjust your singing again to the new smaller body type and practice your singing until it "fits" your new body type again.
On top of that, I think dramatic operatic singers (who sing Wagner) tend to have larger bodies, because you need more endurance and vocal power in that kind of music (due to the orchestration).
I also agree that practice is the most important thing. You should find the best music for your voice and if your voice is not big, do not sing big repertoire.
Answer: If you think of the freakishly great, natural, singers, like James Brown and Little Richard, Aretha Franklin there does seem to be a link with powerful build, thick neck (male voices) suggesting athletically strong organs of breath, perhaps mostly genetic traits. Singers like Jack Bruce and Tom Jones also suggest this link with build.
Interestingly, while the child Michael Jackson also had this type of build, the adult Jackson did not. It is clear that the vocal ability of the child Jackson was superior. As an adult, Jackson appeared to struggle even with vibrato, having instead to resort to a weak tremolo technique. I don't believe this was a stylistic choice.
All this surely must depend on the style of singing. Karen Carpenter's voice did not appear to be affected by her diminishing size.
It is a puzzle, and one that is unlikely to receive much serious scientific research.


ClassCastException while using fragments in android actionbar tabs and tab listener

Question: I get ClassCastException while compilating sources in Android Studio. I can't understand what's causing them. I hope you could help me fix it. This is for my classes but to even start it I wanted to test the basics with emulator with API 16(got Genymotion so if you want me to, I can test it using any available API) but couldn't get it to work.
MainActivity
import android.app.ActionBar;
import android.app.Fragment;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;

@SuppressWarnings("deprecation")
public class MainActivity extends ActionBarActivity {

    private android.support.v7.app.ActionBar.Tab tabOne;
    private android.support.v7.app.ActionBar.Tab tabTwo;
    private android.support.v7.app.ActionBar.Tab tabThree;
    private Fragment fragmentOne = new FragmentOne();
    private Fragment fragmentTwo = new FragmentTwo();
    private Fragment fragmentThree = new FragmentThree();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        android.support.v7.app.ActionBar actionBar = getSupportActionBar();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

        tabOne = actionBar.newTab().setText("fragmentOne").setTabListener( new TabListener<FragmentOne>(this, "fragmentOne", FragmentOne.class));
        tabTwo = actionBar.newTab().setText("fragmentTwo").setTabListener( new TabListener<FragmentTwo>(this, "fragmentOTwo", FragmentTwo.class));
        tabThree = actionBar.newTab().setText("fragmentThree").setTabListener( new TabListener<FragmentThree>(this, "fragmentThree", FragmentThree.class));

        actionBar.addTab(tabOne);
        actionBar.addTab(tabTwo);
        actionBar.addTab(tabThree);

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}

and my TabListener
import android.app.ActionBar;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;

public  class TabListener<T extends Fragment> implements android.support.v7.app.ActionBar.TabListener {
    private android.support.v4.app.Fragment mFragment;
    private final Activity mActivity;
    private final String mTag;
    private final Class<T> mClass;

    /** Constructor used each time a new tab is created.
     * @param activity  The host Activity, used to instantiate the fragment
     * @param tag  The identifier tag for the fragment
     * @param clz  The fragment's Class, used to instantiate the fragment
     */
    public TabListener(Activity activity, String tag, Class<T> clz) {
        mActivity = activity;
        mTag = tag;
        mClass = clz;
    }

    @Override
    public void onTabSelected(android.support.v7.app.ActionBar.Tab tab, android.support.v4.app.FragmentTransaction fragmentTransaction) {
        if (mFragment == null){
            mFragment = android.support.v4.app.Fragment.instantiate(mActivity, mClass.getName());
            fragmentTransaction.add(android.R.id.content, mFragment, mTag);
        }
        else{
            fragmentTransaction.attach(mFragment);
        }
    }

    @Override
    public void onTabUnselected(android.support.v7.app.ActionBar.Tab tab, android.support.v4.app.FragmentTransaction fragmentTransaction) {
        if(mFragment != null){
            fragmentTransaction.detach(mFragment);
        }
    }

    @Override
    public void onTabReselected(android.support.v7.app.ActionBar.Tab tab, android.support.v4.app.FragmentTransaction fragmentTransaction) {

    }
}

fragment classes are exact the same at the moment because I just wanted to see if the xml content is displayed properly
public class FragmentThree extends Fragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.three_layout, container, false);
        return rootView;
    }
}

Stack trace:
E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.patryk.android4/com.example.patryk.android4.MainActivity}: java.lang.ClassCastException: com.example.patryk.android4.FragmentOne cannot be cast to android.support.v4.app.Fragment
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
        at android.app.ActivityThread.access$600(ActivityThread.java:130)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:4745)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
        at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.ClassCastException: com.example.patryk.android4.FragmentOne cannot be cast to android.support.v4.app.Fragment
        at android.support.v4.app.Fragment.instantiate(Fragment.java:420)
        at android.support.v4.app.Fragment.instantiate(Fragment.java:395)
        at com.example.patryk.android4.TabListener.onTabSelected(TabListener.java:30)
        at android.support.v7.internal.app.WindowDecorActionBar.selectTab(WindowDecorActionBar.java:634)
        at android.support.v7.internal.app.WindowDecorActionBar.addTab(WindowDecorActionBar.java:563)
        at android.support.v7.internal.app.WindowDecorActionBar.addTab(WindowDecorActionBar.java:549)
        at com.example.patryk.android4.MainActivity.onCreate(MainActivity.java:34)
        at android.app.Activity.performCreate(Activity.java:5008)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)

            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
            at android.app.ActivityThread.access$600(ActivityThread.java:130)
MainActivity.java:34 is this line
 actionBar.addTab(tabOne);

(TabListener.java:30) is this one
        mFragment = android.support.v4.app.Fragment.instantiate(mActivity, mClass.getName());

Comment: Could you please post the stacktrace? I wanna to see the class mismatch.
Comment: Here is one spelling mistake, that must not have effect on the casting :) tabTwo = actionBar.newTab().setText("fragmentTwo").setTabListener( new TabListener(this, "fragmentOTwo", FragmentTwo.class));  ->  "fragmentOTwo"
Comment: Edited OP and added stack trace
Answer: First: public class MainActivity extends AppCompatActivity
Second:
private android.support.v4.app.Fragment fragmentOne = new FragmentOne();
private android.support.v4.app.Fragment fragmentTwo = new FragmentTwo();
private android.support.v4.app.Fragment fragmentThree = new FragmentThree();

Third:
public class FragmentThree extends android.support.v4.app.Fragment
public class FragmentOne extends android.support.v4.app.Fragment
public class FragmentTwo extends android.support.v4.app.Fragment

Answer: You didn't post the stacktrace, but I already see some mismatch in classes. You use some from the support library: android.support.v4.app.FragmentTransaction, some from the main set: import android.app.FragmentTransaction;.
Please check this aspect and make sure you use same classes.
Comment: I have some unused imports because in process of fixing code and type mismatches, I had to use older versions of libraries.


$f$ differentiable at $a$ then $f$ is continuous at $a$

Question: "$\textit{$f$ is differentiable at $a$, then $f$ is continuous at $a$}$"
This is the statement proven in my lecture notes, however I think the proof is wrong.
Recall $$\lim_{x\to a} f(x) = f(a)$$
Then we rearrange and have $$\lim_{x\to a} (f(x)-f(a)) =\lim_{x\to a} \left(\frac{f(x)-f(a)}{x-a}\right)(x-a) = \lim_{x\to a} \left(\frac{f(x)-f(a)}{x-a}\right)\lim_{x\to a}(x-a) = f'(a)\cdot 0 = 0$$

Why is this a proof of the above statement? Okay I understand that at the end we obtain zero so we can rewrite the term on the LHS as the "definition" of continuity. However we started exactly from the "definition" of continuity. Indeed we started from  $\lim_{x\to a} (f(x)-f(a))$ which by Arithmetic of Limits is equal to the above. Hence we wanted to prove $A \implies B$ but we started from $B$ and we showed it works for $A$. This is a circular reasoning!
Comment: It makes sense to write $\lim_{x\to a} (f(x)-f(a))$ even if $f$ is not continuous at $a$, in which cases you are writing a number that is not $0$ or something that is not a number. But solely writing the expression does not carry the assumption that $f$ is continuous at $a$.
Comment: okay my example below doesn't use exactly the same logic, but I hope what I mean is clear
Comment: Look at what it says backwards
Comment: @mathbeing oh right! So the whole thing then works because $f'(a)$ exists right?
Comment: Yes!! You start with that limit which you don't know even if it is a number. But you can express it in other way by performing some formal arithmetic and the result must be the same, even if you started with something that does not make sense. As you end up with $0$, the limit you didn't know anything about must be the $0$ number.
Comment: You are not multiplying both sides by 0 in the above proof. In the first equality you are multiplying by $\frac{x-a}{x-a}$ which goes to 1 as $x$ goes to $a$.
Answer: better is we start from the Expression $$\frac{f(x)-f(a)}{x-a}\cdot (x-a)$$
and now you must ask under which conditions the Limit exists
Comment: This makes sense! Thank you!


RStudio pipe operator (%>%) shortcut (CTRL+SHIFT+M) not working in Edge browser

Question: I encountered a number of situation where my pipe operator shortcut (%>%) was not working in RStudio Server in my Microsoft Edge browser.
Answer: The root cause was that the shortkey (CTRL+SHIFT+M) is assigned to something else in Microsoft Edge, namely to the function to 'Sign in as a different user or browse as a Guest'.
https://support.microsoft.com/en-us/microsoft-edge/keyboard-shortcuts-in-microsoft-edge-50d3edab-30d9-c7e4-21ce-37fe2713cfad
According to a Microsoft forum there is no way to change the pre-defined Edge shortcuts. End of story. At least this is clear; but doesn't make a me a happy user.
Comment: Thanks for posting the answer. You can mark it as accepted after 48 hrs, when it is available to mark. It can help other community members in future with similar kinds of issues. Thanks for your understanding.
Answer: The allocate the same shortcut to mute in Teams if I recall correctly...
You could allocate %>% to a different shortcut I believe. Although I've never been convinced it was a major typing task...
Comment: The shortkey is a habbit that is in your system so....


Why is the water in the pool at Rio 2016 green?

Question: During the first few games of diving I had not noticed this color, but on Tuesday, August 9, 2016 the water of the Olympic diving pool in Rio 2016 was green.
What would be the reason for this color?
Here you can see the difference between two close pools:
Answer: This was unintentional, and caused by the pH of the pool being "outside the usual range". Quoting from BBC News:

The International Swimming Federation (Fina) explained it was caused by water tanks running out of certain chemicals.
But Fina stressed that there was "no risk" to athletes.
It explained that the discoloration was caused by the pH level - or acidity level - of the water being "outside the usual range".
Comment: Chloramine, a common sanitizing agent and a family of sanitizing by-products, will turn the water green. For residential pools, shock helps to reduce those chloramines by changing them into more volatile chemicals that evaporate out of the water (creating that "chlorine smell"). I'm not sure what a pool this size would be using.
Comment: Could it have been a cleaning substance or something of the sort?
Answer: A third-party contractor used hydrogen peroxide to clean the pools. Hydrogen peroxide is a de-chlorination agent, it neutralizes the chlorine which is added to the water to prevent the growth of algae and other micro-organisms.
With the chlorine levels lowered without anybody knowing, algae grew in the water and turned it green and reportedly slightly smelly. Now that the problem has been corrected, the chlorine is killing off the algae, and the pools are slowly returning to normal.
The pool used for synchronized swimming had to be completely drained and re-filled (using water from a training and warm-up pool for water polo, which is no longer needed because after the qualifying phase, the water polo competition was scheduled to move into the big stadium anyway) because neither the athletes nor the judges would have been able to clearly see what goes on under water, which is where most of synchronized swimming happens.


How to make div content not over floating to the right?

Question: When I write a content in my page it will go to right forever and it won't break line, what is the problem? I want the content to stick to the same width but it is okay to over flow on y axis. my code:

 Content

Thank you.
Comment: first. why do you use inline styles and not CSS ? second. `same width` what do you mean by that ? which is the div that is causing the problem etc. please be more specific. keep in mind that we don't know your problem :)
Comment: What exactly is the problem here? You set a div with width: 900px; It doesn't appear to "go to the right forever" at least in my tests. It seems to be doing exactly what you told it to - be 900px in width.
Comment: I have just copied it from my css file, anyway, I want the content not to go forever to the right I want it to line break that's all
Answer: First, i think that the div1 and div2 is the problem, why dont you just do it with one element ?
So it will be like this :

  Content

So, #mainBody will wrap it at fixed dimension, with 200px padding, 1px red border, and will overflow scroll vertically
Comment: Try to add `word-wrap: break-word`, and what kind of content you put there exactly ? If you put text there, it should be do line break, even when the `word-wrap` not defined.
Answer: If you want to make the content not float right or even left ,then you need a clear class which clear your float , so that the next time you enter something that will go below everything and not left or right .Here I am providing you the code below , do check out and share if your problem persists.
.clear{
         clear:both;
      }

The above code will clear both "float right and float left".
If you want to delete just the right float then you may use
.clear{
           clear:right;
      }

So now after creating the above class just use this in the html section :

Entire Code:

<stlye type="text/css">
    .clear
    {
        clear:both;
    }
</style>

 Content

Comment: At which div should I add the class?
Comment: Add it after where you want your content to not float right anymore .
Comment:  ->, you just need to add this after


É possivel trocar classe de muitas DIVs com um unico comando js?

Question: Amigos
Tenho diversas DIVs em minha pagina, cada qual com seu ID, porem com o mesmo padrao, por exemplo "checker-001", "checker-002", e asim por diante...
onde, eu uso um JS para trocar suas caracteristicas, por exemplo
$('#checker-363').removeClass('UmaVelhaClass').addClass('UmaNovaClass');

que eh bastante simples e util.
Eis minha pergunta:
É possivel trocar centenas de DIVs de uma soh vez? com um único comando?
por exemplo trocando o "numero" por um   " * ":
 $('#checker-*').removeClass('UmaVelhaClasse').addClass('UmaNovaClasse');

Ou sou obrigado a fazer um loop pra isso?
Answer: Utilize isso:
$('[id^="checker-"]').removeClass('UmaVelhaClasse').addClass('UmaNovaClasse');

Quando você utiliza o seletor [id^="checker-"] você está buscando todos os elementos que possuem o id que iniciam com aquele padrão, no caso checker-.
Comment: Nada, é um prazer ajudar
Comment: rapaizzz , muito obrigado por ser tao objetivo e responder EXATAMENTE  a minha pergunta!  ajudou demais!!!
Comment: Ahh sim .. detalhe, esqueci de agradecer o **codigo** de exemplo **funcionando**!  pra gente que eh noob e nem sabe fazer a pergunta direito, ele eh parte **essencial** !!!!!!!!!!!! Valeu mais uma vez!
Answer: Experimente adicionar uma classe em comum para todas as divs que deseja alterar, uma vez que você quer fazer troca de classe em todas de uma só vez, não acho recomendado seleciona-las por id já que todas possuem essa necessidade em comum. O uso do seletor [id^="checker-"] resolve o problema, porém, ele é um pouco mais pesado.
Um exemplo de uso seria:
$('.classeEmComum').removeClass('UmaVelhaClasse').addClass('UmaNovaClasse');


Diferença entre cache de primeiro e segundo nível do NHibernate

Question: Ao pesquisar sobre cache dentro do NHibernate, eu me deparei que existem dois níveis de cache que podem ser utilizados, o de primeiro nível e o de segundo nível.
Achei artigos com implementações de ambos os tipos e tudo mais, porém eu gostaria de saber qual é a real diferença dos dois. Por que escolher um ou o outro?
Comment: Em inglês: http://stackoverflow.com/questions/337072/what-is-first-and-second-level-caching-in-hibernate
Comment: Neste link, o autor dá uma ideia de quando utilizar o segundo cache: http://blog.streamlinelogic.ca/2007/03/nhibernate-cache.html
Answer:
O cache de primeiro nível nada mais é do que a sessão (definida pela interface ISession) que armazena as entidades (registros) carregados na memória. Também é chamado de cache de transação. Este cache previne que um mesmo registro (identificado pela chave primária) seja carregado duas vezes, reduzindo assim o consumo de memória e solicitações ao banco de dados, além de rastrear as alterações realizadas no mesmo.

Saiba mais em: http://nhforge.org/doc/nh/en/index.html#architecture-overview

O cache de segundo nível, também denominado de cache de query's, é opcional e pode ser habilitado nas configurações do NHibernate. Este cache permite que você registre query's que são realizadas frequentemente, armazenando o seu resultado e evitando que estas sejam executadas novamente no banco de dados. Um exemplo clássico de uso deste cache seria a listagem dos itens em promoção apresentados na página principal de e-commerce (que são os mesmos para cada usuário que visitaria o site).

Saiba mais em: http://nhforge.org/doc/nh/en/index.html#performance-cache


Continuity of a simple eigenvalue and its corresponding eigenvector

Question: Given a square function valued matrix $A(\boldsymbol{t})$ whose entries are complex continuous functions of a vector of real parameters
$\boldsymbol{t}$, if  $\lambda_0$ is a simple eigenvalue at $\boldsymbol{t} = \boldsymbol{t}_0$ with a corresponding unit eigenvector $\boldsymbol{x}_0$, then for all $\boldsymbol{t}$ near $\boldsymbol{t}_0$ there is a corresponding eigenvalue and unique (normalized) eigenvector that are continuous in $\boldsymbol{t}$. I am looking for a proof or a counter example. I am especially interested in the case when $\boldsymbol{t}$ is a two dimensional vector.
Let $\boldsymbol{\Phi}$ be an $n \times n$ integer matrix with entries $\phi_{pq}\in\mathbb{Z}$. Moreover, let $\phi_{pp}=0$ (diagonal), $\phi_{pq} \neq 0$ (non-diagonal),
$\phi_{pq} > 0;~\forall q>p$, $\phi_{pq} = -\phi_{qp}$ and gcd($\{\phi_{pq}\}_{q>p}$) $=1$. Let $\mathcal{X}$ denote the set consisting of all possible
$k \times k$ principle sub-matrices of $\boldsymbol{\Phi}$, with $2 \leq k \leq n$. Define $|\boldsymbol{A}|_{d+1} = \sum_{p=1}^{k-1} a_{pp+1}$ for any
$k \times k$ matrix $\boldsymbol{A}$. Furthermore, the matrix $\boldsymbol{\Phi}$ must also satisfy the constraint that $\forall \boldsymbol{X} \in\mathcal{X};|\boldsymbol{X}|_{d+1}=x_{1k}$, where $k$ is the dimension of $\boldsymbol{X}$.
Below I give the matrix that I am interested in. It is a rank 2 matrix most of the time. Its largest eigenvalue is always simple. I have an analytic expression for its largest eigenvalue. I need to know whether its normalized eigenvector is continuous?
Let $\boldsymbol{\mathcal{R}}(\boldsymbol{b})$ be an $n \times n$ Hermitian matrix (of continuous Hermitian functions) with entries
\begin{equation}
V_{pq}^{\mathcal{R}}(\boldsymbol{b}) = r_{pq}(\boldsymbol{b}) = A_1 + A_2e^{-2\pi i \phi_{pq}\boldsymbol{b}\cdot\boldsymbol{s}_0};A_1,A_2\in\mathbb{R},
\end{equation}
that is
\begin{equation}
V_{pq}^{\mathcal{R}}(u,v) = r_{pq}(u,v) = A_1 + A_2e^{-2\pi i \phi_{pq}(ul_0 + vm_0)}; u,v,l_0,m_0\in\mathbb{R},
\end{equation}
where $\phi_{pq}$ is the element found in the $p$-th row and $q$-th column of $\boldsymbol{\Phi}$, $\boldsymbol{b}=\left\langle u,v \right\rangle$ and $\boldsymbol{s}_0=\left\langle l_0,m_0 \right\rangle$. Furthermore let, $A_1=1,0<A_2<1$, $l_0 \neq 0, m_0 \neq 0$.
Its largest eigenvalue is
$\lambda = \frac{n(A_1+A_2)}{2} + h$,
where $h=\frac{1}{2}\sqrt{[n^2-4 {n \choose 2}][A_1+A_2]^2+4\sum_{p<q}(A_1^2+A_2^2+2A_1A_2\cos(2\pi\phi_{pq}\boldsymbol{b}\cdot\boldsymbol{s}_0))}$
Comment: It doesn't matter much that your parameter space is two-dimensional, and you could replace it with the single parameter $t=ul_0+vm_0$.
Answer: It is a classical result that you can always manage for the eigenvalues to be continuous, even when they are multiple. For hyperbolic matrices (i.e. with real eigenvalues) the result of Bronshtein ensures Lipschitz continuity for the eigenvalues.
For your question in your framework the eigenvalue is smooth: with $p(X,t)$ be  the characteristic polynomial, you have at a simple root
$$
p(\lambda_0,t_0)=0,\quad \partial p/\partial X(\lambda_0,t_0)\not=0,
$$
so that you can use the implicit function theorem to get near $(\lambda_0,t_0)$ the equivalence
$$
p(\lambda,t)=0\Longleftrightarrow \lambda=\alpha(t),\alpha(t_0)=\lambda_0\text{ with a smooth function $\alpha$}.
$$
The eigenvectors could be very unstable at multiple roots. Consider the $2\times 2$ matrices
$$
A_1=\begin{pmatrix}1&0\\0&1\end{pmatrix},\quad A_0=\begin{pmatrix}0&1\\1&0\end{pmatrix}
$$
and the smooth matrix
$
A(t)=H(-t)e^{-1/t^2}A_0+H(t)e^{-1/t^2}A_1,\quad H=1_{\mathbb R_+}.
$
The eigenvectors of $A(t)$ for $t<0$ are $e_1,e_2$ whereas the eigenvectors of $A(t)$ for $t>0$ are
$$
e_1\pm  e_2,
$$
so the (normalized) eigenvectors are discontinuous.
Comment: Thank you for answering. I want to know what happens in the case that the eigenvalues are always distinct (no multiplicity). Are the eigenvectors continuous?
Comment: @trienko: Yes, in the case of simple eigenvalues the eigenvectors can be (locally, meaning if $t$ varies in a small disk) chosen to be continuous. However, if you want to choose them to be continuous functions on the entire set of (complex) values of $t$ for which all eigenvalues are simple, then there are obstructions.
Comment: What do you mean with obstructions? Do you have any literature on this (or references you can point me to)? I would appreciate this. I need to prove this theorem. $\boldsymbol{t}\in\mathbb{R}^2$. The matrix at each $\boldsymbol{t}$ is complex.
Comment: For my my matrix $\boldsymbol{A}(\boldsymbol{t})$ it seems to be continuous. Would it help if I define my matrix.
Answer: Bazin's answer works for the general case, but the two-dimensional case is exactly solvable, which affords it a direct proof which may or may not be more useful in your case.
Let $A=\begin{pmatrix}a&c\\b&d\end{pmatrix}$, and consider its eigenvalue equation
$$\det(\lambda-A)=\det\begin{pmatrix}\lambda-a&-c\\-b&\lambda-d\end{pmatrix}=\lambda^2-(a+d)\lambda+ad-bc=0,$$
whose general solution is
$$
\lambda=\frac{a+d\pm\sqrt{(a+d)^2+4(ad-bc)}}{2}=\frac{a+d}2\pm\sqrt{\left(\frac{a-d}2\right)^2+bc}.
$$
The eigenvalues, then, are continuous functions of the matrix entries. If you ever come up on a branch cut you'll run out of eigenvalue but the other one will pop into existence there, which in practice means you can ignore the potential discontinuities of the square root.
Once you have an eigenvalue $\lambda$, you can get an eigenvector $x = \begin{pmatrix}u\\v\end{pmatrix}$ by solving
$$(\lambda-a)u-cv=0,$$
with the other equation automatically satisfied for $\lambda$ an eigenvalue, which means that
$$x = u\begin{pmatrix}1\\ \frac{\lambda-a}{c}\end{pmatrix}
=\frac{1}{\sqrt{1+\left(\frac{\lambda-a}{c}\right)^2}}\begin{pmatrix}1\\ \frac{\lambda-a}{c}\end{pmatrix}
=\frac{1}{\sqrt{c^2+\left({\lambda-a}\right)^2}}\begin{pmatrix}c\\ {\lambda-a}\end{pmatrix}$$
is an eigenvector even when $c=0$, and depends continuously on $\lambda$ and the matrix entries. (In the complex case take squares of the moduli, and the last relation is only true up to a phase, but the end result is still a continuously-dependent eigenvalue).
This breaks only in the case that $c=0$ and $\lambda=a$ simultaneously, in which case the eigenvalue is not simple, which you've discarded, or the matrix is diagonal. In this case, there's more you can say about the eigenvalue, because $a$ and $d$ are bounded from each other but $c$ is zero or small, in which case
$$
\lambda=\frac{a+d}2 + \left(\frac{a-d}2\right)\left(1+\frac{2bc}{(a-d)^2}+O(b^2c^2)\right)=a+\frac{bc}{(a-d)}+O(b^2c^2).
$$
Plugging this back in and rearranging, you get that
$$x
=\frac{1}{\sqrt{1+\frac{b^2}{(a-d)^2}+O(c)}}\begin{pmatrix}1\\\frac{b}{a-d}+O(c)\end{pmatrix}$$
is your eigenvalue, and again it's continuous at $c=0$ as long as $a$ is bounded from $d$.
The take-home message, then, is that the two-dimensional case is very often amenable to direct manipulations that make you not need the general results for higher dimensionality. If you do things carefully enough, this can usually help you understand your problem better anyway (though if you don't it will get messy fast).
Comment: Thank you so much for the detailed answer. I however require a definite answer for $n$ dimensions. The vector $\boldsymbol{t}$ can be two dimensional. From experimental data it seems that the above theorem is true, as long as the eigenvalue is simple $\forall \boldsymbol{t}\in\mathbb{R}^2$?
Comment: Oh. Apologies, I misread the question. The special case is when the matrix itself is two-dimensional. The dimensionality of the space of parameters is not that relevant; most such results will prove continuity on the matrix entries. For a higher dimensionality of your parameter space, though, you should be aware that avoided crossings will in general turn into conical intersections, which are trickier to deal with.
Comment: Do you know of any literature dealing with the above issue?
Comment: I would start with Wikipedia, or whatever quantum chemistry textbook you're able to plough through. It's hard to know if it will be an issue without knowing more about your matrix.
Comment: I added the details of my matrix, could you please have a look at it? Maybe you could spot a possible issue. All the other eigenvalues are always smaller than its largest eigenvalue $\forall \boldsymbol{b}\in\mathbb{R}^2$. It would really help me tremendously.


How to send Chatbase Intents in BLiP

Question: I have a chatbot made with BLiP's Builder.
I'm trying to integrate Chatbase with it but I was unable to set the intent of my user's inputs.
I couldn't find any documentation on how to do this beside the generic API, but I've seen people in the BLiP forums saying they have that setup.
There is an option to send a full http request and that should work, but I'm wondering if there's a way to do this using the tools' native integration.
Comment: Here you have all the info you need to set the parameters to not handled at Blip! https://help.blip.ai/docs/en/analytics/chatbase/tratando-eventos-not-handled-sessionFlow-chatbase/#docsNav It took some time for me to find it, but I did and it works fine.
Answer: Thank you for your question. Chatbase does not have a native integration with Blip, therefore you would need to use the generic API in order to fully integrate your bot.

How to send Chatbase Intents in BLiP


Add location to to profile2 just after the user registers

Question: I am trying to force add a location to a user's profile2 just after the user register's an account. The user's are able to add locations to their profile by using flags, but since there are no locations just after the user registers, the rules add fails because the locations list has not been initiated.
The below code is what I currently have:
if (isset($account->is_new) && !empty($account->is_new)) {
  function user_account_presave_user_presave(&$edit, $account, $category) {
    global $user;

    // Load profile2.
    $profile = profile2_load_by_user(array('type' => 'next', 'uid' => $user >uid));

    // Add in the necessary custom fields and values.
    $profile->field_next_destination['und'][] = array(
      'longitude' => '0.0',
      'latitude' => '0.0',
    );

    // Save the profile2 to the user account.
    profile2_save($profile);

  }
}

I am not sure if the IF statement should be in the Function, but if it is not, the Function fails to allow users to register because the CAPTCHA reuse attack function is triggered.
Has anyone ever run into this?
Thank you!
Answer: Try using hook_user_insert instead. The $account will have $account->uid set at that stage.
P.S wrapping hook_user_presave in that condition looks wrong and probably won't work with the hook registry cache.
Comment: I am still getting a "CAPTCHA session reuse attack detected."
Comment: "CAPTCHA session reuse attack detected" is a different issue, probably related to caching of the page/form where the captcha is being shown. see `_captcha_get_posted_captcha_info` for the related code.
Comment: I have turned off recaptcha in an attempt to isolate the issue as well as use user_insert, but it doesn't seem like it it currently doing anything. Will be doing a db_insert be what I have to do?
Comment: If the Profile2 profile hasn't been created, you may need to create it with [`profile2_create`](http://www.drupalcontrib.org/api/drupal/contributions%21profile2%21profile2.module/function/profile2_create/7)
Comment: I am unfortunately not gaining any traction on this.
Comment: Where am I going wrong in the below?
   `function user_account_presave_user_presave(&$edit, $account, $category) {
      global $user;
      $profile = profile2_load_by_user($user->uid, 'main');
      if (!$profile) {
        $profile = profile2_create(array('user' => $user, 'type' => 'main'));
        $profile->field_test_text['und'][0]['value'] = "test";
        profile2_save($profile);
      }
    }`
Comment: As mentioned above, try `hook_user_insert` not `hook_user_presave` also use the `$account` parameter, not `global $user` because the user account being updated may not always be the current logged in user (e.g admin other user update) You might also need to set `$account->profiles['main'] = $profile;` but could be automatic on next load with uid set.
Comment: Shortly after I submitted the above comment I realized the hook_user_presave mistake I made. You are very right about that. It appears I have having difficulty with the $account variable. It seems as if it is empty at this point. Is there a way I can set it safely? I have everything working when I use hook_user_update very well. Thank you


What's the difference between a family close under countable disjoint unions and a family close under countable unions?

Question: Could you give examples of families close under countable disjoint unions and close under countable unions?
Thanks.
Answer: Any family closed under countable unions is clearly closed under countable disjoint unions. However, the converse is not true. For example, consider the set $$\mathcal{U}=\{\{1, 2\},\{1, 3\}\}.$$ This set is definitely not closed under countable, or even finite!, unions, but it is trivially closed under arbitrary disjoint unions since its two elements are not disjoint.
Comment: My keyboard has been a bit wonky since some gin and tonic got spilled over it. I blame that. ;-)
Comment: @AsafKaragila Muahahaha!
Answer: Look at the family $\{\mathbb N\setminus\{n\}\mid n\in\Bbb N\}$. This family is certainly not closed under finite unions, let alone countable unions. Because taking any two different sets, their union is $\Bbb N$ itself which is not in the collection. But the family is closed under disjoint union, simply because no two sets are disjoint!
In the context of measure theory, we often think about $\sigma$-algebras, which are closed also under complements and intersection. There if we have any countable union $\bigcup A_n$, we can write it as a disjoint union $\bigcup B_n$, where $B_n=A_n\setminus\bigcup_{k<n}A_k$. And therefore the two things are equivalent for an algebra of sets: being closed under countable unions and under countable disjoint unions.


Exchange New-MailboxExportRequest PST backup to Linux server share

Question: I'm putting together a backup script for an MS Exchange server. It uses New-MailboxExportRequest to export the Mailbox as PST files.
However, it doesn't appear possible to write these PSTs to a Linux samba share (i.e a shared folder on a Linux server that's mounted in Windows).
Despite the share even having 777 permissions, New-MailboxExportRequest is unable to write to it. If I write to the folder using any other method from Windows, it's fine.
I understand the target folder needs write access by the "Exchange Trusted Subsystem" user. However, that user isn't available under the share folder permissions from Windows to grant access there (It only allows the linux server location to look for users/groups to add). I've already granted "Full Control" to the "Everyone" user/group and even that doesn't work... For all normal purposes, the folder is writeable.
Is there some way to specify access for "Exchange Trusted Subsystem" to a Linux folder share, or some other option here?
Alternatively, I may need to backup to an NTFS filesystem somewhere in the Windows end, but I'd prefer to use the Linux server if possible.
Thanks.
Answer: It's a group (Exchange Trusted Subsystem) not a user.
If your samba share cannot find/add that AD group to the share and file level permissions there, it isn't going to work.
Alternative would be to export it to a folder on the Exchange server itself and then just move the PST file across the network to the Linux samba share using a logged in user that has permissions to do so.
Comment: Thanks for the answer. I think if I spent alot of time configuring Samba to allow assigning AD groups to Linux folders it might work that way. However, I've opted for the simpler approach to backup to a drive on the Windows server and then mount that from the Linux server (from where it's transferred/rsync'd to an offsite AWS backup server).


How to prove that a linear operator acting on a null ket produces a null ket?

Question: Help me solve this question. Isn't it obvious that when a linear operator, say $A$, acts on a null ket, it will give a null ket? That's like a property of linear operator. How do I prove this?
Comment: is a "null ket" the same as the zero ket?
Comment: The null ket is the zero of the vector space of quantum states, so this is true  by definition together with the definition of a linear operator. These are the ideas of QuantumSpaghettification's proof.
Answer: Let the null ket be denoted $ \newcommand{\p}[2]{\frac{\partial #1}{\partial #2}} \newcommand{\f}[2]{\frac{ #1}{ #2}} \newcommand{\l}[0]{\left(} \newcommand{\r}[0]{\right)} \newcommand{\mean}[1]{\langle #1 \rangle}\newcommand{\e}[0]{\varepsilon} \newcommand{\ket}[1]{\left|#1\right>} \newcommand{\bra}[1]{\left<#1\right|} \newcommand{\braoket}[3]{\left<#1\right|#2\left|#3\right>} \ket{0}$ and let an arbitrary ket be $\ket{A}$ the property of the null ket is that:
$$\ket{0}+\ket{A}=\ket{A}$$
This is the property we can use to find the action of the linear operator, $\hat B$, on the null ket. Since we must have:
$$\hat B\ket{0}+\hat B\ket{A}=\hat B\ket{A}$$
Let  $\ket{A'}=\hat B\ket{A}$ which gives:
$$\hat B\ket{0}+\ket{A'}=\ket{A'}$$
I will leave it to you to decide why this implies $\hat B\ket{0}$ is a null ket.


Why does echo display the view and the return statement doesn't display anything

Question: These is my create and store functions:
public function create(Request $request)
{
    $data = $request->except('_token');
    $validator = $this->validator($data);

    if ($validator->fails())
    {
        $this->throwValidationException(
            $request, $validator
        );
    }
    $this->store($data);
    $request->find($request);
    return redirect()->back()->with('message', 'Permintaan berhasil diinput');
}

public function store(array $data){
    Permintaan::create([
        'kdInventaris' => $data['kodeInventaris'],
        'namaInventaris' => $data['namaInventaris'],
        'jenis' => $data['optInventaris'],
        'jumlah' => $data['jumlah'],
        'spesifikasi' => $data['spesifikasi'],
        'keterangan' => $data['keterangan'],
    ]);
}

When it is redirecting, it works but got a blank page again and is replaced with echo.
It works, but has this message and got a successful redirect:

"HTTP/1.0 302 Found Cache-Control: no-cache Date: Mon, 01 Jun 2015
  16:04:33 GMT Location: http://localhost:8000/permintaan Redirecting to
  http://localhost:8000/permintaan."

I wonder if the error has anything to do with my return redirect()->back()->with('message', 'Permintaan berhasil diinput');.
Answer: This redirect() means you are trying to Return a named route
If you do use redirect() then you should give a named route such as return redirect()->route('someroute');
You cannot use it for back. But, If you wanted to so, then you can simply redirect back by
Redirect::back()->withMessage('Permintaan berhasil diinput')

or even you can use
return redirect()->back()->with('message', 'Permintaan berhasil diinput');

Here you can learn more about the Redirects in Laravel's Documentation
Comment: Wow. You're my hero. Thanks:)


Initiate file download and redirect to loged-in home page

Question: The users can share the file download URL and user with credentials can download the file. All the things working fine. Once the user paste the download url in address bar, it redirects to login page and after successful login the file downloads. But its not redirecting to the loged in home page. Need to happen both things (file download & redirect to loged-in homepage) on successful login. How can we achive this.
Comment: This question has been answered here: http://stackoverflow.com/questions/15872534/how-to-download-a-file-then-redirect-to-another-page-in-php

To summarise: redirect first, then initiate the download.
Comment: I am using header("Location:); for downloading file. From there i need to redirect to homepage.
Comment: Please read the linked article carefully. You will need to use Javascript to achieve what you want but the basis of a solution is there.
Answer: Try to use any of these modules. I hope below modules helps you to solve your issues :

LoginToboggan

Allow users to login using either their username OR their e-mail address.
Allow users to login immediately.
Provide a login form on Access Denied pages for non-logged-in (anonymous) users.
The module provides two login block options: One uses JavaScript to display the form within the block immediately upon clicking "log in".
  The other brings the user to a separate page, but returns the user to
  their original page upon login.

Login Destination

The Login Destination module allows you to customize the destination
  that a user is redirected to after logging in, registering to the site
  (7.x), using a one-time login link or logging out (7.x). The
  destination can be an internal page or an external URL. It is possible
  to specify certain conditions like referring pages or user roles and
  make the destination depend upon them. You may use PHP snippets to
  provide custom conditions and destinations. It is also possible to
  keep users on the currently visited page after logging in or out.

Anonymous Login

This is a very simple, lightweight module that will redirect anonymous
  users to the login page whenever they reach any admin-specified page
  paths, and will direct them back to the originally-requested page
  after successful login.

OR
You can do this by using Rules module.

The Rules module allows site administrators to define conditionally
  executed actions based on occurring events (known as reactive or ECA
  rules).
Comment: I need to pass the URL like /action=download&fid=123?destination=node/456 which download the file with id 123 first and then redirect to node/456. How can we achieve this. If done like this, after login its redirect to node/456 without downloading the file.


Como manipular evento click do addEventListener em javascript

Question: Preciso desenvolver um jogo usando HTML 5 e Javascript com o jogo estando dentro de um canvas.
Criei uma tela de abertura do jogo e depois que clicar em jogar ele direciona para outra tela. Chamei desta forma o evento click
document.getElementById('canvas').addEventListener('click', verificaClick, false);

Onde canvas é o id de meu canvas e verificaClick a função que manda para o próximo passo segundo a opção selecionada pois tenho as opções "jogar", "como jogar" e "créditos".
Se eu clicar jogar ele direciona para uma página onde escolho a "fase" ou "etapa" do jogo que quero jogar, mais ou menos como Candy Crush.
Meu problema é que o canvas redesenha tudo certinho, entretanto permanece o evento de click da primeira parte do jogo, do primeiro desenho do canvas. Estou redesenhando, apagando o contexto e redesenhando, mas permanece o mesmo clique nas posições dos primeiros "botões" que desenhei.
Está correto o trecho onde chamo o evento de click?
document.getElementById('canvas').addEventListener('click', verificaClick, false);

Se não, como eu deveria fazer; Colocar vários contextos e adicionar o evento no contexto? Como faria isso?
Comment: Editei sua pergunta usando formatação de código em vez de negrito (no editor, o botão `{}` faz isso). Mas não entendi bem o problema. Você quer simplesmente remover o event listener?
Answer: Uma solução possível é retirar o listener após o uso, e adicionar outro referente ao próximo estado. Isso pode ser feito dentro da sua função verificaClick, depois que você validar que o click foi realmente no botão para a próxima tela.
function verificaClick(){
    // ...

    // Não sei exatamente como você faz a validação, mas vamos supor
    // que a condição abaixo verifique o clique sobre o botão 'Jogar':
    if(x > 100 && x < 300 && y > 350 && y < 410){
        // ...
        document.getElementById('canvas').removeEventListener('click', verificaClick, false);
        document.getElementById('canvas').addEventListener('click', verificaClickLevelSelect, false);
        // ...
    }

    // ...
}

function verificaClickLevelSelect(){
    // ...

    // Caso seja detectado um clique no botão 'Voltar', por exemplo:
    if(x > 50 && x < 150 && y > 50 && y < 90){
        // ...
        document.getElementById('canvas').removeEventListener('click', verificaClickLevelSelect, false);
        document.getElementById('canvas').addEventListener('click', verificaClick, false);
        // ...
    }

    // ...
}

Claro, sua árvore de navegação pode ser ENORME. Nesse caso, esse método pode ser rudimentar demais e difícil de manter. Uma implementação mais elaborada poderia incluir a manutenção "automática" dos listeners através de um objeto no escopo global, que armazenaria a máquina de estados e seria atualizado por um método helper a cada navegação.
Não vou tirar teu prazer em programar essa máquina, parece divertido! :)
Comment: Obrigado ai viu cara, deu certo, havia me esquecido completamente de como utilizar o listener, esqueci que dava para remover, obrigado mesmo
Comment: Ah, queisso, não foi nada :) estamos aí pra isso!


Why php service do not get variables?

Question: From UI I make call:
$http.post('services/loadCategory.php', {
    'id'    :'1',
    'type'  :'string'
}).then(function(response) {
    debugger;
    ...
}, function(response) {
    ...
});

On PHP service I can't get variables from body POST request:
include ("bd.php");
header("Content-type: text/html; charset=windows-1251");
// ----- ----- ----- ----- -----
if (isset($_POST['type'])) {
    $type = $_POST['type'];
}
if (isset($_POST['id'])) {
    $id = $_POST['id'];
}
//
exit(json_encode(
    array('type' => iconv('windows-1251', 'UTF-8', $_POST['type']),
          'id' => iconv('windows-1251', 'UTF-8', $_POST['id'])
)));

Request from service: { id:'', type:'' } How fix that?
Comment: Does `$_POST` have any content at all? (use `print_r()` to check). What about `$_REQUEST`?
Answer: When posting JSON to PHP, the $_POST variable is empty. To get the raw JSON in your PHP, use the following:
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
    $data = json_decode(file_get_contents('php://input'), true);
}

You can then access the data with $data['id'] and $data['type']
Check the incoming $data with print_r($data);
Comment: Working)). Bit I do not understand - why simple $_POST do not work?
Comment: @DarienFawkes This is because most front end setups, like jQuery, transmit POST data using Content-Type: x-www-form-urlencoded and the common ?key1=foo&key2=bar serialization. AngularJS uses Content-Type: application/json and { "key1": "foo", "key2": "bar" }. While this is just as good, PHP doesn't know how to deal with this natively.
Answer: After doing a quick search about this issue, it appears that PHP has a hard time deserializing the POST body sent by AngularJS. AngularJS sends all information JSON encoded (application/json) as compared to most other JavaScript variants which send the content as application/x-www-form-urlencoded.
To fix this, you should either set the content-type of your request to application/x-www-form-urlencoded or you can try one of the solutions below which came from a similar question.
Based on this question, it would seem that the following code (provided by Felipe Miosso) seems to solve the problem:
  // Your app's root module...
  angular.module('MyModule', [], function($httpProvider) {
  // Use x-www-form-urlencoded Content-Type
  $httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';

  /**
   * The workhorse; converts an object to x-www-form-urlencoded serialization.
   * @param {Object} obj
   * @return {String}
   */
  var param = function(obj) {
    var query = '', name, value, fullSubName, subName, subValue, innerObj, i;

    for(name in obj) {
      value = obj[name];

      if(value instanceof Array) {
        for(i=0; i<value.length; ++i) {
          subValue = value[i];
          fullSubName = name + '[' + i + ']';
          innerObj = {};
          innerObj[fullSubName] = subValue;
          query += param(innerObj) + '&';
        }
      }
      else if(value instanceof Object) {
        for(subName in value) {
          subValue = value[subName];
          fullSubName = name + '[' + subName + ']';
          innerObj = {};
          innerObj[fullSubName] = subValue;
          query += param(innerObj) + '&';
        }
      }
      else if(value !== undefined && value !== null)
        query += encodeURIComponent(name) + '=' + encodeURIComponent(value) + '&';
    }

    return query.length ? query.substr(0, query.length - 1) : query;
  };

  // Override $http service's default transformRequest
  $httpProvider.defaults.transformRequest = [function(data) {
    return angular.isObject(data) && String(data) !== '[object File]' ? param(data) : data;
  }];
});

Alternatively, you might be able to fix this problem by adding the following line of code to your PHP:
$params = json_decode(file_get_contents('php://input'),true);

Why php service do not get variables?


php-soap 5.3.17-2 el6 x86_64

Question: I just transferred a website to a server where I appear to lack the PHP-SOAP extension.
Unfortunately I cannot upgrade to the 5.4.10 that is available on remi at the moment as I am not 100% sure if the existing codes would still work and not cause any issues.
All websites are built without notices and anything so if any function would trigger a deprecated notice it would break the code.
I have been searching for the php-soap-5.3.17-2.el6.remi.x86_64.rpm package on Google for most of today and still cannot find it or any other that would be compatible.
Any help would be appreciated.
Answer: this is from Scientific Linux's repo:
<code>[alexus@wcmisdlin02 ~]$ yum info php-soap-5.3.3-14.el6_3.x86_64
Loaded plugins: refresh-packagekit, security
Installed Packages
Name        : php-soap
Arch        : x86_64
Version     : 5.3.3
Release     : 14.el6_3
Size        : 324 k
Repo        : installed
From repo   : sl-security
Summary     : A module for PHP applications that use the SOAP protocol
URL         : http://www.php.net/
License     : PHP
Description : The php-soap package contains a dynamic shared object that will add
            : support to PHP for using the SOAP web services protocol.

[alexus@wcmisdlin02 ~]$
</code>
Comment: I need 5.3.17-2.
Comment: did you try build it yourself? does 5.4.0 requires 5.3.17+ or is 5.3.3 is sufficent?
Comment: I do not want to upgrade to 5.4.10. I currently have 5.3.17-2 and I need the php-soap-5.3.17-2 package. I have tried 5.3.19 but it will not work with 5.3.17.
Comment: sorry, then .. keep on looking or see if you can build that RPM yourself
Comment: I asked Remi for the rpm and he was very nice to provide it. I tried to find the soap sources to build it but it proved to be a challenge as soap is not very popular plus Pear has released a version of their own.

php-soap 5.3.17-2 el6 x86_64


i'm trying to draw a NxN chessboard in java, but in prints out a white blank screen

Question: i'm a student who just started learning java in college. So in today's lesson my teacher gave me some assignments, including one that i must write a program, using the StdIn.Draw library, that when you type in a number N, it prints out an NxN chessboard with height and width N also. I decided to use an NxN array and set certain elements into a value (e.g true) and others into another value. After that, i used the library to draw the chessboard with respective to the array i just created. It looks like this:
class chessboard {
 public static void main(String[] args) {
    int N = StdIn.readInt();
    boolean[][] hi = new boolean[N][N];
    double r = 1 / N;
    int x = 0;
    for (int i = 0; i < N; i++){
        for (int j = 0; j < N; j++){

            if ((int)(i+j)%2 == 0)
                hi[i][j] = true;
            else {
                hi[i][j] = false;
            }
        }
    }
    StdDraw.setXscale(0.0, 5.0);
    StdDraw.setYscale(0.0, 5.0);
    int i = 0;
    int j = 0;
    double a = 1.0;
    double b = 1.0;
    while ((a < N) && (i < N)){
        while ((b < N) && (j < N)){
            if (hi[i][j] != true){
                StdDraw.setPenColor(StdDraw.BLACK);
                StdDraw.filledSquare(a ,b, r);
            }
            else {
                StdDraw.setPenColor(StdDraw.RED);
                StdDraw.filledSquare(a ,b, r);
            }
            b = b + r;
            j++;
        }
        b = 1.0;//reset b after the inner while loop
        a = a + r;
        i++;
    }
 }
}

When i test run it, it just prints out a white blank screen, nothing else. I couldn't find anything wrong with my algorithm, and i have tried to adjust the size of the initial a and b coordinate and the X and Y scale many times, but it just doesn't work. I tried to ask my friends about it, but they don't know either.
This is my screenshot of the problem:

Sorry if my English is bad, for i'm not a native speaker. And please if you could answer then keep it simple for me because i just started learning to code. Thank you.
Oh another thing. I'm studying based on this book: http://introcs.cs.princeton.edu/java/home/
Comment: check the value of `r` - looks like it would be zero.
Answer: This uses integer division as both operands are int.
double r = 1 / N; // = 0; !!

So cast an operand, or change it to:
double r = 1.0 / N;

Also for the inner while-loop initialize the counter there,
you did a reset of b, but not of j after the while loop.
With a for-loop one could write:
double a = 1.0;
for (int i = 0; i < N; ++i) {
    double b = 1.0;
    for (int j = 0; j < N; ++j) {
        StdDraw.setPenColor(hi[i][j] ? StdDraw.RED: StdDraw.BLACK);
        StdDraw.filledSquare(a ,b, r);
        b += r;
    }
    a += r;
}

Not sure about the positioning.
BTW
        if ((int)(i+j)%2 == 0)
            hi[i][j] = true;
        else {
            hi[i][j] = false;
        }

becomes
        hi[i][j] = (i + j) % 2 == 0;

And
       if (hi[i][j] != true){
       // Better:
       //if (!hi[i][j]) {
            StdDraw.setPenColor(StdDraw.BLACK);
            StdDraw.filledSquare(a ,b, r);
        }
        else {
            StdDraw.setPenColor(StdDraw.RED);
            StdDraw.filledSquare(a ,b, r);
        }

becomes
        StdDraw.setPenColor(hi[i][j] ? StdDraw.RED : StdDraw.BLACK);
        StdDraw.filledSquare(a ,b, r);

Comment: Thank you! The program printed out something, but it is not what i expected:

http://i.imgur.com/AG0Fo9Z.png

why the upper last 2 block are always the same colour?
Comment: I found that j was not reset after the loop; changed the answer with a for-loop.
Answer: There is a problem with the line
double r = 1 / N;

Because 1 and N are both integers, Java will perform integer division, which means it will keep the integer part of the division result and discard any remainder.
You can have Java perform floating point division instead by making the numerator a double:
double r = 1.0d / N;

Reference: Integer division: How do you produce a double?
Comment: `1.0` is already a `double`, no need for the `d`. It is needed instead when you don't have decimals (because otherwise it would be treated as integer). So, either `1.0` or `1d` will work, `1.0d` is redundant


Change SQL Server user SID

Question: I have SQL Server 2012 and I am using domain users (from Active Directory). By mistake users were deleted from AD, created new with identical logins and passwords (but with different SIDs), deleted and restored the original ones - in the end old users with old SID's were recreated.
Almost everything seems to be fine again, except for one user. SQL Server somehow got stucked with wrong SID for one user (all other users are fine) and is not getting the right SID from AD. I checked SID in both places - SIDs in AD is not the same as in SQL Server.
As result of this "SID mismatch" this user can not access to database. If it tries, it fails and gets:

"Error: 18456, Severity: 14, State: 5."
Login failed for user 'DomainX\UserX'. Reason: Could not find a login matching the name provided.

I deleted user from server and all databases it was used, then added - and again got wrong SID! And this "new" user still can not connect to database.
There are two things that "grinds my gears":

how SIDs for other users match and mismatch for just one?
if other users are fine (they got old SIDs), then I can  assume there is not problems in domain controller?

I have found a lot about different manipulations with two existing user (or orphaned?) logins, but failed to found about just changing SID.
 But the main question is - how to change SID of one user in MS SQL Server (version 11.0.)? Is this even possible?
UPDATE
As I keep thinking about this, I realised that I have wrong question. Since this UserX is domain user, it is not SQL Server local user - that means that I can not change SID directly in SQL Server.
I have two identical servers (ServerA and ServerB) that uses the same users from AD. In ServerB UserX has got right SID and can normaly authenticate in SQL Server (right SID means the same as in AD). To be clear - UserX has got wrong SID in ServerA.
Question - if this user is domain user from Active Directory, where and how change its SID? If UserX can authenticate in ServerB, that means SID must be changed in ServerA within Windows Users?
Please correct me, if some thoughts or ideas has gone in wrong tracks.
UPDATE 2
I have found a solution to my problem, although it did not answered the question. For anyone interested - my colleges found deleted user with that wrong SID in AD. That user was renewed and now in AD both users are active - the good one and the bad one. SQL Server recognized users and problem with user login and SID mismatch somehow resolved itself - UserX in ServerA now has right SID and can access database. Now everything works as it should be! :)
Comment: check this: http://superuser.com/questions/581042/is-it-possible-to-change-the-sid-of-a-local-user-account-manually . However be very careful with this. changing an SID can really screw things up.
Answer: I had a similar situation with a deleted AD user and SID mismatch.  For me, the problem was local SID caching and the solution was to follow the workaround in the link below on the SQL server and client's pc.
https://support.microsoft.com/en-us/help/946358/the-lsalookupsids-function-may-return-the-old-user-name-instead-of-the

Open Registry Editor.
  To do this in Windows XP or in Windows Server 2003, click Start, click Run, >type regedit, and then click OK.
To do this in Windows Vista and newer, Click Start, type regedit in the >Start Search box, and then press ENTER.
Locate and then right-click the following registry subkey:
  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa>
Point to New, and then click DWORD Value.
Type LsaLookupCacheMaxSize, and then press ENTER.
Right-click LsaLookupCacheMaxSize, and then click Modify.
In the Value data box, type 0, and then click OK.
Exit Registry Editor.

Optionally, afterwards, right-click the LsaLookupCacheMaxSize DWORD you created and delete it.
Comment: It's preferred to copy and paste into a block quote the important steps from the link into your answer. That way if the link goes bad the answer is still good.
Comment: @ToddWilcox Sorry, I have corrected this.
Comment: This could have worked for me. Thanks for providing another way to fix this. :)
Answer: Have you tried checking for orphaned users by issuing the following command:
sp_change_users_login 'Report'

(against the  master database of the affected SQL Server and against the database_in_question on the affected server.)
If you have orphaned users, you can then issue a:
sp_change_users_login 'Update_one', 'Domain\UserX', 'Domain\UserX'

...against the affected database or if the SQL Login is mapped to a database user issue a:
sp_change_users_login 'Update_one', 'UserX', 'Domain\UserX'

to fix the SID mismatch.
Syntax of sp_change_users_login on the Microsoft site.
Comment: Hi. Sorry, but this user is not orphaned. I tried, but this did not made any changes.
Comment: @John aka hot2use There are too many S on your second line (I can't edit) at the end of changeS: sp_change*s*_users_login 'Report'.

Change SQL Server user SID


let a and b be constants and let yj=axj+b for j=1,2....n. What are the relationships betwee...

Question: let $a$ and $b$ be constants and let $yj=ax_j+b$ for $j=1,2....n.$ What are the relationships between the means of $y$ and $x$, and the standard deviations of $y$ and $x$?
I'm not sure what they are wanting here?
Answer: I guess they just want you to relate expectations and variances of $y_j$ wWith $x_j$ by just applying $E$ and $Var$ on both sides. That is
$$E[y_j] = E[a x_j + b] = aE[x_j] + b$$
where we just used the linearity of the expectation.
For the variance you have
$$Var[y_j] = Var[a x_j + b] = Var[a x_j] + Var[b]  = Var[ax_j] = a^2 Var[x_j]$$
where we just used that the variance of a random variable plus a constant is the sum of the variances (this is not true if you have the sum of two dependent random variables) and we also used that the variance of a constant is indeed 0. Finally, we used that the constants multiplying can be pulled out to the square.
To get the standard deviation just take square root. So
$$\sigma_{y_j}  = a \sigma_{x_j} \mbox{  for all  } j=1,\dots,n$$
where $\sigma$ denotes the standard deviation.
The conclusion is that the standard deviation of the $y_j$'s are proportional to the standard deviations of the $x_j$'s by $a$ units.


Dynamics crm remove the repeated data while fetching via api

Question: Trying to retrieve all state under one particular country.
URL:
api/data/v9.1/leadaddresses?$select=stateorprovince&$filter=stateorprovince ne  null and country eq 'US'&$count=true&$orderby=stateorprovince

Problem here is it returns data like this
"value": [
  {
"@odata.etag": "W/"166729382"",
"stateorprovince": "AK",
"leadaddressid": "691de670-aa45-426b-8fee-00b3a7f7e469"
},
  {
"@odata.etag": "W/"166729369"",
"stateorprovince": "AK",
"leadaddressid": "12db5897-dc53-44ae-b4aa-03c5486ad6ac"
},
  {
"@odata.etag": "W/"166729416"",
"stateorprovince": "AK",
"leadaddressid": "f64ccf06-fa67-421a-aa5f-0469302be1c2"
},
  {
"@odata.etag": "W/"166729206"",
"stateorprovince": "AK",
"leadaddressid": "b1f9ce4a-a06b-4d7d-befc-04bea0d41a4e"
},
  {
"@odata.etag": "W/"166729323"",
"stateorprovince": "AK",
"leadaddressid": "a4b9ff56-2d24-4957-b09b-04ef6ce56304"
},

Any way to remove the repeated data.
Answer: You have to use fetchxml to get distinct values, that is the only option.
<fetch top="50" distinct="true" >
  <entity name="leadaddress" >
    <attribute name="stateorprovince" />
    <filter type="and" >
      <condition attribute="stateorprovince" operator="not-null" />
    </filter>
  </entity>
</fetch>

You can use web api endpoint and use the above fetchxml like below:
https://crmdev.crm.dynamics.com/api/data/v9.1/leadaddresses?fetchXml=<fetch top="50" distinct="true" >   <entity name="leadaddress" >     <attribute name="stateorprovince" />     <filter type="and" >       <condition attribute="stateorprovince" operator="not-null" />     </filter>   </entity> </fetch>


In guitar, why some players "pulse" a chord? (press while strumming, relax, press it again)

Question: Why some guitar players "pulse" a chord? (pressing down while strumming, relaxing for a split sec, press it again for next strum)
Is it to mark the beat, relax the fingers, silence the strings, all of the above?
I've tried it and it's harder to play (at the start anyway), but I'd pick it up if it helped with my sore fingers!
See for example: Tommy Emmanuel Guitar Lesson - #11 Bass Part - Fingerstyle Milestones.
Edit:
Just found another possibility.  Andy Guitar suggests doing it to get the shape of a chord into "muscle memory", lifting the fingers up to 5mm (as an exercise, not necessarily during playing).
Thank you all for your answers!
Answer: Generally pulsing a chord would most often be used as part of a rhythmic technique to lend a particular element to the rendition as part of the style of playing - or as part of the arrangement for a particular song that lends itself to the technique.
The video example you shared is actually part of a fingerstyle technique of creating a bass line and although Tommy is pulsing his fingers, the muting effect in the video is achieved by palm muting.
As Tim suggested in his answer, if you are using barre chords, it is not difficult to create the rhythmic staccato effect by "pulsing" or releasing the pressure on the strings to mute or dampen them in a rhythmic pattern but is very difficult to do while playing chords with open strings.  I find palm muting (using the strumming hand) to be a much easier technique to master than attempting to mute open strings with fingers on the fretting hand.
A musical arrangement featuring many barre chords can indeed be tiresome to play so "pulsing" would certainly be one way to reduce the stress on the fretting hand by alternating between pressure and relaxing the pressure.
If your primary goal at your stage of learning guitar is to reduce finger soreness, you might try lighter strings and/or having a skilled guitar tech lower the action on your guitar.  You will find more tips for minimizing finger pain during the early stages of learning to play guitar here on Stake Exchange Music.
Custom Finger Friendly Guitar String Set for beginning guitarist
Comment: You are welcome.  Keep aiming for the stars.  One thing I have discovered about playing guitar is that no matter how much I improve my own skills, there is always plenty of room to get even better.  YouTube is full of examples of players that make me think "I could never play that well".  But I can do things now that I used to think I would never be able to do and it makes me wonder why I ever doubted.  How good you become is a matter of how dedicated you are to improving.  It sounds like you are very interested in improving your skills.  Keep it up.  But most importantly - enjoy the journey!
Comment: Thanks!  Good catch on the palm mute, and good to know I can use that if I ever wanna stacc, since I'm learning it.  My primary goal is to keep up with Tommy.  I know:  aim for the stars, but with firm fingers on the fret board!  (so no pulsing for now :)
Answer: With some rhythm patterns, it's necessary to strum chords that are very short in duration. It spices up the rhythm itself, and the simplest way to achieve it is to 'pulse' - hold down the strings, and momentarily loosen the grip to make that strum sound short.
It works best on full barre chords, because all strings can be choked at once, with one slight move. On chords involving open strings, it's a slightly different technique, as not only do the fretted strings have to have their associated fingers relxed, but at the same time, any open strings need muting with the same or spare fingers.
For a simple entry into this technique, try 'She's a Woman' (Beatles), where there's only 4 strums per bar, but all cut short by the simple motion of releasing the finger pressure on all strings just after the strum, producing no sound, before the next strum. But be aware that those strums are all on the &, not on each beat!
Having sore fingers isn't pleasant for guitarists. Perhaps you are pressing a lot harder than needed. perhaps the action is too high, perhaps the strings are too tight due to their gauges.
Answer: That's the normal way to play a repeated note when the notation doesn't call for sustained notes or legato.
Note that on, say, a piano, if you play a chord twice, there will be a silence because when you lift your hand, the dampers will kick in. To prevent that, you can use the sustain pedal. Then that becomes somewhat like the effect of strumming a guitar's strings while holding the chord.
One reason to avoid sustain in a guitar passage might be that it contains a mixture of repeated and non-repeated chords (possibly requiring left hand position changes), and for whatever reason you want all of the durations to be consistent.
Another is that guitar music doesn't all have to be "jingly-jangly"; listeners get tired of that and their attention fades.
In rock guitar, if you strum repeatedly on a fingered chord, the effect isn't particularly dramatic because the attack and volume are leveled by distortion. In a mix with other instruments, the additional strums might not even be audible, except for the additional sustain duration they provide.
Answer: The above answer is fine. I use the technique to give a "snappy" rhythm. Not for melancholy of serious songs, great for "Happy Birthday" and other lively music.
Comment: I think you meant for this to be a comment as I see it as a comment to an answer where it makes more sense.  You might want to delete this as an answer to avoid downvotes.
Comment: I see you've made a comment as Rockin Cowboy suggests, but you haven't deleted the answer.
Answer: I've found this technic out myself as I've been an autodidact in Guitar playing. (There were no wikipedia or youtube tutorials SE!) All we had were some basic diagrams like C, G7, D7, E, am ... and we shared our knowlegde at the campfire.  So I learnt to play the F chord with help by the thumb. This was quite easy: the movement was similar to make a fist.
Also the barré chords we found all out ourself by constructing them from the am and E chords ...
(Unfortunately it was too late for me: my fingers had been already deformed by arthritis.

Is it to mark the beat, relax the fingers, silence the strings, all of the above?

Yes, it has all those effects. You can choose why it do it for you. I used it for all three purposes.
Don't give up. It will benefit your sore fingers!
Answer: To silence the strings for a rhythmic effect, usually staccato. The tempo is unrelated, but often you'll find this heavily used in fast Funk and Pop rhythms with heavy syncopation.
Comment: The above answer is fine. I use the technique to give a "snappy" rhythm. Not for melancholy of serious songs, great for "Happy Birthday" and other lively music.


Can't bridge traffic between a wireless and wired interface of a windows 7 laptop

Question: I'm trying to route packets between a wired-wireless-wired link. I'm using a Spirent test center as a traffic generator which routes traffic to an Access point over a LAN cable(wired link)- This Access point then routes this traffic to a windows laptop (wireless Link)which in turn must route the packet  back to the Spirent test center(wired link).
The 1st port of Spirent has an IP of 192.168.1.200 and its default gateway is the IP of the access point 192.168.1.1 . Both the wired and wireless interfaces of Access Point have the same IP that is 192.168.1.1 . The ip address of the WiFi interface of the laptop is 192.168.1.163 and the Ip of the ethernet interface(connected to Spirent) is 192.168.1.165. The other port on Spirent has an IP of 192.168.3.200 and its default gateway is 192.168.1.165.
The routing table of the AP is as follows:- routes ap.
The routing table of the laptop is :-routes laptop
I can't send traffic from end to end. The traffic reaches the wireless interface (.1.163) of the laptop but not the wired interface( .1.165).
I tried to bridge it but it didn't work. So I disabled the bridge and set separate IPs to both the interfaces of the laptop and assigned static routes. But it still doesn't work.
EDIT1:- I bridged the interfaces of the laptop with an IP of 192.168.1.170. Now I can't ping the 2nd port of the Spirent (.3.220) at all! I could add a static route to the laptop but because the WiFi interfaces  are bridged ( and therefore have the same IP and the same IF number), I dont know what default gateway or what  outgoing Interface to provide.
Comment: You can't bridge a wired interface to a wireless client. You will need to find some other way to structure your network.
Comment: I'm trying to bridge the wireless and wired interface of the same laptop. I know windows offers this functionality, but I cant route the packets between the 2 interfaces
Comment: I'm confused. Are you trying to route, or are you trying to bridge? You wrote that you need to route, but they are completely separate concepts. Routing sends traffic between different networks, while bridging works on the same network.
Comment: @RonMaupin - I'm actually okay with either bridging or routing provided they pass traffic to 192.168.3.200 which is the endpoint. I tried to bridge the 2 interface 192.168.1.163 and 192.168.1.165  and assigned a static route -p add 192.168.3.200 mask 255.255.255.0 192.168.3.200 .   But that didnt work
Comment: If you are bridging, you can't have the same source and destination MAC address on the frame, and routing will not work with the same source and destination IP address on the packet. You need to have a different destination interface from the source interface. That means that you need two interfaces on your traffic generator is you want it to be both the source and destination device.
Comment: @RonMaupin The traffic generator does have 2 emulated devices with different ips and Mac addresses.
Comment: @RonMaupin Device 1 has an Ip of 192.168.1.200 and device 2 has an ip of 192.168.3.200. Each have a different MAC . In an earlier comment you said bridging works only on the same network, so should I change the IP of device 2 to include it in the .1 subnet?
Comment: The interfaces are on two separate networks, so you need a router to route between the networks. You cannot bridge between separate networks. A host sending traffic to an IP address on a different network will send the traffic to its configured gateway, and, presumably, the gateway has a route to the destination network.
Comment: @RonMaupin I could try two things 1. Enable Internet Connection Sharing( that was the first result when I googled how to use your laptop as a router) 2. Scrap Bridging completely and rely on static routes to forward the traffic.
Comment: The only issue with 2. is that I can't ping the final device 192.168.3.200 from my AP. So I am probably going wrong in assigning the default gateway in my route
Comment: I think ICS will go from wired to wireless. You simply don't bridge two different networks. What is the configured gateway for your source interface (the traffic generator or the WAP)? That is where the traffic will be sent since the destination is on a different network.
Comment: gateway for the source interface is the WAP
Comment: As a gateway. the WAP must know how to get to both networks. The gateway must know where to send traffic for the foreign network. It is a bridge, not a router. You need a router.
Answer: Linux Ethernet/wireless bridging
It seems you really cant bridge a wifi interface. One user suggested giving the wired interface an IP that is a subset of the wifi interface subnet . Maybe I will try that .


Showing that $X \times \mathbb{A}^1$ is regular in codimension one.

Question: I am reading the proof of Proposition 6.6 in Hartshorne which states that $\operatorname{Cl} X \cong \operatorname{Cl} (X \times \mathbb{A}^1)$.
Let $X$ be a noetherian, integral, separated scheme which is regular in codimension one. We want to show $X \times \mathbb{A}^1$ is regular in codimension one.
Hartshorne starts out be describing points in $X \times \mathbb{A}^1$ which are of codimension one. I am already confused at this point.
First of all, we talk about codimension for closed, irreducible subsets of $X$ but I am not sure how we know that a point in $X \times \mathbb{A}^1$ is necessarily closed and irreducible.
More importantly, how does knowing what the points of codimension one are help us show that the stalks of dimension one are regular?
I don't understand the motivation here at all.
I notice the next claim in the proof was asked about but never answered:
$X \times \mathbf{A}^1$ is regular in codimension 1
(I am also very lost as to what Hartshorne is trying to say in that claim however I didn't add it to this question as it has already been asked but was never answered).
Answer:
The dimension of the stalk at a point is equal to the codimension of the closure of that point.
There are two types of points whose closure will have codimension 1. It is helpful to think of points of codimension 1 as hypersurfaces of $X \times \mathbb{A}^1$.

In order for the closure of a point in $X \times \mathbb{A}^1$ to have codimension one, its closure needs to be either $X$, or letting $H$ denote a hypersurface of $X$, $H \times \mathbb{A}^1$. The latter are the points of type 1 and the former are those of type 2.