JavaScript Date.getWeek()?
Get week of year in JavaScript like in PHP
How long would the conference be for? I want to know if this is grammatically correct " How long would the conference be for?". bash if -a vs -e option Both about -a and -e options in  is said:  -a file     True if file exists. -e file     True if file exists.    Trying to get what the difference is I ran the following script:  resin_dir=/Test/Resin_wheleph/Results  if [ -e ${resin_dir} ] ; then     echo "-e "; fi  if [ ! -e ${resin_dir} ] ; then     echo "! -e"; fi  if [ -a ${resin_dir} ] ; then     echo "-a"; fi  if [ ! -a ${resin_dir} ] ; then     echo "! -a"; fi   /Test/Resin_wheleph/Results exists and is a directory. And this is what I get:  -e -a ! -a   which seems to be a little strange (notice -a and  ! -a). But when I use double brackets (e. g. if [[ -e ${resin_dir} ]]) in the similar script it gives reasonable output:  -e -a   So:    What is a difference between -a and -e options? Why -a produces a strange result when used inside single brackets? Unique constraint that allows empty values in MySQL I have a number of tiff files named:    sw.001.tif sw.002.tif ...   and I want to remove the .tif at the end of each of the files.  How can I use the rename command to do this? How to make sure an application keeps running on Linux I'm trying to ensure a script remains running on a development server. It collates stats and provides a web service so it's supposed to persist, yet a few times a day, it dies off for unknown reasons. When we notice we just launch it again, but it's a pain in the rear and some users don't have permission (or the knowhow) to launch it up.  The programmer in me wants to spend a few hours getting to the bottom of the problem but the busy person in me thinks there must be an easy way to detect if an app is not running, and launch it again.  I know I could cron-script ps through grep:  ps -A | grep appname   But again, that's another hour of my life wasted on doing something that must already exist... Is there not a pre-made app that I can pass an executable (optionally with arguments) and that will keep a process running indefinitely?  In case it makes any difference, it's Ubuntu. Is there a package of Ubuntu drivers as driver pack solution? I tried to search for it, but I did not find it. If there is, how can I easily get it? .NET Attributes: Why does GetCustomAttributes() make a new attribute instance every time? So I was playing around a little more with attributes in .NET, and realized that every call to Type.GetCustomAttributes() creates a new instance of my attribute. Why is that? I would think that the attribute instance would basically be a singleton-per-MemberInfo, with 1 instance bound to the Type, PropertyInfo, etc...  Here is my test code:  using System;  namespace AttribTest { [AttributeUsage(AttributeTargets.Class)] class MyAttribAttribute : Attribute {     public string Value { get; set; }      public MyAttribAttribute()         : base()     {         Console.WriteLine("Created MyAttrib instance");     } }  [MyAttrib(Value = "SetOnClass")] class MyClass { }  class Program {     static void Main(string[] args)     {         Console.WriteLine("Getting attributes for MyClass.");         object[] a = typeof(MyClass).GetCustomAttributes(false);         ((MyAttribAttribute)a[0]).Value = "a1";          Console.WriteLine("Getting attributes for MyClass.");         a = typeof(MyClass).GetCustomAttributes(false);         Console.WriteLine(((MyAttribAttribute)a[0]).Value);          Console.ReadKey();     } } }   Now if I were to implement attributes, I would expect the output to be:  Created MyAttrib instance Getting attributes for MyClass. Getting attributes for MyClass. a1   Where the "class loader" (sorry, I have more of a Java background, not 100% sure how .net loads its types) would compile MyClass, and create an instance of MyAttribAttribute, and store them together somewhere. (probably the Perm Gen in the heap if this were Java) The 2 calls to GetCustomAttributes() would then just return the same earlier created instance.  But the actual output is:  Getting attributes for MyClass. Created MyAttrib instance Getting attributes for MyClass. Created MyAttrib instance SetOnClass   So... why? It seems like creating a new instance of all these objects for every call is a bit excessive, and not good for performance/memory management.  Is there any way to always get the same instance over and over?  Anyone have any ideas why it was designed this way?  The reason I care at all is because I made a custom attribute that internally holds some validation information, so in the Attribute I basically have a "private bool Validated" that I set to true. The validation stuff takes a while, so I don't want to run it every time. Now the problem is that since it creates a new instance of the attribute each time I get the attributes, Validated is always "false". Is it possible to switch from one area of graduate study to another in US universities? For example, suppose someone has enrolled in a computer science phd program. Can he switch over to math(or physics) phd program in the same school later?(or say from applied mathematics to pure mathematics?)  What are the steps for doing for doing that? For sets $A,B$, let $|A|\leq^*|B|$ say that there exists an onto map $f:B\rightarrow A$ or $A=\emptyset$.   My question is, is $$\forall A,B(|A|\leq^*|B|\longrightarrow |A|\leq|B|)$$ equivalent to the axiom of choice?  Thanks Let $f$ be a real, continuous function defined on $[0,\infty)$ such that $xf(x)$ is increasing for all sufficiently large values of $x$. Show that if   $$\int_0^x f(y)\,dy \sim Ax^\alpha \quad \left(\,x\to \infty\right)$$  for some positive constants $A$ and $\alpha$, then  $$f(x)\sim \alpha Ax^{\alpha -1} \quad \left(\,x\to \infty\right).$$  Clearly, I have to use differentiation somewhere, but I don't know how to manipulate $\lim_{x\to \infty}\frac{\int_0^x f(y)\,dy}{Ax^\alpha}=1$ to get the desired result.  From suggestions given, I know that by L'hospital's rule, it's enough to show that the limit $\lim \frac{f(x)}{\alpha Ax^{\alpha -1}}$ exists, and this limit equals $ \lim \frac{xf(x)}{\alpha Ax^{\alpha}}$. From here, I'll need to use the given assumption that $xf(x)$ is eventually increasing. But how can I show the existence of the limit based on these facts?  I would greatly appreciate any solutions, hints or suggestions. How do I calculate the date six months from the current date using the datetime Python module? XIV pages in page counts? Is it possible to make biblatex output page counts for both the regular pages and the roman-numbered pages, for example:     Cook, Theodore Andrea. The Curves of Life : Being an Account of Spiral Formations and Their Application to Growth in Nature, to Science and to Art; with Special Reference to the Manuscripts of Leonardo da Vinci. — London : Constable and Company, 1914. — xxx + 479 p.   Here there are "30 pages + 478 pages" in total. Thanks! Where is attribute table in ArcGIS Desktop when not visible? I've just updated to ArcGIS 10.1 for Desktop and when I go to open an attribute table, I can not see it anywhere.   I'm wondering if it is off my screen somewhere or if its just super tiny that I can't see it.   I'm using dual monitors and it's not popping up on either.  Is there a way I can find my attribute table? I've been working with the Fermat numbers recently, but this problem has really tripped me up. If the Fermat theorem is set as $f_a=2^{2^a}+1$, then how can we say that for an integer $b&lt;a$, the $\gcd(f_b,f_a)=1$? What's the best way of accessing field in the enclosing class from the nested class? Adding coordinate system to layout in QGIS composer? Can virtual particle have mass? Do all virtual particle travel at light speed in a vacuum? else wouldn't that imply they should have rest mass however tiny? When they pop back out of existence do their mass disappear instantly? BTW what is the heaviest virtual particle ever found? An integer $a \pmod m$ has inverse if and only if $\gcd(a,m)=1$? An integer $a \pmod m$ has inverse if and only if $\gcd(a,m)=1$?  Why is this? I tried understanding it from my notes but I don't get it.  A thorough explanation would be greatly welcome.  Thanks for all the answers so far. I think my biggest problem is understanding why $\gcd(a,m)\neq1 \Longrightarrow \not\exists a^{-1}$. Are there any XSLT processing command line tools? What are the best practices for modeling inheritance in databases?  What are the trade-offs (e.g. queriability)?  (I'm most interested in SQL Server and .NET, but I also want to understand how other platforms address this issue.)