How we can calculate weeks between two dates? I dont see any API. Does any API exsists? How we can do that?  I see there is an API to calculate Months only  Date myDate1 = Date.newInstance(2015, 2, 17); Date myDate2 = Date.newInstance(2017, 12, 17); System.debug('Months Between Two :'+myDate1.monthsBetween(myDate2)); System.debug('Weeks Between Two :'+myDate1.weeksBetween(myDate2));   The below line will never works. Any pointers to get weeks difference ?  System.debug('Months Between Two :'+myDate1.weeksBetween(myDate2));
I have two Date values. I need to find number of weeks between them. I want to do it Apex Class. Not looking for formula fields.  So far I tried:  Integer numberofweeks = (projectStartDate - opp.Project_Start_Date__c)/7;    I receive this error:     Date arithmetic expressions must use Integer or Long arguments
Are there any good tools besides SeleniumRC that can fetch webpages including content post-painted by JavaScript? One major shortcoming of curl is that more and more wepages are having their main piece of content painted by a JavaScript AJAX response that occurs after the initial HTTP response. curl never picks up on this post-painted content.   So to fetch these types of webpages from the command line, I've been reduced to writing scripts in Ruby that drive the SeleniumRC to fire up a Firefox instance and then return the source HTML after these AJAX calls have completed.  It would be much better to have a leaner command line solution for this type of problem.  Does anyone know of any? A priori power analysis for generalized linear mixed-effects model Let's say I have a data set (with a binary DV) which I used a generalized linear mixed-effects model on. I am currently trying to run a simulation-based power analysis to determine the sample size I should try to collect for a replication attempt.   I know about the  function for fitted lme4 model objects, which will create simulated responses that follow the size and structure of the actual dataset.  My question is, how can I use this fitted model object to run an a-priori power analysis for my replication?. In other words, is there an easy way to extract the necessary information from the simulate function, vary the sample size, then to simulate responses?  EDIT:  Here is a simple example with ten subjects that should give me a good starting place. The data here are totally fake so the effects are not close to what I have in the pilot data.  The two variables of interest are age in months (between subjects) and whether the stimulus is "similar" or "dissimilar" (within subjects). Each individual is exposed to three items within each similarity group, for a total of six binary responses for each subject. As seen in the model, I am interested in a possible interaction between age and similarity and include a random slope of similarity to do this.   Let me know if I need to modify anything/provide more information to make things easier.   set.seed(28)  fakeData &lt;- data.frame(ID = rep(1:10, each = 6),                        months = rep(round(runif(10, min = 60, max = 80)), each = 18),                        similarity = rep(c("Sim", "Dissim"), each = 3),                        response = sample(c(0, 1), 60, replace = TRUE))  fakeModel &lt;- glmer(response ~ months * similarity + (similarity | ID), family = binomial, data = fakeData) summary(fakeModel) Now, that Adobe has stopped issuing new releases for Linux desktops, the only option for users is to use Google Chrome, for those who want to use the latest Flash updates. I use Chromium. Is there any way to get Chromium use the Flash from Google Chrome? The reason I as this question is that I have noticed both these browsers run in the background, so technically, the browsers' plugins are available to use. I want to add a check constraint on a column if entered value for column is greater than 3 than it should be saved as 1 else entered value. For that scenario I am using below query but on insertion of data it shows an error message.  create table tblTestCheckConstraint  ( id int, NewColumn int )   alter table tblTestCheckConstraint add constraint chk_tblTestCheckConstraint_NewColumn1 CHECK   (     CASE         WHEN NewColumn &gt;4 THEN 1         ELSE NewColumn     END = 1 )   Insert Statement:   insert into tblTestCheckConstraint values ( 1,5) insert into tblTestCheckConstraint values ( 1,2)   Error Message:   Msg 547, Level 16, State 0, Line 1 The INSERT statement conflicted with the CHECK constraint "chk_tblTestCheckConstraint_NewColumn1". The conflict occurred in database "DBName" , table "dbo.tblTestCheckConstraint", column 'NewColumn'. The statement has been terminated. Yesterday, I was browsing the mobile Stack Overflow site. I noticed one thing: the textareas where you write your comments/answers are very buggy. I'm using a Samsung Galaxy S2, with the standard Android browser (Android version 4.1.2). There are a number of things that aren't working when typing your comment/answer.   Automatic spacing with Swype is disabled (however this might be because of Swype, not the site). Text navigation buttons (step left, step right, select text, copy text etc.) doesn't work with the on-screen keyboard, and selecting text by holding your finger over text is extremely difficult. When you paste something it always seems to be pasted at the top of your text, no matter where you try to paste it. Replying to another comment ("@Example User") does not show suggested people to reply to, like the full site does.   Is there anything I can do to solve these issues/bugs, or is it in the hands of Stack Overflow itself, and if so, should it be looked into?  Edit: I was using the mobile version of the site when noticing these bugs. LWJGL Eclipse Resource Deployment I'm still experimenting with some OpenGL in LWJGL, and as I get to know more and more about OpenGL, I start to do more complicated things like multi texturing, shadowmapping and more. Now, right now I'm using the src folder (src/res) for my resources, and use src/resourcename in my code. When I export it, this won't work on another location as the relative path is ofcourse incorrect. What would be the best way of deploying your game with all the resources in one file? Maybe put the files in the jar?  I would like to hear from a few people how they store and deploy their project with resources, thanks! mbstring is missing for phpmyadmin in ubuntu 16.04 When I installed phpmyadmin in Ubuntu 16.04 LTS, it gives me an error mentioned below.     The mbstring extension is missing. Please check your PHP configuration   then I tried to install php-mbstring, it says mbstring is up to date, Can anyone help me to solve this? Solve $x=y\frac{dy}{dx}-\left(\frac{dy}{dx}\right)^{2}$ Uses of the 'Golden Ratio' I have heard much about the numerous appearances of the ratio found in nature: 1.6180339887.  Are there any actual mathematical uses that have been found of this number? What are its advantages? Just curiosity, really. Incubated but not hatched egg I got the message "oh" and it showed my egg. Before I could do anything the server went down. When I got back on my egg was gone. Is there anything I can do to retrieve my incubated but not hatched egg? Permalinks: custom post type -> custom taxonomy -> post I am having trouble working with WordPress rewrite rules, and could use some help.  I have a custom post type called _shows_.  All shows have a single custom taxonomy category _show-category_. A _show_ will never have more than one _show-category_.  I would like my urls to route in this manner:  www.mysite.com/shows/  =&gt;  archive-shows.php  www.mysite.com/shows/%category%/ =&gt; taxonomy-show-category.php  www.mysite.com/shows/%category%/%postname%/ =&gt; single-shows.php   So as a real world example, lets say we have a _show-category_ "Foo" and a _show_ post titled "Bar" that has "Foo" as it's _show-category_. I would expect my WordPress app to look like this:  www.mysite.com/shows/foo/ =&gt; shows all posts under the foo category www.mysite.com/shows/foo/bar =&gt; shows the indivual post   I try to avoid plugins when possible, but am open to any solution. How to get rid of navigation symbols in beamer? Solving ODE with negative expansion power series I am solving a series of ODE, such that each DE is equal to some degree of term that I'm expanding to. For instance, one DE is this:  $\xi^r\partial_r g_{rr}+2g_{tt}\partial_t\xi^t=\mathcal{O}(r)$  $g_{ii}$ are given, from metric, but that's not important. I need to assume that the solution (since I'm looking for components of $\xi^\mu$, which is a vector with components $\xi^t,\xi^r,\xi^\phi$) is given with power series of the form:  $\xi^\mu=\sum\limits_{n}\xi^\mu_n(t,\phi)r^n$, and this is to be seen as expansion around $1/r$ (expansion around $r=\infty$).  Now when I plug this in the ODE I get this  $\frac{2}{l^2}\sum_n\xi^r_nr^{n+1}+2\sum_n\xi^t_{n,t} r^n+\frac{2}{l^2}\sum_n\xi^t_{n,t}r^{n+2}=\mathcal{O}(r)$, where   $\xi^\mu_{n,i}$   is the derivative with the respect to i-th component.   What troubles me is, how to expand this? Do I set n=0,-1,-2,... until my $\mathcal{O}(r)$ terms cancel each other out? Or?  I'm kinda stuck :\ How to insert HTML to PHP DOMNode? Show $\inf_f\int_0^1|f'(x)-f(x)|dx=1/e$ for continuously differentiable functions with $f(0)=0$, $f(1)=1$. Let $C$ be the class of all real-valued continuously differentiable functions $f$ on the interval $[0,1]$ with $f(0)=0$ and $f(1)=1$. How to show that $$\inf_{f\in C}\int_0^1|f'(x)-f(x)|dx=\frac{1}{e}?$$  I have been able to show that $1/e$ is a lower bound. Indeed, $$\begin{align*} \int_0^1|f'(x)-f(x)|dx &amp;= \int_0^1|f'(x)e^{-x}-f(x)e^{-x}|e^xdx \\ &amp;\geq \int_0^1\left(f'(x)e^{-x}-f(x)e^{-x}\right) dx \\ &amp;= \int_0^1 \frac{d\left(f(x)e^{-x}\right)}{dx}dx  \\ &amp;= f(1)e^{-1}-f(0)e^{0}\\ &amp;=\frac{1}{e}. \end{align*}$$ But how to show this is the infimum? Is there a function $f\in C$ such that we get $\int_0^1|f'(x)-f(x)|dx=1/e$? How to Straighten Curved UVs into Straight Belt Showing the actual 3D model of a curving ramp.  Shows the UVs of that model that blender did automatically. Shows the UV image that I need.   I am going put a road texture on it., but round faces are not helping me at all. All I need is straight belt kind of UV. Can I get cheaper plane tickets by using a VPN? In a Youtube video by ADVChina, the speaker is recommending using a VPN in China for various reasons, and to sign up using his referral code.  He says there are various practical uses including "You could also go and get cheaper plane tickets by hopping around different countries." and shows a screenshot of a flight website called KAYAK, with the VPN software changing his country to Italy.  Is it possible to get cheaper plane tickets by using a VPN in this way? I've never heard of KAYAK, but if I use something like Skyscanner, is it common for tickets to be priced differently depending on which country the user's IP is from?  Is it because of different taxes in different countries? So could it be illegal to get discounts like this? Or is there some pricing strategy from airlines to charge different amounts depending on the country of purchase? Possible Duplicate:          I've added myself back into the admin's group I think, by following   But I still can't do commands like:  sudo aptitude update   I get the message  oshirowanen is not in the sudoers file.  This incident will be reported.   How do I add myself into the sudoers group now that I am in the admin group? Closing Reject Suggested Edit dialogue freezes review process Kernel Panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)