IE9 - cursor disappearing or blinking very fast in text fields

Question: The typing cursor is disappearing or showing randomly in IE9 for a site I'm creating.
After some investigation, I found out that this is being caused by some scrolling banners at the bottom of the page. The cursor disappears completely in text box when on the screen the banners are showing, but when i scroll to hide the banners everything returns to normal.
I have set up a test fiddle to describe this: http://jsfiddle.net/uruwf/3/ After messing with the frameRate of the image scroller the cursor speed changes as well.
I tried already changing to a different jQuery image scroller and the issue persists. This is reproducible Only in IE9 (not even IE6).
There are too many forms on this site for it to be ignored.
Possible solutions/answers I'm seeking:
1 - Make the cursor display as it should and does in other browsers (ideal - blinking when waiting to type, no-blink when typing)
2 - Force the cursor to display always when on focus (no blink at all)
3 - Force the cursor to blink  always when on focus (constant blinking)
4 - Anything else that you can think of that would be user friendly
Your Help is VERY much appreciated!
Comment: From http://logicbox.net/jquery/simplyscroll/: "Any feedback or bugs should be directed to @logicbox or firstname.lastname@example.com. Enjoy!". Did you already try that?
Comment: Thanks, i'm still waiting for a response from them, unfortunatelly I tried 1 other jquery scroller (smoothdivscroll.com) and the issue is identical. Been struggling with this for 3 days now.
Answer: Unfortunately this looks like it's an CPU/thread management issue, increasing the frame rate makes the cursor appearance more intermittent until it finally doesn't appear at all. Depending on CPU speed setting a lower frame rate might make the blinking work acceptably.
I did a google search and couldn't find any answers to this issue (apart from ones that suggested downgrading to IE8), amusingly the first result I looked at was this very question!
You could instead use a solution that animates the 'left' property, though this would result in lower performance across every browser.


Circular arc bisection

Question: Given a circular arc defined by three points $Ax$, $Ay$, $Bx$, $By$, $Cx$, $Cy$ (start, mid, end), is it possible to split it into two halves, i.e. to find the coordinates of the point $Mx$, $My$ so that $\|AM\|=\|MC\|$, using only basic arithmetic operations ($+, -, \times, \div$)? Or is it necessary to use some higher operations, such as square root or sine/cosine?
Answer: This point can be constructed with ruler and compass (find the center of the circle by intersecting two mediatrices, then find the middle of the chord and draw the radius through it).
This means that it can be solved with square roots.
Now, if you consider the arc through $(-2,0)$, $(-1,1)$ and $(2,0)$, its middle point is at $(0,\sqrt5-1)$. This should convince you that a square root is required.

Circular arc bisection


Tumblr - Custom Domain Help

Question: I own the domain name, iamgabeaudick.com. It was my personal website, but I now want to use it as my tumblr domain. I've changed the DNS, and tumblr confirms that the domain is set up correctly.
But when I access iamgabeaudick.com, a blank "Index of /" page appears.
Any ideas why this is? Do I need to configure the ftp files in some way?
Answer: Your domain is working fine for me (I can see your Tumblr blog). It sounds like your DNS is just being cached, either by your computer, or by your ISP.
You probably just need to wait 24hrs.
Comment: @gabeaudick - Yes, your Tumblr. First post is: "Graduates, It's Not About You."
Comment: No problem. don't forget to mark your question as answered after the time limit
Answer: DNS settings take some time to propagate and not all DNS servers refresh at the same time.  Like @webdestroya says, probably give it a day.  For what it's worth it hasn't updated for me and I'm seeing the "Index of /" at the time of this post, but since it worked for someone else it probably just needs some time.

Tumblr - Custom Domain Help


Hiding fields from the debugger

Question: Is it possible to hide fields and/or properties from showing up in the debugger watch window?  See, we've got a class here with over 50 private fields, most of which are exposed through public properties.  This means we're seeing a duplication of a large number of data in the watch window listing.
Is there any means of controlling this?
Answer: Try this attribute:
 [DebuggerBrowsable(DebuggerBrowsableState.Never)]

Use it to hide your backing fields by placing the attribute above the field declaration like this:
class Foo
{
    [DebuggerBrowsable(DebuggerBrowsableState.Never)]
    int bar;  // this one will be hidden
    int baz;  // but this one will be visible like normal
}

Keep in mind that the DebuggerBrowsableState enumeration has two other members:

Collapsed: Collapses the element in the debugger.
RootHidden: This shows child elements of a collection but hides the root element itself.
Comment: I don't know why this is marked as valid answer. If the object comes from 3rd party where we can't apply [DebuggerBrowsable] then this is no answer. The question is rather if/how can we config VS to just hide them for us
Comment: @Andrew Hare is there any way to do this for local variables? We have some code that passes around a users password. During pair programming sessions we don't want the users password to be staring their partner in their face.
Answer: Check out the DebuggerBrowsableAttribute:
http://msdn.microsoft.com/en-us/library/system.diagnostics.debuggerbrowsableattribute.aspx
In fact, this article has some very useful tips for this area:
http://msdn.microsoft.com/en-us/magazine/cc163974.aspx
You might find that using a DebuggerTypeProxy makes more sense. This allows you to provide a "custom view" of the type.
Answer: The DebuggerBrowsableAttribute is covered in this other SO question. If you're doing C# heavily then it's a good question to read up on.
Answer: I know this is old but you would be much better off with using DebuggerTypeProxy http://msdn.microsoft.com/en-us/library/d8eyd8zc.aspx
this way you don't have to modify your class with ugly attributes and the extra benefit is that you can always look at the real type if you do in fact need to have a look at one of those "hidden" fields.
Answer: You could use autos instead of locals or use watches and only watch the variables of interest...

Hiding fields from the debugger


Send a PDF document in C# or vb.net to whatsapp?

Question: Does somebody know how I can send or attach a <code>.pdf</code> document to Whatsapp in C# or vb.net?
I tried to look in their api, but I didnt find anything.
Thanks for any help
Comment: Think the media endpoint is what your looking for https://developers.facebook.com/docs/whatsapp/api/media
Answer: WhatsApp Business API
https://developers.facebook.com/docs/whatsapp/getting-started
or search by tag "WhatsApp chatbot"
https://www.twilio.com/whatsapp
Twilio c# send attach
Comment: i know there is twilo.im looking for something that dosnt cost


If $a^p+b^q+c^r=a^q+b^r+c^p=a^r+b^p+c^q$ .prove that $ a=b=c$ or $p=q=r$?

Question: Let $$a,b,c,p,q,r$$ be positive integers such that :
$$a^p+b^q+c^r=a^q+b^r+c^p=a^r+b^p+c^q$$
How do I prove :$ a=b=c$ or $p=q=r$ ?
Thank you for any kind of help.
Comment: What have you tried so far? Can you elaborate more on how/where you're stuck? This would make it easier for people to give a solution that doesn't explain stuff you already know, and just adds whatever new insights are required to get a solution.
Comment: I deduced it from diophantian equation,and it's seems to me true about the equility of exponents positive integers .
Comment: and no attempt it's look hard for me,i'm affraid from d.equation
Comment: If you aren't mathematically certain that this is true (i.e., you don't have a proof), and if you haven't seen it stated as a fact from a reputable math source, you should indicate that. In that case there's always the chance that it's false.
Comment: if i have a source where is the problem to indicate it ?
Comment: If you have a source, that will make everyone more comfortable that this really is true so they can focus on helping you prove it, rather than wasting some time trying to find a counter example in parallel.
Comment: thank you for your helpful  comments .In way if it is true that's good to all and if it is false seems the counter-example appear in the first view
Answer: The case when all of $a,b,c$ are not distinct is straightforward, as well as the cases when not all of $p,q,r$ are different.
Assume $a>b>c$ and assume $p> q,r$.
Case $1$ is when $p>q> r$. In this case clearly $a^p+b^q+c^r$ is strictly larger than any possible combination.
Case $2$ is when $p>r>q$
In this case clearly $a^q+b^r+c^p$ is smaller than any other combination.


hook_menu not rendering page or form

Question: I'm using 6, and I CANNOT get hook_menu to take me to the page where the form is. I go to www.myurl.com/test_form (and for good measure, www.myurl.com/?q=test_form) to check.
If I clear the caches, then I get a WSOD. If I don't, I get a 404. I have changed permissions and cleared caches and tried to figure out what Drupal wants with no luck. What did I do wrong?
function module__menu() {
      $items = array();
      $items['test_form'] = array(
            'title' => 'New Form',
            'page callback' => 'drupal_get_form',
            'page arguments' => array('module_form'),
            'description' => 'Form',
            'access callback' => TRUE,
            'type' => MENU_CALLBACK,
      );
      return $items;
}

function module_form($form_state) {
$form = array();

    //my form stuff.....

    return $form;
}

UPDATE: Thanks for the advice. Did what you guys said. Still no luck. Error log doesn't show any errors either, so I'm totally lost here.
Comment: Is this your actual code and is your module named module? I kind of assumed module_menu() was really going to be something like pajarotis_menu() in your code, but perhaps this is exactly what your code is. I don't think you can use "module" as the name of a module.
Answer: You've got two underscores in your menu function declaration, try changing it to:
function module_menu() {

Other than that your code is fine, although on the off chance you're using this module to create a custom content type I'd recommend changing the name of your callback function so you don't get a collision with hook_form().
Comment: Beat me to it :)
Comment: no, just want to make a simple form that i hope to make dynamic with AHAH.
Answer: You have 2 underscores in hook_menu():
function module__menu() {

should be
function module_menu() {

Edit: Also, your module name should not be "module" (in the assumption that the code you provided is your actual code). Also hook_form() is already a Drupal hook so you should not be using a function called mymodule_form to provide your own standalone form. Try mymodule_form_description_form().
Answer: Try clearing the cache; it happened a lot of times to me, due to the menu being cached.
Comment: done that. and also the admin/build/modules trick. nothing
Comment: try commenting the current page callback & page argument to point to something that prints a simple test message... see if that gets registered and prints the message in the page... if it works revert code and check with your form.. i'd also suggest you to manually truncate the cache tables once... this happens to be my ritual.. though less logical it works for me.. hope it does something similar to you

hook_menu not rendering page or form


Serverless card payment processor integration options

Question: I m currently developing an app for a local company that needs to integrate card payments for enabling customers to buy some sort of physical products.
Are there any options for a "serverless" card payment integration?
Unfortunately I cant use Stripe + Firebase because Stripe is not available for my country. (Romania)
Has anyone implemented a card payment solution using Braintree payments and Firebase?
Thanks a lot.
Answer: The Firebase functions-samples repo contains examples of processing payments with Stripe and with Paypal. If you look at the code for these, you'll see that the Firebase aspects of them are fairly similar, and the main differences are in the calls to the Paypal/Stripe API.
If you need to support another payment provider, you will have to make your own implementation of this approach, typically using these examples as a template. I also recommend checking out the video explaining this flow: Go serverless: manage payments in your apps.
Comment: Somebody who voted to close likely downvoted - with the rationale that if a question is off-topic, answering it encourages more off-topic questions.
Comment: Thanks Wai, that makes sense. It's one of those guidelines I disagree with, but at least it would explain. :)
Comment: You're welcome Paul. Whoever downvoted, can you explain why please?


Spring Roo 1.3.1 release

Question: I am new to the spring Roo. We are using spring Roo 1.3.1 in our project. I have roo aspect files like roo_javabean.aj(for setters and getters) and roo_jpaEntity.aj in my porject when i check out my project from svn. I was told whenever we add a new property to domain object we need to run roo command on the porject location in command line.
So i downloaded roo 2.0.0.M3 version as i couldn't find 1.3.1 release online. I added one property in my domain object and ran roo command on my command line hoping roo would update the roo_javabean.aj file with setters and getters of the new property variable(@Transient public Date oneTest;) i added, but roo is deleting my existing aspect files for my domain object. please see the below

C:\Users\workspace\project>roo
                  _
   _ _ __  _ __() __   __ _   _ __
  / __| '_ \| '| | '_ \ / _` | | '/ _ \ / _ \
  __ \ |) | |  | | | | | (| | | | | () | () |
  |/ ./||  ||| ||_, | |_|  _/ ___/
      |_|                 |___/           2.0.0.M3

Welcome to Spring Roo. For assistance press TAB or type "hint" then hit ENTER.
WARNING: You are using Spring Roo 2.0.0.M3, but project was generated using Spring Roo 1.3.1.RELEASE
.
If you continue with the execution your project might suffer some changes.
Do you want to continue opening Spring Roo Shell?(YES/No)yes---->if i say yes it is deleting the present files.
Deleted SRC_MAIN_JAVA\com\vik\pro\domain\reference\example_Roo_Jpa_Entity.aj - not require
r governor com.vik.pro.domain.reference.example

I am not sure why, is it because i am using roo 2.0 and my project pom.xml is defined as 1.3.1.
Is there any i can download 1.3.1 release because all I can find is 1.2.5, 1.3.2 and 2.0.0 in spring website.
Answer: There're a big number of differences between Spring Roo 2.x and 1.x versions to be able to maintain the backward compatibility between them.
The following message appears when you use a different version of Spring Roo in a Spring Roo generated project.
<code>WARNING: You are using Spring Roo 2.0.0.M3, but project was generated using Spring Roo 1.3.1.RELEASE . If you continue with the execution your project might suffer some changes. Do you want to continue opening Spring Roo Shell?(YES/No)
</code>
That confirmation message is really useful to prevent undesired changes in your project.
If you have just started to create your project, I recommed you that use Spring Roo 2.x version. It introduces the last Spring technologies (Spring IO, Spring Boot, Spring Data, etc.) in your project and generates a more flexible architecture (domain layer, repository layer, service layer and web layer with separated controllers and views)
However, you could download the Spring Roo 1.3.1 version from here
Hope it helps,
Comment: I was able to run roo after downloading 1.3.1 version from the link you provided. I am not having any issues now. Roo is generating aspectJ files it is supposed to
Comment: Happy to hear that! :)

Spring Roo 1.3.1 release


Find the points where $f(x)=1-|x|$ is not differentiable in the interval $[-1,1]$

Question: Find the points where $f(x)=1-|x|$ is not differentiable in the interval $[-1,1]$
My solution goes like this:

We claim that  the function $f(x)=1-|x|$ is not differentiable at $x=0.$ Thus is true indeed, since $f'(0)=\lim_{\Delta x\to 0}\frac{f(\Delta x)-1}{\Delta x}=\lim_{\Delta x\to 0}\frac{1-|\Delta x|-1}{\Delta x}=\lim_{\Delta x\to 0}\frac{-|\Delta x|}{\Delta x}.$ Now, if $\Delta x>0$ then $f'(0)=-1$ and if $\Delta x>0$ then $f'(0)=1.$ Thus, $f'(0)$ does not exist. Next, we claim $x=1$ is also such a point where $f(x)$ is non-differentiable. Now, $$f'(1)=\lim_{\Delta x\to 0}\frac{f(1+\Delta x)-f(1)}{\Delta x}=\lim_{\Delta x\to 0}\frac{f(1+\Delta x)}{\Delta x}$$ If $1+\Delta x>0$, then $f(1+\Delta x)$ does not exist, since $1+\Delta x\notin [-1,1]$  and thus the Right -Hand Limit does not exist or rather can'tbe calculated. Thus, the limit $f'(1)$ doesnot exist at all. Hence, $f(x)$ is not differentiable at $1.$ Similarly,  we can prove $f(x)$ is not differentiable at $x=1.$

Is the above solution correct? If not, where is it going wrong?
Answer: First summarize some comments (now deleted, though useful).

The definition of derivative you are using is: $f'(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}h.$ (I will likewise write everywhere $h,$ it is shorter than $\Delta x.$)
This definition may very well be applied at endpoints $\pm1$ of the interval of definition of $f.$ (Hardy himself, in Pure Mathematics, has no problem with derivative at endpoints. And many authors, like Stewart in Calculus, define $\lim_{t\to a}g(t)=L,$ for a function $g$ defined on any domain $D$ of which $a$ is a limit point, by: $\forall\varepsilon>0\quad\exists\delta>0\quad\forall t\in D\quad(0<|t-a|<\delta\Rightarrow|g(t)-L|<\varepsilon).$

Now, a complete answer to your question "Is the above solution correct? If not, where is it going wrong?"

Your conclusion that $f'(0)$ does not exist and your intuition are correct but your proof is not perfectly written. Same remark as in one of @Théophile 's comments: keep everything before and after "if $\Delta x>0$ then $f'(0)=-1$ and if $\Delta x>0$ then $f'(0)=1$", but instead of that sentence, better write: "$\lim_{\Delta x\to0^+}\frac{-|\Delta x|}{\Delta x}=-1$ and $\lim_{\Delta x\to0^-}\frac{-|\Delta x|}{\Delta x}=1.$"
Depending on the authors, some people (including Wikipedia, YouTube, and may be your teacher) might agree with your conclusion that $f'(1)$ does not exist either, but for a very different reason from the previous one for $f'(0)$: the new reason you were encouraged to reproduce instead of your first version.
However, according to the (better sourced) definitions above, $f'(1)$ does exist. And this is what you were trying to examin in your first version, when considering $f'(1)=\lim_{h\to 0}\frac{f(1+h)-f(1)}h=\lim_{h\to 0^-}\frac{1-|1+h|}h.$  For $h$ close enough to $0,$ $1+h$ is positive, hence the absolute value may be dropped and we find
$$f'(1)=\lim_{h\to 0^-}\frac{-h}h=-1.$$ (Note that you could prove similarly that $f'(x)=-1$ for every $x\in(0,1]$ and $f'(x)=1$ for every $x\in[-1,0),$ and that a simpler way is to derivate $x\mapsto1-x$ on the first interval and $x\mapsto1+x$ on the second one.)
Your main confusion (in that previous version) was to find also another limit (and concluding that the limit $f'(1)$ does not exist for the same reason as $f'(0)$) when you wrote "if $1+h<0,$ then $f'(1)=\lim_{h\to 0}\frac{1-|1+h|}h=\lim_{h\to 0}\frac{2+h}h$" (which you moreover evaluated to $2$ instead of $\infty$). It is true that if $1+h<0$ then $\frac{1-|1+h|}h=\frac{2+h}h,$ but taking the limit of this equality as $h$ tends to $0$ makes no sense because (again) for $h$ close to $0,$ $1+h>0$ (no matter the sign of $h$).

Edit, upon request per comments: My summary of the unfortunately deleted comments above was not complete. It should include a third point: your prefered definition of $\lim_{t\to a}g(t)=L$  (different from Hardy's and Stewart's one quoted in the second point) implicitely requires $g$ to be defined on both sides of $a$ (i.e. on $(a-\varepsilon,a)\cup(a,a+\varepsilon)$ for some $\varepsilon>0$). If you submit to this restriction, limits (hence also derivatives) at end points of a domain are not defined (better said than "cannot be calculated"), not in the sense "undefined" like an indeterminate form, but simply voluntarily excluded from the definitions. With this convention, the poor $f'(\pm1)$ in your example are de facto deprived of a definition, so that the correct answer to "is $f$ differentiable at $\pm1$?" is not "no" but "this question does not make sense, by lack of a definition". It is even a waste of time, for such an answer, to talk about left and right limits and derivatives (invoking the theorem that when you stick to functions $g$ defined on both sides of $a,$ $\lim_ag$ exists iff $\lim_{a^+}g$ and $\lim_{a^-}g$ exist and are equal).
Edit: related post: Differentiability at endpoints
Comment: @Franklin it is really annoying that comments disappear like that. Please tell me if you need me to rewrite my last comment, which was a small criticism of your saying something like "if $\Delta x<0$ then $f'(1)=-1$ and if $\Delta x>0$ then $f'(1)$ is undefined" in your previous comment (if I remember well...).
Comment: I didn't even receive your comment in my notification! Strange! Of course, if you don't mind, you may write it. Not only will that help me when I stumble back after some time in this post, but also help other readers as well :)
Comment: Well @Franklin  it was something like: writing "if $\Delta x<0$ then $f'(1)=-1$" is not correct. Instead, write "$\lim_{\Delta x\to0^-}\frac{f(1+\Delta x)-f(1)}{\Delta x}=-1$", or as a shorthand: "$f'_{\rm left}(1)=-1$". Similarly, don't write "if $\Delta x>0$ then $f'(1)$ does not exist", but "$f'_{\rm right}(1)$ does not exist". It is the same incorrection as above when you write "if $\Delta x>0$ then $f'(0)=-1$ and if $\Delta x>0$ then $f'(0)=1$" instead of "$f'_{\rm right}(0)=-1$ and $f'_{\rm left}(0)=1$".
Answer: I was confused by your proof as it was hard to follow the chain of equalities. I'd suggest laying it out a little more explicitly
For $x>0$, we have $f(x) = 1-x \implies f'(x) = -1 = \lim_{x\to 0^+}f'(x)$
For $x<0$ we have $f(x) = 1+x \implies f'(x) = 1 = \lim_{x\to 0^-}f'(x)$
The two limits are not equal so the derivative does not exist $x=0$.
The other two places we could argue $f(x)$ has no derivative is $x\in\{-1,1\}$ since these will only have one-sided derivatives.
Comment: It's the difference between $\lim_{x \to a} \lim_{h \to 0} \frac{f(x + h) - f(x)}{h}$ and $\lim_{h\to 0} \lim_{x\to a} \frac{f(x+h) - f(x)}{h}$.
Comment: The statement "if $\lim_{x\to a^+}f'(x) \neq \lim_{x\to a^-} f'(x)$, then $f$ is not differentiable at $a$" is true, but it's a subtle truth that requires the Mean Value Theorem. Speaking as a professor, I would prefer an argument on the level of the definition of the derivative. In this case, it is just as easy to show that $\lim_{x\to} \frac{f(x)-f(0)}{x}$ does not exist.
Comment: @MatthewLeingang -- good suggestion -- the above answer is just where my mind went first -- can you spell out how you'd show the derivative-as-limit doesn't exist without referring to left and right limits of the derivative?
Comment: Sure. If $x>0$, then $\frac{f(x)-f(0)}{x-0} = -1$, so $\lim_{x\to 0^+} \frac{f(x) - f(0)}{x-0} = -1$. On the other hand, if $x<0$, then $\frac{f(x)-f(0)}{x-0} = 1$, so $\lim_{x\to 0^-} \frac{f(x) - f(0)}{x-0} = 1$. Since *these* two one-sided limit disagree, $\lim_{x\to 0} \frac{f(x) - f(0)}{x-0}$ does not exist, which means that $f$ is not differentiable at $0$.
Comment: @MatthewLeingang how is that different than what I wrote? Not challenging, but asking.
Comment: @MatthewLeingang gotcha!
Comment: I told you it was subtle! :-)
Comment: @MatthewLeingang lol — No kidding!!


How do I make this nested div to show up on top right corner and make text wrap around it?

Question: I am trying to set a nested div on the top right of its parent div and text to wrap around the nested div.
I really should understand how position, float and display work together.
Here is my sample:
CSS
.parentDiv {
    width:295px;
    border:1px solid black;
}
.parentDiv .childDiv1 {
    width:36px;
    border:1px solid black;
    float:left;
}
.parentDiv .childDiv2 {
    width:210px;
    border:1px solid black;
    float:left;
}
.parentDiv .childDiv3 {
    width:44px;
    right:0px;
    top:0px;
    border:1px solid gray;
    position:relative;
    float:right;
}

HTML

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

 search here

Live jsfiddle
Answer: Move it inside .childDiv2
Demo here
CSS (no change):
.parentDiv {  width:295px;border:1px solid black; }
.parentDiv .childDiv1 { width:36px;border:1px solid black;float:left; }
.parentDiv .childDiv2 { width:210px;border:1px solid black;float:left; }
.parentDiv .childDiv3 { width:44px;right:0px;top:0px;border:1px solid gray; position:relative; float:right; }

HTML

               Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

                    search here

Answer: Like this: jsFiddle. Make the child div appear first as a child of childDiv2 and keep the CSS as-is.
Answer: Here is a simplified version:

        search here

   Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

CSS:
.childDiv2 { width:210px;border:1px solid black;}
.childDiv3 { width:44px;right:0px;top:0px;border:1px solid gray;float:right  }

Answer: Here's my jsFiddle solution
In addition to the fix, I removed the unnecessary CSS.
The reason for this issue is parsing order. HTML is parsed left-to-right, top-to-bottom. When you have element-A declared after element-B, element-A will naturally be parsed after element-B.
As others have noted, all that needed to be done was to move the paragraph of text so that it's declared after childDiv3. This will allow childDiv3 to reside on the first line of childDiv2 and float itself normally.
Additionally, I added a margin to childDiv1 and some padding to parentDiv to space things out a bit. Feel free to strip out or modify properties as you wish. I also added a .clear element before the closing tag of parentDiv so that it would properly wrap around its floated child elements, as you may have intended it to.


Browsers send Authorization header only for constrained pages- How does it know?

Question: I have a sample application where few of the pages have security constraint.
(Total 5 pages. Secured 2 pages)
I was watching the request/response sets in Fiddler and was surprised!
Even after BASIC authorisation is completed, the browser is sending Authorisation header only for my constrained pages.
How does the browser know which pages in an application are constrained?
I am wondering if browser does one of the below:

Does the browser do a HEAD request before each GET? Is this how it finds if the page being navigated to is constrained?
Does the browser assume url pattern like "all pages in the same folder as the url that was responsible for the 401"?
Comment: Inspect the requests in Firefox Firebug plugin or any other plugins.
Comment: I'm inspecting http requests using Fiddler. I'm browsing with Chrome and IE11 and seeing the raw request/response in Fiddler. Would it be any better to use Firebug?
Comment: As I know if I access `https` page from `http` page then an extra cookie `path=/;secure` is added.
Comment: I'm not using https as of now as it is a test application. So, all pages are on http.
Answer: IMHO it cannot know. But it can cache the fact that at last visit, the server asked for authentication. To control that, you should :

clear all in browser (cookies, history, cache)
stop it and start it again (to make sure you start with a clean browser)
only then inspect requests and responses

You should see two consecutive requests for each secured page at first time, first getting a 401 Unauthorized response, and second carrying authentication headers. And on following requests on same page, the browser remembers the page requires authentication and directly sends the header, without sending them for other pages.
So it does not guess, but only remembers which pages requires authentication headers.
Comment: I did try with a new browser to prevent caching. Anyway, I'll check again. Even with the above approach, it would mean that the browser tries all secured links without authorization header atleast once and gets 401 and then remembers to send the header from next time onwards. Why should the browser try without that header once for every link? So many secured links will return 401 atleast once. Is there something we are missing?


Reading a protocol buffer file in Python

Question: I am making requests to a public transportation API for data analysis. Several files are in JSON format, which is easy to deal with; however, some files are in .protobuf format.
I am curious how to parse these files into a human-readable format. For example, if I open the .protobuf file in a text editor, this is what I receive:
1"$
+(B���uC-(�̉�B
1462;
2"6

    741127020 *F
�ZB�����C-(�̉�B
1583<
3"7

    719255020 *10
K�B�8��C-FH@(�̉�B
1220<
4"7

Thanks!
Answer: Protobuffer is a binary format, so it's not human readable in it's raw state. To read it, go get the python bindings from Google and install with:
pip install --upgrade gtfs-realtime-bindings

Once you have those, you can download the pb file or read it locally very easily:
from google.transit import gtfs_realtime_pb2
import urllib.request

feed = gtfs_realtime_pb2.FeedMessage()
pb_url = "http://someURL/someFile.pb"

with urllib.request.urlopen(pb_url) as response:
    feed.ParseFromString(response.read())
    print(feed)

This will give you something like:
header {
  gtfs_realtime_version: "1.0"
  incrementality: FULL_DATASET
  timestamp: 1579313685
}
entity {
  id: "10-abc-O-1"
  trip_update {
    trip {
      trip_id: "10-1622-O-1"
    }
...

Comment: Awesome, thank you so much. NOTE:: take a look at the hyperlink Mark provided - you must instantiate ```feed``` like so: ```from google.transit import gtfs_realtime_pb2
import urllib

feed = gtfs_realtime_pb2.FeedMessage()```


Get block title from hook block view

Question: I create blog programmatically and I want to show  title block.
This is not working:
<code>  'header' =>  array(
                    '#prefix' => '<p>',
                    '#suffix' => '</p>',
                    '#markup' =>  $block->subject,
               ),
</code>
Or better to create new field via hook_block_configure?
Maybe exist way to find title from DB?
Comment: Drupal 7 or Drupal 8? Kindly specific version before asking any question.
Comment: @AAjayReddy Drupal 7
Answer: Try like this
<code> $block = module_invoke('views', 'block_view', 'name-block_1');
 $title = $block->title;
 $content = render($block['content']);
</code>

Get block title from hook block view


Showing that prime factors of a number is congruent to $1 \pmod 5$

Question: I have come across numbers of the form
$$b=1+10a+50a^2+125a^3+125a^4$$
where $a$ is a positive integer.
Looking at the prime factors of $b$, I am conjecturing that all prime factors of $b$ are $\equiv 1 \pmod 5$. But I cannot prove this. Looking at $b$ in $\bmod 5$, we see that
$b \equiv 1 \pmod 5$. If $p$ is a prime divisor of $b$, then I cannot necessarily conclude that $p \equiv 1 \pmod 5$, for example $91 \equiv 1 \pmod 5$, but $91 = 7 \times 13$. However, I think with the way that $b$ is defined, it can be shown that its prime divisors are actually congruent to $1 \pmod 5$.
Here are the first few numerical data for the choices of $a$:
$$a=1, b = 311, \{ 311 \}$$
$$a=2, b=3221, \{ 3221 \}$$
$$a=3, b=13981, \{ 11,31,41 \}$$
Comment: Hint : $$b=\frac{(5a+1)^5-1}{25a}$$
Comment: After a bit of testing, it really looks like this conjecture runs deeper than I anticipated...
Comment: Verified till $a=10000$ using python
Answer: Peter beat me to it in the comments, but here is a general result. Let $\Phi_n(x)$ denote the $n^{th}$ cyclotomic polynomial. This is the unique sequence of monic integer polynomials satisfying
$$x^n - 1 = \prod_{d \mid n} \Phi_d(x)$$
which exist and are unique by Möbius inversion. Then:

Claim: If $a$ is an integer, then all the prime factors $p$ of $\Phi_n(a)$ which do not divide $n$ are congruent to $1 \bmod n$.

This result can be used, among other things, to prove that there are infinitely many primes congruent to $1 \bmod n$ in an elementary way without the full strength of Dirichlet's theorem.
Sketch. Let $p$ be a prime not dividing $n$ which divides $\Phi_n(a)$. The idea is to show that $\Phi_n(a) \equiv 1 \bmod p$ if and only if $a \bmod p$ has multiplicative order $n$ in the group of units $\mathbb{F}_p^{\times}$. Since by definition $\Phi_n(a) \mid a^n - 1$ we have that $a^n \equiv 1 \bmod p$, so $a$ has order dividing $n$. Letting $f(x) = x^n - 1$, we have that since $f'(x) = nx^{n-1}$ is nonzero $\bmod p$ by hypothesis, the roots of $f(x) \bmod p$ all have multiplicity $1$, and since by definition
$$x^n - 1 = \prod_{d \mid n} \Phi_n(x)$$
it follows that $\Phi_d(a) \not \equiv 0 \bmod p$ for all proper divisors $d$ of $n$ (or else $a$ would be a root of multiplicity greater than $1$), hence that $a^d \not \equiv 1 \bmod p$ for all proper divisors $d$ of $n$. So $a \bmod p$ has order exactly $n$ as desired.
Since $\mathbb{F}_p^{\times}$ has order $p-1$, by Lagrange's theorem $p-1$ must be divisible by $n$. $\Box$
This result strongly suggests that your polynomial $f(x) = 1 + 10x + 50x^2 + 125x^3 + 125x^4$ is related to $\Phi_5(x) = 1 + x + x^2 + x^3 + x^4$ in some way. We can relate them as follows:
$$\begin{eqnarray*} 5f(x) &=& 5 + 10(5x) + 10(5x)^2 + 5(5x)^3 + (5x)^4 \\
 &=& \frac{(5x + 1)^5 - 1}{5x} \\
 &=& \Phi_5(5x + 1). \end{eqnarray*}$$
So $f(x) = \frac{(5x + 1)^5 - 1}{25x}$ as Peter says in the comments. So if $p \neq 5$ is a prime dividing $f(a)$ for some integer $a$ then $p$ divides $\Phi_5(5a + 1)$ and then the claim above shows that $p \equiv 1 \bmod 5$. Moreover, since $f(a) \equiv 1 \bmod 5$, $p$ is never equal to $5$.
Comment: shouldn't it be $\prod\limits_{d \mid n} \Phi_d(x)$ and not $\prod\limits_{d \mid n} \Phi_n(x)$? Otherwise, everything else makes sense. thanks
Answer: As Peter's comment states,
$$b = \frac{(5a+1)^5-1}{25a}$$
Thus, for any prime $p \mid b$, then also $p \mid (5a+1)^5 - 1$. Using the multiplicative order, with
$$m = \operatorname{ord}_p(5a+1)$$
then $m \mid 5$. However, $m \neq 1$ since $(5a+1)-1 = 5a$ and $\gcd(5a, b) = 1$, so $m = 5$. Both Fermat's little theorem and Euler's totient function give that $(5a+1)^{p-1}\equiv 1\pmod{p}$, which means that
$$5 \mid p - 1 \; \; \to \; \; p \equiv 1 \pmod{5}$$


AM-GM inequality.

Question:
By the AM-GM Inequality, we know that
$$(2^{1-x} + 2^{x+1} + 3^{x} +3^{-x})/4\geq(2^{1-x}\cdot2^{x+1}\cdot3^{x} \cdot3^{-x})^{1/4}$$
By solving this, we get
$$(2^{1-x} + 2^{x+1} + 3^{x} +3^{-x})/4\geq\sqrt{2} \\ \implies f(x)\geq2\sqrt{2}$$
However, if AM-GM is applied separately, we get
$$(2^{1-x} + 2^{x+1})/2\geq[2^{1-x}\cdot2^{x+1}]^{1/2} \\
(2^{1-x} + 2^{x+1})\geq4, \\ ( 3^{x} +3^{-x})/2\geq(3^{x}\cdot3^{-x})^{1/2}\\
3^{x} +3^{-x}\geq2\\
\implies f(x)\geq3$$
Why are the results different?
Comment: Please edit your question. It's impossible to read in this state.
Comment: The results are different because in the first case there does not exist any value of $x$ such that all the four numbers are equal, so you cannot get the real minimum of the function. Whereas in the second case there exists one value of $x$ such that the two numbers are equal every time you apply the AM-GM inequality.
Comment: The results are different, but not contradictory. For example, both $\sin x \ge -1$ and $\sin x \ge -1001$ hold true for all real $x$, though obviously $-1 \ne -1001$. Maybe you should add some details about what your actual reason was for using AM-GM in the first place.
Comment: A simpler example: $4 = \sqrt{ 4 \cdot 4} \le \frac 12 (4 +4) = 4$ and $4 = \sqrt{2 \cdot 8} \le \frac 12 (2 + 8) = 5$ are both true.
Comment: And also your graph is different from what you wrote. Please clarify.
Answer: In the first inequality, we have $$\frac{2^{1-x} + 2^{x+1} + 3^{x} +3^{-x}}{4}\geq\sqrt{2}\implies f(x)\geq2\sqrt{2}$$
However, its equivalent condition is:
$2^{1-x} = 2^{x+1} = 3^{x} = 3^{-x}$, which has no solutions, so $f(x)>2\sqrt2$.
(By $3^x=3^{-x}$, we have $x=0$, but $2^{0+1}\neq3^0$)
In the second one, the equivalent condition is:
$2^{1-x} = 2^{x+1}, 3^{x} = 3^{-x}$, which implies $x=0$.
So $f(x)\geq f(0)=3$, then we have the minimum of $f(x)$ is $3$.
In this case, $f(x)\geq f(0)=3>2\sqrt{2}$, so the first inequality still holds.

AM-GM inequality.


Unit Testing UIElements

Question: Let me just start by saying that I'm new to Unit Testing and it's actually the first time I'm trying to do it.
I am developing an application where a user can add elements to a Canvas, select them, move them around and so on. On each selected element I add an Adorner. When the control is deselected the adorner is removed.
I have a method that receives a UIElement and removes the Adorner and that is the method I'm testing.
The method I'm using to remove the adorner is:
public static void ClearElementAdorners(UIElement element)
{
    IEnumerable<Adorner> a = AdornerLayer.GetAdornerLayer(element).GetAdorners(element).AsEnumerable<Adorner>();
    if (a != null)
    {
        a.ToList().ForEach((p) =>
        {
            AdornerLayer.GetAdornerLayer(element).Remove(p);
        });
    }
}

The method I'm using to test is this one.
[TestMethod]
public void ClearElementAdornersUnitTesting()
{

    Button el = new Button();
    Button el2 = new Button();
    TestingWindow t = new TestingWindow();
    t.Show();

    t.TestingCanvas.Children.Add(el);
    t.TestingCanvas.Children.Add(el2);

    AdornerLayer alayer = AdornerLayer.GetAdornerLayer(el2);
    alayer.Add(new ClassLibrary.EditModeAdornerLayer(el2));

    ClassLibrary.AdornerOperations.ClearElementAdorners(el2);
    Assert.AreEqual(el, el2);
}

What I'm doing is creating two buttons. One of them gets an adorner and the other one stays as control for the test. I remove the adorner from the element and at the end check if they are equal. I have debugged the method to remove the adorner and I know it's working. What I don't know is how to test it. The Assert.AreEqual always fails with this error.
{"Assert.AreEqual failed. Expected:<System.Windows.Controls.Button>. Actual:<System.Windows.Controls.Button>. "}

Again this may be totally wrong, but how can I run this test? If more information is needed I will gladly provide it.
Thanks
The right way of doing this is:
Adorner[] adorner = AdornerLayer.GetAdornerLayer(el2).GetAdorners(el2);
Assert.IsNull(adorner);

Comment: To be a pain in the ass: This is not a unit test. It is more of an integration test because of the huge number of things that are involved to get these kinds of test going.
Answer: The buttons are not the same but at the end you are testing as if they were. The first button does not have anything to do with it. Remove it and just test for the adorner layer being empty afterwards.
Comment: I guess I could do it like this: Adorner[] adorner = AdornerLayer.GetAdornerLayer(el2).GetAdorners(el2);
            Assert.IsNull(adorner);
Comment: You are clearing the layer and that is what you should be testing for. The other button is not necessary at all.
Comment: yes that makes sense. The previous code I posted works and the test passes. Thanks for your help.

Unit Testing UIElements


Is there a CKeditor / Drupal module that allows for a one-button image upload (without requiring Flash)?

Question: Background:
I'm looking to add an image upload button to CKeditor. Ideally, I'd like to automated the click responses to start IMCE and jump right to the IMCE Upload button. In fact, I'd like to put the IMCE upload button on CKeditor's tool bar.
My Question:
Is there a way to put the IMCE Upload button directly onto the CKEditor tool bar just like we have here in side of StackExchange?
What I've seen/tried:
I've seen other methods recommending One Click Upload but this uses SWFloader. The Media module is great but people want a direct upload from inside the editor. They don't want to jump to another screen.
Answer: The Insert module should be perfect for this https://www.drupal.org/project/insert

Insert is a utility that makes inserting images and links to files
  into text areas or WYSIWYGs much easier. It adds a simple
  JavaScript-based button to FileField and ImageField widgets. When used
  with ImageField and ImageCache, images may be inserted into text areas
  with a specific ImageCache preset.
This module was previously known as FileField Insert.
Comment: Please also provide module descriptions when linking to Drupal modules.


Erro no insert no banco de dados

Question: Bem estou desenvolvendo um inventário de TI além de dar alguns erro , ao inserir um hd de 80 ele só salva o zero e os outros dados não são inseridos tambem. como posso resolver isso .

Esse é o código
<form method="post" action="cadastrando.php" onSubmit="">
    <fieldset>
        <legend>Sistema de Inventário</legend>

        Setor:
        <input class="form_inp" type="text" name="setor" size="30" required>

        Usuário:
        <input class="form_inp" type="text" id="usuario" name="usuario" size="30" required>

        O/S :
        <input class="form_inp" type="text" name="os" size="30" required>

        Hd :
        <input  class="form_inp"type="text"  name="hd" size="30" required>

        Memória:
        <input class="form_inp" type="text" id="" name="memoria" size="30" required>

        Processador:
        <input class="form_inp" type="text" id="processador"  name="processador" size="30" required>

        Cd/Dvd:
        <select class="form_inp"  name="cd">
            <option value="Sim">Sim</option>
            <option value="Não">Não</option>
        </select>

        Placa Mãe:
        <input class="form_inp" type="text" id="placam" name="placam" size="30" required>

        HostName:
        <input class="form_inp"type="text" id="host" name="host" size="30" required>

        Monitor/Patrimônio/Marca/Modelo:
        <input class="form_inp" type="text" id="monitor" name="monitor" size="30" required>

        Nobreak/Patrimônio/Marca/:
        <input class="form_inp" type="text" id="nobreak" name="nobreak" size="30" required>

        Placa de Rede :
        <input class="form_inp" type="text" id="placar" name="placar" size="30" required>

        Placa de Vídeo:
        <input class="form_inp" type="text" id="placav" name="placav" size="30" required>

        <input type="submit" style="float: right;" value="Cadastrar" >
        <input type="reset" style="float: right;" value="Limpar">

    </fieldset>
</form>

<?php
    if($_SERVER['REQUEST_METHOD'] == 'POST') {
    print_r($_POST);
    $setor=$_POST['setor'];
    $usuario=$_POST['usuario'];
    $hd=$_POST['hd'];
    $memoria=$_POST['memoria'];
    $processador=$_POST['processador'];
    $cd=$_POST['cd'];
    $placam=$_POST['placam'];
    $host=$_POST['host'];
    $monitor=$_POST['monitor'];
    $nobreak=$_POST['nobreak'];
    $placar=$_POST['placar'];
    $placav=$_POST['placav'];
    $sql="INSERT INTO setor(setor,usuario,hd,memoria,processador,cd,placam,host,monitor,nobreak,placar,placav) VALUES('$setor','$usuario','$hd','$memoria','$processador','$cd','$placam','$host','$monitor','$nobreak','$nobreak','$placav')";
    $resultado_cadastro = mysqli_query($link,$sql);
}

    ?>

E outro erro que dar é o seguinte , por que tá dando esse erro se tá tudo certo , ficarei grato.
Answer: Pela action do teu form, a parte php deve estar dentro do ficheiro cadastrando.php.
Os erros depois, se estou a pensar bem, consegues resolver com uma simples verificação do metodo http que foi usado para fazer a requisição dentro do ficheiro cadastrando.php:
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST') {
    $setor=$_POST['setor'];
    $usuario=$_POST['usuario'];
    $hd=$_POST['hd'];
    $memoria=$_POST['memoria'];
    $processador=$_POST['processador'];
    $cd=$_POST['cd'];
    $placam=$_POST['placam'];
    $host=$_POST['host'];
    $monitor=$_POST['monitor'];
    $nobreak=$_POST['nobreak'];
    $placar=$_POST['placar'];
    $placav=$_POST['placav'];
    $sql="INSERT INTO setor(setor,usuario,hd,memoria,processador,cd,placam,host,monitor,nobreak,placar,placav) VALUES('$setor','$usuario','$hd','$memoria','$processador','$cd','$placam','$host','$monitor','$nobreak','$nobreak','$placav')";
    $resultado_cadastro = mysqli_query($link,$sql);
}
?>

Para testar isto podes colocar dentro deste if acima o seguinte:
...
print_r($_POST);
...

E depois vês se imprime os dados que preencheste no formulário, depois sabes que podes fazer o que tens a fazer com eles.
Mas, lembra-te que tens de declarar a tua conecção que está na variável $link antes da inserção efetiva na BD, pelo que vejo não estás a declara-la/importa-la em lado nenhum
Nota que podes deixar o teu php no mesmo ficheiro do formulário, mas tens de apagar 'action="cadastrando.php"' dentro do <form ..., e usa o mesmo pedaço de código que coloquei acima
Comment: Os erro saíram mais não tá fazendo fazendo o insert dos dados . atualizei o código a cima .
Comment: Não mudei e já confirmei sua resposta
Comment: Deves colocar outra pergunta com tudo o que for relevante à tua connecção e maneira que estás a inserir os dados, escusas de colocar o HTML. Eu vou tentar ajudar @allanaraujo , aqui já não faz sentido nem consigo perceber o porquê, de não estar a inserir. Dá algum erro? Estás com a variável `$link` ok?
Comment: farei isso . e colocarei todo código
Comment: @allanaraujo, o html não precisas, se já estás a receber os dados, faz esse teste que te digo em cima para testar isso. Mas se vires os dados que preencheste no form não coloques o html que não é preciso
Comment: já coloquei  a pergunta.

Erro no insert no banco de dados


Radius of Convergence for series in $z^{3n}$ using Cauchy-Hadamard formula

Question: If
$∑
a_nz
^n$ has radius of convergence R, use the formula $R = \left( \limsup_{n \to \infty} | a_n |
 ^{\frac{1}{n}} \right)^{-1} $
to
find the radius of convergence of
$∑
a_nz^{
3n}$
I tried to solve this question using the ratio test, I got an answer of $R^{\frac{1}{3}}$, however, I am not sure how to solve it using Cauchy-Hadamard formula.
Any hint will be appreciated.
Comment: The series is $\sum b_nz^{n}$ where $b_n=0$ if $n$ is not a multiple of $3$ and $a_{n/3}$ if $n$ is a multiple of $3$.
Answer: For each $n\in\Bbb Z_+$, let$$b_n=\begin{cases}a_{n/3}&\text{ if }3\mid n\\0&\text{ otherwise.}\end{cases}$$Then $\sum_{n=0}^\infty a_nz^{3n}=\sum_{n=0}^\infty b_nz^n$ and, for each $n\in\Bbb N$,$$\sqrt[n]{|b_n|}=\begin{cases}\sqrt[n]{|a_{n/3}|}=\sqrt[3]{\sqrt[n/3]{|a_{n/3}|}}&\text{ if }3\mid n\\0&\text{ otherwise}\end{cases}$$and therefore$$\limsup\nolimits_n\sqrt[n]{|b_n|}=\sqrt[3]{\limsup\nolimits_n\sqrt[n]{|a_n|}}.$$
Comment: Thanks again sir, much appreciated


Existence of a sequence of continuous functions convergent pointwise to the indicator function of irrational numbers

Question: Prove that there does not exist a sequence of continuous functions $
f_n :\left[ {0,1} \right] \to R
$ such that converges pointwise, to the function
$$f(x)=
  \begin{cases}
    0 & \text{if $x$ is rational},\\\\
    1 & \text{otherwise}.
  \end{cases}.
$$
I have no idea How can I prove this. Prove that there no exist such sequence if the convergence is uniform, it's easy, because the limit would be continuous, but here I don't know How can I do. I suppose that some "nice" properties are "preserved" in the limit, in this kind of convergence, but I don't know any of them.
Comment: It's a theorem of Baire. In his answer in the thread mentioned above LostInMath points to Theorem 1.19 on page 20 of Bruckner, Bruckner & Thomson *[Real analysis](http://books.google.com/books?id=1WY6u0C_jEsC&pg=PA20)* (if you can't access that page, changing google.com to google.cl may help)
Comment: Does this answer your question? [Pointwise limit of continuous functions is 1) measurable and 2) pointwise discontinuous](https://math.stackexchange.com/questions/75192/pointwise-limit-of-continuous-functions-is-1-measurable-and-2-pointwise-discon)
Comment: I said that I **didn't** vote to close and I meant it. Still, the point is that the set of discontinuity of a pointwise limit of continuous functions is a set of [first category](http://en.wikipedia.org/wiki/Meagre_set), while your function is discontinuous everywhere.
Comment: Wow! That´s nice!!!  where can I find a proof of this fact? Or at least the name of the theorem, to find it´s proof
Comment: Jeeze. how can cambridge set something like this for an analysis II question...
Comment: I'm not voting to close, but this question is essentially a duplicate of http://math.stackexchange.com/q/75192/
Comment: Ok, closed it , if you want, I did not see that post
Comment: Ok, closed it , if you want, I did not see that post, I think that you are exagerating, but I don´t know what it is measurable functions , and this kind of things :S
Comment: See also: http://math.stackexchange.com/questions/541619/proof-that-a-sequence-of-continuous-functions-f-n-cannot-converge-pointwise
Answer: The reason (given in comments) that $f$ is not a pointwise limit of continuous functions is that $f$ is discontinuous everywhere, while pointwise limits of continuous functions have a comeager set of points of continuity. The latter fact is proved here, additional details are given here, and a textbook reference is: Theorem 1.19 on page 20 of Real analysis by Bruckner, Bruckner & Thomson.
Answer: Here is a simple solution to this old posting.
Suppose $(f_n:n\in\mathbb{N})\subset \mathcal{C}(\mathbb{R})$ is such that
$f_n\xrightarrow{n\rightarrow\infty}\mathbb{1}_{\mathbb{Q}}$ pointwise. Define the sets
$$E_n:=\bigcap_{m\geq n}\{x\in\mathbb{R}:|f_m(x)|\leq\frac12\}$$
Each $E_n$, being the intersection of closed sets, is closed.
If $x\in E_n$, then $|f_m(x)|\leq\frac12$ for all $m\geq n$ and so, $\mathbb{1}_{\mathbb{Q}}(x)=\lim_nf_n(x)\leq\frac12<1$, each means that $x$ is irrational. Hence $E_n$ is a nowhere dense closed set.
Conversely,  $\mathbb{R}\setminus\mathbb{Q}\subset \bigcup_nE_n$ since for each irrational $x$, $f_n(x)\xrightarrow{n\rightarrow\infty}0$.
Hence
$$\mathbb{R}\setminus\mathbb{Q}=\bigcup_nE_n$$
and so, $\mathbb{R}\setminus\mathbb{Q}$ is a set of first category.
This implies that $\mathbb{R}=\big(\mathbb{R}\setminus\mathbb{Q}\big)\cup\mathbb{Q}$ is of first category. We know from Baire's theorem that $\mathbb{R}$ (with the usual topology) is of second category: contradiction!


Replace entire DIV with a custom DIV using JQuery in a Chrome extension

Question: I'm building an extension in Chrome for an internal tool we use. We have had this tool for a few years and the navigation menu has never worked in Chrome. The developers refuse to fix it. So part of what I am attempting to do with my extension is to replace the menu with a functioning menu.
Currently the menu is wrapped in a DIV. I want to replace that entire DIV with a new DIV with a working menu. At first I thought it would easy enough to use JQuery's replaceWith() function but replaceWith() only seems to work on single pieces of code. I was able to easily replace the entire Menu with a single element. Then I came across .load() but I was not able to successfully get the .html file in the extension folder to actually load.
I shortened this menu but it is an example of the current DIV:

Home

New Ticket Expand New Ticket

And I basically want to replace it with something like:

Home

New Item

New Item2

Comment: But the items in your example do not match the items in your desired outcome. Where is "New Item" and "New Item2"?
Comment: Terry - The  stuff is going to replace everything in the  so really the DIV stays but everything between  gets replaced with the  stuff.
Answer: Simply loop through the children in the
 and replace them with
, and then finally replace the parent element with
:
$(document).ready(function() {
    var $menu = $("#ctl00_MasterMenu");

    $menu.children("span").each(function(index) {
        $(this).replaceWith("
"+$(this).html()+"
");
    });

    $menu.replaceWith("
"+$menu.html()+"
");
});

See fiddle here - http://jsfiddle.net/teddyrised/fuE37/
Answer: Something like this might do the trick:
// store the parent div's info
var $parent = $('#ctl00_MasterMenu');
var parentID = $('#ctl00_MasterMenu').attr('id');
var parentClass = $('#ctl00_MasterMenu').attr('class');
var parentStyle = $('#ctl00_MasterMenu').attr('style');

// create li elements for each of the spans
$parent.children().each(function(index, child){
    $(child).replaceWith('
'+$(child).html()+'
');
});

// create the ul element and copy the attributes
$parent.children().wrapAll('
');

// remove the old div
$parent.replaceWith($parent.html());

Demo: http://jsfiddle.net/louisbros/aMm5t/1/


What is bias in aerosol data?

Question: I was reading this information related to aerosol, especially aerosol optical depth of the MISR and MODIS instruments. I didn't actually get what bias means in the context of the AOT retrievals of these instruments.
Answer: These instruments sense reflectance from the earth's surface in several spectral bands. A theoretically motivated, but somewhat ad hoc, formula is used to estimate aerosol properties from carefully pre-processed sensor data. Because the relationships among the aerosol properties and what is measured by the instrument are nonlinear, complex, and potentially affected by extraneous factors (for example, a separate formula altogether is used for land versus water), it is essential to "field truth" the results through comparison to independent objective aerosol measurements.
This is a form of calibration.  In calibrating any instrument we recognize that the instrument's readings may--for certain ranges of readings or combinations of underlying conditions--have a different value, on average, than the true value.  Bias is the numerical difference between the average instrument reading and the true value. A "high" or positive bias occurs when the instrument reading is greater than the true value on average; otherwise, the bias is either zero or negative.
Bias typically varies from one value to another. For example, p. 65 of the MODIS algorithm documentation (2009) compares MODIS to AERONET sunphotometer values to "validate" the MODIS results.  The bias is depicted by the vertical discrepancies between the plotted points and an imaginary diagonal line with equation $y=x$.
The bias will be estimated by collecting pairs of (field truth, instrument) readings. It is rare to see any distinction made between the true bias (how the instrument actually behaves on average) and estimates of the bias; the word "bias" loosely applies to both concepts.  The two values will be close when the estimates are made from many independent pairs of readings.
Finally, the results of such measurements should be expressed using methods of "inverse regression," or a generalization thereof, as explained in a summary by Lavagnini & Magno writing in Mass Spectrometry Reviews (2007).  This procedure aims to put "error bands" around the true value, given the instrument reading.  After all, in practice, you will be relying on the instrument reading--you won't have anything better at most locations--so you will want some measure of how reliable those readings might be.  Don't expect to see very many applications of this procedure, though: it seems not to be well enough known in many fields.

What is bias in aerosol data?


Trig Differentaition

Question:
Differentiate $y=27 \sec^3(x)$ with respect to $x$.

I tried splitting the $\sec^3(x)$ into $\sec^2(x)\cdot \sec(x)$ and using the product rule but that didn't work.
Comment: Why not directly apply the chain rule?
Answer: $$y=27 \sec^3(x)$$
$$y=27 \times(\sec (x))^3$$
Now apply the chain rule...
The "outside" function is the function 'to cube'
The "inside" function is the $\sec(x)$
So focusing on the cube on the "outside"...
$$y=27 \times (inside)^3$$
$$\frac{dy}{dx}=27\times 3 \times (inside)^2 \times (derivative-of- inside)$$
then focussing on the "inside"...
$$\frac{dy}{dx}=27\times 3 \times (\sec(x))^2 \times (derivative-of- \sec(x))$$
$$\frac{dy}{dx}=27\times 3 \times (\sec(x))^2 \times (\sec(x)\tan(x))$$
$$\frac{dy}{dx}=81\times (\sec(x))^3 \times \tan(x)$$
$$\frac{dy}{dx}=81 \sec^3(x) \tan(x)$$
Comment: Okay, so then it'd just be simple differentiation, by multiplying the co-efficient by 3, reducing the power by one and then multiplying by the differential of the function which would be 1?
Comment: Hope that makes sense, it's looks more complicated when it's written out than when you do it - This is the way most schools teach students to think about it rather than the formal substitution method that gets written in a text book - but go with whatever works for you
Answer: If $y = 27\sec^{3}(x)$, then you can find $y'$ in a couple of ways.
Using the method you suggested:
$$y = 27\sec^{3}(x) = 27\sec^{2}(x)\cdot\sec(x)$$
Applying the product rule, we have:
$$y' = 27\dfrac{d}{dx}\big[\sec^{2}(x)\cdot\sec(x) \big] = 27\bigg(\dfrac{d}{dx}\big[\sec^{2}(x)\big]\cdot \sec(x) + \sec^{2}(x)\dfrac{d}{dx}\big[\sec(x)\big]\bigg)$$
One would need to find $\dfrac{d}{dx}\sec^{2}(x)$ by the chain rule (or by applying the product rule again).
By the chain rule:
$$y = (f\circ g)(x) = f(g(x)),\quad \text{ where } g(x) = \sec(x),\quad f(x) = 27x^3$$
Then $$y' = f'(g(x))\cdot g'(x) = 3\cdot (\sec(x))^2 \cdot g'(x)$$
Does this make sense?
Comment: Yes, but I think I'll go with the substitution method someone else provided. Seems simpler and thank you for the effort you put into answering.
Answer: Rewrite $y=z^3$ where $z=3\sec x$. As $z$ is a function of $x$ $$\dfrac{dy}{dx}=3z^2\cdot \dfrac{dz}{dx}\;\text{with}\;\dfrac{dz}{dx}=3\sec x\tan x$$ So $$\dfrac{dy}{dx}=27\sec^2 x\cdot(3 \sec x\tan x)$$

Trig Differentaition


Why do these 2 congruences imply the following?

Question: Suppose the following 2 congruences hold
\begin{equation*}
(x + \alpha)^n \equiv x^n + \alpha \hspace{4mm} (\text{mod} \hspace{2mm} x^r - 1, \hspace{2mm} p) \\
(x + \alpha)^p \equiv x^p + \alpha \hspace{4mm} (\text{mod} \hspace{2mm} x^r - 1, \hspace{2mm} p)
\end{equation*}
I am told that this implies the congruence
$$
(x + \alpha)^\frac{n}{p} \equiv x^\frac{n}{p} + \alpha \hspace{4mm} (\text{mod} \hspace{2mm} x^r - 1, \hspace{2mm} p)
$$
Can any one please explain to me why this is?
Answer: Do you mean $\mod {(x^r-1,p)}$? I assume this.
The only possibilities for $(x^r-1,p)$ are $1$ and $p$.
►$(x^r-1,p)=p$
Because of the well known property  $(x+y)^p\equiv x+y\pmod p$ we have
$$(x+a)^{\frac np}\equiv x^{\frac np}+a\pmod p\iff(x+a)^n\equiv(x^{\frac np}+a)^p\equiv x^n+a$$ Therefore  only the first condition implies the condition to be proven.
►$(x^r-1,p)=1$
This case is trivial in the sense that all pair of integers are equivalent modulo $1$.
Comment: Thank you for your response. Unfortunately, I am still unsure as to why that property implies the $\iff$ statement?
Comment: In particular, I am unsure of where the $(x^{\frac np}+a)^p$ term came from?
Comment: Raised to the p-th power both members of the first equation.
Comment: Thanks, I have marked this as my accepted answer. On one final note, do you know where I might find a reference for the stated property?
Comment: I am terribly sorry, but I am still struggling to understand this. May I refer you to this question (https://math.stackexchange.com/questions/2687739/given-xan-equivx-frac-npap-equiv-xna-prove-that-xa-frac-np?noredirect=1#comment5553514_2687739)?


Top 3 os maiores números da lista e seus índices

Question: Tenho a lista [5, 7, 2]. Preciso criar outra lista contendo os índices desta lista, ordenados de forma que o primeiro índice corresponda ao maior elemento da lista, o segundo corresponda ao segundo maior e assim por diante - ou seja, [1, 0, 2].
Só consegui mostrar um número da lista por vez:
Índice : 1
Números: 7
O que eu não entendo é como montar o for para aparecer os índices e seus valores.
lista = [5, 7, 2]

ind_num = lista.index(max(lista))

print('Maior elemento: ',max(lista))

print('Indice: ', (ind_num))

Comment: Lucas, poderia ser mais claro? Cada elemento de uma lista (o que acredito que deva ser seu caso, possui um índice próprio, começando do zero). Edit: Entendi seu caso, irei elaborar  a resposta.
Comment: Os elementos de uma lista são os seus valores por lista = [5, 7, 2], os elementos dessa lista são 5, 7, 2 e sues incides começando pelo 0 ou seja os maiores estão nos índices 1, 0, 2
Answer: Uma alternativa é:
lista = [5, 7, 2]
indices = sorted(range(len(lista)), key=lambda i: lista[i], reverse=True)
print(indices) # [1, 0, 2]

range(len(lista)) cria uma sequência com todos os índices da lista (no caso, serão os números 0, 1 e 2).
Em seguida sorted ordena esses índices, mas em vez de levar em conta o seu valor, ele considera o respectivo valor dele na lista original - é isso que o lambda passado para key faz: para cada índice i, o valor que será levado em conta na ordenação é lista[i].
Por fim, usamos reverse=True para que ele ordene do maior valor para o menor.
O resultado é a lista [1, 0, 2].


First sheaf Cohomology on $\mathbb C$

Question: If E is a holomorphic vector bundle on $X= \mathbb C$

is it true that $H^1(X,E)=0$?

I know it's true for $E=O_X$ the sheaf of holomorphic functions by Dolbeaut theorem.
Answer: Yes, in general if $E$ is a holomorphic vector bundle over a Stein manifold $X$, then $H^p(X,\mathcal{O}(E))=0$ for all $p\geq 1$, by Cartan's theorem B.

First sheaf Cohomology on $\mathbb C$


Condition under which the subring of multiples of an element equal the ring itself?

Question: Let $R$ be a commutative ring with identity with $b\in R$. Let $T$ be the subring of all
multiples of $b$, $T=\{r\cdot b : r \in R\}$. If $u$ is a unit in $R$ with $u \in T$,
prove that $T=R$.
Could you help me some suggestions?
I really have no clues to do this questions, I can only show $1\cdot R$ belongs to $T$. I even don't know the general way to prove two rings are equal.
Comment: Hint: Here "equal" means equality as sets, so you need to show that every element of $R$ is contained in $T$.
Comment: Do you know how to show that two sets are equal?
Comment: Yeah, just show T contains R and R contains T.Here, it is easy to show T is subring of R, I try to show R is subring of T, but I failed.
Comment: Hint: T contain a unit, and is closed under multiples. But every element is the multiple of a unit so ...
Comment: I do not understand your comment.
Comment: What part don't you understand? Note: you need to write @username in order for the user to be notified of your comment. You can complete usernames using the Tab key, e.g. @Bill
Comment: You don't necessarily know that $b$ is a unit; but you do know that $u$ is a unit, and therefore all multiples of $u$ are also in $T$ (since if $x=q\cdot u$, then $x=q\cdot (r\cdot b)=(q\cdot r)\cdot b\in T$).  Now what do you know about multiples of a unit....
Comment: @Bill Dubque Thank you. I got you, and what next?  Sorry, I am still confused
Comment: For example, if $\,2\in T\,$ then, since $T$ is closed under multiples, it contains all multiples of $2$. Similarly, if $\,u\in T\,$ then $T$ contains all multiples of $u$. Thus, since every element is a multiple of a unit $u$, we infer that $T$ contains every element of $R$.
Answer: The critical thing to realize here is that if $u$ is a unit, and $u = ab$, then $a$ and $b$ are both units.  For if $u$ is a unit, then $uv = 1$ for some $v \in R$, so that $1 = (ab)v = a(bv) = b(av)$, where we have used the commutativity of $R$.  So $u \in T$ a unit implies $b \in T$ is a unit is well, since $u = ab$ for some $a \in R$.  Now since $b \in T = Rb$ is a unit, for any $s \in R$ take $r = sb^{-1} = s(av)$.  Then $s = s1 = sb^{-1}b = rb \in Rb = T$, so in fact $R \subset T$.
Hope this helps.  Cheerio,
and as always,
Fiat Lux!!!
Comment: There's no need to deduce that $b$ is a unit since we are already given a unit $\,u\in T,\,$ see the comments to the question.
Comment: @BillDubuque:  yes, I do believe you are correct, but I thought, since $T = Rb$, it might be a little more clear to make it explicit.  Clearer to me, in any event.  Thanks for the input.  Best.
Comment: I am really appreciative with both of your comments, sincerely thank you.
Comment: @user127534:  Thank you very much, and glad I could help out.
Comment: @RobertLewis  Just a little confusing, why do you take r=sb^-1 ?
Comment: @user127534:  we have $T \subset R$, and we want to show $R \subset T$ so we can affirm $R = T$.  Now $T$ is the set $Rb$ of all multiples of $b$ in $R$.  So taking $r = sb^{-1}$ for $s \in R$ gives an element of $R$ which when multiplied by $b$, yields $s$, so we can see explicitly that $s \in T = bR$.  Just a little trick, really.  Does that clarify?  If not, please leave a comment and I'll get back to you.  OR if you have any other questions . . .
Comment: @RobertLewis My question is we want to prove s=br, but you just let r=sb^-1, which I feel is just another way to say s=br. What you suppose is what we want to prove.
Comment: @user127534:  we need to show every $s \in R$ is of the form $rb$ for some $r \in R$.  Given that $b \in T$ is a unit, I need *some* element of $r \in R$ with $s = rb$.  I know $s$, presumably, so I can exhibit $r$ by saying $r = sb^{-1}$.  You start with $s$, then find $r$.  That's the order of the logic, though it is in effect another way of saying $s = br$.  But it starts from what we have, and establishes what we need.  Do these remarks help?
Comment: @RobertLewis Now I feel this is the trickiest part of this problem.
Comment: @user127534:  It is a *little* tricky, but not very, and it's a common trick that occurs in many places.  All I want do to is show *every* $s \in R$ can be written $rb$ for some $r \in R$.  So I just "solve" the equation $s = rb$, using the fact that $b$ is a unit.  I know it seems tricky at first, but you'll see this trick again and again in your mathematical studies and career, I'll betcha!
Comment: @RobertLewis Again, really thanks for your help! This is my first time to study abstract algebra. I definitely need to practice more.
Comment: @user127534:  well, we all need to practice more, and it really *does* help.  These things become second nature with time, though they seem sort of odd at first.  Best of luck, and feel free to ask if you have further questions!  Regards.
Comment: @user127534 It's not a trick - see my answer where I explain the conceptual foundations.
Answer: I'd like to dispel the notion in the comments that the key idea is a "trick". Instead, I will show that it boils down to the transitivity of "contains" or  "divides" (i.e. $\ b\mid c,\,\ c\mid d\ \Rightarrow\ b\mid d),\ $  using the following simple but fundamental correspondence (ubiquitous in divisibility theory)
Theorem $\ \ bR \supseteq aR\iff b\mid a\,$ in $\,R\quad$ [Contains = Divides for principal ideals]
Proof $\ (\Rightarrow)\,\ a = a\cdot 1\in aR\subset bR\,\Rightarrow\, a = br,\ $ for some $\,r\in R,\,$ so $\,b\mid a\,$ in $R.$
$(\Leftarrow)\ \ b\mid a\,$ in $R\,\Rightarrow\, a = br,\ $ for some $\,r\in R,\ $ so $\ aR = brR\subseteq bR,\,$ by $\,rR\subseteq R.\  $ QED
Corollary $\ $ If $\,c\in bR\,$ and $\,c\mid d\,$ then $\,bR \supset dR$.
Proof $\ $ Translating containment relations to corresponding divisibilty relations we obtain $\ c\in bR\,\Rightarrow\, b\mid c,\,$ so $\, c\mid d\,\Rightarrow\, b\mid d\,\Rightarrow\, bR\supseteq dR,\,$ by transitivity of "divides" and Theorem. $\  $ QED
Your exercise is the special case of the Corollary when $\,c\,$ is a unit, i.e. $\,cr = 1\,$ for some $\,r\in R,\,$ therefore $\,c\mid 1,\,$ so with $\,d=1\,$ in the corollary, we conclude that $\,bR\,\supseteq\, 1\cdot R = R.\,$ Hopefully this clarifies the motivation behind my hint in the comments to your question.
While imposing this conceptual structure costs slightly more effort, the rewards are great, since this structure plays a fundamental conceptual role in divisibility theory and related algebra. Indeed, if you later study algebraic number theory you will learn that ideals satisfying "contains = divides" play a key role in Dedekind's beautiful ideal-theoretic restoration of unique factorization in algebraic number rings (Dedekind domains are those domains whose proper ideals have prime factorizations (necessarily unique); they are the domains whose ideals satisfy "contains = divides", and a suitable finiteness condition, e.g. Noetherian).
Comment: Excellent expiation! I really learn a lot from your comments. I will definitely learn in-detailed the concepts you mentioned.


Linear dependence of a set of vectors

Question: Is the following a correct description of a linearly dependent set of vectors:
A set of vectors $S$ (in a vector space $V$) is said to be $\textbf {linearly dependent}$  if there exists $\textbf {distinct}$ vectors $ \mathbf{v}_{1}, \ldots , \mathbf{v}_{m} \in S$ and scalars $c^{1}, \ldots, c^{m} \in \mathbb{F}$ (where $\mathbb{F}$ is the underlying scalar field of the vector space $V$), not all of which are zero, such that $$c^{1}\mathbf{v}_{1}+\cdots +c^{m}\mathbf{v}_{m}= \sum_{i=1}^{m}c^{i}\mathbf{v}_{i} = \mathbf{0}$$
What this means is that $\textbf {at least one}$ vector in $S$ can be completely specified in terms of the other vectors in the set and hence is dependent on the remaining vectors in the set $S$. In this sense, if one vector can be 'constructed' from a linear combination of the remaining vectors in $S$, then there is a relationship between these vectors; the existence of this vector in $S$ is dependent on the other (remaining) vectors in the set (i.e. it does not exist independently relative to the set $S$ as it is a combination of the other vectors in the set).
Importantly, however, the property of linear dependence pertains to a set of vectors and $\textbf{not}$ to any particular vector. As such, although relative to a particular set of vectors a given vector may not have an independent existence (as it is formed from a linear combination of the other vectors in that set), when considered individually (outside of any given set of vectors) it does exist as an independent mathematical object.
Comment: Everything you said up until the last paragraph is exactly correct. In the last paragraph, you seem to be conflating linear independence with "independent existence." I'm not sure exactly what you mean by that. All of the vectors in $V$ exist, regardless of which ones can be written as linear combinations of others.
Comment: @Bungo Ah, ok. Yes, I wasn't sure about the last paragraph when I wrote it. I guess I was trying to reiterate that relative to a given set, if a vector is linear combination of the remaining vectors in that set then in a sense it does not have an independent existence in that set, as it resides within the span of the remaining subset of vectors, such that its 'removal' would not affect the number of vectors we could describe with the remaining vectors?!
Comment: P.S. You are correct that linear dependence is a property of *sets* of vectors. For example, think about what it means goemetrically for, say, three vectors to be linearly dependent in $\mathbb{R}^3$. It simply means that all three vectors lie in the same plane. If none of them is the zero vector, and none lie in the same line, then if you remove any of the three vectors (it doesn't matter which one), then the remaining two will be linearly independent.
Comment: What you said in your last comment is mostly correct. However, linear dependence of a set of vectors doesn't necessarily mean that there is a specific vector which is to blame for linear dependence. This *can* be true, for example, if one of them is the zero vector. But it can also mean that you just have too many vectors.
Comment: Yes, I see. I was trying really to give a meaning to the notion of $dependence$ between a set of vectors.
Answer: Yes, this is a correct description.

Linear dependence of a set of vectors


Chrome refresh right-click reload options not available

Question: I'm trying to do a hard reload and empty cache in Chrome because a previously loaded site keeps coming up on the localhost port I'm using.
The problem is the right-click options seem to have stopped working, ie. nothing happens when I right-click on the refresh button and I can only left-click and reload the page normally.
I had the option before so I know it's not the Chrome version I am using. It's pretty annoying. Does anyone know what's happening here?
Thanks in advance!
Answer: Just figured out the basic reason for this - Developer Tools Console must be open to access right-click options on the browser refresh button.
There are two ways to do this. The quickest way is to press F12. You can also right-click anywhere on the page and select Inspect.
I guess it is a feature mostly just for developers and the Chrome team doesn't want regular users accidentally clearing their cache!
Comment: If you still can't right-click, make sure you have dev options opened for the correct window and tab. If you have several instances same app/site open it's an easy thing to overlook. Personally, I think if dev options are opened on any windows/tab on chrome, advanced user interface should be available on all of them
Comment: THanks alot @mikeym. I spend alot time to found what can be problem! Some times i have right-click options but another time i dont have that option. Problem is becouse  Dev Tools not opened. Deam... :D
Answer: Press F12 to open the developer tools and then you can right-click the reload button, and you get three options - Reload, Hard Reload (redownloads images) and Empty Cache and Hard Reload.
Answer: I do have Dev Tools open in Chrome. For the past week or so, right-click no longer works on the toolbar button with the tooltip 'Reload this page, hold to see more options'. Workaround: Left-click to refresh the page and once the page reloads, Right-click on the same toolbar button and the menu appears now.
Comment: I think that Dev Tools has to be open when you first refresh or navigate to the page to enable the menu
Answer: In order for the right-click > empty cache and hard reload option to show, dev tools must be opened AND the mobile view icon must be selected in dev tools (toggle device toolbar), then it should work.
Comment: This has already been said in the 3 other answers, whats the point of this?
Comment: No one else mentioned choosing the mobile view icon. These steps worked for me.
Comment: @Boom100100 It works fine for me without having the mobile view icon selected.
Answer: Updated answer as of September 18, 2023: Open the dev tool by pressing F12, HOLD the SHIFT key and left-click on the refresh button.
Answer: Answer 2023: Left click and HOLD. You can't right click on it any longer.


Developing commercial apps on Windows from Dreamspark

Question: May I develop commercial apps on Windows from Dreamspark? I know, that I can't do this using Dreamspark's Visual Studuo, but if I used Mingw?
Answer: Dreamspark access for Azure offers only the following services:

Web Apps
MySQL DB
VSO (Visual Studio Online)
Application Insights

More about Azure: https://azure.microsoft.com/en-us/documentation/articles/fundamentals-introduction-to-azure/
Answer: Yes you can add development apps from DreamSpark to the Windows Store for commercial gain if your a registered student see the EULA At
https://www.dreamspark.com/Student/Direct-EULA.aspx
see
. No commercial use.
Except as provided below, you may not use the DreamSpark Direct Subscription software for commercial purposes or commercial software application development, publication or distribution unless you first purchase the appropriate commercial license(s) for the software.
• Windows Phone Application Requirements. To commercially publish and distribute a phone-based software application that you developed using the DreamSpark Subscription software, the application must be submitted through the Windows Phone Dev Center (https://dev.windowsphone.com/) for publication in the Windows Phone Store and comply with all applicable Windows Phone Store Application Provider requirements.
• Windows Application Requirements. To commercially publish and distribute a computer-based software application that you developed using the DreamSpark Subscription software, the application must be published in the Windows Store and comply with all applicable Windows Store Application Developer requirements.
• Xbox LIVE Indie Games Development Requirements. To commercially publish and distribute a console-based game or software application that you developed using the DreamSpark Subscription software, the application must be published to Xbox LIVE Indie Games and comply with all applicable Xbox LIVE Indie Games development requirements.
All Student get a FREE Windows Store Developer Account via DreamSpark.com
https://www.dreamspark.com/Student/Windows-Store-Access.aspx


Java libgdx Shooting bullet at direction with constant speed

Question: I am trying to get my bullets to fire towards (input coords) at a constant speed.
So far I was able to get it to shoot at the direction but the farther I click (touch, android game) the faster the bullet goes. I have tried different methods by scaling but failed miserably, I have started coding just a month ago and using this as a project to increase my knowledge of how things work before I work on a full game but having too much trouble with this.
This is what I have been using to get the bullet to move towards the direction I want it to, the codes with // in front were other samples I got while browsing through the internet in hopes of getting what I wanted. I have thought of not using velocity to set the direction, but I have no clue of another method for this.
EDIT: All in short, I cannot get all the bullets to move in the same speed, farther I click, higher velocity bullet has.
Any help guys? Thanks a bunch
Player Class :
    public void update(float delta) {
    if (Gdx.input.isTouched()) {
        if (System.currentTimeMillis() - lastShot >= FIRE_RATE) {
            bullets.add(new Bullet(position.x + 6,position.y + 6,4,4,Gdx.input.getX() / 2,Gdx.input.getY() / 2));
            lastShot = System.currentTimeMillis();
        }
    }
    for (int i=0;i<bullets.size();i++) {
        bullets.get(i).update(delta);
    }
}

Bullet Class :
    public Bullet(float x, float y, int width, int height, float targetX, float targetY) {
    this.width = width;
    this.height = height;
    position = new Vector2( x , y );
    velocity = new Vector2( 0 , 0 );
    velocity.set(targetX - position.x,targetY - position.y);
    //velocity.set(targetX - position.x, targetY - position.y).nor().scl(Math.min(position.dst(targetX, targetY), speedMax));
}

public void update(float deltaTime) {
    //position.add(position.x + speedMax * deltaTime * ax,position.y + speedMax * deltaTime * ay);
    position.add(velocity.x * deltaTime, velocity.y * deltaTime);
    //velocity.scl(1 - (0.98f * deltaTime));
    // Linear dampening, otherwise the ball will keep going at the original velocity forever
    }

Comment: `velocity.set(targetX - position.x,targetY - position.y);` Isn't this why it goes faster the farther you click? Rather: how are you defining your targets?
Comment: @jhobbie Yes, It is why it goes faster, but what I mean is I dont know another method of getting the bullet to move towards the direction of my input (mouse click or touch for phone device).
My targets I define it by using libgdx's Gdx.input.isTouched() then Gdx.input.getX() and Gdx.input.getY()
Answer: Well, normalizing vectors should be rather straightforward. Take your components, square them, and add them together (pythagorean theorem) and then divide each component by this result. I.e. vX = (targetX - position.x)/Math.sqrt(((targetX - position.x) * (targetX - position.x)) + ((targetY - position.y) *(targetY - position.y )))
Then you can multiply vX by some constant, and do the same for a vY and then set your velocity.
Comment: That's pretty much what he already did in the one outcommented line. Just in an object oriented way...
Comment: @jhobbie I have tried adding what you said and It seems the bullets dont move, They are adding to the list and world but do not move at all. I may be implementing this the wrong way, I will experiment more with this formula and see if it works, Ill keep you updated, I have also added the Player Class to my question to see if it helps with more details.
Comment: Just wanted to make sure that you were using `setVelocity()` on my `newX` and `newY`, I labeled them rather poorly
Comment: @jhobbie I am using velocity.set(newX*speedMax,newY*speedMax) speedMax being my constant, it seemed making the constant higher made them move a bit faster, but not accurate, the bullets fly all over the place. I think I may be using it wrong still
Comment: I think I normalized incorrectly, give it another go?
Comment: @jhobbie Cheers man! this worked like a charm. It is now fireing at constant speed no matter the distance I click. Thanks a million man.
Comment: Sorry for the confusion along the way, glad I could help.


Sitefinity 4 - MasterPages

Question: I am running the trial version of Sitefinity 4 RTM.
The great thing about Sitefinity 3.x was that I could port my masterpages from an existing site and they would just work with Sitefinity:  Sitefinity did not inject stuff into the pages, or the content blocks.
However, Sitefinity 4 seems to be injecting its own stuff (styles, etc) into the page that screw up my layouts.
Also, for example the Sitefinity ContentBlocks wrap their content in a  tag.
Is there a way to stop this happening or would I have to rewrite my master pages and style sheets if using Sitefinity 4?
Other issues, eg, setting up a new site are great, but the above is a bit of a killer.
Answer: First, you'll probably want to post this to the Sitefinity forums.  You'll get a lot more attention there.
--
However, here are a few thoughts:

Check out the Design and Skin settings for Sitefinity Widgets.  By default, Sitefinity Widgets get associated with a Sitefinity Skin and some embedded stylesheets.  By switching to a custom skin, you can define your own CSS.
Feel free to modify the templates being used by Sitefinity widgets.  You can define your own HTML.

I'm doing a webinar next week (Real World Project Development with Sitefinity 4.0) that will touch on some of these things.  For those visiting here later, the video can be found on Telerik.TV.
Good luck.
Comment: Thanks the reply, am subscribed to the webinar.  My issue is that I have always just designed the masterpages for the overall site, then reused them in the CMS area of the site.  This strategy doesn't seem to work so neatly in SF4, so really need to know what I have to do to keep a consistent look and feel between standard pages and Sitefinity pages... and how much more work this represents.  I can see that the new layouts eliminate the need for nested masterpages, which is great, but is my base design that is giving me problems.  Also, the trial version won't run the Charity SDK...
Answer: Once you integrate master page from an existing site, no need to add  attribute block in the child page, provide only the body part. sitefinity by default generates  attribute.
Here is a link for documentation on how to use custom CSS. Hope this will be helpful:
https://docs.sitefinity.com/custom-themes-and-templates-create-the-css-of-the-theme

Sitefinity 4 - MasterPages


how to prove this inequality with $a,b,c\in [1,3]$

Question: let $a,b,c\in [1,3]$,show that
$$3\left(\dfrac{1}{a}+\dfrac{1}{b}+\dfrac{1}{c}\right)+\dfrac{45}{a+b+c}\ge 16\left(\dfrac{1}{a+b}+\dfrac{1}{b+c}+\dfrac{1}{c+a}\right)$$
I had found this simaler problem,https://artofproblemsolving.com/community/c6h615194
I can't prove this it
Comment: I solved your problem. If you want to see my solution, show please your attempts.
Comment: @inequality -- _River Li_ has solved your question. You haven't given the courtesy of even upvoting, never mind accepting which you should also do
Answer: WLOG, assume that $c = \max(a,b,c) = 3$. The inequality becomes
$$\frac{3}{a} - \frac{16}{a+3} + \frac{3}{b} - \frac{16}{b+3} + 1 - \frac{16}{a+b} + \frac{45}{a+b+3} \ge 0.$$
Let $f(x) = \frac{3}{x} - \frac{16}{x+3}$.
We have $f''(x) = \frac{6}{x^3} - \frac{32}{(x+3)^3}$.
For $x\in [1,3]$, we have $(x+3)^3/x^3 = (1 + 3/x)^3 \ge 2^3 > 32/6$
and hence $f''(x) > 0$.
Thus, $f(x)$ is convex on $[1,3]$.
We have
$f(a) + f(b) \ge 2 f(\frac{a+b}{2})$. It suffices to prove that
$$\frac{12}{a+b} - \frac{64}{a+b+6}  + 1 - \frac{16}{a+b} + \frac{45}{a+b+3} \ge 0$$
or
$$\frac{(a+b-2)(a+b-6)^2}{(a+b)(a+b+3)(a+b+6)}\ge 0.$$
We are done.
Answer: You haven't given details of what you have tried, so I shall just provide a suggestion.
One thing that will help is that if you replace $(a, b, c)$ with $(ka, kb, kc)$ for some $k > 0$ then the desired inequality is unchanged (the $k$ cancels). So given any triple $(a, b, c)$ you can scale it down so that the smallest element is equal to $1$. However, the inequality is also invariant under permutations of $(a, b, c)$. So without loss of generality you can assume that $c = 1$.
You now have an inequality in two variables. Change this into an "$f(a,b) \ge 0$" statement. At the very least, you can simply plot this in a two-dimensional plane.
A possible help is that if we write $\alpha := 1/a \in [\tfrac13, 1]$ then
$$
\frac1{a+x} = \frac1{a(1+x/a)} = \frac1a \cdot \frac1{1+x/a} = \frac{\alpha}{1+\alpha x}.$$
This last reducing may or may not be useful.
Answer: $$3\big(\frac{1}{a}+\frac{1}{b}+\frac{1}{c}\big)+\frac{45}{a+b+c} ≥ 16\big(\frac{1}{a+b}+\frac{1}{b+c}+\frac{1}{c+a}\big)$$
Let:
$\big(\frac{1}{a}+\frac{1}{b}+\frac{1}{c}\big)=A$
$\frac{9}{a+b+c}=B$
$2\big(\frac{1}{a+b}+\frac{1}{b+c}+\frac{1}{c+a}\big)=C$
We use inequality:
$$C=\frac{1}{a+b}+\frac{1}{b+c}+\frac{1}{c+a}≥\frac{9}{2(a+b+c)}=\frac{B}{2}$$
So we must show:
$3A+5B ≥ 16 C≥ 8B$, or $3A +5B≥ 8B$, or $A≥B$
Or:
$\big(\frac{1}{a}+\frac{1}{b}+\frac{1}{c}\big)≥\frac{9}{a+b+c}$
Which is easy to prove.
Note:If you want the proof of inequality used, ask it as a question, I will answer.


Trouble understanding the not:(:last-child) selector

Question: I'm new to HTML/CSS and I'm having a bit of trouble understanding how the :not(:last-child) selector works.  I've read the explanation on MDN and it's a bit over my head so I was hoping for a simpler explanation.  I've written this code to better illustrate my issue:

The first paragraph.

The second paragraph.

List 1

List 1

List 1

List 1

Hello World!

The way I understand it the line, .paragraph:not(:last-child) { background: #ff0000; } should tell CSS to apply a red background to every element with the class "paragraph" except the last one.  The behaviour I should see is a red background applied to the first paragraph and nothing else.
However, CSS applies a red background to both paragraphs.  It's almost as if CSS is classing the unordered list as a paragraph and treating that as the last child or something.  But I can't see any reason why it would do that.
If anyone could explain how this behaviour makes sense I'd be very appreciative.  Please bear in mind I'm very much a beginner so ELI5 if possible
Thanks.
Answer: You are very close! Last child pseudo requires the count of items within a context, in your code you are saying all paragraphs but not limiting the set so the browser doesn't know which to style.
I've updated your code to contain the paragraphs in a div and now the last paragraph is not styled with a red background. I had not thought to put a pseudo in a not pseudo so I learned something too. :)
For example if you want to do the same with the unordered list you can do all unordered list li's or use the list class to isolate lists with that class for this style. This is because li's are counted intrinsically, which means the browser knows how many there are already.

.container .paragraph:not(:last-child),
ul.list li:not(:last-child),
.new_div p:not(:last-child) {
  background: #ff0000;
}

The first paragraph.

The second paragraph.

List 1

List 1

List 1

List 1

Hello World!

Hello World!


How can I watermark images with a taxonomy term from the node they belong to?

Question: I'm working on a site for a business who would like to watermark all their product photos with the brand name of the product (which is a taxonomy term reference field on the product content type).
Looking into this, I found a variety of modules that will watermark images in various ways, but most expect to just put a single image or text overlay on all images of a given style, which is not what I need here.
The one exception I found was Textimage, which works with the Image Effects module and, at least in theory, supports node tokens. But when I tried out those two modules, I was unable to get any token for the taxonomy field in question to work. I tried [node:field_brand] and [node:field_brand:entity:name] without success — it just put the text of the token instead of replacing it with the brand. Other tokens, like [node:title], did work, but not the one I wanted (even though it was in the list of available tokens).
I posted to the issues queue for Textimage, but it doesn't seem like anyone's monitoring it regularly, and I'm on a deadline.
Does anyone know either how I can get the node replacement to work in Textimage, or alternatively any other way of doing this? I'm not at all wedded to Textimage and Image Effects — they're just the only modules thus far that claim to be able to do what I need to do.
Comment: Have you exposed your custom field_brand in the appropriate entity type view settings?
Comment: I just double-checked the setup of the field itself and yes, it turns out I made a mistake in setting up the field on the test content type I was using! So the problem was 100% on my end, and is now solved. Thank you for pointing me in the right direction!
Answer: Problem solved — Rainer Feike's comment prompted me to examine the field setup and I realized I had made an error in the way I set it up that was causing the token not to resolve (there were two taxonomy fields on the original product content type, referencing two different vocabularies, and I had matched the wrong field name with the vocabulary in setting up the test content type I was trying out the new image style on).
Once I corrected that it worked. My apologies for posting about what turned out to be a self-created problem.


How can I create this sort of path structure?

Question: Before I go ahead and implement my site's architecture, I'd like to check whether or not it's valid.
I have two taxonomy vocabularies that I want to use as part of my Pathauto settings. My site is a local accommodation guide, so I'd like to implement a URL structure like this:
mywebsite.com/cottages/Whitby/Little-Cottage
mywebsite.com/holidayapartments/Scarborough/Seaside-Apartment
<code>                  ^                 ^             ^
                  |                 |             |----- Accommodation name
                  |                 |------------------- Location name
                  |------------------------------------- Accommodation type
</code>
Which follows the syntax mywebsite.com/[accommodation type]/[location]/[accommodation name]
Up until now, I've found it impossible to do this using just taxonomy tokens. I always end up with paths that look wrong.
A way around this seems to be to set each accommodation type as its own content type (for example, 'cottage' content types, 'holiday apartment' content types etc), instead of just having one 'accommodation' content type as I currently have then set the path settings for each content type like so:
Cottage content types: cottages/[termpath-raw]/[titlepath-raw]
Holiday apartment content types: holidayapartments/[termpath-raw]/[titlepath-raw]
Whilst this seems to produce the result I want, it feels more like a compromise than the correct solution. Before I go ahead and do this, I want to check that there isn't another way of setting up the path structure that I want using taxonomy tokens.
I'm also wondering what happens when I introduce multiple vocabularies for those content types - how will I ensure that the location vocabulary doesn't get replaced in the URL structure by another vocabulary (for example, if I use a vocabulary for holiday types - family, group, singles, couples etc - how do I ensure that this vocabulary doesn't take the place of the location vocabulary?).
Comment: What do you mean by the "path looks wrong"?  Please clarify what it looks like and why it is wrong.
Comment: I'll see if I can recreate it and post back its syntax later - but it's safe to say that I couldn't produce a path structure like the one I want to.
Answer: Okay, I've just had a look at my old test site and I can see that I'm using the following syntax:
<code>[field_locations-term-raw]/[term-raw]/[title-raw]
</code>
This displays like so:
<code>/grange-over-sands/holiday-apartments/test-property
</code>
The location comes before the page type (accommodation) here, which I'm aware of, but now the path is displayed perfectly! I've previously deactivated the Domain Access module, so I can only assume that it was DA that was causing my paths not to show correctly.
This leaves me with a new question,though, which I'll start separately.
Answer: I'm not too experienced with Drupal, however I am setting up a site where each node is tagged with 2 different vocabularies. Setting up the pattern and the entire taxonomy-browsing engine was quite a challenge for a beginner. I had been grinding the soil before I eventually got what I wanted.
I would risk a conclusion that for term browsing, it'd be impossible to get the pattern you desire. You would probably need to change your approach and treat the path branches as arguments (contextual filters) for a View.
You might however get this structure to work, if you chose to use that pattern as a path for final nodes, something like:
<code>[node:accommod_categ:type]/[node:location_categ:name]/[node:accommod_categ:name]
</code>
(This assumes that each node is tagged with 2 mandatory terms)
But this would be a single node view only, rather than a category overview, which is probably what you want to supply for a web visitor.
Interesting challenge, btw, I'd be glad to see your results when you're done. Hope you find a spare minute to describe us how you did it. Good luck!