Search Results

Search found 8367 results on 335 pages for 'temporal difference'.

Page 74/335 | < Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >

  • Display real time years, months, weeks and days between 2 days in JavaScript

    - by alex
    This is what I've coded it up, and it appears to work. window.onload = function() { var currentSpan = document.getElementById('current'); var minute = 60000, hour = minute * 60, day = hour * 24, week = day * 7, month = week * 4, year = day * 365; var start = new Date(2009, 6, 1); setInterval(function() { var now = new Date(); var difference = now - start; var years = Math.floor(difference / year), months = Math.floor((difference - (years * year)) / month), weeks = Math.floor((difference - (months * month + years * year)) / week), days = Math.floor((difference - (weeks * week + months * month + years * year)) / day); currentSpan.innerHTML = 'Since has passed: ' + years + ' years, ' + months + ' months, ' + weeks + ' weeks and ' + days + ' days'; }, 500); }; This seems to update my span fine, and all the numbers look correct. However, the code looks quite ugly. Do I really need to set up faux constants like that, and then do all that math to calculate what I want? It's been a while since I've worked with the Date object. Is this the best way to do this?

    Read the article

  • how to use conditional select query ? in sqlserver

    - by Arunachalam
    how to use conditional select query ? in sqlserver i have a column in which i store date type variable .now i should retrieve one value from that column and find the difference with the curent_timestamp and if the difference is less than 10 mins i should a return 1 and if more than 10 mins i should return 0.is it possible ? 05-12-2010 13.58.30 - 05-12-2010 13.56.30 here the difference is 2 so it should return 1 .

    Read the article

  • Using c# System.DateTime like c++ time_t

    - by David Boland
    In C++ I am able to get the current time when my application starts I can use time_t appStartTime = time(null); then to find the difference in seconds from when it started I can just do the same thing, then find the difference. It looks like I should be using "System.DateTime" in C# net, but the MSDN is confusing in its explanation. How can I use System.DateTime to find the difference in time (in seconds) between when my application starts, and the current time?

    Read the article

  • Casting DataTypes with DirectCast, CType, TryCast

    - by Alex Essilfie
    Ever since I moved from VB6 to VB.NET somewhere in 2005, I've been using CType to do casting from one data type to another. I do this because it is simply faster, used to exist in VB6 and I do not know why I have to be using DirectCast if there is apparently no difference between them. I use TryCast once in a while because I understand that sometimes casting can fail. I however cannot get the difference between CType and DirectCast. Can anyone tell me the difference in plain simple English what the difference the two (CType and DirectCast)? Adding examples of where to use what as well would be helpful. Thanks.

    Read the article

  • scripting subtlties [closed]

    - by jpmyob
    Possible Duplicates: When to use anonymous JavaScript functions? Is there any difference between var name = function() {} & function name() {} in Javascript? in javascript (and other scripting languages) what is the 'real' difference between these two syntax: a) function myFun(x) { yadda yadda } b) myFun(x) = function { yadda yadda } to a casual observer - no 'real' difference - you still call either as myFun()...and they still return the same thing, so if reference and return are identical - is it a preference or is there some difference in the code parsing engine that treats these two differently - and if so - when would you use one over the other???

    Read the article

  • Timeout Exceptions

    - by Raihan Jamal
    This is my below code, I am confuse why this thing is happening. In this code getLocationByIpTimeout is a method in which I am passing two things- one is the ip address and second is the timeout. So I will get the timeout exception if the response is not getting back in under 5 ms. So when I ran this below code, I am getting few timeout exceptions but the most important thing that I am confuse is if I am getting timeout exceptions (time taken to get the response is greater than 5 ms) then why the program is entering in that if loop in which I am having difference 5. What can be the possible reason for this? It is because of catch block?? Any suggestions will be appreciated. long runs =10000; long difference = 0; while(runs > 0) { String ipAddress = generateIPAddress(); long start_time = System.nanoTime(); try { resp = PersonalizationGeoLocationServiceClientHelper.getLocationByIpTimeout(ipAddress, 5); } catch (TimeoutException e) { System.out.println("Timeout Exception"); } long end_time = System.nanoTime(); if(resp == null || (resp.getLocation() == null)) { difference = 0; } else if(resp.getLocation() != null) { difference = (end_time - start_time)/1000000; } if(difference> 5) { System.out.println("Debug"); } }

    Read the article

  • Is there a performance difference between Windows 7 on SSD installed from scratch versus it using a recent ghost/clone drive image from a harddisk?

    - by therobyouknow
    I'm planning to upgrade a notebook PC to a Solid-State Flash Drive (SSD) soon. I want to use the notebook before that and am considering installing Windows 7 on the hard disk (spinning variety, 5400rpm) before I get the SSD. To save time I am wondering if I can ghost/clone the installation of Windows 7 from the hard drive and put on the SSD. Would the performance of this clone from the harddisk onto the SSD be different from starting again and reinstalling Windows 7 from scratch on the SSD? (Windows 7 32bit professional)

    Read the article

  • SQL SERVER – Challenge – Puzzle – Usage of FAST Hint

    - by pinaldave
    I was recently working with various SQL Server Hints. After working for a day on various hints, I realize that for one hint, I am not able to come up with good example. The hint is FAST. Let us look at the definition of the FAST hint from the Book On-Line. FAST number_rows Specifies that the query is optimized for fast retrieval of the first number_rows. This is a nonnegative integer. After the first number_rows are returned, the query continues execution and produces its full result set. Now the question is in what condition this hint can be useful. I have tried so many different combination, I have found this hint does not make much performance difference, infect I did not notice any change in time taken to load the resultset. I noticed that this hint does not change number of the page read to return result. Now when there is difference in performance is expected because if you read the what FAST hint does is that it only returns first few results FAST – which does not mean there will be difference in performance. I also understand that this hint gives the guidance/suggestions/hint to query optimizer that there are only 100 rows are in expected resultset. This tricking the optimizer to think there are only 100 rows and which (may) lead to render different execution plan than the one which it would have taken in normal case (without hint). Again, not necessarily, this will happen always. Now if you read above discussion, you will find that basic understanding of the hint is very clear to me but I still feel that I am missing something. Here are my questions: 1) In what condition this hint can be useful? What is the case, when someone want to see first few rows early because my experience suggests that when first few rows are rendered remaining rows are rendered as well. 2) Is there any way application can retrieve the fast fetched rows from SQL Server? 3) Do you use this hint in your application? Why? When? and How? Here are few examples I have attempted during the my experiment and found there is no difference in execution plan except its estimated number of rows are different leading optimizer think that the cost is less but in reality that is not the case. USE AdventureWorks GO SET STATISTICS IO ON SET STATISTICS TIME ON GO --------------------------------------------- -- Table Scan with Fast Hint SELECT * FROM Sales.SalesOrderDetail GO SELECT * FROM Sales.SalesOrderDetail OPTION (FAST 100) GO --------------------------------------------- -- Table Scan with Where on Index Key SELECT * FROM Sales.SalesOrderDetail WHERE OrderQty = 14 GO SELECT * FROM Sales.SalesOrderDetail WHERE OrderQty = 14 OPTION (FAST 100) GO --------------------------------------------- -- Table Scan with Where on Index Key SELECT * FROM Sales.SalesOrderDetail WHERE SalesOrderDetailID < 1000 GO SELECT * FROM Sales.SalesOrderDetail WHERE SalesOrderDetailID < 1000 OPTION (FAST 100) GO Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: Pinal Dave, SQL, SQL Authority, SQL Puzzle, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • Slow boot time since upgrade to 12.04 from 11.10

    - by danh28
    I have tried for quite a while now to reduce my boot time, disabled some startup items, removed packages that were causing crashes after boot, removed ureadahead pack files, reinstalled ureadahead, uninstalled ureadahead and installed e4rat....and nothing has made that much difference. e4rat made the biggest difference with a reduction of a few seconds but my boot time is still around 80 seconds. Can anyone help? Dmesg and bootchart below: dmesg bootchart

    Read the article

  • What is enterprise software, exactly?

    - by good_computer
    I don't understand the difference between "normal" software and enterprise software. Even after reading these... "Enterprise Software" on Wikipedia "Enterprise Software Is Sexy Again" on Techcrunch "The Great Enterprise Software Swindle" on Coding Horror I can't really wrap my head around the real differences. Is there any difference at all between the two? Why do people say enterprise software sucks?

    Read the article

  • 'sudo su -' vs 'sudo -i' vs 'sudo /bin/bash' - when does it matter which is used, or does it matter at all?

    - by Paul
    When I'm doing something that requires root be typed in dozens of times in a row, I prefer to switch my session to a root session. In the various tutorials and instructions I have used on the Internet, I see sudo su, sudo su -, sudo -i and sudo /bin/bash being used to open a root session, but I'm not clear on the difference between these and when or if that difference matters. Can someone clear this up for me?

    Read the article

  • What good books are out there on program execution models? [on hold]

    - by murungu
    Can anyone out there name a few books that address the topic of program execution models?? I want a book that can answer questions such as... What is the difference between interpreted and compiled languages and what are the performance consequences at runtime?? What is the difference between lazy evaluation, eager evaluation and short circuit evaluation?? Why would one choose to use one evaluation strategy over another?? How do you simulate lazy evaluation in a language that favours eager evaluation??

    Read the article

< Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >