FAQ Database Discussion Community


How do I find the time difference between two timestamps?

php,timestamp,difference
Let's say I have two mongo dates. $a = $mongoDateA->sec; $b = $mongoDateB->sec; So now I have two timestamps to compare, but I need to figure out, if dateB is any later than a day more than dateA. so if the difference between the two dates is 1 day, I...

Pandas difference between dataframes on column values

python,pandas,dataframes,difference
I couldn't find a way to have a dataframe that has the difference of 2 dataframes based on a column. So basically: dfA = ID, val 1, test 2, other test dfB = ID, val 2, other test I want to have a dfC that holds the difference dfA -...

Differencing with respect to specific value of a column

r,difference
I have a variable called Depression which has 40 observations and goes from 2004 to 2013 quarterly (e.g. 2004 Q1, 2004 Q2 etc.) I would like to make a new column which differences with respect to the 27th row/observations which corresponds with 2010 Q3 and set that value to 0....

mongo DB average difference

mongodb,average,difference
I am struggling with a MongoDB query in some homework. I am very new to MongoDb and so far only understand the basics. Here is the question: Suppose that we have full-time results data since 2001-08-01 for a variety of football competitions in a mongo database collection results which has...

Different colors in browser [closed]

css,firefox,colors,difference,color-profile
I have a strange problem in my browser. Color of page's elements looks different than I described in my css code. I checked it with browser's color picker and it showed right color (#5cb85c) and right preview of button's color. But when I did screenshot of page and checked it...

Wrong difference when calculating the difference between the present day and another date

javascript,date,difference
I need your help. My code is not returning the proper differential value when calculating the difference between the present date minus another date (UK Date Standard) Ex. The correct answers should result to: 30/01/2015 - 30/01/2015 = 0 30/01/2015 - 29/01/2015 = 1 30/01/2015 - 31/01/2015 = -1 Current...

Scala: Sequence difference

scala,set,difference
What would be the best way to find difference (complement) D of two sequences A and B, where D = A - B is the sequence of all objects that belong to A but not to B. For example with: val A = Seq((1,1), (2,1), (3,1), (4,1), (5,1)) val B...

Substract last cell in row from first cell with number

excel,find,row,difference,subtract
I have the following Excel sheet In column J i need the final difference between the first cell in the row and the last cell (with a number). Numbers can appear from column C until column I. Numbers do not always start in column C and do not always end...

What is the advantage of dynamic memory control?

c++,memory,dynamic,stack,difference
For example, I want to make a stack. I can do it in that way, using the dynymic memory control, with new and delete opereations: #include <iostream> using namespace std; struct List { int x; List *Next,*Head; }; void Add(int x, List *&MyList) { List *temp=new List; temp->x=x; temp->Next=MyList->Head; MyList->Head=temp;...

c++ - difference between runtime timing function and command line time

c++,timing,difference
I have the following code with the timing function from http://stackoverflow.com/a/1861493/4587344 and the libbsc from https://github.com/IlyaGrebnov/libbsc. #include <vector> #include <iostream> #include <random> #include <cassert> #include <sys/time.h> #include "libbsc/libbsc/libbsc.h" typedef unsigned long long timestamp_t; static timestamp_t get_timestamp () { struct timeval now; gettimeofday (&now, NULL); return now.tv_usec + (timestamp_t)now.tv_sec * 1000000;...

ORACLE SQL: Select records with time difference less than a minute

sql,oracle,time,difference
I have a table in which I have same the records but with different timestamps. E.g. - 1 2015-03-03 13:41:11.0 [createService]: [accountNumber = 123456] 2015-03-02 01:19:11.0 [createService]: [accountNumber = 123456] 2015-03-02 01:19:06.0 [createService]: [accountNumber = 123456] E.g. - 2 2015-03-07 01:21:11.0 [createService]: [accountNumber = 567890] 2015-03-04 01:17:11.0 [createService]: [accountNumber =...

Difference between entering values in cin using spacebar and enter key?

c++,cin,difference
What is the difference between inputting a sequence of values for an array of integers in cin using a SPACE and an ENTER key? For example - If I have to input a sequence of numbers in an array and stop receiving the input as soon as 0 is entered...

Z3: Difference logic performance

logic,z3,difference
I have a problem to solve that can be translated into difference logic, and rather than implementing a decision procedure, I would like to use z3 for this purpose. Nevertheless, I run a few examples and I had exponential-like runtimes (even though there is a polytime decision procedure for it)....

Difference between Data Storage and Hosting Storage?

firebase,difference,data-storage
In the Firebase 'Pricing & Plans' for the free Hacker Plan, it says we have "100MB Data Storage" and "1GB Hosting Storage" but what exactly is the difference between data and hosting storage? By extensions (if this isn't already answered in the previous question) is there a difference between Data...

Time Difference between events

java,time,difference
I am trying to calculate the time difference between the user-set-date and the current-system-date. My code is as follows, import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import javax.swing.JFrame; public class Main { public static void main(String[] args){ // Make the frame JFrame appFrame = new JFrame("Get Things Done"); // Make a...

Finding difference is not working

python,difference,array-difference
I am trying to find difference from two files but still I get answer from two files This is my code #File one(This file contents should be removed after comparing file two) a = open('diff1','r+') #File two #This file has 999999 records b = open('gtin','r+') f8 = open('missing-test-remove.txt','w') def diff(a,...

how to subtract a value from one column from a value from a previous row, different column in r

r,function,data.frame,apply,difference
I have a dataframe composed of 3 columns and ~2000 rows. ID DistA DistB 1 100 200 2 239 390 3 392 550 4 700 760 5 770 900 The first column (ID) is a unique identifier for each row. I'd like my script to read each row, and subtract/compare...

What is the difference between the IDE and JDK and when do you use each one? [closed]

java,ide,difference
What is the difference between the IDE and JDK and when do you use each one?

separate 'entangled' vectors in Matlab

matlab,matrix,vector,difference
I have a set of three vectors (stored into a 3xN matrix) which are 'entangled' (e.g. some value in the second row should be in the third row and vice versa). This 'entanglement' is based on looking at the figure in which alpha2 is plotted. To separate the vector I...

Difference between malloc() and simple declaration in fixed sizes [duplicate]

c,double,malloc,difference
This question already has an answer here: Difference between declaration and malloc 8 answers Let assume that I want to get space for an array of x double, x being an integer. Can someone explain me the difference between double myArray[x]; and malloc(x*sizeof(double)); excepted the fact that malloc() returns...

Define the bottom of each bar in a stacked bar graph

python,arrays,numpy,matplotlib,difference
I have a two-dimensional array absolute_heights of shape (2, 6). I'd like to define a new two-dimensional array bottoms of shape (2, 6) that holds 0 at each position i unless 1) The sign of absolute_heights[0, i] - absolute_heights[1, i] matches that of absolute_heights[0, i], in which case bottoms[0, i]...

iOS different action with different devices

ios,difference,udid
I am writing an iOS app using BLE 4.0, Xcode 6. There are many iPods (5 Touch) involved and a sensor. Imagine the iPods are on a toy train track turning around in a massive room. When iPod 1 gets close to the sensor and connects to it, it needs...

SQL server update table with missing values

sql,sql-server,difference
I have 2 similar tables, one with all the data and the other contains a subset of the first. Every 2-3 days I need to insert in the second table the missing values, and I use this code INSERT INTO [SRVDB2].[dbt].[curve].[curve_value] SELECT * FROM [SRVDB1].[dbt].[curve].[curve_value] as DB01 WHERE TargetDate >=...

java difference between calendars

java,android,calendar,simpledateformat,difference
I'm just doing a simple difference of two timemilisseconds of two different calendar. Example: Calendar ini = Calendar.getInstance(); try { Thread.sleep(1500); } catch (InterruptedException e) {e.printStackTrace();} Calendar end = Calendar.getInstance(); long diff = end.getTimeInMillis()-ini.getTimeInMillis(); System.out.println("diff "+diff); System.out.println("ini date "+ ini.getTime()); System.out.println("end date "+ end.getTime()); System.out.println("diff time format "+timeFormat.format(diff)); The time...

What is the difference between Eclipse and Myeclipse

eclipse,difference,myeclipse
I want to develop java dynamic web application that make use of struts2 and hibernate. I am familiar with Eclipse but new to MyEclipse. Both IDEs looks same if compared with UI. What are the features of Myeclipse ? Which IDE will be better option to develop the web application...

How to calculate the Difference between SUM values

sql,teradata,difference
I am pulling total account balances for various dates and need to calculate the difference between those total account balances but need solution. SQL: SELECT SNAPSHOT_DATE, SUM(ACCOUNT_BALANCE_AMOUNT) SAVINGS_BALANCES FROM pIDWUserVW.PRODUCT_SAVINGS_VW WHERE SNAPSHOT_DATE IN ('2015-01-02', '2015-01-30', '2015-02-02', '2015-02-27', '2015-03-31') GROUP BY SNAPSHOT_DATE ORDER BY SNAPSHOT_DATE ASC; Results: SNAPSHOT_DATE SAVINGS_BALANCES 1/2/2015 10,407,069,092.55...

Does it make sense to use Hibernate clear method and then rollback?

hibernate,clear,rollback,between,difference
I want to know if there is any difference between hibernate's session.clear method and rollback() method? I understand that session.clear() will clear objects from the session and rollback() will rollback whole transaction. My question is will there be any performance difference if I use both methods together - first call...

Array objects difference javascript angularjs

javascript,arrays,angularjs,object,difference
I have 2 array objects and I want to get the difference between them as follows: array1 = [{"name":"MPCC","id":"tool:mpcc"}, {"name":"APP","id":"tool:app"}, {"name":"AII","id":"tool:aii"}, {"name":"VZZ","id":"tool:vzz"}, {"name":"USU","id":"tool:usu"}] array2 = [{"name":"APP","id":"tool:app"}, {"name":"USU","id":"tool:usu"}] result = [{"name":"MPCC","id":"tool:mpcc"}, {"name":"AII","id":"tool:aii"}, {"name":"VZZ","id":"tool:vzz"}] Here is the code: $scope.initial = function(base, userData){ var result = []; angular.forEach( base,...

difference of 2 byte arrays

java,arrays,byte,difference
I have a byte array which can have up to 4000 elements. These elementes can be byte/boolean(1 byte) int(2 byte) or long/float(4byte). They are not mixed, so one byte array only contains one data type If the array changes I want to get the position which is affected.. but if...

Matlab- Subtraction of previous in array plus addition of difference

matlab,difference,subtraction
So if I have a matrix s; s = [4;5;9;12;3] and I want to calculate the difference between an entry and it's previous entry plus add the previous difference such that I'll get s = [ 4 0; 5 1; 9 5; 12 8; 3 -1] I'm quite new to...

Calculating differences between values in a vector

r,difference
I have a vector that contains just over quarter of a million values (I know, a huge amount) and I need to calculate the difference of each value from each other. So for example, with the first value 202.7952, I want to calculate the difference between every other value...

Difference between the fill methods vs. draw methods in graphics

java,methods,graphics,difference
g.drawRect(50, 50, 400, 75); g.fillRect(50, 50, 200, 200); Someone told me the first line will draw a rectangle while the second one will draw a square. I understand the parameters, but however wouldn't g.drawRect(50,50,200,200); also draw a square? I thought fill would actually fill the square with a color. ...

How to display all the dates between multiple two dates in a table?

mysql,date,datetime,difference
I want to display all the dates between two dates for a particular record And this is the table : ID Start_Date End_Date 1 2013-01-14 2013-01-18 2 2013-02-01 2013-02-04 and now i want to get all the dates between from date and to date. Expected output ID Date 1 2013-01-14...