Silverlight: How to receive notification of a change in an inherited DependencyProperty

Question: I have a control which inherits from (you guessed it) Control.
I want to receive a notification whenever the FontSize or Style properties are changed.  In WPF, I would do that by calling DependencyProperty.OverrideMetadata().  Of course, useful things like that have no place in Silverlight.  So, how might one receive those kinds of notifications?
Answer: I think here is a better way. Still need to see the pros and Cons.
 /// Listen for change of the dependency property
    public void RegisterForNotification(string propertyName, FrameworkElement element, PropertyChangedCallback callback)
    {

        //Bind to a depedency property
        Binding b = new Binding(propertyName) { Source = element };
        var prop = System.Windows.DependencyProperty.RegisterAttached(
            "ListenAttached"+propertyName,
            typeof(object),
            typeof(UserControl),
            new System.Windows.PropertyMetadata(callback));

        element.SetBinding(prop, b);
    }

And now, you can call RegisterForNotification to register for a change notification of a property of an element, like .
RegisterForNotification("Text", this.txtMain,(d,e)=>MessageBox.Show("Text changed"));
RegisterForNotification("Value", this.sliderMain, (d, e) => MessageBox.Show("Value changed"));

See my post here on the same http://amazedsaint.blogspot.com/2009/12/silverlight-listening-to-dependency.html
Using Silverlight 4.0 beta.
Comment: As long as we need to do it entirely from the code, I guess we don't have another option till we get the DependencyPropertyDescriptor in Silverlight from MS
Comment: I like that this is a nicer way of wrapping up that ugly binding, but that is an awfully heavy way to get property change notifications.
Comment: I've also used this approach, unfortunately it leaks memory. In my experience it will hold a reference to what ever element you use it with, which will in turn hold on to other objects. The culprit appears to be the callback which will retain a reference to your view for the life of your application.
Comment: It works (+1!) but as Ian said its not optimal. As a workaround I've moved the attached property (in my case called `ListenAttachedIsEnabledProperty` to the class I want to override and added the following two lines in the constructor `var b = new Binding("IsEnabled") { Source = this }; SetBinding(ListenAttachedIsEnabledProperty, b);`
Comment: it will throw when calling RegisterForNotification for multiple textboxes probably because you can't create multiple DependencyProperties with the same Name.
Answer: It's a rather  disgusting hack, but you could use a two-way binding to simulate this.
i.e. have something like:
public class FontSizeListener {
    public double FontSize {
        get { return fontSize; }
        set { fontSize = value; OnFontSizeChanged (this, EventArgs.Empty); }
    }

    public event EventHandler FontSizeChanged;

    void OnFontSizeChanged (object sender, EventArgs e) {
      if (FontSizeChanged != null) FontSizeChanged (sender, e);
    }
}

then create the binding like:
<Canvas>
  <Canvas.Resources>
     <FontSizeListener x:Key="listener" />
  </Canvas.Resources>

  <MyControlSubclass FontSize="{Binding Mode=TwoWay, Source={StaticResource listener}, Path=FontSize}" />
</Canvas>

then hook up to the listener's event in your control subclass.
Comment: When the MyControlSubclass FontSize property change, the binding will be clear so it seems it doesn't work? not?
Answer: You cannot externally listen to dependency property changed notifications.
You can access the Dependency Property Metadata with the following line of code:
PropertyMetadata metaData = Control.ActualHeightProperty.GetMetadata(typeof(Control));

However, the only public member that is exposed is "DefaultValue".
There are a multitude of ways to do this in WPF. But they are currently not supported by Silverlight 2 or 3.
Answer: The only solution I see is to listen to the LayoutUpdated event - yes,  I know it is called a lot. Note however that in some cases it won't be called even though FontSize or Style has changed.
Answer: This is what I always use (haven't tested it on SL though, just on WPF):
    ///
    /// This method registers a callback on a dependency object to be called
    /// when the value of the DP changes.
    ///
    /// <param name="owner">The owning object.</param>
    /// <param name="property">The DependencyProperty to watch.</param>
    /// <param name="handler">The action to call out when the DP changes.</param>
    public static void RegisterDepPropCallback(object owner, DependencyProperty property, EventHandler handler)
    {
        // FIXME: We could implement this as an extension, but let's not get
        // too Ruby-like
        var dpd = DependencyPropertyDescriptor.FromProperty(property, owner.GetType());
        dpd.AddValueChanged(owner, handler);
    }

Comment: I'm pretty sure DependencyPropertyDescrtiptors are mythical beasts in Silverlight, unfortunately.
Comment: DependencyPropertyDescriptor is not supported by Silverlight 2 or 3


Tempate not displayed on the page attribute section while adding or editing the pages

Question: I have used wordpress and there is a section page attributes which includes Parent, Template and order. What my problem is i am not being able to see the templates to select while adding the pages. One problem is that the current theme is not displayed and it shows nothing on Current theme. I have two themes and both listed as not used themes.
The server i have used is IIS server. Is there anyway i can solve this issue? Any suggestion will be appreciated. Thanks in advance.
Answer: Maybe this wasn't clear, but with the Template select box on the Edit Page screen, you select one template in your current theme, you can't just switch to another theme here. This is explained in the documentation on creating new Pages, which also has information and examples on creating new templates.
If you have a problem with your theme, try re-activating it by selecting another theme and then your theme again. Make sure to enable debugging to see error messages that might otherwise be hidden.


Android Expandable lists having multiple child items in a single row and their onClick event

Question: I could not figure out how to implement two basic functionalities with the expandable lists: 1. The onClick for the child 2. Using linear layout for the children, so that I can have multiple clickable items in same row under the parent item
Can somebody help me with some sample code for the above?
Answer: If someone is still interested - the google guys have written some very good samples for understanding and using expanable lists!
You can either use ExpandableListView (which extends ListView class), or simply create an ExpandableListActivity, which hosts an ExpandableListView.
Just take a look at these three examples. I made screenshots to show what it looks like (only notice that the background color isn't the one from the default theme):
Example 1 - ExpandableList which receives data from a custom ExpandableListAdapter

Example 2 - ExpandableList which receives data from a CursorAdapter
(no pic)
Example 3 - ExpandableList which receives data from a simple HashMap-based Adapter


Run release build of iOS app on development device

Question: When I build my iPad app for running on my development iPad, it only builds the debug version. I need to see how fast the real release version is; how do I do this? I'm used to Visual Studio's Debug/Release builds, so this Run/Test/Profile/Analyze/Archive stuff isa  bit confusing. I see Schemes are related to this but isn't there a simple switch "I want to test Debug/Release version of my app on my device"?
Comment: If you found a solution, please accept an answer that helped you.
Comment: I'm very glad I got this working... release version runs 60% faster!
Answer: You want to do a release build using an ad-hoc provisioning profile, which will allow you to install it on your device and any others you have specified.
Test flight app is free and can help with this process as well.
Comment: This was the key part I wouldn't have figured out - changing to Release alone didn't work as I was using a dev profile.
Comment: Excellent, glad you got it working. If this helped you consider marking it as the answer.
Answer: In your scheme settings, you can select to build for debug or release. Make sure you have set up code signing correctly. Xcode 5 can help with that.
Comment: Can you define "correctly"? If it's working for debug won't it work for release? Also... really I have to edit the scheme every time, I can't have separate schemes to test debug/release?
Comment: It is possible to have different schemes, but you can only assign one scheme to the "Run" command. So you'd have to switch the schemes every time. Easier to just change debug/release.
Answer: You can create a new Build Configuration in the Project View under the Xcode Project. Make it a duplicate of Distribution

Then just choose Edit Schemes and choose the new scheme and run on your device. Make sure you the certificates selected in your Build Settings. However you don't get full Debugging capabilities when running a AdHoc/ Distribution build.
Comment: Is this an XCode5-specific thing?
Answer: This took me a really long time, but I got it working. I usually use automatic signing and it works great. I switched to using FastLane in order to speed up the test flight distribution process and it required that I switch to manual signing. I had to change my release signing certificate to iOS Distribution.
I then had a bug that was only reproducible in release mode, so I needed to run the app on my device in release mode, but it was a pain to keep re-uploading to test flight.
I tried changing my build system to legacy, but that didn't work. I read up on profiles and certificates and I realized that I need to use iOS development certificates to run on device directly (which is what I was doing in debug mode). However, I needed to use iOS distribution certificates to distribute the app. Automatic signing had been taking care of this for me.
I ended up just turning on automatic signing briefly to test my app and then turned it back off and used git to revert the status of the workspace.
TLDR: turn on automatic signing and then turn it back off when done testing


how to configure dynamic urls in httpd.conf file for reverse proxy

Question: I am using apache httpd server for reverse proxy to make cross domain ajax calls.
ProxyPass /v1/virtuals http://mypage.com/:4277/v1/virtuals/abc
ProxyPassReverse /v1/virtuals  http://mypage.com:4277/v1/virtuals/xyz
in the above url the abc,xyz  will be changed based on the selection.those will be dynamic.so how could i configure the urls with that dynamic content in httpd.conf file
Answer: Tried with wild card pattern. but it is not working.
http://mypage.com/:4277/v1/virtuals/
in httpd.conf is sufficient to allow all the urls


Ising model scale invariance

Question: What is the connection between divergence of the correlation length and scale invariance. Why is a system scale invariant at its critical point if the correlation length tends to infinity? Is it true that the correlation length describe the typical length of the connected range?
Answer: As you say, the correlation length, $\xi$, is a measure of domain size. Two spins that are within a correlation radius will have similar statistics.
A system where there is such a scale can not be scale invariant. Indeed, scale invariance means that you can zoom in or out of the system and finds that it still looks the same. When there is a correlation length, zooming out makes it shrink and zooming in makes it expand. There is no way that you will not notice this.
The only way out is either if $\xi=0$ or if $\xi = \infty$. Then in both cases doubling or dividing the correlation length by a scale factor returns the same value of $\xi$. The case $\xi = 0$ is trivial. It means that the spins are all independent from each other. I.e. that your theory is not interacting. We are left with the critical case: $\xi = \infty$.
Comment: Dear Steven, I was wondering if you are familiar with the literature on 2D bond percolation, using RG. The one parameter RG is covered in most books, then there's the work of Young et al. (1975) using a 6-parameter model for a much more accurate result. But as for simpler models (params < 6), do you know of any such works? Thanks in advance for any suggestions.
Comment: Sorry, I can't think of anything. However if you understand the work of Young et al. you can simply set to zero some of their parameters and ignore the corresponding RG flow equations. As long as you pick irrelevant couplings it should not make a big difference.

Ising model scale invariance


Contact reminder

Question: I have entered a contact in Civi. I want to reminder myself to contact her in a year. I don't have administer privileges. I can't find anything within the contact to let me do this.
Answer: You can create a scheduled Activity with this contact. https://docs.civicrm.org/user/en/latest/organising-your-data/activities/
via the Actions button on the contacts Summary screen
If you add the dashlet for activities to your dashboard, you will also be reminded of this whenever you log in until you mark the activity as completed.
Comment: Thanks very much for the response.
Answer: If your administrator isn't willing to set up the scheduled reminders, then you could always just put a regular calendar reminder in your regular calendar.

Contact reminder


overscan with noveau display driver

Question: I'm using opensource driver there is an overscan, my hdtv/monitor res.1920x1080 24" how can I configure the screen, if need more details let me know (edges of the picture are lost ubuntu 14.04 LTS nvidia gtx550ti graphic card
Answer: Overscan is a function of the monitor - you should be turning this off on the monitor, not on the PC.
Graphics drivers do sometimes have facilities to correct for overscan in the monitor but these are intended only for monitors where it's impossible to disable overscan, which is basically CRT monitors.  On digital flat panels (LCD etc) you will get a much poorer (blurry) display quality if you do this because the image will have been re-sized twice - once by the graphics card and once by the monitor.  Instead, you should output full-frame from the graphics card and disable overscan on the monitor.
On most monitors this "just works" because signal hints it receives over HDMI tell it that the signal is coming from a PC, and from this the monitor can infer that it shouldn't use overscan.  In some monitors (particularly those designed as televisions) it may be a manual option in the monitor settings however.
Some monitors may refer to this as enable/disable overscan, but at least one some (including my Samsung TV) the no-overscan mode is referred to as "screen fit".

overscan with noveau display driver


What to consider when migrating from hosted (saas) to individual deployments

Question: The company I work for sells a hosted (ie software as a service) software system. We've now been asked if we can provide a local install of the software for a potential customer, sort of the reverse of what seems to be happening else where with people moving towards the hosted model. The question is what we should consider in providing this and where the likely gotchas could be, we've had some discussion in the office but I thought I'd put it out to a wider community. Our app requires a sql server install, some other dependencies (ie tomcat) and installs a few windows services. I'd presume we'll require dedicated (possibly virtual) machines for our system.
Answer: Support will get a lot more complicated when you move away from SaaS. Although you're talking about one customer now, you should consider how these issues will scale with 5, 10 or 50 customers.
Will the customer be doing their own backups? If things go wrong and they have to reinstall your software and restore their backups, will they be able to do it themselves or will you need to go onsite? If you do need to do a site visit, what will your response time be?
Will they have admin access to the database? If not, will they be able to manage backups effectively? If so, what happens when they start fiddling and adding their own "performance enhancements"?
New releases and upgrades: With SaaS you can deploy upgrades when you want, and everyone will start using the new version straight away. This sucks if you break something but at least you know where you stand. With individual deployments all customers will upgrade at different times and you'll have to start supporting multiple versions of your software.
Will the customer install updates themselves or will you do it remotely? How complex is your deployment procedure - single click or 10 step process?
What hardware will your software be running on? A dedicated server or a 5 year old desktop that's also running Exchange? If your software runs a report and no-one gets email for an hour, will that be your fault?
None of these are insurmountable problems. Everyone who sells packaged software has to deal with them, but they're things you don't have to worry about when you run the services yourself. It might not be worth the extra hassle for a single customer.
You could also look at going down the appliance route, like Google do with their search appliances. You sell the customer a server with all your software pre-installed and configured. You have full remote access to the box, but they only have limited rights. But their data stays onsite and not off in the cloud. This could be a good compromise approach.


How to improve memorizing ability?

Question: I'm a student,  how can I improve my memory ?
 Also, I heard that Matcha tea is good for students,  is that true?
Answer: Train your Brain.
its not the supplement in the market which will boost your memory application, althgough you can take Omega supplements which is good for brain stuff and heart.

How to improve memorizing ability?


Copying transforms from one object to another

Question: I am working on a virtual production app, and I need to be able to copy the transforms of one GameObject and all of its children to another. I asked previously here how to animate a character moving while allowing outside motion to override it, and it was suggested that I make a hidden copy of the character and transfer the positions of the bones to the main character in LateUpdate. Is there a way to copy all of the bone positions from one GameObject to another?
Answer: Something like this?
public static void CopyTransformTree(Transform sourceRoot, Transform destRoot) {
    // Read local pose in one operation.
    sourceRoot.GetLocalPositionAndRotation(out var localPos, out var localRot);
    // Clone local pose to destination transform in one operation.
    destRoot.SetLocalPositionAndRotation(localPos, localRot);

    // Clone scale (skip if your bones don't use scale).
    destRoot.localScale = sourceRoot.localScale;

    // Iterate over as many children as both roots have.
    int limit = Mathf.Min(sourceRoot.childCount, destRoot.childCount);
    for (int i = 0; i < limit; i++) // Recurse on each child sub-tree.
        CopyTransformTree(sourceRoot.GetChild(i), destRoot.GetChild(i));
}

void LateUpdate() {
    CopyTransformTree(sourceRootBone, destRootBone);
}

Comment: Is there a  way to do this with blendshapes as well?
Comment: That's not what your question asked. You can post it as a new question, though it will be very similar, just calling `SkinnedMeshRenderer.GetBlendShapeWeight`/`SetBlendShapeWeight`.
Comment: Though rather than copying every shape weight, you might prefer to have your animation running on the invisible copy, and then clone selected bone rotations to the visible copy that's being driven by performance. Basically, choose whichever route is shorter to get to the same combined result.
Comment: I did find a way, but it's rather specific. Your solution does indeed copy the bone positions, but still overrides them.
Comment: I'm not able to understand the problem from that description. Want to update your question to clarify? Is it safe to assume you called this function only on the bones you wanted to copy, and not the entire skeleton?
Answer: You can copy the transforms of one GameObject and all of its children to another using the Transform class's methods.

public void CopyTransforms(Transform sourceTransform, Transform targetTransform)
{
    // Copy the position, rotation, and scale of the source transform to the target transform
    targetTransform.position = sourceTransform.position;
    targetTransform.rotation = sourceTransform.rotation;
    targetTransform.localScale = sourceTransform.localScale;

    // Copy the positions, rotations, and scales of all child transforms recursively
    foreach (Transform sourceChild in sourceTransform)
    {
        Transform targetChild = targetTransform.Find(sourceChild.name);
        if (targetChild)
        {
            CopyTransforms(sourceChild, targetChild);
        }
    }
}
```


Is there a safe way to get 12 V power from an ATX power supply when the computer is turned off?

Question: I have some LED stripes to illuminate my workspace. Since I have nothing else at hand, I connected it to the 12V rail of my PSU in my computer. This works very well when the computer is turned on, but I would like to be able to use the lights also when the computer is not running.
Comment: Why not just acquire a separate power supply?
Comment: There is *powered off*, and there is *disconnected*. Assuming your ATX PS still connected to mains *and* computer, there's 5 V stand by - typically no more than 10 W, with the computer consuming an unknown amount. Assuming your workspace to feature a monitor, it may be more useful to use that for illumination. And even a small EE challenge.
Answer: That would mean the power supply is turned on, because you don't have 12V at standby.
But if your LED lights don't take more than 5 to 10W, you could use the 5V standby output by using a boost converter from 5V to 9-12V.
Your power supply should be capable of providing more power (in watts) than what your LED light needs.
Another way of doing this WITHOUT a boost converter is to rewire or re-arrange the LEDs on your strip so that they're in parallel instead of being in series (typically there are 3 LEDs in series with 1 or 2 resistors on 12V strips), so that the strip can run at 3-5V, though this would be less efficient, but would get the job done.
If you don't know the details or need more info on how to do that, let me know in the comments below this answer, and I will add the necessary details here.


How should I reference the original work in a survey paper?

Question: For example, if I want to dedicate a subsection of my survey paper to another research paper, I believe I need to reference the original paper. However, how should I do that? This subsection will have an interleaving of my observation and ideas and the original contents of the authors. Do I need to reference it whenever I try to talk about the original research paper?
Comment: How do people do it in the papers you read?
Comment: For the papers I read, most of them do not spend much time on reviewing existing techniques. They do mention and summarize those papers but there are usually several papers per paragraph which makes it a bit easier. But they do not reference the related papers for every sentence.
Answer: If you are devoting an entire subsection to discuss one specific original paper, then you should fully cite it at the beginning (e.g., AuthorA et al. [2]) and then refer to just the authors' names each time you subsequently refer to it (e.g., Author A et al.). This is particularly important since you will be interleaving your own ideas. It is very important to clearly distinguish your own ideas from those of the original paper. To do this, you must explicitly mention the original paper authors each time you refer to their work. Whenever you do not explicitly mention their names, then readers will understand that you are giving your own ideas.


Binding Dependency Properties

Question: So here I come creating a user control. It consists of a treeview dropping down from a combobox.
Actually, there is a button with a control (DropTree) dropping down from its contextmenu. So I have a control DropTree.
public partial class DropTree : UserControl
{
    public TreeView TreeView
    { get{return treeView;} }

    public DropTree()
    { InitializeComponent(); }
}

to simplify it, I made the TreeView control public, then I have my main control which is called ComboTreeView.
Now I need to represent some treeview properties in it, so I define several dependency properties:
    public static DependencyProperty SelectedItemProperty = DependencyProperty.Register("SelectedItem", typeof(object), typeof(ComboTreeView), new FrameworkPropertyMetadata { Inherits = true, IsNotDataBindable = false, DefaultUpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged });

    public object SelectedItem
    {
        get { return GetValue(SelectedItemProperty); }
        set { SetValue(SelectedItemProperty, value); }
    }

and in constructor it is:
public ComboTreeView()
{
            InitializeComponent();
            TreeViewControl.SetBinding(TreeView.SelectedItemProperty, new Binding("SelectedItem") { Source = this, Mode = BindingMode.TwoWay });
}

and it all seems ok, until i run it. It crashes saying that SelectedItem cannot be binded to data. I don't understand?
The same goes for ItemsSource and SelectedValue... but only SelectedValuePath property defined this way goes fine.
Can anybody help? Or is there any other way to bind it correctly?
PS: by the way, I need to use DataBinding for ComboTreeView in my code later.
Answer: Try to set the Binding on SelectedValue instead of SelectedItem.
Answer: TreeView.SelectedItem is a readonly property. You can't set it, whether explicitly or through binding. In order to select a node in a TreeView, you must set the TreeViewItem.IsSelected property to true.

Binding Dependency Properties


I do not understand the code version of time based sprite animation?

Question: I'm Universo and for the longest time had coding issues around the concept of time-based sprite animation basically, do not know how to implement it and any code or explanation simple or complex that I've found has been extremely confusing to me and was hoping to have a kind person walk me through the code step by step, explaining exactly how this is implemented correctly.
Here's what, I believe to know about the concept and or idea for time-based sprite animation it is to construct a delay or halt of some code statement using time of some kind in milliseconds with a collection of moving images and or sprites however any attempts from the tutorial's or my own brain have resulted in inaccurate various speed sprite animations and not the consistent stable speed, Id appreciate and be grateful for here's some code to show my progress and perhaps help you understand my position in this mess baring in mind, I prefer my code be as extremely simple and speedy as possible within the limitations, of course:
JavaScript with HTML5 Canvas
window.onload = function () {

var canvas = document.getElementById("canvas"); // get the canvas object

var ctx = canvas.getContext("2d");
/* make sure we have a context for that canvas so we can draw stuff */

var FrameSize = 120; //120 pixels
var FrameNumber = 0; //obvious
var img = new Image(); // make a image object
img.src = 'sprite_ani.png'; // url to the image
var last = 0; // no idea

function Render() {

  ctx.clearRect(0,0 ,640,480); // clear screen
  now = performance.now(); //to get the current timestamp in milliseconds
  delta = now - last; // last is 0, how does this work?
  last = now; // last is now, why?

  if(delta > 20 //what does this value represent??) {
     FrameNumber += FrameNumber + 1;

   /* increment FrameNumber by 1 could have been FrameNumber++ */

     delta = 20; // No idea why I need to keep this the same number??
  }

  if(FrameNumber>=4){   //just to make sure this is the end of the frame number sequence
     FrameNumber = 0; // to reset the frame number
  }
     ctx.drawImage(img,FrameSize*FrameNumber,0,120,120,0,0,120,120);

     /*
     perticularly draw a sequence of images and switch each individual image
     in that sequence based on the equation

     FrameSize
     (number to multiply the pixels by)
     * // multiply operator symbol
     FrameNumber
     (the pixels for the FrameSize to multiply with)
     */

     window.requestAnimationFrame(Render); // do the Raf stuff part one
}
window.requestAnimationFrame(Render);  // do the raf stuff part two
}

As you can see, it's extremely simple yet, I'm still struggling to not only understand it but extremely simply implement it, I'm not a fan of over-complicated coding hence why I ditched c++ ages ago.
Could someone in extremely simple english guide me through time-based sprite animation in the context of JavaScript preferably, Id also really appreciate various time-based sprite animation methods being explained too in extremely simple terms but not holding out, I thank you for reading this far.
Answer: After literally years on and off trying to figure out how to do some form of time-based sprite animation here is the final code, it's basically about getting delta and then creating an accumulation of increment and comparing if that's greater then delta and if so do a frame number increase "make sure to use framenumber++, not frame number = frame number + 1 it messes it up for some reason"
window.onload = function () {

        var canvas = document.getElementById("canvas");

        var ctx = canvas.getContext("2d");

        var FPS = 30;
        var Accumulator = 0;
        var FrameSize = 120;
        var FrameNumber = 0;
        var FrameCounter = 1;

        var img = new Image();
        img.src = 'sprite_ani.png';
        var Accumulator = 0;
        var last = performance.now();

        function Render() {

          ctx.clearRect(0,0 ,640,480);
          now = performance.now();
          var delta = now - last;

          last = now;

          Accumulator++;
          if(Accumulator >= delta)
          {
             FrameNumber++;
             console.log(FrameNumber);
             Accumulator = 0;
          }

          if(FrameNumber>=4){

             FrameNumber = 0;
          }

             ctx.drawImage(img,FrameSize*FrameNumber,0,120,120,0,0,120,120);

            window.requestAnimationFrame(Render, 3/1000);
        }
        window.requestAnimationFrame(Render, 3/1000);

       }


Generate random points around a feature in QGIS

Question: I have a point file that details the number of items and their size at each feature. I would like to illustrate these features by generating the right number of points at the right size around the feature point. This needs to be done using symbology, so probably a geometry generator based approach.
I can think of two possible approaches:
1-Generate a random offset for each of the n points, but I have no idea how to loop though a number of items generating a randomised location for each.
2-use a geometry generator to create a polygon then fill it with a point marker fill, this would be easier but not great and wouldn't give the right number of points and some might be cut in half
Comment: Please provide some example data, including max distance from your original point.
Answer: I solved this as follows:
Use a geometry generator to create a polygon the size of which can be adjusted to control the density of the points. Then apply a random marker fill which allows expression based control of the size and number of points


Backlight does not come on after booting

Question: I have a slightly old Gateway NV series laptop, and just installed Ubuntu 14.04 LTS because Windows was getting slow. Once it installed though, I found that the screen backlight does not come on after it reaches the boot screen. It works during the BIOS page, but goes off after. The screen itself works, because I can see the images if I put a bright flashlight up to it. Right now and during the install, I have been using an HDMI connection to my TV, which works perfectly, but just can't get the back light to function on the laptop. Using the backlight settings or hotkeys does nothing, and it shows no available drivers I can download. What can I do to fix this? My laptop is using a Mobile Intel® GM45 Express Chipset for graphics and a Intel® Core™2 Duo CPU T6600 @ 2.20GHz × 2 processor. Thank you for any help.
Answer: This has to do with the ACPI backlight driver for your specific video card in your laptop. Google Search "Forcing backlight on linux"
The Ubuntu wiki has a section dedicated to forcing the back light on. https://wiki.ubuntu.com/Kernel/Debugging/Backlight
Comment: Great link. Got halfway through the 'testing work around' section and the backlight came on. It was then, after messing with the brightness settings, I found the brightness control works the OPPOSITE on my computer. Setting to full brightness turns the light off, and no brightness set makes the screen bright. I looked through the page, but not sure if there's a command for reversing the controls. If not, I'll just set the default to zero.


What is the word for "aerial" but in the space

Question: Aerial means existing, happening, or operating in the air. I am wondering if there any word that has the same definition but in space?
Comment: You might think *spatial* is the adjective for *space*
Comment: *Sidereal* is really from the stars, but it could fit. Another option is *interplanetary*, which is not directly an answer to your question, but it is for what you really intended to ask: `Unmanned Interplanetary Vehicle`.
Comment: As a side note: German language has solutions for this, as in German *Weltraum* ("world space") is commonly used for *cosmos*, and this is productive for compound nouns such as *Weltraumfahrt* ("world space navigation"), and then from this the shorter *Raumfahrt* (space navigation) is derived.
Comment: Thanks, I was looking for a word for `Unmanned Aerial Vehicle` but in space. Not sure `Unmanned Spatial Vehicle` will fit the context or not. (Also this is the first time I see this word)
Comment: Well, space probe, space drone...
Answer: Referring to the context you pose, I would suggest "cosmic" or "extraterrestrial" as describing the specific "space" that you refer to in the question.
https://www.thefreedictionary.com/cosmic
https://www.thefreedictionary.com/extraterrestrial
Answer: In comments you clarify,

I was looking for a word for Unmanned Aerial Vehicle but in space. Not sure Unmanned Spatial Vehicle will fit the context or not.

Unmanned space vehicle would certainly be clear and to the point.
You might also call it an unmanned spacecraft or unmanned space ship.
In science fiction, writers have often mentioned things such as space probes or drones with a similar meaning.
In some cases, the name we use for the vehicle might make it clear that it travels in space, without having to use an extra word to say so.  For example, NASA calls its unmanned space vehicles, unmanned satellites (if they remain in Earth orbit) or unmanned missions. Wikipedia has a List of unmanned NASA missions that might provide other ideas for nomenclature.
Answer: Space is accepted and is self-defining.  Why not use Unmanned Space Vehicle?
From Oxford English Dictionary:

The expanse in which celestial objects are situated; the physical universe (excluding celestial objects) beyond the earth's atmosphere,
  consisting of near vacuum with small amounts of gas and dust.

As in:  article

This United States Air Force unmanned space vehicle explores
  reusable vehicle technologies that support long-term space ...
Answer: You said in a comment under your question:

Thanks, I was looking for a word for Unmanned Aerial Vehicle but in space. Not sure Unmanned Spatial Vehicle will fit the context or not. (Also this is the first time I see this word)

Aerial and aeronautical are adjectives for things in the atmosphere.
Analogously, the adjective for things in space is astronautical. (Spatial, while also analogous, doesn't really work in this case.)

From the noun astronautics:

[Merriam-Webster]
: the science of the construction and operation of vehicles for travel in space beyond the earth's atmosphere

As per another answer, unmanned space vehicle sounds more natural than unmanned astronautical vehicle.
However, when you talk about things manufactured for space in general, you are talking about things that are of an astronautical nature, not things that are of a space nature.


Why would Dumbledore say "After all this time?" to Snape?

Question: When Snape's changed his allegiance from Voldemort to Dumbledore he did so expressly because he wanted to honour Lily's memory by protecting Harry. It was Dumbledore himself who persuaded him to take this course of action.

"If you loved Lily Evans, if you truly loved her, then your way forward is clear."
  Snape seemed to peer through a haze of pain, and Dumbledore's words appeared to take a long time to reach him.
  "What — what do you mean?"
  "You know how and why she died. Make sure it was not in vain. Help me protect Lily's son."
(Deathly Hallows, Chapter 33, The Prince's Tale).

If this was the basis on which Snape changed sides and the basis for Dumbledore's trust of Snape then why on earth would he be surprised, 15 years later, that Snape's motivations remain the same? Dumbledore seems genuinely surprised that Snape is still acting out of his love for Lily. He is confident that telling Snape that Harry must die won't cause him disquiet. He questions why Snape's motivations would be unchanged "after all this time".

[Snape] stood up. "You have used me."
  "Meaning?"
  "I have spied for you and lied for you, put myself in mortal danger for you. Everything was supposed to be to keep Lily Potter's son safe. Now you tell me you have been raising him like a pig for slaughter-"
  "But this is touching, Severus," said Dumbledore seriously. "Have you grown to care for the boy, after all?"
  "For him?" shouted Snape. "Expecto Patronum!"
  From the tip of his wand burst the silver doe: she landed on the office floor, bounded once across the office, and soared out of the window. Dumbledore watched her fly away, and as her silvery glow faded he turned back to Snape, and his eyes were full of tears.
  "After all this time?"
  "Always," said Snape.
(Deathly Hallows, Chapter 33, The Prince's Tale).

Bear in mind both that:

Dumbledore was completely confident in Snape's loyalty. He trusted him implicitly and absolutely.
The sole basis for Snape's loyalty, based on what Snape actually revealed to Dumbledore, was his commitment to protect Harry on Lily's behalf.

Why does Dumbledore suddenly cast doubt on Snape's commitment to honouring Lily and protecting Harry here? Surely that was the basis for his allegiance to the Order all along? Doesn't Dumbledore's absolute trust of Snape imply that he was completely confident that Snape's motivations were unchanged?
Comment: Note that while his original motivation 15 years ago was honouring Lily, it's also quite likely that he developed other motivations in the meantime - genuine respect, trust and/or caring for Dumbledore and what he represented. It wouldn't really be out of character for him to stop being in love with Lily, while staying loyal to Dumbledore. Joining the Death Eaters was a juvenile stupidity, not a well-thought act of a mature man - he might very well resent it not just for causing Lily's death, but also just for being cowardly, self-serving and frankly stupid. He matured a lot since then.
Answer: He's not referring to the commitment to the Order - he's referring to the Patronus, and what it represents.
If the person you love has an animal form, your patronus can turn into something resembling them.
Tonk's patronus became a wolf after she fell in love with Lupin.

As Harry swung the cloak back over himself, she waved her wand; an
immense silvery four-legged creature erupted from it and streaked off
into the darkness.
Chapter: Snape Victorious, Harry Potter and the Half-Blood Prince

This was a definite change, as Snape points out to her shortly afterwards (while being his usual prick self).

And incidentally," said Snape, standing back to allow Harry to pass
him, "I was interested to see your new Patronus."
[...]
"I think you were
better off with the old one," said Snape, the malice in his voice
unmistakable. "The new one looks weak."
Chapter: Snape Victorious, Harry Potter and the Half-Blood Prince

Lily's patronus was a doe - either coincidentally or specifically because of James' Animagus form (probably the latter).
You can't choose your Patronus. The fact that Snape's is a doe - is Lily - means that he still truly loves her, and that his feelings for her haven't weakened over the years. It's the depths of this love that hits Dumbledore so hard - that's the reason he gets tears in his eyes on seeing the Patronus.
By "After all this time?" he means "After all this time your feelings for her haven't changed, or dimmed, or faded?"
Comment: @TheDarkLord Because Lilly was the trigger that caused him to finally "switch sides", but that doesn't mean it was the only reason. Someone who had known little trust or respect in his life suddenly receiving it from someone like Dumbledore for example - that would be profound.
Comment: I think you're partly right. The Patronus does testify to the strength of Snape's feelings for Lily. It's understandable that Dumbledore would be surprised about the doe. But surely if he thinks that Snape's feelings for Lily have weakened then he thinks that Snape's commitment to the Order has weakened (since she was the reason he joined). Why would Dumbledore be so confident Snape was still loyal to him in that case?
Comment: @Nzall Sorry, the quote isn't clear - Snape is talking to Tonks, not Harry. I was looking for a quote to indicate that hers had changed and saw Snapes, but CHEESE's answer has a better one. This is from Book 6, when Tonks is delivering Harry to the castle.
Comment: Beautiful, this cleared up something I'd wondered for a long time after seeing the movie (which has the same "After all this time?" quote). +1
Comment: Note: what was Harry's old patronus and what is his new one? And from what book does that quote come?
Answer: It's been almost 17 years since Lily died, and about 22 since Snape was rejected by Lily in fifth year after O.W.Ls.
Patronuses change after a great shock, and emotional upheaval (from HP6):

"Tonks's Patronus has changed its form," he told him. "Snape
  said so anyway. I didn't know that could happen. Why would your
  Patronus change?"
  Lupin took his time chewing his turkey and swallowing before
  saying slowly, "Sometimes . . . a great shock . . . an emotional upheaval
  . . ."

It's not normal to be in shock for 17 years after a breakup, or to still be in love enough for a Patronus after so much time.  Obviously Patronuses revert back to original form once some of the grief of the loss has worn off.
He's not saying "after all this time, you still have a reason to be loyal to me?" he's saying "after all this time, you grieve for Lily Potter?"
Comment: @TheDarkLord Not after over a decade of peace and working with The Order. Snape's a piece of shit as a person, but he was always a fringe Death Eater - he didn't really believe in their creed. By the events of Book 1 he's essentially been rehabilitated. Even if he managed to get over Lily in the intervening years it's likely he'd stick with The Order and (specifically) Dumbledore.
Comment: He doesn't grieve for Lily Potter. He grieves for Lily *Evans*.
Comment: @TheDarkLord Dumbledore knew Snape still cared for Lily; however, he didn't know that he was still grieving, that he was still in the state of emotional upheaval and shock.
Comment: @TheDarkLord You are mistaking grief and love.
Comment: But his grief for Lily *was* his reason for being loyal to Dumbledore. They're one and the same thing.
Comment: @TylerH They were 21 (died October 31 1981, both born 1960).  Sorry about the math, I was contaminated by JKR :-)
Comment: Where are you getting that they revert back to an original form from? I'm curious as I don't recall reading anything about it, and was under the assumption that the "great shock/emotional upheaval", joy, love etc makes the change more or less permanent (until the next great shock). True love, whether requited or not, would be good enough for a change in Patronus
Comment: @CHEESE Surely he always grieved for Lily because he always loved her. Imo you haven't addressed the issue of why Dumbledore was so certain that Snape was loyal to the Order. If he thought he didn't care for Lily any more then there was no reason why Snape couldn't have been Voldemort's man.
Comment: If the change in a patronus is ONLY a temporary thing, what does that say about other examples of patronuses changing that we know of? Surely Lily's love of James did not come as a great shock to her. Same for Tonks and Lupin. P.s. is it possible that Lupin was being somewhat evasive when he was speaking about how and why a patronus might change, and therefore his comments were not comprehensive (on account of personal embarrassment)?
Comment: @CHEESE Wait, the Potters died at the age of 17/18? That seems rather young for everything that happened. I don't think those "years since" times are correct. IIRC they were ~21 when they died (still a bit young compared to the casting job...)
Comment: @Thomo - The revertion to original form is logical, given the nature of the Patronus charm. But then again, same argument can be made for permanent change, if the emotional factors are extreme. But then - again - again, this would be very rare and definitely a cause for Dumbledore to be surprised. And last point - no, patronus change would not wait for next great shock - there is a time when it wears off. After all, time heals all wounds. Or so they say.
Comment: @TheGiantofLannister Once again, there is a difference between grief and love
Answer: I think the context of the

"After all this time?"

is set by the preceeding:

"But this is touching, Severus," said Dumbledore seriously. "Have you
  grown to care for the boy, after all?".

And what that means is simple: Dumbledore asks if Snape finally gotten over his dislike of Harry. I'd say that saying that Snape was not fond of the boy is an understatement of highest caliber. All that matters to Snape is what Harry represents - a part of Lily that's still here. But it's the only thing that matters to Snape, really.
I do not precisely remember the scene from the movie, but i think Rickman then has very unmistakable expression on his face... Which tells a lot, especially since that bit is missing in the book. Then again, JKR was consulting of the movies, so...
So the question is much less an accusation or castigation of any doubt by Dumbledore, but genuine surprise at the strength of the Snape's feelings for Lily.
The surprise may be explained by the nature of the Patronus charm: always an animal, it expresses the nature of the caster, is linked to significant events in one's life and with requirement for a single, very happy memory.
Think on it for a bit and it's possible that Snape was very happy being extremely unhappy. Sort of creepy.
Comment: There is slight difference between protection and care. If you aretouching a hot wire I can hit you on your hands by a light stick or by a hammer. In both cases I the first sace I have (carefully) saved your life. In the second case I have broken your arms and, by the way, saved your life. Stape was convinced to change sides in the name of Lily, not in the name of Harry.
Comment: Another point is that Dumbledore and Snape knew that Voldemort hadn't been defeated and that he would return once. Snape was also double agent and his open care for Harry would be a strong argument against his loyalty to Voldemort. He protected Harry all the time, see the match in Sorcerer's stone, and keeps his loyalty to Lily and Harry against anybody. Including Dumbledore. The fewer people knew, the fewer risks to Snape and Harry.
Comment: The only reason Dumbledore was considering that Snape may have grown to care for Harry was because he was overlooking Snape's feelings for Lily. My question is, why would he have forgotten those feelings in the first place? Also, I know Snape is hardly Mr Happy but I don't think that the impression we get from the books is someone who gloried in misery.
Comment: @Crowley - And I'm saying that very same thing. And pointing out that he was doing the mental equivalent of breaking Harry's both arms all the time. Notwithstanding the fact it made for great cover, he positively enjoyed it all end every time.
Comment: @TheDarkLord - And I'm answering that it was not the fact of the feelings for Lily but *their strength*, underscoring it with the way the Patronus works. For me, all that say that Snape lives actually in the day of her death, for the last 17 years of his life. This is what surprises Dumbledore, not the fact. And last bit: for Snape it's not even far-fetched to blame Harry for her death, actually - he showed up, she had to die because of that...
Comment: @TheDarkLord You don't get that impression. Funny you'd mention that though because both sides mistrusted him for a certain reason including being able to close his mind and give false impressions too. He deceived yourself even. The context here is key. Severus only clarifies that no he doesn't care about Harry so much as about Lily. (And besides, if Dumbledore didn't ask we wouldn't have the brilliant one word line 'Always'. Not that that's related to the story itself.)
Comment: Weird that this, the obvious correct answer, got so little upvotes. Its pretty obvious that Dumbledore is asking Snape whether he cares for Harry as well, or is it just Lily. In fact, this answer is so obvious it's surprising the question wasn't closed.
Answer: Snape make a bad break in this conversation. He calls Lily by the surname, says "Lily Potter." In my opinion, this is not an accident, something that Severus began to perceive her not as Lily Evans, but as Lily Potter, says that he accept her along with her husband and child.
But here we are resting on one problem - Snape didn't  know that James was animagus, which means that he might not have associated Lily's patronus with him.
By the way, do students teach the Patronus spell? Harry demonstrates Patronus to OWL, this is "aerobatics", he should not know this idea at that time. But probably,  they learn later? It is possible that Snape saw James's and Lily's patronus, when they were taught, in the seventh year is permissible.
Or maybe they weren't studied at school at all, and, say, Snape taught Lily to call the patronus. Finally she was so interested Dementors ...
Comment: I don't see how this answers the question... and in any case, do you have canon proof of any of these claims, such as that Snape didn't know James was an Animagus?
Comment: Snape definitely has known that James was an Animagus, since James saved Snape from Lupin in his Werewolf form.


Is there a reason to downvote questions if they garner enough flags to be on hold?

Question: Is there a particular reason why one would downvote a question before/after it becomes [on hold]? Is it purely to tell the question's author "hey, you need to put some more effort into your questions."? Often times I find myself just flagging a question rather than downvoting it, unless its a really bad question such as "Can you do my homework for me?"
Comment: Downvotes aren't there for the author (primarily).  They're there for everyone else, to know that that's a question that isn't worth their time, and for the system to know that the user asked a bad question.  If a question is bad enough for you to want to close it, it's almost certainly not actually a useful question, meaning it merits a downvote.  Exceptions to that should be quite rare.
Comment: @JK.:  Because a question may be a duplicate but not a bad question.  It's important to disambiguate downvotes from close votes in that context.
Comment: One reason is the roomba.  If the Q has a rouge up vote and is closed it will not get deleted.  If you cast a down vote then it will be eligible for deletion.
Comment: @Javia1492 No.  Duplicates are not rommba'd.
Comment: Another side effect of the downvote is that if pushes the OP closer to a question ban. If you think that his behaviour is so bad that he should be banned from asking new questions, then you should consider downvoting.
Comment: Yes. it could always be reopened, but the downvotes would remain. they're two different tools with two different purposes.
Comment: @NathanOliver Does this also apply to questions marked as duplicates that get downvoted?
Comment: Correcting @NathanOliver, duplicates are not deleted by the closedAbandoned rules, but they may qualify by the other two.
Comment: If the question isn't salvageable, it allows users to vote to delete after closure.
Comment: If a question is bad enough that it requires a close vote, then why would it not also deserve a downvote?
Answer: If a question isn't useful, regardless of what state it's in, it's eligible and subject to downvotes.  Depending on the content that may mean it will never recover - like "Do my homework for me"-type questions - but a vote can be undone if a question (or answer) is edited, and that edit is done outside of the ~5 minute grace period for edits.
They're not really for the author, but they are the person they hit directly; it tells the world that this question isn't useful, and the author gets that indirectly.
Answer:
Is there a particular reason why one would downvote a question before/after it becomes [on hold]?

Question closure is about topicality. Questions that are off-topic or do not contain adequate information to be answered (or they do contain adequate information but it is drowned out by massive amounts of irrelevant information) should be closed.
Question voting is about usefulness, clarity, and perceived research effort (among other things). If it does not show any research effort, is unclear or not useful then it should be downvoted regardless of the close/open status of the question.
It is possible (though uncommon) to find a question that is useful and shows research effort, but it just plain off-topic. In such cases it would not be appropriate (though acceptable, anyone can vote for any reason—or lack thereof—that they like) to downvote while it would be appropriate to close vote.
Similarly, it is possible to (and somewhat more common) to find a question that shows no research effort or is not useful, but is on-topic. In such cases it is appropriate to downvote, but not appropriate to close vote.
Comment: I don't get the downvote here.  This answer is exactly correct.  Downvoting and close voting are orthogonal.  They do intercept each other so doing both is a common action but it also means if you do one action
it does not mean you must do the other action
Comment: Wouldnt unclear be flagged "should be closed->unclear what you're asking" or does it have to be unclear and off-topic for that flag to apply?
Comment: @Javia You can close vote as unclear _and_ downvote as unclear, if it is in fact unclear. You can also downvote for any number of reasons not mentioned here.


XSS - arbitrary file in background-image css property

Question: Is it possible to make an XSS attack if you can inject an arbitrary file (any extension, like: .js, .html etc...) in background-image CSS property? If yes, how to do it?
Comment: @dandavis But CSS3 with HTML5 _is_ turing-complete.
Comment: Well, CSS is not scripting, so no.
Answer: No, that's not possible.
A value to background-image will be rendered as an image. Even an SVG with embedded script code would just be displayed as an image when loaded via background-image. So XSS isn't possible here (the same way an arbitrary value to  can never lead to XSS).
Even if you couldn't just change a background-image value but inject new CSS, you most likely wouldn't be able to get XSS. The techniques to inject script code via CSS expression(...) or url('javascript:...') don't work in modern browsers. In other words, even embedding an entire user-controlled CSS file can lead to severe side-channel leaks but not to plain XSS.
Comment: Just want to add, that there was question on SO [CSS injection: what's the worst that can happen?](https://stackoverflow.com/q/718611/387194), are those links and answer still relevant in 2019? They are from 2009.
Comment: @jcubic Good point! The answers over there are outdated and should be updated accordingly.
Comment: I agree that browsers *behave* this way and do not execute JavaScript in SVG in `` or CSS `background-image`. However, can anybody point to any specs that define this, or is this just a common sense to do from browser vendors? I'm also interested in CSS `filter: url("data:image/svg+xml,...")` which seems to behave the same way but there, too, I cannot find a spec that requires/promises this behavior.
Answer: In extreme cases, it might actually lead to issues, but not necessarily XSS, nor necessarily through the background-image style rule.
Extreme case number 1: Your browser vendor could have a vulnerability in the rendering engine for background-image which if exploited leads to code being executed. This is highly unlikely with modern browsers, but in theory it could be possible.
Extreme case number 2: the site could have nonstandard CSS modifications such as EQCSS that support eval('') or another way to execute Javascript. In this case, you effectively can inject Javascript into the page.
Extreme case number 3: if the site is designed in such a way that arbitrary CSS classes and accompanying rules can be added, it is possible to write clever rules that can leak data based on CSS attribute selectors. For example, screen reader attributes added by certain javascript frameworks containing part or all of certain page content could potentially be combined with images hosted on another site to leak data about the contents of the attributes.
Extreme case number 4: The ::before and ::after CSS rules support the "content" style rule that can be used to insert pretty much arbitrary strings before or after content. there is currently a draft (https://drafts.csswg.org/css-content/) which proposes to extend this content style rule beyond the before/after limitation.


Binomial coefficients in Geometric summation

Question: Guys please help me find the sum given below.
$$\sum_{k=j}^i\binom{i}{k}\binom{k}{j}\cdot 2^{k-j}$$
(NOTE):The two coefficients are multiplied by 2 power (k-j)
I am using the formula: $\binom{r}{m}\binom{m}{q}=\binom{r}{q}\binom{r-q}{m-q}$
But not able to reach something fruitful.
Thanks in advance.
Answer: If we set $N=i-j$,
$$\begin{eqnarray*}\sum_{k=j}^{i}\binom{i}{k}\binom{k}{j}2^{k-j}=\frac{i!}{j!}\sum_{k=j}^{i}\frac{2^{k-j}}{(i-k)!(k-j)!}&=&\frac{i!}{j!}\sum_{k=0}^{N}\frac{2^k}{(N-k)!k!}\\&=&\frac{i!}{j!N!}\sum_{k=0}^{N}\binom{N}{k}2^k\\&=&\color{red}{\binom{i}{j}3^{i-j}}.\end{eqnarray*}$$
Comment: Please explain your last move,rest awesome,thanks..
Comment: @JaspreetSingh : the last step is just the binomial theorem: $$\sum_{k=0}^{N}\binom{N}{k}x^k = (x+1)^k.$$
Answer: HINT: Start with a box of $i$ balls numbered from $1$ through $i$, so that they can be individually identified. There are $\binom{i}k$ ways to choose $k$ of them to move to a second box. There are then $\binom{k}j$ ways to choose $j$ of the balls in the second box to move to a third box. That leaves $k-j$ balls in the second box; there are $2^{k-j}$ ways to pick a subset of them to move to a fourth box. Thus, for each possible choice of $k$ there are
$$\binom{i}k\binom{k}j2^{k-j}$$
possible different outcomes. Clearly this is possible if and only if $j\le k\le i$. If you sum over all of these possible values of $k$, you count the ways to distribute $i$ white balls amongst four boxes in such a way that the third box has exactly $j$ balls in it.

Can you find a closed expression in terms of $i$ and $j$ for the number of ways to distribute $i$ white balls amongst four boxes in such a way that the third box has exactly $j$ balls in it?
Comment: can the other three boxes be empty in any of the case?
Comment: @Jaspreet: Yes: in the first step $k$ might be $i$, in which case the first box ends up empty. And whatever $k$ is, after the $j$ balls are moved to the third box, we can move *any* subset of the balls remaining in the second box to the fourth, so the $k-j$ balls can end up distributed in any way between the second and fourth boxes.
Comment: considering what u said then answer would be $$\binom{i-j-1}{2}\$$
Comment: @Jaspreet: No, that binomial coefficient doesn't really have anything to do with the problem. There are exactly $i-j$ balls in the other three boxes, and they can be distributed amongst those three boxes in any way at all.
Answer: Suppose we are trying to evaluate
$$\sum_{k=j}^n {n\choose k} {k\choose j} 2^{k-j}.$$
which is
$$2^{-j} \sum_{k=j}^n {n\choose k} {k\choose j} 2^{k}.$$
Introduce
$${k\choose j} =
\frac{1}{2\pi i}
\int_{|z|=\epsilon}
\frac{(1+z)^{k}}{z^{j+1}} \; dz$$
which has the property that it is zero when $k\lt j,$ so we may extend
$k$ back to zero to get
$$\frac{1}{2\pi i}
\int_{|z|=\epsilon}
\frac{1}{z^{j+1}}
\sum_{k=0}^n {n\choose k} 2^k (1+z)^k
\; dz
\\ = \frac{1}{2\pi i}
\int_{|z|=\epsilon}
\frac{1}{z^{j+1}}
\left(1+2(1+z)\right)^n
\; dz
\\ = \frac{1}{2\pi i}
\int_{|z|=\epsilon}
\frac{1}{z^{j+1}}
\left(2z+3\right)^n
\; dz.$$
Extracting the coefficient we get
$${n\choose j} 2^j 3^{n-j}$$
for a final answer of
$${n\choose j} 3^{n-j}.$$
I hope you'll permit me to include this MSE link where the above method is used in a more sophisticated manner.
Answer: If you use the formula you noted you are changing two variable binomials by just one variable and the other is constant:
$$\sum_{k=j}^i\binom{i}{k}\binom{k}{j}\cdot 2^{k-j}=\sum_{j\le k\le i}\binom{i}{j}\binom{i-j}{k-j}2^{k-j}=\binom{i}{j}\sum_{0\le k-j\le i-j}\binom{i-j}{k-j}2^{k-j}$$
So you can see now a sum from zero to the upper parameter of the binomial coefficient multiplied by an exponent with the variable $k-j$, what is the definition of binomial expansion. Then
$$\sum_{j\le k \le i}\binom{i}{k}\binom{k}{j}\cdot 2^{k-j}=\binom{i}{j}(1+2)^{i-j}$$
These manipulations are valid for everything because $k$ and $j$ are entire numbers by definition of the binomial coefficient, and this is the unique condition where $\binom{i}{k}\binom{k}{j}=\binom{i}{j}\binom{i-j}{k-j}$ holds.
Comment: Its there in Concrete Maths by Knuth
Answer: Well you were totally in right direction
$\binom{i}{j}\cdot \sum_{k=j}^{k=i}$$\binom{i-j}{k-j}\cdot 2^{k-j}$ can be written as
$\binom{i}{j} \cdot \sum_{e=0}^{e=i-j}$$\binom{i-j}{e} \cdot 2^e$ .Apply binomial theorem to get the answer $\binom ij \cdot (1+2)^{i-j}$


How can the universe be expanding?

Question: I assume expansion implies an increase in the volume of the universe. But if the volume of the universe is increasing, does that not imply the area it is expanding into's volume is being reduced?
Answer: In 1929, Hubble published his discovery that the sizes of galaxy redshifts and proportional to galaxy distances. That is, nearby galaxies are less redshifted than further away galaxies. This implies that further away galaxies are travelling away from us faster than nearby galaxies, which implies that we live in an expanding universe. We do not expand into anything, but rather, space is stretching. The Earth is not expanding, nor are you, me, or any other matter in the universe. It is space itself that is stretching.

How can the universe be expanding?


Differential equations systems

Question: We have that system of differential equations: $$
\left\{
\begin{array}{ll}
x'=-x \\
y'=-2y \\
\end{array}
\right.
$$
I have to solve that system but I only know the method of derive first equation and substitute in the second and get a second order differential equation which I know to solve. But it seems that that method doesn't work here. How can I solve it? I'm beginner at this kind of exercises.
Thanks!
Comment: Actually the method you are using is more complicated than what you need here! Can you think of any function whose derivative would be minus itself? ($f' = -f$)
Answer: These are two unrelated DE's and you have to solve them independently. The answer is $x(t)=ce^{-t}$ and $y=de^{-2t}$ where $c$ and $d$ are constants.
Answer: This system is just a collection of 2 uncoupled ODEs, and so can be solved separately, just as we would a simple 1st order ODE.

Differential equations systems


How can I generate a Visual Studio 2008 solution manually?

Question: For a project I am doing I need to manually create a .net project. I am currently using a StreamWriter to create the .sln, .csproj and base (empty for now) class. I am also generating the AssemblyInfo.cs class. I have copied exactly the files and folder structure VS.Net creates when you create an empty windows class library project.
For some reason when I try to open the .sln file nothing at all happens. I can open the .csproj file fine, but the project will not compile. I don't get any error messages, just nothing happens. I have checked all of the files I am creating against the ones created by Visual Studio using Beyond Compare and they are exactly the same except for the project name and GUID.
Does anyone know if Visual Studio is doing something behind the scenes when it creates a project? Is there something else I could be missing?
Answer: I would check the text encoding of your files.  I believe .csproj files are encoded as UTF-8, but I could be wrong.
Answer: Dave Markle had the correct answer.
I was using the following code to create my file:
StreamWriter sw = File.CreateText(FileName);

This created the file correctly but did not set the encoding correctly. I changed it to this:
FileStream fs = File.Create(FileName);
StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);

and it works great.


On the integrals $\int_{-1}^0 \sqrt[2n+1]{x-\sqrt[2n+1]x} \mathrm dx$

Question: Playing with integrals of type,
$$
I(n)=\int_{-1}^0 \sqrt[2n+1]{x-\sqrt[2n+1]x} \mathrm dx,
$$
$$
n \in \mathbb{N}
$$
I got two interesting results for the limiting cases $n=1$ and $n \to \infty$:
$$
\lim_{n \to \infty} I(n) = 1
$$
The second result is perhaps more interesting,
$$
I(1)=\int_{-1}^0 \sqrt[3]{x-\sqrt[3]x} \mathrm dx \approx \frac {\pi}{\sqrt {27}}
$$
The approximation is valid to $12$ places of decimal.
My question is straight, can we prove these results analytically? Any help would be appreciated.
Comment: You should avoid the ambiguity due to complex roots in using the next integral : $$\int_0^1 \sqrt[2n+1]{x+\sqrt[2n+1]x} \mathrm dx.$$
Answer: For $n \in \mathbb{N}$ we have
\begin{align}
I (n) &= \int \limits_{-1}^0 \left[x - x^{\frac{1}{2n+1}}\right]^{\frac{1}{2n+1}} \mathrm{d} x \stackrel{x = -y}{=} \int \limits_0^1 \left[y^{\frac{1}{2n+1}} - y\right]^{\frac{1}{2n+1}} \mathrm{d} y = \int \limits_0^1 y^{\frac{1}{(2n+1)^2}}\left[1 - y^{\frac{2n}{2n+1}}\right]^{\frac{1}{2n+1}} \mathrm{d} y \\
&\hspace{-10pt}\stackrel{y = t^{\frac{2n+1}{2n}}}{=} \frac{2n+1}{2n} \int \limits_0^1 t^{\frac{n+1}{n (2n+1)}} (1-t)^{\frac{1}{2n+1}} \mathrm{d}t = \frac{2n+1}{2n} \operatorname{B}\left(\frac{n+1}{n(2n+1)}+1,\frac{1}{2n+1} + 1\right) \, .
\end{align}
Using $\Gamma(x+1) = x \Gamma(x)$ we can rewrite this result to find
$$ I (n) = \frac{\operatorname{B} \left(\frac{1}{n} - \frac{1}{2n+1}, \frac{1}{2n+1}\right)}{2 (2n+1)} = \frac{1}{2(2n+1)} \frac{\operatorname{\Gamma}\left(\frac{1}{n} - \frac{1}{2n+1}\right) \operatorname{\Gamma}\left(\frac{1}{2n+1}\right)}{\operatorname{\Gamma}\left(\frac{1}{n}\right)}$$
for $n \in \mathbb{N}$. In particular,
$$ I(1) = \frac{\operatorname{\Gamma}\left(\frac{2}{3}\right) \operatorname{\Gamma}\left(\frac{1}{3}\right)}{6} = \frac{\pi}{6 \sin \left(\frac{\pi}{3}\right)} = \frac{\pi}{3 \sqrt{3}} \,.$$
Moreover, we obtain
$$ \lim_{n \to \infty} I (n) \stackrel{\Gamma(x) \,  \stackrel{x \to 0}{\sim} \, \frac{1}{x}}{=} \lim_{n \to \infty} \frac{1}{2(2n+1)} \frac{\frac{n(2n+1)}{n+1} (2n+1)}{n} = \lim_{n \to \infty} \frac{2n+1}{2(n+1)} = 1 \, .$$
Comment: @JJacquelin I have added an intermediate step to illustrate what I have done here. The only assumption is that $x^{1/(2n+1)} = - (-x)^{1/(2n+1)}$ holds for $x < 0$, which (as confirmed by the results) seems to agree with the OP's definition of odd roots of negative numbers.
Comment: I think that your calculus is not correct. At first line you supposed $x^{\frac{2n}{2n+1}}= (-x)^{\frac{2n}{2n+1}}=y^{\frac{2n}{2n+1}}$ which is false. It is true that $((-x)^{2})^{\frac{n}{2n+1}}=y^{\frac{2n}{2n+1}}$ but $ x^{\frac{2n}{2n+1}}\neq ((-x)^{2})^{\frac{n}{2n+1}}$. The first is complex. The second is real.
Comment: Interesting because I get another solution but I can not reply the second result
Comment: @ComplexYetTrivial. I agree that the key point is the definition of odd roots of negative numbers. $\sqrt[3]{-1}$ has three roots, $−1$ and two complex. I would agree with the OP results if the integral was $$\int_0^1\sqrt[2n+1]{x+\sqrt[2n+1]{x} }dx $$
Comment: @JJacquelin, I am truly sorry if it is sarcastic, but I think at this point Wolfram Alpha has got a bug, for the integrand is indeed defined for all real $x$, whether positive or negative . In fact you can manually plot it on both sides of the y-axis and find that there is indeed a positive area bound by the curve and the y-axis between -1 and. 0.
Answer: Too long for a comment.
After ComplexYetTrivial's answer, we have
$$I_n=\frac{\Gamma \left(\frac{2 (n+1)}{2 n+1}\right) \Gamma \left(\frac{n+1}{n(2
   n+1)}\right)}{2 \Gamma \left(\frac{1}{n}\right)}$$ Expanding as series
$$I_n=1-\frac{1}{2 n}+\frac{12-\pi ^2}{24 n^2}+O\left(\frac{1}{n^3}\right)$$ which is not "too bad" even for $n=1$; this would give $1-\frac{\pi ^2}{24}\approx 0.588766$ while $\frac{\pi}{3 \sqrt{3}}\approx 0.604600$.
For a few values of $n$
$$\left(
\begin{array}{ccc}
n & \text{approximation} & \text{exact} \\
 1 & 0.588766 & 0.604600 \\
 2 & 0.772192 & 0.774848 \\
 3 & 0.843196 & 0.843965 \\
 4 & 0.880548 & 0.880851 \\
 5 & 0.903551 & 0.903695 \\
 6 & 0.919132 & 0.919210 \\
 7 & 0.930383 & 0.930429 \\
 8 & 0.938887 & 0.938916 \\
 9 & 0.945540 & 0.945560
\end{array}
\right)$$
Comment: well I didn't think that the 2nd degree Taylor approximation would be so accurate, +1.
Comment: @AweKumarJha. Me neither, be sure ! In fact, we can easily go further. Cheers :-)
Comment: @AweKumarJha. Still better if we use $$I_n=1-\frac{1}{2 n}+\frac{12-\pi ^2}{24 n^2}+\frac{12 (\zeta (3)-2)+\pi ^2}{48 n^3}+O\left(\frac{1}{n^4}\right)$$ The numbers would become $$\{0.594897,0.772958,0.843423,0.880644,0.903600,0.919161,0.930401,0.938899,0.945549\}$$
Answer: I found the solution of your interesting integral by try:
$$\int_{-1}^0 \left(x-x^{\frac{1}{2 n+1}}\right)^{\frac{1}{2 n+1}} \,dx  = \frac{(-1)^{\frac{2 n}{1+2 n}} \left(-1+(-1)^{1+\frac{1}{1+2 n}}\right)^{1+\frac{1}{1+2 n}} (1+2 n)^2 \text{Hypergeometric2F1}\left[1,2+\frac{1}{n},2+\frac{1}{n}-\frac{1}{1+2n},(-1)^{\frac{2 n}{1+2 n}}\right]}{2 (1+2 n (1+n))}$$
I checked the result for several values, but since I can't get your second result, the numerical solution is complex, I guess you did a mistake in your post! Please check your second result!
Answer: I am afraid that your calculus is not correct. Unfortunately the calculus for $I(1)$ is not detailed. One cannot say where exactly is the mistake.
I guess that the trouble comes from a transformation such as $x^{\frac{2n}{2n+1}}= ((-x)^{2})^{\frac{n}{2n+1}}$ which is false.  $$ x^{\frac{2n}{2n+1}}\neq ((-x)^{2})^{\frac{n}{2n+1}}$$ for $-1<x<0$ the first term is complex. The second is real.
The integral is not real $\simeq \frac{\pi}{\sqrt{27}}$.
$$I(1)=\int_{-1}^0 \sqrt[3]{x-\sqrt[3]x} \mathrm dx \simeq 0.68575-0.242772\,i$$
Comment: Yes your right, see my post below, I recognize the same


What should I do when the Lightroom 3 spot removal brush gets stuck?

Question: Has anyone come across the healing/spot clone brush 'sticking' in Lightroom 3 getting stuck? It happens fairly frequently for me and I've never found a way to solve it, occasionally if I close it and reopen it'll work but sometimes I'll just have to give up for half an hour and then it'll work.
Answer: To my 'humble' experience, in LR3 as well as in LR4, the healing/spot brush slows down, and even stuck, when this is applied after sharpening is done. Now, sharpening is the last action I do in LR and things are slowing down far less.
Emptying the cashes and restarting the computer several times while working can help,
but LR will always be devouring RAM...
Comment: Well this is the thing, it's the only action I was applying (so history was 'imported into lightroom' then spot heal) so the files weren't bogging down like they could have been after a few hours. I'll try killing the cache again though, but it's only a small library (close them off after 3 months). Weird bug!
Answer: I've definitely experienced fairly major slow-downs.  I think it's just very processor-intensive.  The problem is that LR doesn't do anything to tell us that it's working and will be back soon.
I just leave the computer until it sorts itself out.  It always does in the end.


HELP SharePoint 2016 farm is completely down

Question: I am currently experiencing an unknown error. every single site i visit says sorry something went wrong. when i look up the correlation code I am unable to find it in my URL log.
Answer: Without much details I cannot say what went wrong. You can try below:

Check the DNS and Load Balancer configuration
Check if the SharePoint Timer Service is started
Verify that the SharePoint Servers are able to connect to the database
Check free space on the drive.
Answer: Have you checked the event-log on the server?
Service account password changed?
Use PowerShell to get the most relevant events.
Merge-SPLogFile -Path "C:\tmp\FarmMergedLog.log" -Level High
Answer: Did you refer to your ULS logs? The default location for SharePoint 2016 ULS logs is %ProgramFiles%\Common Files\Microsoft Shared\Web Server Extensions\16\Logs. You can use ULS Log Viewer to analyze SharePoint errors like filtering by correlation ID. Reference: How to Use ULS Log Viewer to Analyze SharePoint Errors?
Could you find any clues in your ULS logs? It's hard to troubleshoot such issue without any details.


Communication of allah to us through signs

Question: Will Allah communicate to us through universal signs? Like wind. For ex : when I pray, a strong wind hit me. So is that an yes from allah Or something or wind is wind or is it shirk?
Answer: God is able to send a sign

Only those who listen will respond. As for the dead, God will
resurrect them; then to Him they will be returned. And they say, "If
only a sign could come down to him from his Lord." Say, "God is Able
to send down a sign, but most of them do not know."

Signs of Him given to the Jews and to the disbelievers are manyfoldly cited in the Quran. Mostly, the story ends in that the disbelievers did not believe in spite of the signs, and the signs were vain; two examples out of many:
46:21-25

And mention the brother of Aad, as he warned his people at the dunes.
Warnings have passed away before him, and after him: "Worship none but
God; I fear for you the punishment of a tremendous Day." They said,
"Did you come to us to divert us from our gods? Then bring us what you
threaten us with, if you are being truthful." He said, "The knowledge
is only with God, and I inform you of what I was sent with; but I see
you are an ignorant people." Then, when they saw a cloud approaching
their valley, they said, "This is a cloud that will bring us rain."
"In fact, it is what you were impatient for: a wind in which is
grievous suffering." It will destroy everything by the command of its
Lord. And when the morning came upon them, there was nothing to be
seen except their dwellings. Thus We requite the guilty people.

Another passage
30:50-53

So observe the effects of God's mercy—how He revives the earth after
it was dead. Indeed, He is the Reviver of the dead. He is Capable of
everything. But if We send a wind, and they see it turning things
yellow, they would continue thereafter to disbelieve. You cannot make
the dead hear, nor can you make the deaf hear the call when they turn
away. Nor can you guide the blind out of their error. You can make
hear only those who believe in Our signs, and so have submitted.

Allah speaks of signs through wind; He states that it would not make the disbelievers believe, and continues:

You can make hear only those who believe in Our signs, and so have
submitted.

But it is the wind the sign? He speaks of «hearing» the signs. It is rather His Word which is the sign.
Allah communicated to His messengers and prophets through their mind; i.e. the Word that was not spoken out acoustically.
We, too, may receive answers of Him in our mind. However, it is not easy to discern this from any other thought that comes into our minds. We have to know the Word of God (from the Quran) to know whether it can be His answer.
I would not believe in external signs like wind as His answer. If you have a question, would God change the winds to answer you? What a trouble would this create in our weather if any question of an individual would change the winds! Even if we suppose that it would be possible to Allah to do so, He is likely not to do it.


Use queries in a kanban board's columns instead of status

Question: Is there a way in Jira (using an app or not) to categorize my columns based on queries? The swimlanes already support that, but the columns seem to be tied to status. Can I have a matrix that's based on queries in both dimensions?
Comment: Columns are status-based, as the status indicates, well... the status. The whole Kanban theory is based on visualisation of flow across statuses. You may be trying to solve the wrong problem (maybe gathering different projects with different statuses on a consolidated view?). Explain why you want to use formulas on columns and you might have better, more insightful answers.
Answer: If you use JIRA Cloud, you can categorize the cards based on colors.
Go to your Kanban board and click on the board settings.
You should see a option for Card colors.
It will let you assign colors to your card based on Queries.


Why the word "ride" is used in this sentence?

Question: "Ride a bike", for every vehicle the word 'drive' is used.For example drive car, drive a bus etc.But for a particular vehicle 'bike' why is the word drive not used,and instead of drive the word ride is used in sentences.
Comment: When you in a car, but not the driver, you are riding.
Comment: It's somewhat idiomatic. There is no *logical* explanation why we don't say *drive a bike*. (At least not that I'm aware of.)
Comment: See [this answer](https://english.stackexchange.com/a/72399/191178) on ELU for a good explanation.
Answer: "Drive" seems to be idiomatic for most motorized vehicles, while ride is idiomatic for unpowered or self-powered vehicles.  As you say, you "drive" a car, bus, train, boat, motorcycle, scooter, truck, tractor, carriage, taxi, limousine, or hearse ... but you "ride" a bicycle, tricycle, unicycle, skateboard,  toboggan, or surfboard.
You also ride a horse, camel, elephant, donkey, pony, mule, yak, ox, reindeer, ostrich, or any other animal that can be ridden.
There is at least one exception:  Because a hoverboard is so much like a skateboard, most people seem to prefer "ride" for this, even though it has an electric motor.  In the same way small electric scooters are "ridden" -- unless you sit down on them, in which case either "ride" or "drive" might be fine.
Answer: There's not a technical reason why this is incorrect (you would be understood), but anything that is not powered by a motor (bicycle, scooter, horse, etc.) is ridden.
Comment: The other day, I was *riding* a motorbike.


Problem with links

Question: I have a few links on my home page witch shows on tabs. Links looks like /a10/o(example). When i deploy my app from na24 to na34 when i click on that links show me message not enough privileges. When i look on same tab like in na24,they have different ids. In Na24 is a10/o in Na34 is a1k/o,what to do? i get this message.
Answer: These initial three chars are object name of any custom object in your org. that is why they are different from one org to another. In your case you between NA24 and NA34.
You need to check profile permission for this object. You should have read permission on this object.
Go to Setup-> Users-> Profile -> Object Name
Comment: I do all permisons before,still same...
Comment: as you are checking that object in NA34 you need to update your link with new created object chars that is a1k/o
Comment: I cant change it cause its managed... Anyone else?
Comment: You need to query for the object/record id and NOT hard code the id. You should really almost never hard code an id into code. This makes it org specific as ids can and will change from org to org.

To get only the object id query for a record of that type and substring the first three chars to build your url.
Answer: As suggested by other members, ids are org-specific - you should rely on something more robust for your logic, otherwise it can also get way too complex to maintain.
Also a reminder that read permissions for the given object can be given through various approaches:

Org-wide defaults;
Profiles;
Permission sets.

Problem with links


Ender 5: Bowden tube shifts in/out of extruder during retractions

Question: I have an Ender 5 with an aluminum extruder that was printing beautifully for a few days after building it. I received a Capricorn bowden tube and new couplings as a gift, and replaced those, and now I have stringing issues I can't solve.
I've been all over the map with settings (temps, speeds, z-hop, retraction, etc. etc.), I've swapped the tubes, the couplings, the filament, I've checked for clogs, and put clamps on the collars, but no matter what I do, the tube shifts in and out during retractions by about .25 - .5 mm. I suspect that has something to do with the stringing, as nothing else has solved it.
Any suggestions are appreciated. I haven't made adjustments to the extruder, but I don't know if that's possible or necessary. I've never had a system using the bowden, so that part of 3d printing is new to me. I'm using 3d Solutech PLA.
Comment: Is it just the pressure fitting on the brass coupler that shifts in/out? That's not a problem unless it causes the PTFE tube to come out entirely, and you can use the blue clips that should have come with the printer to stop it if it is a problem. If switching the bowden tube has caused stringing, it's likely something else about the new tube setup that's' the problem. Can you show some pics of it? Is the length the same as the old bowden tube?
Comment: Unfortunately, it's the tube itself that slips back and forth. I have used the blue clips and also small zip ties. It feels like the teeth in the coupler catches well, but the retraction is..."overpowering" it? I swapped the old tube back in and get the same issue (same length, etc.) It's just the basic white PTFE one versus the blue Capricorn.
Comment: If the tube slips in the coupler by .25-.5 mm, that's fine as long as it doesn't actually fall out. Effectively, you just lose that much length from your retractions, since part of the retraction goes into pulling the tube back into the coupler. When the retraction is reversed, the effective filament position should go back to what it was before the retraction.
Comment: OK, good. It's a really small amount. Just wanted to rule it out as causing anything else that crops up. If you want to post this as the answer, I'll accept.
Comment: If you're happy with the scope of the question being "is this shift in/out the source of my problems", I'm happy to post "probably not" with the above explanation as an answer. You may need a new question to identify the source of your problem then.
Comment: Yep, I totally agree. I had been concerned about the tube shift anyway, but I don't think it's contributing to the stringing.
Answer: If it's just the pressure fitting on the brass coupler that shifts in/out, or the PTFE tube shifting slightly in/out but remaining in the coupler, that shouldn't be a problem unless it's so loose it can come out entirely. The blue clips which should have come with the printer are intended to stop this motion or at least provide enough pressure to prevent it from falling all the way out.
Regarding the small 0.25 - 0.5 mm of play, effectively it just means you lose that much length from your retractions, since part of the retraction goes into pulling the tube back into the coupler. When the retraction is reversed, the effective filament position should go back to what it was before the retraction. As long as your retraction amount is sufficient after the loss, it should not cause stringing.
You probably need to look for another cause of your stringing.
Comment: I don't think a zip-tie is what you want, but you can just print the clip. https://www.thingiverse.com/thing:2994683 matches the factory design.
Comment: I didn't get any blue clips with my Ender 5, and the little grey thing moves on mine. Will a zippy-tie work?
Comment: Ah yes, of course I can now!


How to solve a case of unbalanced repeated measures?

Question: I have animals, that could be virgin or mated (reproductive state is the fixed factor), which I've stimulated sequentially with 4 different doses of an odour (doses are the repeated measures, the same animal was blown with 4 increasing doses of the same odorant). Then, I measure the neuronal response (variable: number of spikes) of each animal to each dose of the odorant.  This might be a typical case or repeated measures, however I have some missing values for the doses, I have not all the doses completed for some animals. For example, for animal 1, I missed recording 1 out of the 4 doses.
what can I do? I have two statistical packages: SPSS 16 or Statistical.
thanks for your help!
Comment: How many participants (i.e., animals) do you have? If the ratio of animals to missing data is too big, this is not that good. In all cases (e.g., after using mixed effect modeling as proposed by Mike Lawrence) you should compare the results of the data with listwise deleted cases (i.e., all animals with missing data omitted) with the modeled results...
Answer: Repeated Measures
Personally I would pursue a hierarchical model where the basic observations are, for each animal, the 4 (or fewer) levels of odour and the corresponding neuronal responses.  And the predictor for the per animal intercept and slope on this relationship is the animal's reproductive status.  (Here I'm assuming that your interest is in the effect of reproductive status on these aspects of the response function and to what extent it is distinguishable from individual variation.)  That would give you nice interpretable animal level regression parameters, e.g. moving from virgin to mated animals drops the predicted firing rate by x and increases the effect of one unit increase in odour dose by z.
Failing that, a mixed model with reproductive fixed effect would probably also work.  Actually I think that's all SPSS 16 offers you anyway.
I wouldn't immediately worry about missing data in this framework.  Just try it and then check for robustness of the results, as Rob suggests. The more basic problem is knowing what SPSS is telling you when you fit one of these models.  For that, you'll want to read up a bit first.  Other folk here may have preferred introductions to mixed models - mine are all R-oriented and therefore not so helpful.
Spikes
If you are working with spike counts they are probably conditionally Poisson distributed (and don't forget the offset, if the exposure during measurement varies).  If you don't have the option to specify that fact you might need to fit the model in appropriately adjusted log counts or suchlike.
Missing Data
If you have enough animals missing a few measurements for some of them might be ok.  For a lot of missing, there won't be much information as Rob also points out.
If you (or your audience) worry about the missing data, you could do multiple imputation first.  If I remember right, and I don't really use SPSS for anything, 16 makes you use AMOS for multiple imputation, but later version have it built into the missing value module.  So that might be an option.
Answer: Mixed effects analysis (available in R via the lme4 package, free as always) can handle missing data like this. My understanding is (possibly erroneous? Mixed effects modelling experts please feel free to provide correction) of how this is achieved is as follows:
Given a set of predictor variables that are combined in some way to form a matrix that I usually call the "predictor design" (for example, for a completely crossed design of 3 variables with 2 levels each, the predictor design is a 2x2x2 matrix in which you expect to have each cell filled with an observed response), and given a set of "units of observation" (ex. individual human participants in an experiment), missing data can occur if the experiment fails to obtain an observation for a given unit in a given cell of the predictor design.
If the missing data occurs in a cell of the design that involves a continuous predictor variable over which the model would typically attempt to fit a slope, the model simply goes ahead and fits the slope across those cells without missing data. I think that the model also takes into account the fact that there is missing data in determining the degree of influence that given unit's data has on inference relating to that slope; that is, slopes from units with lots of missing data will by definition be based on fewer observations and thereby are expected to be less reliable estimates, a circumstance that the model takes into account when combining that estimate with those from other units with possibly more reliable estimates.
If the slope cannot be computed (ex. one or fewer cells have data), or if the missing data occurs in a cell of the design that involves a categorical predictor variable, then that given unit will not influence inference of that particular slope/effect, but remains in the model for influence of slopes/effects for which the unit does have sufficient data. (Hm, now that I think of it, I'm not sure how this works in the context of missing data for cells that constitute the intercept level of contrasts when treatment contrasts are used...)
Note, however, that if you are missing information about the predictor variables (eg, you have a response, but you're unsure where in the predictor design it should fall), the model will not attempt to impute this information and will instead simply ignore that value.
Comment: While I don't doubt the veracity of your claims, it may be more useful to the OP and to the community in general if you describe how the lme4 package handles missing values.
Comment: ...if by "handle" you mean ignore/remove all observations with missing values for any of the covariates or responses.
Comment: Thanks for answers. Sorry, but I'm not an expert neither a statistician,  I don't handle R. I've just two statistical softwares, SPSS 16 or STATISTICA 7.0 from StatSoft and I'm quite lost! I've tried mixed models with SPSS with fixed effect for reproductive status and dose as the repeated effect. however I'm quite confuse, I'dont know how interprete the results.
Comment: @Rom, if you do not know how to interpret results, try formulating it as a new question.
Comment: @AndyW & fabians: I've updated the post to reflect my understanding of how mixed effects models handle missing data, please feel free to let me know if my understanding is erroneous in any way!


I wanted to install debian 10, but before that i would like to get a live session

Question: I downloaded a debian-live. Unfortunately when I boot from the installation media I don't find any option to try it. All I see is options to install and graphical install. My ubuntu just works fine with settings UEFI and secure boot on.
Comment: You either just don't see it, or you're using something else. Live install is of course available in Debian https://www.debian.org/CD/live/
Comment: Have you tried boot it with Legacy Boot option instead of UEFI?
Comment: Thanks for coming back and providing an answer!  If you like, you can also mark the question as resolved by clicking the grey tick on the left of your own answer.  The tick will turn green.  This will also be noticable in the list of questions / when your question appears in search.  We will (I expect) additionally mark this question closed.  The question as written requires further information that it does not contain. So we don't need to allow other people posting alternative answers to what you already posted.
Answer: Problem solved..! actually its the startup disk creator which is failing to select desired source disc image, it kept on selecting the previous one debian net install image which I've tried earlier and that's not changing when I'm trying to change different disc image, so I've created bootable USB with Disks app. Its working now gng to try and install Debian
Comment: To clarify your answer - you are using the Startup Disk Creator provided by Ubuntu, right? If I remember correctly, this app has to recognize the disk image in some way. For example, I think it also refuses to accept Fedora Linux disk images.
Comment: yeah, the same thing happened with me.
Answer: I found the page hard to navigate: if I click what seems like the correct thing it takes me to a page of torrent files for the non-live installer.
Check the file-name.
The correct ones are in https://cdimage.debian.org/debian-cd/current-live/amd64/bt-hybrid/ (You may need to change the architecture: You did not say)


How to make the the voltage higher after a logic gate

Question: In my circuit a have a 2 switches that connects to a logical gate and the output of gate will go to a relay but after the logic gate the voltage got lower to mili voltage and not enough voltage for the relay to work, they say that I must use capacitor but it only last for a second and I want my relay to work in indefinitely by the result of the two switches of the logic gate.
Anyone have an idea or hint to solve my problem?
here's a picture of my circuit design
Comment: Is that really your circuit? It's lacking pull-downs at the gate inputs, there are no current-limiting resistor for the LED, there should be a flyback diode to protect the logic gate from the relay coil switching spikes, relay is anyway unnecessary to light a simple LED from a logic gate output, ... What do you want to do, *actually*?
Comment: sorry to provide less information, the picture is just the vague idea of my circuit and I'm a beginner for circuit designing, so my problem is the input of the logical gate is 9V and the output is just 818.18mV and not enough for the relay to switch or tick to the other rail.
Comment: and is there a way to make the voltage of output of logical gate higher?
Comment: Strictly speaking, you don't need the relay at all.  The logic gate can drive the LED (through a resistor) itself.
Answer: Here's a few ways of doing the same thing.

Circuit 1 - is a simple AND gate made from two switches in series. The LED is driven directly with R1 to limit the LED current.
Circuit 2 - replace the LED/resistor with a relay coil. Note the reverse diode across the coil which prevents the back emf spike from damaging the switches when you turn OFF. The switch contacts of the relay now control the LED.
Circuit 3 - Now we've added the 2 input AND gate. Note R1 and R4 (47k) are PULL DOWN resistors to ensure the inputs stay at 0V when the switches are open. This resistor value is not critical and could vary from 1k0 to 1M0. The output of the gate is capable of supplying enough current to light an LED. Again the 1k0 resistor is there to limit the maximum LED current.
Circuit 4 - If we need more current output we can add a transistor, in this case a BJT but we could use an N channel MOSFET (not shown) if we needed to switch a much higher current e.g. a motor or a solenoid. The transistor is just used to switch the LED.
Circuit 5 - The transistor is being used to switch the relay coil. Note we keep the reverse connected diode. In this case it protects the transistor. R3 value has been lowered to allow for more current through the transistor taken by a relay coil.
Comment: 7 years on and OP long gone -  sadly. Anwers like this are very welcome.
Answer: 4081 logic gate, according to its datasheet, can maximally supply 10 mA current at its output. If you connect relay with low active resistance, voltage will significantly sink and current will increase up to chip burnout if applied for prolonged period of time.
I propose you to change circuit adding transistor able supplying required current between logic gate and relay.
Comment: so adding only a transistor between the relay and gate, do I have to add other components to the circuit?
Comment: Of course you should add some other components to ensure transistor works properly and can tolerate conditions. @dim gave you a set of excellent suggestions in comment to your question, you probably will need to redesign whole circuit to make it simple, properly functioning in *all* conditions and cost effective.
Answer: The 4081 is an AND gate so, just wire both switches in series (to get AND) with the LED and a current limiting resistor to get the functionality you require.
Answer: Uhm , does this circuit:

simulate this circuit – Schematic created using CircuitLab
not achieve the same thing as what you intended to achieve ?
So you don't need the AND gate
You don't need the relay.
You do want to add a 470 ohm resistor so you will not destroy your LED by applying 9V to it (LEDs generally do not like that).
If this is not what you wanted then specify more clearly what you wanted in the first place.
Comment: well it's just a vague idea for my circuit, I use and gate to my circuit because I have to different inputs and I just represent it using the switches.
Comment: And I have a sticky-note here with two wheels drawn on it, it represents the next car I'm going to buy. Now tell me what car I will buy. See, vague representations do not help much in guiding others to the direction you want them to go to.
Comment: you see in my question above is how to make the output voltage of a logic gate higher, let say that I'm asking what is the best car to buy and I want to replace my broken old car and someone say that it's better to repair my old car because it will cost you less?