How do I find the maximum value of $S(\tau) = (\tau^\eta − 2η\tau^{\eta−1} + \eta(\eta − 1)\tau^{\eta−2})e^{−\tau}$?

Question:
Given this function:
$$
S(\tau) = (\tau^\eta − 2η\tau^{\eta−1} + \eta(\eta − 1)\tau^{\eta−2})e^{−\tau}
$$
How can I find out what the maximum value of $S(\tau)$ is?

I need this value in order to get a normalized form of this wave shape. I could use root finding, but I'd prefer an analytical solution if possible.
PS: My math skills are weak, hopefully the question makes sense.
Comment: Find the derivative, solve $S'(\tau) = 0$ and check if any solution yields a maximum.
Comment: Where are you stuck when finding the derivative?
Comment: Thanks for the response @AlvinLepik, although I'm not sure how to find the derivative, nor how to solve it if I did. Are you suggesting using newtons method, or some other root finding method? I'd like to find an analytical approach if possible...
Answer: First we can begin the differentiation process by using the product rule:
$$\frac{d(uv)}{dx} = u\frac{dv}{dx}+v\frac{du}{dx}$$
where $u = \tau^\eta − 2η\tau^{\eta−1} + \eta(\eta − 1)\tau^{\eta−2}$, and $v = e^{−\tau}$
Completing the differentiation and simplifying gets us to:
$$S'(\tau) = -{\tau}^{{\eta}-3}\left({\tau}^3-3{\eta}{\tau}^2+\left(3{\eta}^2-3{\eta}\right){\tau}-{\eta}^3+3{\eta}^2-2{\eta}\right)\mathrm{e}^{-{\tau}}$$
This isn't necessarily difficult, but it's $\textbf{very}$ tedious. If you want to see a step by step solution you can put your equation into this website: https://www.derivative-calculator.net, and then click on step-by-step solutions.
We can then solve $S'(\tau) = 0$ using the above solution by splitting it into $3$ separate equations:
$$e^{-\tau} = 0, \quad \tau^{\eta - 3} = 0, \quad {\tau}^3-3{\eta}{\tau}^2+\left(3{\eta}^2-3{\eta}\right){\tau}-{\eta}^3+3{\eta}^2-2{\eta}$$
We can now observe that the first equation will have no solution and the second equation has a unique solution at $\tau = 0$, if $\eta \geq 3$.
The third equation will take a little more effort. First we can collect like terms in $\tau$, giving us:
$$\tau^3 - 3\eta\tau^2 + (3\eta^2-3\eta)\tau - (\eta^3 - 3\eta^2 + 2\eta) = 0$$
Which can be solved using techniques that you would use to solve other cubic polynomials. Alternatively, there is a trick that can be applied here: By substituting $x =\tau - \eta$ we can eliminate the quadratic term and simplify, reducing the equation to:
$$x^3-3x\eta-2\eta = 0$$
This is still not trivial to solve but a trick I found that seems to work here is explained well with an example here: https://amsi.org.au/ESA_Senior_Years/SeniorTopic2/2e/2e_3links_3.html
Plugging all of this into an online calculator spits out a pretty ugly answer (which, albeit, does seem to have a nice solution at $\eta = 1, \tau = 3$).
If you follow this line of reasoning you will eventually reach an analytical solution but its extremely tedious and the answer you end up with is not pleasant. I suspect this question is intended to be answered using approximation techniques or with software.
Comment: It's also worth noting that a 'correct' answer to this question would also have you determine the second derivative and substitute solutions (the unpleasant ones) into the second derivative to determine the nature of the critical values.


Selective CSS Aggregation for fast D7 development performance

Question: On D6, we had the this module. Depite the module's name, it has an hidden extra feature to optimizes all CSS files except for the module or theme being actively developed. This has the benefit of performance (since all files except the actively developed file are compressed) yet allows for quick development.
Which alternative exists for Drupal 7?
Comment: Of course it would be quite easy to upgrade the module and give it a more focused name, if somebody wants to take [this issue](http://drupal.org/node/1188540)
Answer: At this time, it appears this module is not needed for Drupal 7
this has been committed and fixed in D7 core.
refer to this:
IE: Stylesheets ignored after 31 link/style tags
==========
css aggregation of all stylesheets EXCEPT certain one. just add this to your theme's template file
<code>drupal_add_css(drupal_get_path('theme', 'mytheme') . '/css/custom.css', array(
'group' => CSS_DEFAULT,
'preprocess' => FALSE,
'every_page' => TRUE
));
</code>
Comment: No, you are missing the point. My question was about css aggregation of all stylesheets EXCEPT certain ones, not about IE compatibility. I have rephrased the question to make it more clear.
Comment: i have edited answer. check your solution.


Using SASL from CentOS 7 Host to Authenticate to Active Directory

Question: Trying to configure SASL on a CentOS 7 box to talk to an Active Directory installation. I've tried a couple different configurations that generate different errors. The latest:
No worthy mechs found
ldap_sasl_interactive_bind() failed -6 (Unknown authentication method).
Authentication failed for <user>: Retry condition (ldap server connection reset or broken) (-3)
do_auth         : auth failure: [user=<user>] [service=imap] [realm=] [mech=ldap] [reason=Unknown]

The contents of my saslauthd.conf:
ldap_servers: ldap://thinger.foo.bar.com:3299/
ldap_search_base: DC=foo,DC=bar,DC=com
ldap_filter: (&(cn=%u)(objectClass=user))
ldap_use_sasl: yes
ldap_auth_method: fastbind
ldap_mech: DIGEST-MD5

Starting to run low on ideas.
Comment: Why port 3299? That's not the usual port...
Comment: Yea, it's a bogus port. I try not to disclosing IPs, ports, names, etc. unless it's relevant to the question.
Comment: You should be careful with that. In this case it was a bad idea; it only led to needless confusion. The default LDAP port is hardly private information, for instance.
Comment: Appreciate your perspective.
Answer: I vaguely remember that DIGEST-MD5 requires a specific option to be enabled for the user in the MMC.
Honestly I see no value using SASL / DIGEST-MD5 today. Because to reach a sufficient security level you have to use TLS to also protect the DIGEST-MD5 authentication flow anyway.
Comment: Gotcha. I... installed the cyrus-sasl-ldap package. I changed the mech (in /etc/saslauthd.conf) to ldap. When I run testauthsasld, it gives me a new message about `ldapdb_canonuser_plug_init() failed in sasl_canonuser_add_plugin(): invalid parameter supplied` This was helpful. I've got a little more digging to do. Ty!


batch file/ bash scripts validator

Question: Is there any online batch file/ bash scripts validator? Let you drop the code in the textarea and check syntax errors? Or upload a file for validation.
Comment: I found [ShellCheck](https://www.shellcheck.net/). Although the question was closed as off-topic, and it's pretty old, an answer would be nice when others will come across this question.
Answer: I doubt it, since you can just do bash -n yourscript.sh
Searching, I couldn't find one either. Plenty of hits on using -n though...

batch file/ bash scripts validator


How to match multiple array elements without using unwind?

Question: I have a collection which contains documents with multiple arrays. These are generally quite large, but for purposes of explaining you can consider the following two documents:
{
    "obj1": [
        { "a": "a", "b": "b" },
        { "a": "a", "b": "c" },
        { "a": "a", "b": "b" }
    ],
    "obj2": [
        { "a": "a", "b": "b" },
        { "a": "a", "b": "c" }
    ]
},
{
    "obj1": [
        { "a": "c", "b": "b" }
    ],
    "obj2": [
        { "a": "c", "b": "c" }
    ]
}

The idea is to just get the matching elements in the array to the query. There are multiple matches required and within multiple arrays so this is not within the scope of what can be done with projection and the positional $ operator. The desired result would be like:
{
    "obj1": [
        { "a": "a", "b": "b" },
        { "a": "a", "b": "b" }
    ],
    "obj2": [
        { "a": "a", "b": "b" },
    ]
},

A traditional approach would be something like this:
db.objects.aggregate([
    { "$match": {
        "obj1": {
            "$elemMatch": { "a": "a", "b": "b" }
        },
        "obj2.b": "b"
    }},
    { "$unwind": "$obj1" },
    { "$match": {
        "obj1.a": "a",
        "obj1.b": "b"
    }},
    { "$unwind": "$obj2" },
    { "$match": { "obj2.b": "b" }},
    { "$group": {
        "_id": "$_id",
        "obj1": { "$addToSet": "$obj1" },
        "obj2": { "$addToSet": "$obj2" }
    }}
])

But the use of $unwind there for both arrays causes the overall set to use a lot of memory and slows things down. There are also possible problems there with $addToSet and splitting the $group stages for each array can make things even slower.
So I am looking for a process that is not so intensive but arrives at the same result.
Answer:
Since MongoDB 3.0 we have the $filter operator, which makes this really quite simple:
db.objects.aggregate([
    { "$match": {
        "obj1": {
            "$elemMatch": { "a": "a", "b": "b" }
        },
        "obj2.b": "b"
    }},
    { "$project": {
      "obj1": {
        "$filter": {
          "input": "$obj1",
          "as": "el",
          "cond": {
            "$and": [
              { "$eq": [ "$$el.a", "a" ] },
              { "$eq": [ "$$el.b", "b" ] }
            ]
          }
        }
      },
      "obj2": {
        "$filter": {
          "input": "$obj2",
          "as": "el",
          "cond": { "$eq": [ "$$el.b", "b" ] }
        }
      }
    }}
])

MongoDB 2.6 introduces the $map operator which can act on arrays in place without the need to $unwind. Combined with some other logical operators and additional set operators that have been added to the aggregation framework there is a solution to this problem and others.
db.objects.aggregate([
    { "$match": {
        "obj1": {
            "$elemMatch": { "a": "a", "b": "b" }
        },
        "obj2.b": "b"
    }},
    { "$project": {
        "obj1": {
            "$setDifference": [
                { "$map": {
                    "input": "$obj1",
                    "as": "el",
                    "in": {
                         "$cond": [
                           { "$and": [
                                { "$eq": [ "$$el.a", "a" ] },
                                { "$eq": [ "$$el.b", "b" ] }
                            ]},
                            "$$el",
                            false
                        ]
                    }
                }},
                [false]
            ]
        },
        "obj2": {
            "$setDifference": [
                { "$map": {
                    "input": "$obj2",
                    "as": "el",
                    "in": {
                        "$cond": [
                            { "$eq": [ "$$el.b", "b" ] },
                            "$$el",
                            false
                        ]
                    }
                }},
                [false]
            ]
        }
    }}
])

The core of this is in the $map operator which works like an and internalized $unwind by allowing processing of all the array elements, but also allows operations to act on those array elements in the same statement. Typically this would be done in several pipeline stages but here we can process within a single $project, $group or $redact stage.
In this case that inner processing utilizes the $cond operator which combines with a logical condition in order to return a different result for true or false. Here we act on usage of the $eq operator to test values of the fields contained within the current element in much the same way as a separate $match pipeline stage would be used. The $and condition is another logical operator which works on combining the results of multiple conditions on the element, much in the same way as the $elemMatch operator would work within a $match pipeline stage.
Finally, since our $cond operator was used to either return the value of the current element or false if the condition was not true we need to "filter" any false values from the array produced my the $map operation. The is where the $setDifference operator is used to compare the two input arrays and return the difference. So when compared to an array that only contains false for it's element, the result will be the elements that were returned from the $map without the false elements coming out of $cond when the conditions were not met.
The result filters only the matching elements from the array without having to run through seperate pipeline stages for $unwind, $match and $group.
Answer: return more then one match,
 const { timeSlots } = req.body;
    let ts = [];

    for (const slot of timeSlots) {
      ts.push({
        $eq: ['$$timeSlots.id',slot.id],
      });
    }
    const products = await Product.aggregate<ProductDoc>([
      {
        $match: {
          _id: req.params.productId,
          recordStatus: RecordStatus.Active,
        },
      },
      {
        $project: {
          timeSlots: {
            $filter: {
              input: '$timeSlots',
              as: 'timeSlots',
              cond: {
                $or: ts,
              },
            },
          },
          name: 1,
          mrp: 1,
        },
      },
    ]);


Android can I write layout xml file programmatically and load it with setContentView(R.layout.test_1) function?

Question: I want to write programmatically xml layout file to SD card or other storage and when the app load it will load the file as layout with setContentView function or any other way. is it possible?
Answer: No, this is not possible since the layout files are actually compiled XML files, means you cannot change, add or remove them at run time. Hope this helps.
Answer: The solution is doing a Custom XML Decoder that reads your XML from file, then create programatically the Views you need, and then setContentView(View).  The Decoder isn't trivial if you use many parameters in the XML.
Comment: Ya agree with this approach. And if you don't need to load a complex layout, consider simplify the XML schema so you don't have to write complex decoder.
Comment: Hi,if i will get the xml String decoded from WebSrevice,can it help me to skip the xml Decoder solution?what it mean "create programatically the Views you need" ? do you mean i need to parse the xml and build one by one elments and properties? or there is a way to create view programmaticlly and load the xml to it by simple command (like view.load(xml_doc or xml_string))?Thank you.
Comment: you need to create one by one all the views parsing the properties. You cannot create a view from a string that represents the XML remote file.

you need a Reference in R file to create a View (inflating) or create it manually, programming
Answer: You can try to use method inflate(XmlPullParser parser....) of LayoutInflater.
But resources will be loaded from resources of a context.


How do I link to another action in Magento whilst passing a parameter to the new page (controller) as a POST link and not a query string?

Question: I need to pass a parameter to a new page (without query strings), because I would like to redirect back to the module and query string of the current page.
So I can get from

showdown/index?id=35 --click---> showdown/vote?id=1
showdown/vote?id=1 --redirect--> showdown/index?id=35

The vote action is not seen.
(The redirect method doesn't work as it redirects to the plain index.php homepage url only and not keeping the module/action intact, and I cannot find a helper in Magento for creating hyperlinks.)
Does Magneto have a link helper for this?
Example of stuff I want: <a href="<?php echo Mage::Helper->Link->($url, $array); ?> then $array or whatever variables gets sent to the controller (page I linked to).
Can I use a POST style hyperlink? (I can in Symfony/Yii/Rails/Ramaze frameworks. Why not Zend?)
Answer: Link clicks will not result in a POST request without JavaScript.
Magento Url helper has the syntax

Mage::getUrl('module/controllerfile/action',array('id',1))

which would result in a lookup of the frontName for module and would give you for example

http://site.com/module/controllerfile/action/id/1/

which you could then access with Mage::app()->getRequest()->getParam('id').
If you have multiple URLs involved (like a form post), you can also redirect the user within the controller by using

$this->_redirect('module/controllerfile/action', array('id',1))

You can also create a query string with

$this->_redirect('module/controllerfile/action', array('_query',array('param1'=>'val','param2'=>'val'))).
Comment: `Mage::getUrl('showdown/index/vote',array('id'=>'c'))` is what you want. This will give the URL `http://desbest.uk.to/clients/magentofull/index.php/showdown/index/vote/id/c/`. In your `voteAction()` method you would access the value via `$this->getRequest()->getParam('id')`.
Comment: I can't use `http://site.com/module/controllerfile/action/id/1/` because it fails on my site. Check here. http://desbest.uk.to/clients/magentofull/showdown/index?view=2 works and http://desbest.uk.to/clients/magentofull/showdown/index/view/2 fails. Do you know why? Without having this fixed, I cannot ever have `getUrl` to work.
Comment: http://desbest.uk.to/clients/magentofull/showdown/index/index/view/2 - try using `_redirect('showdown/index/index')`
Comment: But the number of the array key keeps appearing in the url. `Mage::getUrl('showdown/index/vote',array('c'))` becomes `http://desbest.uk.to/clients/magentofull/index.php/showdown/index/vote/0/c/` I do not want `vote/0/c/` I only want `vote/c` If I make it `array('c', 'd')` I end up with `vote/0/c/1/d` Please help!


Use Google Analytics to track bugs?

Question: Is it possible to use Google Analytics to keep track of when users receive 404, 401, and other types of errors as well as associate additional data with those reports, such as stack traces?
I've researched around, and Google Analytics suggests using the following to track when users receive 404 errors:
<code>pageTracker._trackPageview("/404.html?page=" +
 document.location.pathname +
document.location.search + "&from=" +
document.referrer);
</code>
This is great for keeping track of hits, but it doesn't really help in tracking down how the user got to the page in the first place.  Is it possible to associate more informative data with the page view such as a stack trace? Or is Google Analytics not meant to keep track of such data?
Comment: This was flagged as off-topic.  Which SE do you recommend I ask this question on?
Answer: Mind you you will receive some the way you mentioned - mostly the referring page of the 404.
Concerning your other points: there are major security concerns about embedding stack traces into pages shown to the user (which must be the case, because the GA API is client-size JS). It compromises your architecture and other vital security information.
Error logging should be done by a server-side language and basically every language has one, so take your pick - which is probably why GA does not have anything of the kind of features you are asking for.
Comment: While I would agree with you under normal circumstances, the web application will be hosted locally on user's machines, so we don't have access to the error reports generated.
Comment: In that case, I would just setup a central logging gateway file on some server under your control, and then send the logs in an encrypted request. Or really - scratch the encryption - these are their machines anyway :)

Use Google Analytics to track bugs?


how to insert Timestamp field using code First in EF

Question: I have Timestamp field type VARBINARY I want to ask how I should insert byte[] on Timestamp field using code first
private void AddDataToFormsTable(AthenaContext context)
{
    List<Form> listOfForms = new  List<Form>( )
                                 {
                                     new Form(){ UniqeId = Guid.NewGuid(), Name = "Form", Description = "form", ModifiedBy = " ",ModifiedOn = DateTime.Now,CreatedBy = " ",CreatedOn = DateTime.Now},
                                     new Form(){ UniqeId = Guid.NewGuid(), Name = "Form2", Description = "form2", ModifiedBy = " ",ModifiedOn = DateTime.Now,CreatedBy = " ",CreatedOn = DateTime.Now},
                                     new Form(){ UniqeId = Guid.NewGuid(), Name = "Form3", Description = "form3", ModifiedBy = " ",ModifiedOn = DateTime.Now,CreatedBy = " ",CreatedOn = DateTime.Now},
                                     new Form(){ UniqeId = Guid.NewGuid(), Name = "Form4", Description = "form4", ModifiedBy = " ",ModifiedOn = DateTime.Now,CreatedBy = " ",CreatedOn = DateTime.Now},
                                     new Form(){ UniqeId = Guid.NewGuid(), Name = "Form5", Description = "form5", ModifiedBy = " ",ModifiedOn = DateTime.Now,CreatedBy = " ",CreatedOn = DateTime.Now},
                                 };

    listOfForms.ForEach(i =>context.Forms.Add(i));

    context.SaveChanges();

}

Answer: Easy solution, change the type of CreatedOn to DateTime in your database,
otherwise: Convert.ToByte(DateTime.Now)


Mercurial pre-merge hook

Question: Is there a way to do some checks before allowing a merge in Mercurial?
I have found the pre-update hook and have a script that runs before an update is allowed, by adding the following to ~/.hg/hgrc:
[hooks]
pre-update = ~/hg_pre_update.sh

But I'd like to run the check before allowing a merge as well, and currently it just allows the merge to go through without running my checks.
Background
In case there are alternative ways to solve the problem...
We have been having a number of problems with 'lost' edits under Mercurial.  I've tracked down most of them now to the same underlying cause: someone has vim edit sessions open while either they or someone else does a hg update or merge.  The editor warns the file has changed externally, the user ignores the warning and saves their changes.
When these changes are committed, for Mercurial there is nothing controversial.  The user has simply reverted all the changes brought in with the last update and put in their own changes.
Some time later, we notice the code has gone walkabouts.  Cue assorted insults flung the way of mercurial...
Comment: I would direct my insults not at the source control tool but at the other tools.
Comment: Or, actually, at the user that ignored the warning that the file has changed on the disk and just went with the one in the editor.
Comment: Oh yes, that is who my insults are directed at!
Answer: Sorry just worked out there is a pre-merge hook that works just the same as pre-update.  I tried it before asking the question, but now just looking at my hgrc I realise I put the script being called for that hook to ~/hg_pre_merge.sh which doesn't exist.
I can't find the existence of pre-merge documented anywhere but still feeling like a bit of a muppet now.
Comment: All the troublemakers here use vim, so the hook looks for the temporary files left open by vim sessions (`~/.*.swp`) and quits before starting the merge.  There are about 4 people sharing the same central dev system and quite frequently one of them does a merge while the others are in the middle of working.  And when it comes time to commit, none of them really know what they're committing since most of it is other people's work, so they don't realise file X shouldn't have changed...
Comment: Just out of interest.. what will that hook do to protect against this issue?
Comment: @asc99c: Excellent.. Put that in the question. :) Butbutbut... do several people develop simultaneously on the same machine/workingdir? O_O
Comment: Yes!  Traditionally that is how we all worked and there has been immense resistance to changing it.  I've been trying to push Mercurial for a while and it is starting to gain traction.   But on this team we've still got 2 dedicated holdouts who want everyone to work on the same central server, and 2 more who are starting to sway towards mercurial I hope.  At least mercurial can just about cope - the holdouts killed any chance of Subversion getting a foothold.
Answer: Set vim to autoreload changes if no local changes where done. (otherwise ask, or force a merge)
that's how I avoid such issues in any editor...
Comment: They need to learn to save their work and commit (or shelve) it before doing a merge.  It is simply part of the process of using source control.
Comment: It's not me having the problem (well the original problem) and I can't control how other people are using the editor.  The problems I have seen were always where there were local changes as well, so I'm not certain this would help much.
Comment: asc99x: Ugh. To check in the script that the editor has unsaved changes before update/merge sounds tricky, unless it's integrated into the editor (like in Eclipse / Visual Studio / Emacs (probably...). Vim? Dunno.

Mercurial pre-merge hook


Do any .NET DLLs exist that implement luac's functionality?

Question: Does anyone know of any DLLs (preferably .net) that encapsulate the lua 5.1 compiler?  I'm working on a .net project where part of it needs to compile lua scripts, and i would rather have a DLL that i could send script code to instead of sending the script to a temporary file and running luac.exe.
Edit: I'd need a .NET library that implements luac in such a way that it outputs standard lua bytecode (not a lua library that compiles to the CLR).  Compiling the lua c source code didn't work, as when i went to include a reference to the dll in a c# project, visual studio complained that it wasnt a valid assembly.  My searches so far haven't found anything.
Answer: all the code for luac is distributed with lua...  would be trivial to make it a DLL.
Answer: There is the Lua.NET project for Lua and .Net integration:
http://www.lua.inf.puc-rio.br/projects/luanet/
Answer: You can emulate luac in Lua, through the following command taken from the lua-users wiki:
lua -e 'io.write(string.dump(assert(loadfile())))' <sample.lua >sample.out

So if you were going to do that at the API level in C (even though I know you're using .NET), it should be something like
lua_dostring(L, "string.dump(assert(loadstring([==[YOUR CODE HERE]==])))");
size_t sz;
char *output = lua_tolstring(L, -1, &sz);

And then just save sz characters to your output file.
I realize this is a bit of a late answer, but since there wasn't already one here, I figured I'd take a stab at it.


Excel (VBA) - Copiar dados de arquivos

Question: Estou tentando reunir dados de vários arquivos em uma unica planilha.
Em algumas pesquisas que fiz pela rede, encontrei varias sugestões, e abaixo esta o código da que encontrei e atendeu a necessidade.
Fiz alguns ajustes para adaptar ao que eu precisava porem estou com um problema no momento de colar os dados no destino.
Eu preciso "Cola Especial" para que nas células que continham resultados de formulas, seja colado o valor que estava da fórmula.
Tentei de várias formas usar um ".PasteSpecial Paste:=xlPasteValues" da vida, mas sempre da erro no código da linha abaixo:
'Colo na planilha principal
 ActiveWorkbook.ActiveSheet.Range("A2:BA" & rTemp).Copy shPadrao.Range("B" & r)

Segue código completo:
Sub Importar_XLS()

Dim sPath As String, sName As String, fName As String
Dim r As Long, rTemp As Long, r2 As Long, n As Long
Dim shPadrao As Worksheet

'Para a macro executar mais rápido!
With Application
    .ScreenUpdating = False
    .DisplayAlerts = False
End With

'A planilha onde serão colados os dados
Set shPadrao = Sheets("Dados")

'O caminho onde as planilhas estão salvas
sPath = "CaminhoDaPasta\"

'Descubro o nome do primeiro arquivo a ser aberto
sName = Dir(sPath & "*.xl*")

' Apagar o conteudo antes de copiar
shPadrao.Range("A2:BA104857").EntireRow.Delete

'Faço o loop que le todos os arquivos
Do While sName <> ""

   'Acha a ultima linha utilizada na planilha onde serao colados os dados
    r = shPadrao.Cells(Rows.Count, "B").End(xlUp).Row
    shPadrao.Range("A" & r).Value = sName

   'O caminho + o nome do arquivo a ser aberto
    fName = sPath & sName

   'Abro o workbook a ser lido
    Workbooks.Open Filename:=fName, UpdateLinks:=False

   ' Seleciona a planilha que eu quero copiar
    ActiveWorkbook.Sheets("Calculo_Consolidado").Select
    Range("A2").Select

   'Descubro quantas linhas ele possui
    rTemp = ActiveWorkbook.ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row

   'Colo na planilha principal
     ActiveWorkbook.ActiveSheet.Range("A2:BA" & rTemp).Copy shPadrao.Range("B" & r)

   r2 = (shPadrao.Cells(Rows.Count, "A").End(xlUp).Row) - 1

  ' Fecho o arquivo já lido
    ActiveWorkbook.Close SaveChanges:=False

  ' Tentando selecionar celula e arrastar conteudo ate a proxima vazia
   Range("A" & r).Select
   Range("A" & r).Copy
   Range("A" & r & ":" & "A" & r2 + 1).PasteSpecial
   Application.CutCopyMode = False

  'Atualizo a variavel com funcao DIR() que acha o proximo arquivo nao processado
    sName = Dir()

Loop

On Error GoTo 0

With Application
    .ScreenUpdating = True
    .DisplayAlerts = True

End With

Range("A" & r2 + 1).Select

End Sub

Comment: Você quer colar o valor resultado de saída da fórmula ou a fórmula bruta em si?
Comment: Olá... Quero colar o resultado da formula
Comment: Alguma sugestão?
Comment: Qual é o erro? E qual o valor de `r` e de `rTemp`
Answer: Hum... olha pelo que entendi você quer colar apenas o resultado da formula, mas você utilizou a função Application.CutCopyMode = False tente usar ela!
    'Celula que contem a formula
Range("A1").Select
'Usando a funcao Copy do VBA
Selection.Copy
'Seleciono o Destino do Paste
Range("B1").Select
'Usando a Funcao Paste Special,
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
'Informo o Metodo de copia
Application.CutCopyMode = False

Caso tenha ajudado ficarei feliz :)
Comment: Para melhor atendimento, Selecione apenas os dados o qual as celulas estejam preenchidas!
Comment: Olá Ezequiel, tudo certo? Obrigado por responder, mas essa parte do código esta funcionando. Nele existem dois momentos em que é colado informações. A parte que esta com problema no código esta aqui: 'Colo na planilha principal
     ActiveWorkbook.ActiveSheet.Range("A2:BA" & rTemp).Copy shPadrao.Range("B" & r)
Comment: Evite utilizar `.Select`
Answer: Tenta esse:
wsOrigem.Range("A1").Copy
wsDestino.Range ("B1").PasteSpecial xlValues

Answer: Copias dado especifico entre duas planilhas
Aba Carteira
Aba Plhan1
Aba Carteira > Produto especifico (cimento)

Excel (VBA) - Copiar dados de arquivos


TCP Window Size going to 0 / Wget stops downloading?

Question: I have a somewhat complex setup that doesn't work, and I'm struggeling quite a bit to track down the root cause.
First of all the big picture:
Node backend is a medium size windows azure worker role running JBoss 5. It is streaming out HTTP multipart/chunked JSON data.
Node frontend is  medium size windows azure worker role running JBoss 5. It is requesting the  HTTP multipart/chunked JSON data from the backend node, and then publishing that again via http.
These streams are quite straigt forward and can be tested with a browser or wget.
We observe that the streams just stop working after some time (hours to days). In order to track that down I fired up a wget on the frontend (i.e. client) side and a wireshark to see whats goign on.
Wireshark is set to dump to a ringbuffer of files. Stream speed is roughly 100KB/s, so performance should not be an issue.
What I observe is:
The Receive window of wget starts at 130000 and than decreases down to 517bytes. It eventually hits 0, and than wget sits there fore quite some time (sometimes a few secs, sometimes up to 100s) until it accepts data again.
See this wireshark:

No.     Time            Source                Destination           Protocol Info
 138300 17:33:47.038970 10.211.148.222        220.127.116.11         TCP      52902 > 5284 [ACK] Seq=1 Ack=12610206 Win=27 Len=0
 138301 17:33:47.069346 188.8.131.52         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12610206 Ack=1 Win=514 Len=118
 138302 17:33:47.069353 188.8.131.52         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12610324 Ack=1 Win=514 Len=119
 138303 17:33:47.069358 126.96.36.199         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12610443 Ack=1 Win=514 Len=118
 138304 17:33:47.069362 188.8.131.52         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12610561 Ack=1 Win=514 Len=109
 138305 17:33:47.069366 184.108.40.206         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12610670 Ack=1 Win=514 Len=126
 138306 17:33:47.069370 184.108.40.206         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12610796 Ack=1 Win=514 Len=115
 138307 17:33:47.069374 220.127.116.11         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12610911 Ack=1 Win=514 Len=119
 138308 17:33:47.069378 188.8.131.52         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12611030 Ack=1 Win=514 Len=116
 138309 17:33:47.069382 18.104.22.168         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12611146 Ack=1 Win=514 Len=115
 138310 17:33:47.069386 18.104.22.168         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12611261 Ack=1 Win=514 Len=116
 138311 17:33:47.069390 18.104.22.168         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12611377 Ack=1 Win=514 Len=115
 138312 17:33:47.069499 10.211.148.222        188.8.131.52         TCP      52902 > 5284 [ACK] Seq=1 Ack=12611492 Win=22 Len=0
 138313 17:33:47.069569 22.214.171.124         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12611492 Ack=1 Win=514 Len=132
 138314 17:33:47.069573 126.96.36.199         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12611624 Ack=1 Win=514 Len=121
 138315 17:33:47.069577 220.127.116.11         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12611745 Ack=1 Win=514 Len=103
 138316 17:33:47.069581 22.214.171.124         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12611848 Ack=1 Win=514 Len=107
 138317 17:33:47.069585 18.104.22.168         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12611955 Ack=1 Win=514 Len=118
 138318 17:33:47.069589 18.104.22.168         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12612073 Ack=1 Win=514 Len=118
 138319 17:33:47.069593 18.104.22.168         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12612191 Ack=1 Win=514 Len=117
 138320 17:33:47.069597 184.108.40.206         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12612308 Ack=1 Win=514 Len=126
 138321 17:33:47.069601 188.8.131.52         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12612434 Ack=1 Win=514 Len=108
 138322 17:33:47.069605 22.214.171.124         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12612542 Ack=1 Win=514 Len=112
 138323 17:33:47.069609 126.96.36.199         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12612654 Ack=1 Win=514 Len=109
 138324 17:33:47.069613 188.8.131.52         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12612763 Ack=1 Win=514 Len=107
 138325 17:33:47.069617 188.8.131.52         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12612870 Ack=1 Win=514 Len=104
 138326 17:33:47.069621 220.127.116.11         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12612974 Ack=1 Win=514 Len=115
 138327 17:33:47.069625 184.108.40.206         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12613089 Ack=1 Win=514 Len=107
 138328 17:33:47.069629 220.127.116.11         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12613196 Ack=1 Win=514 Len=107
 138329 17:33:47.069633 220.127.116.11         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12613303 Ack=1 Win=514 Len=123
 138330 17:33:47.069638 22.214.171.124         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12613426 Ack=1 Win=514 Len=105
 138331 17:33:47.069641 18.104.22.168         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12613531 Ack=1 Win=514 Len=129
 138332 17:33:47.069712 10.211.148.222        22.214.171.124         TCP      52902 > 5284 [ACK] Seq=1 Ack=12613660 Win=14 Len=0
 138333 17:33:47.069756 18.104.22.168         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12613660 Ack=1 Win=514 Len=111
 138334 17:33:47.069761 22.214.171.124         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12613771 Ack=1 Win=514 Len=114
 138335 17:33:47.069765 188.8.131.52         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12613885 Ack=1 Win=514 Len=127
 138336 17:33:47.069769 18.104.22.168         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12614012 Ack=1 Win=514 Len=109
 138337 17:33:47.069773 18.104.22.168         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12614121 Ack=1 Win=514 Len=107
 138338 17:33:47.069777 18.104.22.168         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12614228 Ack=1 Win=514 Len=106
 138339 17:33:47.069781 18.104.22.168         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12614334 Ack=1 Win=514 Len=120
 138340 17:33:47.069785 184.108.40.206         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12614454 Ack=1 Win=514 Len=110
 138341 17:33:47.069789 184.108.40.206         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12614564 Ack=1 Win=514 Len=114
 138342 17:33:47.069793 18.104.22.168         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12614678 Ack=1 Win=514 Len=107
 138343 17:33:47.069797 18.104.22.168         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12614785 Ack=1 Win=514 Len=109
 138344 17:33:47.069801 126.96.36.199         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12614894 Ack=1 Win=514 Len=119
 138345 17:33:47.069805 18.104.22.168         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12615013 Ack=1 Win=514 Len=113
 138346 17:33:47.069809 184.108.40.206         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12615126 Ack=1 Win=514 Len=116
 138347 17:33:47.069813 22.214.171.124         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12615242 Ack=1 Win=514 Len=120
 138348 17:33:47.069817 126.96.36.199         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12615362 Ack=1 Win=514 Len=114
 138349 17:33:47.069870 10.211.148.222        220.127.116.11         TCP      52902 > 5284 [ACK] Seq=1 Ack=12615476 Win=7 Len=0
 138350 17:33:47.069908 22.214.171.124         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12615476 Ack=1 Win=514 Len=108
 138351 17:33:47.069912 22.214.171.124         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12615584 Ack=1 Win=514 Len=107
 138352 17:33:47.069916 220.127.116.11         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12615691 Ack=1 Win=514 Len=107
 138353 17:33:47.069919 184.108.40.206         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12615798 Ack=1 Win=514 Len=115
 138354 17:33:47.069923 22.214.171.124         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12615913 Ack=1 Win=514 Len=120
 138355 17:33:47.069927 220.127.116.11         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12616033 Ack=1 Win=514 Len=107
 138356 17:33:47.069931 22.214.171.124         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12616140 Ack=1 Win=514 Len=119
 138357 17:33:47.069935 22.214.171.124         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12616259 Ack=1 Win=514 Len=122
 138358 17:33:47.069939 188.8.131.52         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12616381 Ack=1 Win=514 Len=105
 138359 17:33:47.069943 18.104.22.168         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12616486 Ack=1 Win=514 Len=113
 138360 17:33:47.069947 184.108.40.206         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12616599 Ack=1 Win=514 Len=107
 138361 17:33:47.069950 126.96.36.199         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12616706 Ack=1 Win=514 Len=114
 138362 17:33:47.069954 22.214.171.124         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12616820 Ack=1 Win=514 Len=127
 138363 17:33:47.069959 126.96.36.199         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12616947 Ack=1 Win=514 Len=132
 138364 17:33:47.070004 10.211.148.222        126.96.36.199         TCP      [TCP ZeroWindow] 52902 > 5284 [ACK] Seq=1 Ack=12617079 Win=0 Len=0
 138365 17:33:47.390902 22.214.171.124         10.211.148.222        TCP      [TCP ZeroWindowProbe] 5284 > 52902 [ACK] Seq=12617079 Ack=1 Win=514 Len=1
 138366 17:33:47.599283 10.211.148.222        18.104.22.168         TCP      [TCP ZeroWindow] [TCP ACKed lost segment] 52902 > 5284 [ACK] Seq=1 Ack=12617080 Win=0 Len=0
 138367 17:33:48.203458 188.8.131.52         10.211.148.222        TCP      [TCP ZeroWindowProbe] 5284 > 52902 [ACK] Seq=12617080 Ack=1 Win=514 Len=1
 138368 17:33:48.411799 10.211.148.222        126.96.36.199         TCP      [TCP ZeroWindow] [TCP ACKed lost segment] 52902 > 5284 [ACK] Seq=1 Ack=12617081 Win=0 Len=0
 139055 17:33:50.015857 188.8.131.52         10.211.148.222        TCP      [TCP ZeroWindowProbe] 5284 > 52902 [ACK] Seq=12617081 Ack=1 Win=514 Len=1
 139056 17:33:50.224262 10.211.148.222        220.127.116.11         TCP      [TCP ZeroWindow] [TCP ACKed lost segment] 52902 > 5284 [ACK] Seq=1 Ack=12617082 Win=0 Len=0
 141485 17:33:54.234768 188.8.131.52         10.211.148.222        TCP      [TCP ZeroWindowProbe] 5284 > 52902 [ACK] Seq=12617082 Ack=1 Win=514 Len=1
 141972 17:33:54.442993 10.211.148.222        184.108.40.206         TCP      [TCP ZeroWindow] [TCP ACKed lost segment] 52902 > 5284 [ACK] Seq=1 Ack=12617083 Win=0 Len=0
 146212 17:34:03.422127 22.214.171.124         10.211.148.222        TCP      [TCP ZeroWindowProbe] 5284 > 52902 [ACK] Seq=12617083 Ack=1 Win=514 Len=1
 146214 17:34:03.630469 10.211.148.222        126.96.36.199         TCP      [TCP ZeroWindow] [TCP ACKed lost segment] 52902 > 5284 [ACK] Seq=1 Ack=12617084 Win=0 Len=0
 153400 17:34:22.203389 126.96.36.199         10.211.148.222        TCP      [TCP ZeroWindowProbe] 5284 > 52902 [ACK] Seq=12617084 Ack=1 Win=514 Len=1
 153967 17:34:22.411696 10.211.148.222        18.104.22.168         TCP      [TCP ZeroWindow] [TCP ACKed lost segment] 52902 > 5284 [ACK] Seq=1 Ack=12617085 Win=0 Len=0
 156977 17:34:59.547273 18.104.22.168         10.211.148.222        TCP      [TCP ZeroWindowProbe] 5284 > 52902 [ACK] Seq=12617085 Ack=1 Win=514 Len=1
 156978 17:34:59.755506 10.211.148.222        22.214.171.124         TCP      [TCP ZeroWindow] [TCP ACKed lost segment] 52902 > 5284 [ACK] Seq=1 Ack=12617086 Win=0 Len=0
 156983 17:35:49.424340 10.211.148.222        188.8.131.52         TCP      [TCP Window Update] 52902 > 5284 [ACK] Seq=1 Ack=12617086 Win=517 Len=0
 156984 17:35:49.427810 184.108.40.206         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12617086 Ack=1 Win=514 Len=1440
 156985 17:35:49.427893 188.8.131.52         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12618526 Ack=1 Win=514 Len=1440
 156986 17:35:49.427934 10.211.148.222        18.104.22.168         TCP      52902 > 5284 [ACK] Seq=1 Ack=12619966 Win=506 Len=0
 156987 17:35:49.427960 220.127.116.11         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12619966 Ack=1 Win=514 Len=1440
 156988 17:35:49.427991 184.108.40.206         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=12621406 Ack=1 Win=514 Len=1440

I cannot see why wget would be busy so long.
Also I see similar behaviour with our JBoss/java client.
"Normally" the stream looks like this:

No.     Time            Source                Destination           Protocol Info
     46 17:31:04.858278 18.104.22.168         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=1 Ack=1 Win=514 Len=108
     50 17:31:04.858306 10.211.148.222        126.96.36.199         TCP      52902 > 5284 [ACK] Seq=1 Ack=109 Win=516 Len=0
     61 17:31:04.858528 220.127.116.11         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=109 Ack=1 Win=514 Len=95
    166 17:31:04.861793 22.214.171.124         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=204 Ack=1 Win=514 Len=107
    167 17:31:04.861813 10.211.148.222        18.104.22.168         TCP      52902 > 5284 [ACK] Seq=1 Ack=311 Win=515 Len=0
    320 17:31:04.869327 126.96.36.199         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=311 Ack=1 Win=514 Len=102
    326 17:31:04.869393 22.214.171.124         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=413 Ack=1 Win=514 Len=117
    327 17:31:04.869408 10.211.148.222        184.108.40.206         TCP      52902 > 5284 [ACK] Seq=1 Ack=530 Win=515 Len=0
    328 17:31:04.869419 22.214.171.124         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=530 Ack=1 Win=514 Len=96
    329 17:31:04.870048 220.127.116.11         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=626 Ack=1 Win=514 Len=113
    330 17:31:04.870069 10.211.148.222        220.127.116.11         TCP      52902 > 5284 [ACK] Seq=1 Ack=739 Win=514 Len=0
    337 17:31:04.870431 184.108.40.206         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=739 Ack=1 Win=514 Len=107
    383 17:31:04.871195 220.127.116.11         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=846 Ack=1 Win=514 Len=116
    388 17:31:04.871222 10.211.148.222        126.96.36.199         TCP      52902 > 5284 [ACK] Seq=1 Ack=962 Win=513 Len=0
    423 17:31:04.872362 18.104.22.168         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=962 Ack=1 Win=514 Len=99
    440 17:31:04.873151 184.108.40.206         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=1061 Ack=1 Win=514 Len=100
    446 17:31:04.873182 10.211.148.222        184.108.40.206         TCP      52902 > 5284 [ACK] Seq=1 Ack=1161 Win=512 Len=0
    508 17:31:04.875097 126.96.36.199         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=1161 Ack=1 Win=514 Len=98
    599 17:31:04.877254 184.108.40.206         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=1259 Ack=1 Win=514 Len=104
    604 17:31:04.877307 10.211.148.222        18.104.22.168         TCP      52902 > 5284 [ACK] Seq=1 Ack=1363 Win=517 Len=0
    639 17:31:04.878517 18.104.22.168         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=1363 Ack=1 Win=514 Len=115
    657 17:31:04.878662 126.96.36.199         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=1478 Ack=1 Win=514 Len=104
    660 17:31:04.878693 10.211.148.222        184.108.40.206         TCP      52902 > 5284 [ACK] Seq=1 Ack=1582 Win=516 Len=0
    683 17:31:04.879737 220.127.116.11         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=1582 Ack=1 Win=514 Len=106
    716 17:31:04.880392 188.8.131.52         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=1688 Ack=1 Win=514 Len=100
    720 17:31:04.880448 10.211.148.222        220.127.116.11         TCP      52902 > 5284 [ACK] Seq=1 Ack=1788 Win=515 Len=0
    767 17:31:04.882359 220.127.116.11         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=1788 Ack=1 Win=514 Len=104
    841 17:31:04.883507 184.108.40.206         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=1892 Ack=1 Win=514 Len=108
    843 17:31:04.883527 10.211.148.222        220.127.116.11         TCP      52902 > 5284 [ACK] Seq=1 Ack=2000 Win=515 Len=0
    851 17:31:04.884238 18.104.22.168         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=2000 Ack=1 Win=514 Len=101
    896 17:31:04.885225 126.96.36.199         10.211.148.222        TCP      5284 > 52902 [PSH, ACK] Seq=2101 Ack=1 Win=514 Len=116
    904 17:31:04.885276 10.211.148.222        220.127.116.11         TCP      52902 > 5284 [ACK] Seq=1 Ack=2217 Win=514 Len=0

Also I don't really get why the window is just 517 bytes.Any idea?
The data packages are so small (100-200bytes) due to the current Level 7 protocol used.
Edit:
Data transfer failed after 6GB, or 8GB. seems no 32bit-stuff.
Link/Hardware is unknown, but supposed to be within one microsoft azure data center.
Here is a connection setup of wget (remove a few bits for minimum privacy):

No.     Time            Source                Destination           Protocol Info
 157007 17:50:49.590140 10.211.148.222        18.104.22.168         TCP      58291 > 5284 [SYN] Seq=0 Win=8192 Len=0 MSS=1460 WS=8

Frame 157007 (66 bytes on wire, 66 bytes captured)
    Arrival Time: Apr 16, 2012 17:50:49.590140000
    Frame Number: 157007
    Frame Length: 66 bytes
    Capture Length: 66 bytes
Ethernet II, Src: 00:15:5d:36:03:6d (00:15:5d:36:03:6d), Dst: 02:f5:0a:d3:ff:0a (02:f5:0a:d3:ff:0a)
    Destination: 02:f5:0a:d3:ff:0a (02:f5:0a:d3:ff:0a)
        Address: 02:f5:0a:d3:ff:0a (02:f5:0a:d3:ff:0a)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..1. .... .... .... .... = LG bit: Locally administered address (this is NOT the factory default)
    Source: 00:15:5d:36:03:6d (00:15:5d:36:03:6d)
        Address: 00:15:5d:36:03:6d (00:15:5d:36:03:6d)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
    Type: IP (0x0800)
Internet Protocol, Src: 10.211.148.222 (10.211.148.222), Dst: 220.127.116.11 (188.8.131.52)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..0. = ECN-Capable Transport (ECT): 0
        .... ...0 = ECN-CE: 0
    Total Length: 52
    Identification: 0x17ac (6060)
    Flags: 0x02 (Don't Fragment)
        0.. = Reserved bit: Not Set
        .1. = Don't fragment: Set
        ..0 = More fragments: Not Set
    Fragment offset: 0
    Time to live: 128
    Protocol: TCP (0x06)
    Source: 10.211.148.222 (10.211.148.222)
    Destination: 22.214.171.124 (22.214.171.124)
Transmission Control Protocol, Src Port: 58291 (58291), Dst Port: 5284 (5284), Seq: 0, Len: 0
    Source port: 58291 (58291)
    Destination port: 5284 (5284)
    Sequence number: 0    (relative sequence number)
    Header length: 32 bytes
    Flags: 0x02 (SYN)
        0... .... = Congestion Window Reduced (CWR): Not set
        .0.. .... = ECN-Echo: Not set
        ..0. .... = Urgent: Not set
        ...0 .... = Acknowledgement: Not set
        .... 0... = Push: Not set
        .... .0.. = Reset: Not set
        .... ..1. = Syn: Set
            [Expert Info (Chat/Sequence): Connection establish request (SYN): server port 5284]
                [Message: Connection establish request (SYN): server port 5284]
                [Severity level: Chat]
                [Group: Sequence]
        .... ...0 = Fin: Not set
    Window size: 8192
    Options: (12 bytes)
        Maximum segment size: 1460 bytes
        NOP
        Window scale: 8 (multiply by 256)
        NOP
        NOP
        SACK permitted

No.     Time            Source                Destination           Protocol Info
 157008 17:50:49.591169 126.96.36.199         10.211.148.222        TCP      5284 > 58291 [SYN, ACK] Seq=0 Ack=1 Win=8192 Len=0 MSS=1440 WS=8

Frame 157008 (66 bytes on wire, 66 bytes captured)
    Arrival Time: Apr 16, 2012 17:50:49.591169000
    Frame Number: 157008
    Frame Length: 66 bytes
    Capture Length: 66 bytes
Ethernet II, Src: 02:f5:0a:d3:ff:0a (02:f5:0a:d3:ff:0a), Dst: 00:15:5d:36:03:6d (00:15:5d:36:03:6d)
    Destination: 00:15:5d:36:03:6d (00:15:5d:36:03:6d)
        Address: 00:15:5d:36:03:6d (00:15:5d:36:03:6d)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
    Source: 02:f5:0a:d3:ff:0a (02:f5:0a:d3:ff:0a)
        Address: 02:f5:0a:d3:ff:0a (02:f5:0a:d3:ff:0a)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..1. .... .... .... .... = LG bit: Locally administered address (this is NOT the factory default)
    Type: IP (0x0800)
Internet Protocol, Src: 184.108.40.206 (188.8.131.52), Dst: 10.211.148.222 (10.211.148.222)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..0. = ECN-Capable Transport (ECT): 0
        .... ...0 = ECN-CE: 0
    Total Length: 52
    Identification: 0x6cbb (27835)
    Flags: 0x02 (Don't Fragment)
        0.. = Reserved bit: Not Set
        .1. = Don't fragment: Set
        ..0 = More fragments: Not Set
    Fragment offset: 0
    Time to live: 127
    Protocol: TCP (0x06)
    Source: 18.104.22.168 (220.127.116.11)
    Destination: 10.211.148.222 (10.211.148.222)
Transmission Control Protocol, Src Port: 5284 (5284), Dst Port: 58291 (58291), Seq: 0, Ack: 1, Len: 0
    Source port: 5284 (5284)
    Destination port: 58291 (58291)
    Sequence number: 0    (relative sequence number)
    Acknowledgement number: 1    (relative ack number)
    Header length: 32 bytes
    Flags: 0x12 (SYN, ACK)
        0... .... = Congestion Window Reduced (CWR): Not set
        .0.. .... = ECN-Echo: Not set
        ..0. .... = Urgent: Not set
        ...1 .... = Acknowledgement: Set
        .... 0... = Push: Not set
        .... .0.. = Reset: Not set
        .... ..1. = Syn: Set
            [Expert Info (Chat/Sequence): Connection establish acknowledge (SYN+ACK): server port 5284]
                [Message: Connection establish acknowledge (SYN+ACK): server port 5284]
                [Severity level: Chat]
                [Group: Sequence]
        .... ...0 = Fin: Not set
    Window size: 8192
    Options: (12 bytes)
        Maximum segment size: 1440 bytes
        NOP
        Window scale: 8 (multiply by 256)
        NOP
        NOP
        SACK permitted
    [SEQ/ACK analysis]
        [This is an ACK to the segment in frame: 157007]
        [The RTT to ACK the segment was: 0.001029000 seconds]

No.     Time            Source                Destination           Protocol Info
 157009 17:50:49.591242 10.211.148.222        220.127.116.11         TCP      58291 > 5284 [ACK] Seq=1 Ack=1 Win=132352 Len=0

Frame 157009 (54 bytes on wire, 54 bytes captured)
    Arrival Time: Apr 16, 2012 17:50:49.591242000
    Frame Number: 157009
    Frame Length: 54 bytes
    Capture Length: 54 bytes
Ethernet II, Src: 00:15:5d:36:03:6d (00:15:5d:36:03:6d), Dst: 02:f5:0a:d3:ff:0a (02:f5:0a:d3:ff:0a)
    Destination: 02:f5:0a:d3:ff:0a (02:f5:0a:d3:ff:0a)
        Address: 02:f5:0a:d3:ff:0a (02:f5:0a:d3:ff:0a)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..1. .... .... .... .... = LG bit: Locally administered address (this is NOT the factory default)
    Source: 00:15:5d:36:03:6d (00:15:5d:36:03:6d)
        Address: 00:15:5d:36:03:6d (00:15:5d:36:03:6d)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
    Type: IP (0x0800)
Internet Protocol, Src: 10.211.148.222 (10.211.148.222), Dst: 18.104.22.168 (126.96.36.199)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..0. = ECN-Capable Transport (ECT): 0
        .... ...0 = ECN-CE: 0
    Total Length: 40
    Identification: 0x17ad (6061)
    Flags: 0x02 (Don't Fragment)
        0.. = Reserved bit: Not Set
        .1. = Don't fragment: Set
        ..0 = More fragments: Not Set
    Fragment offset: 0
    Time to live: 128
    Protocol: TCP (0x06)
    Source: 10.211.148.222 (10.211.148.222)
    Destination: 188.8.131.52 (126.96.36.199)
Transmission Control Protocol, Src Port: 58291 (58291), Dst Port: 5284 (5284), Seq: 1, Ack: 1, Len: 0
    Source port: 58291 (58291)
    Destination port: 5284 (5284)
    [Stream index: 2]
    Sequence number: 1    (relative sequence number)
    Acknowledgement number: 1    (relative ack number)
    Header length: 20 bytes
    Flags: 0x10 (ACK)
        0... .... = Congestion Window Reduced (CWR): Not set
        .0.. .... = ECN-Echo: Not set
        ..0. .... = Urgent: Not set
        ...1 .... = Acknowledgement: Set
        .... 0... = Push: Not set
        .... .0.. = Reset: Not set
        .... ..0. = Syn: Not set
        .... ...0 = Fin: Not set
    Window size: 132352 (scaled)
    [SEQ/ACK analysis]
        [This is an ACK to the segment in frame: 157008]
        [The RTT to ACK the segment was: 0.000073000 seconds]

No.     Time            Source                Destination           Protocol Info
 157010 17:50:49.591565 10.211.148.222        220.127.116.11         TCP      58291 > 5284 [PSH, ACK] Seq=1 Ack=1 Win=132352 Len=389

Frame 157010 (443 bytes on wire, 443 bytes captured)
    Arrival Time: Apr 16, 2012 17:50:49.591565000
    Frame Number: 157010
    Frame Length: 443 bytes
    Capture Length: 443 bytes
Ethernet II, Src: 00:15:5d:36:03:6d (00:15:5d:36:03:6d), Dst: 02:f5:0a:d3:ff:0a (02:f5:0a:d3:ff:0a)
    Destination: 02:f5:0a:d3:ff:0a (02:f5:0a:d3:ff:0a)
        Address: 02:f5:0a:d3:ff:0a (02:f5:0a:d3:ff:0a)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..1. .... .... .... .... = LG bit: Locally administered address (this is NOT the factory default)
    Source: 00:15:5d:36:03:6d (00:15:5d:36:03:6d)
        Address: 00:15:5d:36:03:6d (00:15:5d:36:03:6d)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
    Type: IP (0x0800)
Internet Protocol, Src: 10.211.148.222 (10.211.148.222), Dst: 18.104.22.168 (18.104.22.168)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..0. = ECN-Capable Transport (ECT): 0
        .... ...0 = ECN-CE: 0
    Total Length: 429
    Identification: 0x17ae (6062)
    Flags: 0x02 (Don't Fragment)
        0.. = Reserved bit: Not Set
        .1. = Don't fragment: Set
        ..0 = More fragments: Not Set
    Fragment offset: 0
    Time to live: 128
    Protocol: TCP (0x06)
    Source: 10.211.148.222 (10.211.148.222)
    Destination: 126.96.36.199 (184.108.40.206)
Transmission Control Protocol, Src Port: 58291 (58291), Dst Port: 5284 (5284), Seq: 1, Ack: 1, Len: 389
    Source port: 58291 (58291)
    Destination port: 5284 (5284)
    Sequence number: 1    (relative sequence number)
    [Next sequence number: 390    (relative sequence number)]
    Acknowledgement number: 1    (relative ack number)
    Header length: 20 bytes
    Flags: 0x18 (PSH, ACK)
        0... .... = Congestion Window Reduced (CWR): Not set
        .0.. .... = ECN-Echo: Not set
        ..0. .... = Urgent: Not set
        ...1 .... = Acknowledgement: Set
        .... 1... = Push: Set
        .... .0.. = Reset: Not set
        .... ..0. = Syn: Not set
        .... ...0 = Fin: Not set
    Window size: 132352 (scaled)
    [SEQ/ACK analysis]
        [Number of bytes in flight: 389]
Data (389 bytes)

0000  47 45 54 20 2f 69 6e 74 65 72 66 61 63 65 73 2f   GET /interfaces/
...
0100  54 54 50 2f 31 2e 30 0d 0a 52 61 6e 67 65 3a 20   TTP/1.0..Range:
0110  62 79 74 65 73 3d 37 35 35 37 30 32 33 35 39 36   bytes=7557023596
0120  2d 0d 0a 55 73 65 72 2d 41 67 65 6e 74 3a 20 57   -..User-Agent: W
0130  67 65 74 2f 31 2e 31 31 2e 34 0d 0a 41 63 63 65   get/1.11.4..Acce
0140  70 74 3a 20 2a 2f 2a 0d 0a 48 6f 73 74 3a 20 73   pt: */*.
0170  63 74 69 6f 6e 3a 20 4b 65 65 70 2d 41 6c 69 76   ction: Keep-Aliv
0180  65 0d 0a 0d 0a                                    e....

Edit: Fixed title
Comment: I doubt the window is just 517 bytes. A window of 517 does not necessarily mean 517 *bytes* -- see [RFC1323](http://tools.ietf.org/html/rfc1323#page-8). We'd have to see the connection setup to know what it means.
Comment: And by 'connection setup' we mean the first set of packets as the TCP connection is set up.
Comment: There are some packets listed there with len=1440. Are they getting lost on your unusual link? What sort of link is it? Another suspicion: is it failing after 2GB / 4GB of data?
Comment: Ah, right! Obviously due to the ring buffer wireshark didn't know about the window scaling, therefore it reports a just started conenction as 132352, but in all following files as just 517. Thanks David for pointing me to that again.
Comment: The len=1440 seems to be a TCP send buffer flush once the receive buffer is free again. I don't think they are lost, this wireshark is running on the receivers side.
Answer: Window size at zero means the OS has received all the data it can in its receive buffer for this connection and is waiting for the application to read() it. In other words, if you don't read the data the server is sending you, as fast as it's sending it, at some point it will block like this. How are you using wget, can you paste the exact script/command? Same with your java program, are you sure it's reading all the data from the server, and never getting backed up, or missing an event/notification that data is ready, or having a problem where it can't keep up with its read()s?
Also, check <code>netstat -anp</code> and look at the <code>Recv-Q</code> column for this connection, if it's not 0 then there's data buffered up, waiting for your app to read it. Edit: argh, Windows, this link might help.
Answer: Sorry for the delayed update guys.
Long story short, reason behind all this was a broken NAT in the Microsoft Azure cloud. It is ignoring RFC 5382. Their timeout on a TCP connection is 60s. When that timeout is hit, the connection is not actively closed (RST or so, as suggested in the RFC), or just ignored. Instead a very weird translation happening, making the packages arrive with garbeld source/destination IPs on the correct VM. The VM throws those away, but this made caputing them in wireshark quite tricky. It will see them as a totally different connection.
Solution woraround was a 60s application level heartbeat.


what is the way to reach apropriate answer about my question about group in algebra

Question:
Assume there exist $2$ natural numbers that are coprime ($m$ and $n$ such that $(m,n)=1$) such that for each $g$, $h \in G$ we have $g^m h^m = h^m g^m$ and $g^n h^n = h^n g^n$. Then $G$ is abelian group. (That means $ab=ba$.)
Hint: $(m,n)=1$ then there exist $c,d\in\mathbb{Z}$ s.t. $cm+dn=1$. thus
$$gh = g^{cm+dn}  h^{cm+dn} = g^{cm}  g^{dn}  h^{cm}  h^{dn} = (g^m)^c  (g^n)^d  (h^m)^c  (h^n)^d = (g^n)^d  (g^m)^c  (h^m)^c  (h^n)^d$$
Use property in hypothesis to reach $gh=hg$.

Please help me to continue.
Answer: HINT: you need to show that $g^{nd}h^{nd}=h^{nd}g^{nd}$ and $g^{cm}h^{cm}=h^{cm}g^{cm}$.
Comment: A good way to start is $g^dg^dh^dh^d=g^dh^dg^dh^d=h^dh^dg^dh^d=h^dh^dg^dg^d$.
Comment: are you have simle way to proof?if we have same exponent or assumation in hypothesis we can commute
Comment: Try this $gh = g^{cm+dn}  h^{cm+dn} = g^{dn}  g^{cm}  h^{cm}  h^{dn} = (g^d)^n  (g^c)^m  (h^m)^c  (h^n)^d$.
Comment: here problem is commutative ...what theorems help us to commute elements in group?same exponent?
Comment: we use the same exponent property and show the hint.
Comment: hint that you introduce when it is perform that we are same exponent but in your hint in comment not exist same exponent
Comment: i confused...i read soloution about this problem in here:http://math.stackexchange.com/questions/326702/how-to-prove-that-a-group-with-some-properties-is-abelian/327766#   is there anyone to give me best answer and solution of this problem
Answer: Try starting with
$$gh = g^{dn+cm}h^{cm+dn} = (g^d)^n(g^c)^m(h^c)^m(g^d)^n,$$
then apply the identity together with some regrouping.
Comment: You've added nothing to what the OP wrote.
Comment: @DanielLittlewood I don't agree. I both reversed the order of summation in the exponent and changed the way things were grouped.


continuity of a function and net convergence

Question: The following is a statement and its proof in the Banach Algebra Techniques for Operator Theory by Douglas:

I don't understand the last part of the proof. In order to show that $f$ is continuous, one needs to show that
$$
f(y_\alpha)\to f(y).
$$
But what the proof gives is only the convergence of the subnet $(f_{\alpha_\beta})$:
$$
f(y_{\alpha_\beta})=g(x_{\alpha_\beta})\to f(y).
$$
Would anyone clarify how the continuity of $f$ is done?
Answer: Suppose that $\langle f(y_\alpha):\alpha\in A\rangle$ does not converge to $f(y)$. Then there is a subnet $\langle y_{\alpha_\beta}:\beta\in B\rangle$ of $\langle y_\alpha:\alpha\in A\rangle$ such that $\{f(y_{\alpha_\beta}):\beta\in B\}$ is bounded away from $f(y)$. Now apply the argument given in the book to the net $\langle y_{\alpha_\beta}:\beta\in B\rangle$: it has a subnet whose image under $f$ converges to $f(y)$, which is absurd. Thus, $\langle f(y_\alpha):\alpha\in A\rangle\to f(y)$.
Comment: @Jack: There's a lot more going on here. In particular, the argument here relies on the compactness of $X$ and the relationship between $X$ and $Y$.
Comment: @Jack: That's right. This is very much a special case. (And the author could certainly have done a better job of explaining it!)
Comment: Thank you for your answer. So accordingly, one can conclude that if $g:X\to Y$ is a map between two topological spaces and $x\in X$, then $g$ is continuous at $x$ if and only if $\langle g(x_\alpha)\rangle$ has a subnet converging to $g(x)$ for every net $x_\alpha\to x$?
Comment: Ah, I see. So in general, one only has $g:X\to Y$ is continuous at $x\in X$ if and only if $\langle g(x_\alpha)\rangle$ converges to $g(x)$ for every net $x_\alpha\to x$.


Routing to a Public IP (for VM WAN migration)

Question: I'm planning to migrate a virtual machine from one data-center to another. The VM has a public IP address that will change on the new data-center to another public IP address.
I'm planning to change the DNS entry for the VM, so it will reflect the new IP, but I want to keep the machine accessible while the DNS propagates the changes.
Is there a way I can configure some route or iptables rule so that any packet destined to my 1st (old) IP address gets forward to my 2nd (new) IP address?
That way users width cached DNS entry for 1st IP would still be able to access the VM.
After a while, (1 or two days) I could safely remove the routing rule.
I don't know much about IP tables and even less about routing. I was unable to google even a hint on this, except for some academic papers...
Answer: I think this is the wrong approach to the problem.
The issue is that you want to maintain the service while DNS propagates, however if you have access to the DNS then you can simply reduce DNS propagation time down to a few seconds, whatever your acceptable outage is.
Your A record for the domain looks something this:
<hostname> 14400 IN A <IP Address>

The second value is the length of time (TTL) the DNS can be cached for in seconds.  Change this to
<hostname> 10 IN A <IP Address>

Now everyone will pick up any new updates within 10 seconds.  Of course for the duration of this change, there will be an increased burden on your DNS.
So the sequence is

Determine the current TTL value and change it to something small
Wait until the original TTL time has passed, which ensures
everyone has the new record with the reduced TTL
Change the IP address for the record (everyone will get this update within the new
TTL duration - a few seconds)
Change the TTL back to something more reasonable

The "something small" value is whatever outage your service can sustain within its SLA
Comment: if he is serving (and storing) dynamic content, then to actually continue using the old machine will be impractical as there will then be two separate systems holding totally different data
Answer: Create some sort of tunnel link between the two VMs - OpenVPN, GRE, whatever floats your boat.
Once you've done that, assign the old VM's IP to the tunnel interface of the new VM and remove that IP from whatever interface it's currently assigned to on the old VM.
Once that's done, all you need to do is add a route on the old VM for the IP to be routed to the new VM on the tunnel interface.
Caveats: depending on the type of VM (and hence virtual NIC), this may not be possible. Additionally, if there is any egress filtering along the path of your new VM, packets with the old VM's source address will be dropped; in that instance, you will need to configure the new VM to route via the tunnel interface (and hence the old VM) when the source address is the old address.
As far as actual commands go, read the manpage of iproute2.


Relative CW approximation, Hurewicz fibrations and Serre fibrations

Question: Let $B$ be a finite CW complex and $p:E\to B$ a Hurewicz fibration.
I know that every topological space $E$ has the weak(!) homotopy type of a CW complex $D$ realized by a weak equivalence $f:D\to E$. (I apologize for asking two things in one question but they are so related that splitting them up seems a little exaggerated.)

Is it possible to find a CW complex $D'$, a Hurewicz fibration $p':D'\to B$ and a weak equivalence $f':D'\to E$ such that $p'=p\circ f'$?
Is it possible to find a Serre fibration $q:C\to B$ and a weak equivalence $g:C\to E$ such that $q=p\circ g$? Can I choose $C$ to be a CW complex?

ADDENDUM:
Due to Henry T. Horton's great answer, the whole question reduces to the following question.
Let $E$ be a topological space. Is it possible to find a CW complex $D$ and a weak equivalence $f:D\to E$ such that $f$ is also a Serre fibration?
Answer: For the second question, consider the following. Let
$$B^I \longrightarrow B,$$
$$\alpha \mapsto \alpha(0)$$
be the path space fibration and consider the pullback
\begin{matrix}
p^\ast B^I & \longrightarrow & E \\
 \downarrow & & \downarrow \\
 B^I & \longrightarrow & B
\end{matrix}
Write $P_p = p^\ast B^I$; we call $P_p$ the mapping path space of $p: E \longrightarrow B$. We have the mapping path fibration
$$q: P_p \longrightarrow B,$$
$$(e, \alpha) \mapsto \alpha(1).$$

Theorem. $q: P_p \longrightarrow B$ is a Serre fibration and there exists a homotopy equivalence $g: P_p \longrightarrow E$ such that $q = p \circ g$. In fact, since $p$ is a fibration, $g$ is a fiber homotopy equivalence.

The map $g: P_p \longrightarrow E$ above is actually just the projection onto the first factor:
$$P_p \longrightarrow E,$$
$$(e, \alpha) \mapsto e.$$
See the proof of Theorem 6.18 of Davis and Kirk's Lecture Notes in Algebraic Topology (available here) for the details on why $q$ is a Serre fibration.
Comment: Thanks for pointing this out. The whole question would be answered positively, if a CW approximation $D\to E$ of an arbitrary topological space $E$ could be chosen as a Serre fibration. Is this possible?


How to pass url value in django to views

Question: My url.py is as below,
from myapp import views
urlpatterns = [
   url(r'^myapp/get_requests/$', views.get_requests),
]

Now my views.py is as below,
@api_view(['GET'])
def get_request(request):
   #How can I get request ID (base url here)?
   return HttpResponse('test')

In the above if I do request in my browser with url as below it reaches my get_request method,
http://localhost:8080/myapp/get_requests/

But the same gives error 404 when I try with some ID in the end as below,
http://localhost:8080/myapp/get_requests/40

Now How can I get this ID number 40 in my views.py method?
Comment: make a function with post request allowed where you give id as payload .....
go to https://stackoverflow.com/questions/16789988/how-to-write-a-django-view-for-a-post-request for how
Answer: Change your urls.py to
from myapp import views
urlpatterns = [
       url(r'^myapp/get_requests/(?P<id>[0-9]+)$', views.get_requests),
]

Now get the id parameter in your views like this
@api_view(['GET'])
def get_request(request,id):
    print id
    return HttpResponse('test')

For more information check out django docs
Answer: If you want to pick up id from url, you just have to write something like this :
@login_required
def MyFunction(request, id) :

    myobject = get_object_or_404(MyModel, pk=id)

    context = {
            "myobject" : myobject,
    }

    return render(request, 'my template.html', context)

And your url, you have to add url(r'^myapp/get_requests/(?P<id>\d+)/$', views.get_requests),
I assume your url is correct and he's already created with id inside. So I just gave you How I pick up object according to this ID.
Answer: There is a typo in the view function name in your above code. So, it would be get_requests not get_request.
Now coming to your question, it throws you 404 - Not Found because there is no actual route that you've defined that should expect the id after the url.
To start accepting id, add another route for it in your urls.py which has a digit regext like:
from myapp import views
urlpatterns = [
   url(r'^myapp/get_requests/$', views.get_requests),
   url(r'^myapp/get_requests/(?P<id>\d+)$', views.get_requests_with_id),
]

and in your views.py, define the view function to accept id parameter something like this:
@api_view(['GET'])
def get_requests_with_id(request, id):
   # Now use id for whatever you want
   return HttpResponse('test')

You can read about it form the official documentation here: https://docs.djangoproject.com/en/1.11/topics/http/urls/#named-groups


Microsoft.Bcl.Build Error

Question: Currently I'm developing Xamarin.Forms App,
facing the issue of Microsoft.Bcl.Build Error,
But I saw at Xamarin forums still does not solve,
is that any solutions for this?
Comment: You've added the Microsoft.Bcl nuget package to the platform-specific projects, and that did not help?
Comment: I've had this issue before. You need to make sure you are naming your packages in small caps and make sure that you don't have any project before that uses the same name or package name.
Answer: According to the warning message and the default Blank App(Xamarin.Forms Portable) project I created, this issue caused by the NuGet packages that you installed in your PetApp.csproj which dependencies Microsoft.Bcl.Build package are not installed in other projects that reference the PetApp project.
Please install the same packages in other projects that reference PetApp project. You could check the Project column in Error List window to confirm which project need to install these packages.
Please note: Installed the packages that include Microsoft.Bcl.Build dependencies, not only install the Microsoft.Bcl.Build package.

In addition, the Microsoft.Bcl.Build project is not compatible with .Droid project that in Xamarin.Forms project. So if there has a .Droid project in your Xamarin.Forms project, this warning message could not be removed unless you remove the .Droid project.

Microsoft.Bcl.Build Error


Question about Modes

Question: I've been learning about music theory for quite some time now, and I've been wondering. How does one determine the modes of the sharps and flats?
For instance, what is the mode for C#, D#, F#, G#, and A#.
I know that C is Ionian, D is Dorian, E is Phrygian, F is Lydian, G is Mixolydian, A is Aeolian and B is Locrian.
But what about the sharps? Is there a specific mode for each of the sharps, and do they exist for their enharmonic equivalents?
Please let me know...
Comment: You only have 5 tones, but Church modes have 7. What are the other two tones, the `E` and `B`?
Comment: You've listed the "white key" modes. The modes based on the key of C major. They are not THE modes but are commonly used as a teaching device without elaboration, which may explain the confusion here.
Answer: A mode is a specific arrangement or set of intervals around a root pitch. For example a Dorian mode is one where, relative to a root pitch, there are the intervals:

1st degree (root) : +0 semitones
2nd degree : +2 semitones
3rd degree : +3 semitones (minor third)
4th degree : +5 semitones
5th degree : +7 semitones
6th degree : +9 semitones (major sixth)
7th degree : +10 semitones (minor seventh)

Because Ionian, Dorian, Phrygian, Lydian etc. can be obtained as rotations of the diatonic major scale, they are said to be modes of the major scale. There are modes of non-diatonic scales such as the melodic minor scale as well.
C is not Ionian, but the mode of C major starting from C as the root is C Ionian. Here are the rest of the diatonic modes with C as the root:

In the picture above, what is the difference between C Ionian and C Lydian? Then look at F Ionian and F Lydian:

Same difference! In Lydian, the fourth scale degree is sharpened compared to the Ionian mode.
Answer: All of the modes — Major, Dorian, Phrygian, etc. — can start on any key. Using major as the starting point, then the "first" mode is major, the "second" mode is Dorian, the "third" mode is Phrygian, etc. Modes use a common key signature but differing tonic pitches.
For example, if I begin with C# major, then I will have, corresponding to that key signature, D# dorian, E# phrygian, and so forth. From D major, I have E dorian, F# phrygian, ....
The sharps and flats are no exception. Any scale can start on a black key or a white key.
If one plays only the black keys, as expressed in the question (C# D# F# G# A#), the result is known as a pentatonic scale: specifically, the third mode of the F# major pentatonic scale. Pentatonic scales, as any other scale, may start on any key, black or white. A C major pentatonic would be C D E G A, C# major pentatonic would be C# D# E# G# A#, D major pentatonic is D E F# A B.
Search this site for "pentatonic" for many posts on that topic.
Comment: Hey that was really helpful and it makes sense. I had no idea that's how it worked. But then what about modes like Phrygian Dominant? Is that still the Phrygian scale with some sort of change to the dominant scale degree?
Comment: The "diatonic modes" are the ones I described above. For a given key signature, each mode contains the same pitches, just with a different tonic pitch. "Phrygian dominant", so named because it contains a b2 and b7, is an unrelated scale that, while it is a mode of the ascending melodic minor scale, finds its true origins in Middle Eastern music.
Comment: @Aaron - My understanding is that the Phrygian dominant scale is a mode of the *harmonic minor* scale, not a melodic minor scale, thanks to its use of both b2 and plain old non-flattened 3.
Answer: Your third paragraph is true, but only holds for key C.
Instead of using C = Ionian, D = Dorian, etc., you need to think Ionian =^1, Dorian =^2, Phrygian =^3 (^ means note, becoming root of the mode) and so on. So for key C♯, for example, C♯ is root of C♯ Ionian, D♯ is root of D♯ Dorian, and so on.
When you get to the flats (you will eventually!), the same applies. In key A♭, for example (4♭) A♭ is the root (tonic) of A♭ Ionian, B♭ Is the root of B♭ Dorian, etc.
Answer: In addition to the other answers here, it can help to think of modes in terms of "brightness":

-Brightest-
Lydian
Ionian
Mixolydian
Dorian
Aeolian
Phrygian
Locrian
-Darkest-

Each mode in this ordering has one more flat or one fewer sharp (as applicable) than the mode above it.
Note that every mode except locrian is adjacent to either ionian or aeolian, and can be defined in relation to one of them by one raised or lowered tone.
How do you know which tone changes? It's the same order of sharps/flats as key signatures! For example, let's say we're in the key of D, where dorian is the one with no sharps or flats. Then we add sharps as we traverse the list upwards:
D mixolydian has F#;
D ionian has F# and C#;
D lydian has F#, C#, and G#.
We can't keep going because the next sharp is D, which is our root.
Your question about translating sharps to modes can't directly be answered because every key has multiple enharmonic equivalents. But if you know the number of sharps and the mode, you can start at that mode on the list and count down until you get to 0 sharps. 5 sharps and lydian mode? 5 places down from lydian is phrygian, and the root of the natural phrygian scale is E, so you know you're in E lydian.
Answer: Check out my javascript modes app.
No download - just visit this address: https://b-p-thomas.github.io/ and the app runs in the web page.
Use it to read off the notes you have in a particular mode.

In the snap above, the solid blob is next to Bb and you can read off the notes in Bb mixolydian by going clockwise round the dial reading the letter name next to each blob.
The light gray blob shows you the major scale containing the notes of the mode.
In the snap, Bb mixolydian contains the same notes as Eb major.
The important thing is that all major modes have the same pattern of intervals - I've shaded the semitone intervals to make them more obvious.
Comment: Don't *all* modes, minor inc., have the same pattern as each other? TTSTTTS, just starting somewhere else in that sequence?
Comment: @Tim - I was very careful to say major modes. One counter-example to your question - a harmonic minor scale doesn't have that TTSTTTS pattern, so any mode constructed from it won't either.
Comment: Ah, I see now. It was just that the question, the OP, and all the answers only referred to *major* keys and their modes (which of course inc. natural minor). Didn't want OP to get too befuddled..!
Answer:
For instance, what is the mode for C#, D#, F#, G#, and A#.
I know that C is Ionian, D is Dorian, E is Phrygian, F is Lydian, G is Mixolydian, A is Aeolian and B is Locrian.

The modes are associated with the given pitches through this algorithm:

To play a given mode, find the associated key on the keyboard, then find the one an octave higher or lower, and then play all the white keys between them, inclusively.

It is impossible to do this with any black key.

Question about Modes


Difference quotient for higher derivatives

Question: For a differentiable function $f:\mathbb R\to\mathbb R$, we have, by definition,
$$f'(x)=\lim_{h\to0} \frac{f(x+h)-f(x)}h.$$
Is there a similar construction for higher derivatives, i.e. is it possible to write $$f^{(n)}=\lim_{h\to0} \Delta_f^n(x,h),$$
where $\Delta_f^n(x,h)$ is a rational function depending only on $$h, f(x), f(x+h), f(x+2h),\dots, f(x+n h)$$ ?

My attempt: See my answer below.
Answer: Yes! The idea is to start off with $\Delta^1_f(x,h)\overset{\text{Def.}}=\frac{f(x+h)-f(x)}h$ and to then recursively define $$\Delta^{n+1}_f(x,h)\overset{\text{Def.}}=\frac{\Delta^n_f(x+h,h)-\Delta^n_f(x,h)}h.$$
This construction leads to the following closed form, as can be checked by induction: $$\Delta_f^{n}(x,h)=\frac{\sum_{k=0}^n f(x+ k h) \binom nk (-1)^{n-k}}{h^n}.$$

Now it only remains to show that $\lim_{h\to0} \Delta_f^{n}(x,h) = f^{(n)}(x)$ for any $n$-times differentiable function $f$.
To this end, I will use l'Hôpital. First, I will prove two Lemmas
Lemma 1. Let $n\in\mathbb N$. Then for any polynomial function $P:\mathbb R\to\mathbb R$ of degree $<n$, $$\sum_{k=0}^n (-1)^{n-k} P(k) \binom nk=0.$$
Proof. Without loss of generality one can assume that $P$ is of the form $P(x)=x^m$ for some natural number $m<n$.
By the binomial Theorem, $$(e^x-1)^n=\sum_{k=0}^n \binom nk (-1)^{n-k} e^{kx},$$
so that $$\left.\frac{\mathrm d^m}{\mathrm d^mx}\right|_{x=0}(e^x-1)^n=\sum_{k=0}^n\binom nk (-1)^{n-k} k^m.$$
But $$\left.\frac{\mathrm d^m}{\mathrm d^mx}\right|_{x=0}(e^x-1)^n=\left.(e^x-1)^{n-m}\right|_{x=0} \cdot \text{something} = 0.$$
This achieves a proof. $\square$
Lemma 2. If $x\in\mathbb R$ is a number, $n\in\mathbb N$ is an integer, and $f:\mathbb R\to\mathbb R$ is differentiable in a neighbourhood of $x$, then
$$\lim_{h\to0}\Delta^n_f(x+h,h)-\Delta^n_f(x,h)=0.$$
Proof. We have, using l'Hôpital $n$ times (thanks to Lemma 1, we can apply l'Hôpital $n$ times),
\begin{split}
\lim_{h\to0}\Delta^n_f(x+h,h)-\Delta^n_f(x,h)
&= \lim_{h\to0}\frac{\sum_{k=0}^n (-1)^{n-k} \big(f(x+(k+1)h)-f(x+k h)\big)}{h^n} \\
&= \lim_{h\to0}\frac{\sum_{k=0}^n (-1)^{n-k} \big((k+1)f(x+(k+1)h)-kf(x+k h)\big)}{n h^{n-1}} \\
&= \dots \\
&= \lim_{h\to0}\frac{\sum_{k=0}^n (-1)^{n-k} \big((k+1)^n f(x+(k+1)h)-k^n f(x+k h)\big)}{n!} \\
&= \frac{f(x)}{n!} \sum_{k=0}^n (-1)^{n-k} ((k+1)^n-k^n) \binom nk,
\end{split}
and the last sum is equal to $0$ according to Lemma 1. $\square$
Now we can finally prove the desired result:
Theorem. For any $f$ that is differentiable $n$ times in a neighbourhood of $x\in\mathbb R$, $$\bbox[15px,border:1px groove navy]{\lim_{h\to0}\Delta^n_f(x,h)=f^{(n)}(x).}$$
Proof. Once again I use l'Hôpital:
\begin{split}\lim_{h\to0} \Delta_f^{n}(x,h)&\overset{\text{H}}=\lim_{h\to0}\frac{\sum_{k=0}^n k\cdot f'(x+ k h) \binom nk (-1)^{n-k}}{n h^{n-1}}
\\&\overset{k=0 \text{ term is }0}=\lim_{h\to0}\frac{\sum_{k=1}^n f'(x+ k h) \overbrace{\frac kn\binom nk}^{=\binom{n-1}{k-1}} (-1)^{n-k}}{h^{n-1}}
\\&\overset{j\overset{\text{Def.}}=k-1}=\lim_{h\to0}\frac{\sum_{j=0}^{n-1} f'(x+ (j+1) h) \binom{n-1}j (-1)^{(n-1)-j}}{h^{n-1}} \\
&=\lim_{h\to0} \Delta^{n-1}_{f'}(x+h,h) \\
&\overset{\text{Lemma 2}}=\lim_{h\to0} \Delta^{n-1}_{f'}(x,h).
\end{split}
Since $f'$ is differentiable $n-1$ times in a neighbourhood of $x$, this shows that if the Theorem is true for any $n-1$, then it is also true for $n$. Together with the fact that the Theorem is true by definition for $n=1$, a standard inductive argument shows that the Theorem is also true for any $n\in\mathbb N$.
Answer: See the Grünwald–Letnikov derivative.
There are further  differ integrals.


How to import private Slack channels to Mattermost

Question: How to import private channel from Slack (with history) into Mattermost? Do you know a Slack plugin that does a good export that Mattermost can import? I have found a Slack plugin from export.fountstudio.com which though, can't be imported well, most of the time it fails.
I was looking for a valid format of Mattermost message import but I can't find that either, and also I can't find any Mattermost export plugin to see correct format...
Any advices please?
Comment: You should be able to find message formats from their plugin reference - https://developers.mattermost.com/extend/plugins/server/reference/
Comment: Did not find any good way. Mattermost import/export documentation and support is bad, stopping the process.
Answer: From the Mattermost documentation:
Direct Messages and Private Channels cannot be imported. Slack does not include these messages when generating the export archive.
https://docs.mattermost.com/administration/migrating.html?highlight=slack#limitations
Comment: Well, I have a way how to export Slack private channels, so my problem is now at side of Mattermost, which can't describe what it can import or what are precisely the errors on import.


Using Windows header files within Netbeans 6.8

Question: I'm trying to make an windows application within Netbeans.
When using Visual studio it is no problem to use files like tchar.h
I have receaved a basic file structure containing those and I'm trying to get them to work on Netbeans IDE but it seems that Netbeans won't allow using files from Visual Studio.
I have tried to add the tchar.h file and all other file it required (including some C++ core files) and commenting the errors written in those care files:

#error ERROR: Use of C runtime library internal header file.

But netbenas can't find the tchar.h file while being in same folder...
Comment: You may have dug up the wrong tchar.h when trying to fill in the dependencies?  See http://stackoverflow.com/questions/494064/c-visual-studio-compilation-error
Comment: I took files from

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\crt\src

Those files didn't contain the mention that they weren't to be use for programming...

I tried to add VC/include to the include tab but just gives more errors (see next comment)
Comment: In file included from /usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../include/w32api/windows.h:47,
/cygdrive/C/Program Files (x86)/Microsoft Visual Studio 9.0/VC/include/stdarg.h:23:2: error: #error ERROR: Only Win32 target supported!
Comment: If you took them from crt/src (C runtime source) that sounds like a smoking gun on the "Use of C runtime library" error; but the rest is Windowsy and out of my bailiwick.
Comment: basically I'm trying to use the Visual studio windows libraries within netbeans...
Due to a genereal dislike of Visual Studio.
But it seems allmost impossible...
Answer: If you're using gcc you might consider using the unix style wide characters instead of the microsoft specific version. Look at wchar.h
http://en.wikipedia.org/wiki/Wchar.h


Zeroes of f(x) in a splitting field $E $ have the same multiplicity

Question: Let $f(x)$ be an irreducible polynomial over a field $F$ and let $E$ be a splitting field of $f(x)$ over $F$. Then all the zeroes of $f(x)$ in $E$ have the same multiplicity.
The proof of this theorem involves the following steps
Let $a$ and $b$ be distinct zeroes of $f(x)$ in $E.$ If $a$ has multiplicity $m,$ then in $E[x]$, we may write $f(x)= (x-a)^m g(x)$. It follows from a lemma that there is a field isomorphism from E to itself that carries a to b and acts as the identity on $F.$

Thus, $f(x)= \Phi(f(x))= (x-b)^m \Phi(g(x))$

I am not able to understand the above step. I understand that $a$ is carried to b by an isomorphism. But why is $\Phi(x-a)= x-b $

EDIT: Suppose the isomorphism is extended to $E[x]$ such that $\Phi(x)=x$. Does this mean that the required result of the theorem is true only when $\Phi(x)=x$ and not for all other isomorphism mappings ?

Thank you for your help..
Answer: In fact $\Phi$ is an isomorphism of $E$, it is extended to  $E[x]$ by $\Phi(x)=x$, so $\Phi(x-a)=\Phi(x)-\Phi(a)=x-b$.
Comment: Oh do you mean to say that we took $\Phi$ such that $\Phi(x)=x$?
Answer: If we have a homomorphism $\varphi:F\to K$, where $F,K$ are fields (or rings), there is an induced homomorphism $\Phi:F[x]\to K[x]$, which is defined by $\Phi|_F=\varphi,\;\Phi(x)=x$.
Obviously we get $\Phi(x-a)=\Phi(x)-\Phi(a)=x-b$.
Comment: If $\Phi$ is from $E$ to $E$, then $\Phi(x-a)$ is not defined, since $x\not\in E$. The only thing we can do is extend $\Phi$ to $E[x]$.
Comment: Well, I guess it's just a very common and familiar extension, so by abuse of notation, when the same letter is used for a map $E\to E$ and a map $E[x]\to E[x]$, one is expected to understand.
Comment: But, the problem statement mentions  $\Phi$  as the isomorphism from $E \rightarrow E$, which is an identity on the units of $F$. Is it right for us to extend $\Phi$ to $E[x]$?
Comment: Oh okay .. does that mean, that the result in the theorem is true only when the isomorphism mapping $\Phi$ is such that $\Phi(x) = x$?
Comment: Yes, definitely.
Comment: okay... shouldn't have the theorem statement mentioned this explicitly specially when it's valid for only a special case of a isomorphism mapping?


how to know email status (mailject)

Question: I'm using Mailjet SMTP to send email's. Now, i want to verify if email was send or not. Mailjet have this email status , but how i can have access to this information? Mailjet have too this API, but this in php...
If i use DeliveryNotificationOptions can resolve this?
Something like this:
mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnSuccess | DeliveryNotificationOptions.OnFailure | DeliveryNotificationOptions.Delay;

Answer: I can communicate with API Mailjet like:
Uri address = new Uri("http://api.mailjet.com/0.1/reportEmailsent");
HttpWebRequest request = WebRequest.Create(address) as HttpWebRequest;
request.Method = "GET";
request.KeepAlive = true;
request.Headers.Add("apiKey", "numberapiKey");
request.Headers.Add("secretKey", "numbersecretKey");
request.Credentials = new NetworkCredential("apiKey", "serialKey");
request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
request.Accept = "application/x-www-form-urlencoded; charset=UTF-8";

Now getting response:
// Get response
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
   Stream ResponseStream = null;
   ResponseStream = response.GetResponseStream();
   int responseCode = (int)response.StatusCode;
   string responseBody = ((new StreamReader(ResponseStream)).ReadToEnd());
}

how to know email status (mailject)


XAML Calendar Control for Windows Phone 8.1

Question: I am new to Windows Phone Programming. I am in need of XAML Calendar Control with the following features and functionality supported.

Month View & Week View - Capable of handling the click event on any particular given date. And the scroll left and right needed to show the previous and next month / week depending upon the view. Exactly as the calendar app in Windows Phone 8.1

Could you please suggest me links to achieve this.
Answer: I would like to suggest Syncfusion XAML controls for Windows Phone.
They have an excellent Calendar control with month view. Scroll buttons are there for navigating to next/previous month. But I am not sure about week view. Please go through the following link for more details.
http://www.syncfusion.com/products/windows-phone/calendar
Comment: @AniketKulkarni i have updated my answer. SivaSu has asked to suggest links. That's why i have posted link alone. Down voting totally disappoints :(


Como funcionam os sistemas de hospedagem de sites?

Question: Estou criando um site e gostaria de hospedá-lo, mas tenho algumas dúvidas pois já ouvi dizer que as hospedagens possuem limites de acesso mensal ou limites no de tamanho dos bancos de dados. Portanto gostaria de saber:
1: Quais são os tipos de limitações que uma hospedagem comum tem (ou algumas limitações que podem ser considerados na hora de fazer a escolha certa)?
2: O que é hospedagem compartilhada?
3: O que é exatamente a largura de banda que falam tanto?
4: Qual o preço médio de uma boa hospedagem?
5: Requerimentos por AJAX influenciam nos limites da hospedagem, sendo que os requerimentos serão feitos via json para o meu banco de dados?
Answer: Vamos lá:
1: Quais são os tipos de limitações que uma hospedagem comum tem (ou algumas limitações que podem ser considerados na hora de fazer a escolha certa)?
R = principalmente tráfego mensal, quantidade de views ou mesmo banda.
2: O que é hospedagem compartilhada?
R = A hospedagem compartilhada tem limitações de CPU e de recursos de hardware para todos os sites. Basicamente, é um servidor compartilhado por diversos sites. Tem uma relação custo/benefício mais interessante.
3: O que é exatamente a largura de banda que falam tanto?
R = largura de banda é a medição de dados, a velocidade com que eles fluem através das linhas de telefone, cabo ou DSL para tranferir informações de e para um site através do seu computador. Em relação a sua hospedagem de site, a largura de banda mede esse fluxo de transferência de dados, é o número de visitas que você recebe em seu site; volume puro multiplicado pelo tamanho do arquivo incluído em suas páginas.
Então, se você tem um site todo o texto baseado na web, você seria capaz de receber mais tráfego, em números menores de largura de banda que você faria se tivesse uma página com muitas imagens e gráficos, o que naturalmente têm tamanhos maiores de arquivos que estão sendo transferidos a partir do seu site para o navegador do seu visitante (http://webartigos.com/artigos/largura-de-banda-e-a-hospedagem-de-sites/65369)
4: Qual o preço médio de uma boa hospedagem?
R = Depende de quais serviços vc contrata. Por exemplo: contas de e-mail, banco de dados, alguma tecnologia de server side(como PHP, Python, Java ou outra). Os preços variam enormemente
5: Requerimentos por AJAX influenciam nos limites da hospedagem, sendo que os requerimentos serão feitos via json para o meu banco de dados?
R = Certamente, influenciarão na largura de banda.
Answer:
Quais são os tipos de limitações que uma hospedagem comum tem (ou algumas limitações que podem ser considerados na hora de fazer a escolha certa)?

Em geral há os limites óbvios de espaço em disco que pode ocupar, quanto de tráfego (bytes transferidos pela rede em entrada ou saída) que pode gerar, quanto pode usar em bancos de dados, quantas contas de e-mail e o espaço total ou de cada conta que pode ocupar, quais as tecnologias pode usar, instalar, se pode acessar por que tipo de terminal ou protocolo de acesso e coisas assim.
Há os limites que ninguém fala. Pode haver limite explícito de uso de processador e quantidade de acessos em disco e coisas assim. Em geral isto é discriminado em nuvem, mas não em hospedagens tradicionais. Algumas limitem fisicamente mesmo através de máquinas virtuais ou mecanismo de componentização. Muitas vezes não te contam isso, ou fazem parecer que isto é algo bom para você quando na verdade é limitação.

O que é hospedagem compartilhada?

Vários sites de vários clientes estão no mesmo servidor. Com isto precisa ter menos flexibilidade, mais limitação, você disputa recursos com os outros e tem uma certa insegurança. Hoje melhorado um pouco com os dockers da vida, mas que acaba criando outras dificuldades.

O que é exatamente a largura de banda que falam tanto?

É a quantidade total de dados que pode passar na rede por um período de tempo, em geral em cada segundo. Então a largura de de 100Mbps pode passar 100 milhões de bits por segundo (o que não é o mesmo de 12,5 milhões de bytes por segundo, como muita gente pensa. Isto é o mesmo que o seu sistema de internet limita. Existe a banda garantida onde você sempre poderá trafegar tudo isto ou a compartilhada onde você disputa tudo isto com outras pessoas.
Isto não limita diretamente quantas visitas seu site pode ter, a não ser que a largura seja muito, muito baixa, o que não existe. Claro que sempre haverá um limite, mas é mais comum o limite ser do servidor e não da largura de banda. É possível entupir uma banda bem larga com apenas uma visita, ainda que raro, e tem mecanismo para não criar problemas em casos assim.

Qual o preço médio de uma boa hospedagem?

Isso muda, e não dá para responder aqui.

Requerimentos por AJAX influenciam nos limites da hospedagem, sendo que os requerimentos serão feitos via json para o meu banco de dados?

Certamente, em geral até podem reduzir o uso em comparação com páginas normais, se tudo for feito certo. Conheço quem conseguiu piorar.