Search Results

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

Page 41/335 | < Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >

  • Difference of answers while using split function in Ruby

    - by N L
    Given the following inputs: line1 = "Hey | Hello | Good | Morning" line2 = "Hey , Hello , Good , Morning" file1=length1=name1=title1=nil Using ',' to split the string as follows: file1, length1, name1, title1 = line2.split(/,\s*/) I get the following output: puts file1,length1,name1,title1 >Hey >Hello >Good >Morning However, using '|' to split the string I receive a different output: file1, length1, name1, title1 = line2.split(/|\s*/) puts file1,length1,name1,title1 >H >e >y Both the strings are same except the separating symbol (a comma in first case and a pipe in second case). The format of the split function I am using is also the same except, of course, for the delimiting character. What causes this variation?

    Read the article

  • What's the difference between 'service' and 'server'?

    - by bonefisher
    I can imagine that the 'server' can be a machine/host but can be also a program like ftp server, smtp server, etc.. The 'service' on the other hand refers mainly to applications/programms.. Why can then for example the Sql Server cannot be called as Sql Service? It has the same semanthics. Or the other way round: MS Azure service: why it isn't called Azure Server? :)

    Read the article

  • How to get time difference in milliseconds

    - by jason45
    Hi, I can't wrap my brain around this one so I hope someone can help. I have a song track that has the song length in milliseconds. I also have the date the song played in DATETIME format. What I am trying to do is find out how many milliseconds is left in the song play time. Example $tracktime = 219238; $dateplayed = '2011-01-17 11:01:44'; $starttime = strtotime($dateplayed); I am using the following to determine time left but it does not seem correct. $curtime = time(); $timeleft = $starttime+round($tracktime/1000)-$curtime; Any help would be greatly appreciated.

    Read the article

  • What's the difference between using ProtocolType.IP and ProtocolType.Tcp

    - by Sekhat
    I've just answered problem with sockets in c# where in my example code I initializing my socket using ProtocolType.IP as this is what I've always used in my own code, and it has never caused me problems. But I see many examples specifying ProtocolType.Tcp. I guess, what I'm asking is, by using ProtocolType.IP instead of ProtocolType.Tcp is anything being performed differently under the hood that I should be aware of?

    Read the article

  • Difference dynami static 2d array c++

    - by snorlaks
    Hello, Im using opensource library called wxFreeChart to draw some XY charts. In example there is code which uses static array as a serie : double data1[][2] = { { 10, 20, }, { 13, 16, }, { 7, 30, }, { 15, 34, }, { 25, 4, }, }; dataset-AddSerie((double *) data1, WXSIZEOF(dynamicArray)); WXSIZEOF ismacro defined like: sizeof(array)/sizeof(array[0]) In this case everything works great but in my program Im using dynamic arrays (according to users input). I made a test and wrotecode like below: double **dynamicArray = NULL; dynamicArray = new double *[5] ; for( int i = 0 ; i < 5 ; i++ ) dynamicArray[i] = new double[2]; dynamicArray [0][0] = 10; dynamicArray [0][1] = 20; dynamicArray [1][0] = 13; dynamicArray [1][1] = 16; dynamicArray [2][0] = 7; dynamicArray [2][1] = 30; dynamicArray [3][0] = 15; dynamicArray [3][1] = 34; dynamicArray [4][0] = 25; dynamicArray [4][1] = 4; dataset-AddSerie((double *) *dynamicArray, WXSIZEOF(dynamicArray)); But it doesnt work correctly. I mean point arent drawn. I wonder if there is any possibility that I can "cheat" that method and give it dynamic array in way it understands it and will read data from correct place thanks for help

    Read the article

  • Difference in Java versions

    - by Polppan
    Are there any differences between these two java versions. If there are any differences how can I have the version java version "1.4.2" because that is what I have in server. 1) java version "1.4.2_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) 2) java version "1.4.2" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2) Classic VM (build 1.4.2, J2RE 1.4.2 IBM AIX build ca142-20090307

    Read the article

  • Difference between dates when grouping in SQL

    - by CeejeeB
    I have a table of purchases containing a user_id and a date_of_purchase. I need to be able to select all the users who have made 2 purchases within 12 months of each other. The dates can be any point in time as long as they are less than 12 months apart. e.g. user_id date_of_purchase 123 01/Jan/2010 124 01/Aug/2010 123 01/Feb/2010 124 05/Aug/2008 In this example i want user_id 123

    Read the article

  • syntax difference between ruby and python?

    - by fayer
    i wonder if there are tutorials that go through the syntax differences for ruby and python? i have seen a comparison between ruby and php but not between ruby and python. i have looked at both ruby and python but it would be very useful with this side-by-side comparison for deciding which one to choose. thanks

    Read the article

  • MySQL : Calculate business day difference between two dates column

    - by yokoyoko
    My sql query returns back two columns, first column is "date created" and second column is "date updated", first column has a prior timestamp with respect to second column. I need to add a third column which can display business day hrs (9:00am to 5:00pm) response i.e. if date created is 2012-01-01 09:00:20 and "dated updated" is 4:00pm same day then third column should display 7 hrs If date created is 2012-01-01 16:00:20 (4:00pm) and "date updated" is 10:00m on 2012:01:02 (2nd Jan) then third column should display 2 hrs. It should exclude Saturday and Sunday. Can you please suggest appropriate SQL query for this.

    Read the article

  • Difference Between Two Lists with Many Duplicates in Python

    - by Paul
    I have several lists that contain many of the same items and many duplicate items. I want to check which items in one list are not in the other list. For example, I might have one list like this: l1 = ['a', 'b', 'c', 'b', 'c'] and one list like this: l2 = ['a', 'b', 'c', 'b'] Comparing these two lists I would want to return a third list like this: l3 = ['c'] I am currently using some terrible code that I made a while ago that I'm fairly certain doesn't even work properly shown below. def list_difference(l1,l2): for i in range(0, len(l1)): for j in range(0, len(l2)): if l1[i] == l1[j]: l1[i] = 'damn' l2[j] = 'damn' l3 = [] for item in l1: if item!='damn': l3.append(item) return l3 How can I better accomplish this task?

    Read the article

  • Difference between a Deprecated and an Legacy API?

    - by Vaibhav Bajpai
    I was studying the legacy API's in the Java's Collection Framework and I learnt that classes such as Vector and HashTable have been superseded by ArrayList and HashMap. However still they are NOT deprecated, and deemed as legacy when essentially, deprecation is applied to software features that are superseded and should be avoided, so, I am not sure when is a API deemed legacy and when it is deprecated.

    Read the article

  • C++: Help with cin difference between Linux and Windows

    - by Krashman5k
    I have a Win32 console program that I wrote and it works fine. The program takes input from the user and performs some calculations and displays the output - standard stuff. For fun, I am trying to get the program to work on my Fedora box but I am running into an issue with clearing cin when the user inputs something that does not match my variable type. Here is the code in question: void CParameter::setPrincipal() { double principal = 0.0; cout << endl << "Please enter the loan principal: "; cin >> principal; while(principal <= 0) { if (cin.fail()) { cin.clear(); cin.ignore(INT_MAX, '\n'); } else { cout << endl << "Plese enter a number greater than zero. Please try again." << endl; cin >> principal; } } m_Parameter = principal; } This code works in Windows. For example, if the user tries to enter a char data type (versus double) then the program informs the user of the error, resets cin, and allows the user another opportunity to enter a valid value. When I move this code to Fedora, it compiles fine. When I run the program and enter an invalid data type, the while loop never breaks to allow the user to change the input. My questions are; how do I clear cin when invalid data is inputted in the Fedora environment? Also, how should I write this code so it will work in both environments (Windows & Linux)? Thanks in advance for your help!

    Read the article

  • JavaScript Self Executing Functions - What's the Difference?

    - by modernzombie
    I am very familiar with self executing functions from working with jQuery. (function($) { /* do stuff */ })(jQuery); Today I was reading the backbone.js source and noticed that they do this: (function() { /* do stuff */ }).call(this); Is this achieving the same thing? Would the following 2 lines of code do the same thing? (function($) { /* do stuff */ })(jQuery); (function($) { /* do stuff */ }).call(jQuery);

    Read the article

  • Difference between SRC and HREF

    - by Vijey
    The SRC and HREF attributes are used to include some external entities like an image, a CSS file, a html file, any other web page or a javascript file. Is there a clear differentiation between SRC and HREF? where/when to use SRC or HREF? I think they can't be used interchangeably. I'm giving below few examples where these attributes are used: To refer a CSS file: href="cssfile.css" inside the link tag To refer a js file: src="myscript.js" inside the script tag To refer an image file: src="mypic.jpg" inside an image tag To refer another webpage: href="http://www.webpage.com" inside an anchor tag

    Read the article

  • What's the difference between PlaceHolder and <div />?

    - by DaveDev
    In an ASP.NET project I have the following HTML: <asp:PlaceHolder ID="plcTitle" runat="server"></asp:PlaceHolder> <div id="divStrapline" runat="server" /> which are populated with this code: if (this.TitlePanel != null) { plcTitle.Controls.Add(this.TitlePanel); } if (this.Strapline != null) { divStrapline.Controls.Add(this.Strapline); } Are they both the same thing? Is either better than the other? Why?

    Read the article

  • Difference between these two functions that find Palindromes....

    - by Moin
    I wrote a function to check whether a word is palindrome or not but "unexpectedly", that function failed quite badly, here it is: bool isPalindrome (const string& s){ string reverse = ""; string original = s; for (string_sz i = 0; i != original.size(); ++i){ reverse += original.back(); original.pop_back(); } if (reverse == original) return true; else return false; } It gives me "string iterator offset out of range error" when you pass in a string with only one character and returns true even if we pass in an empty string (although I know its because of the intialisation of the reverse variable) and also when you pass in an unassigned string for example: string input; isPalindrome(input); Later, I found a better function which works as you would expect: bool found(const string& s) { bool found = true; for (string::const_iterator i = s.begin(), j = s.end() - 1; i < j; ++i, --j) { if (*i != *j) found = false; } return found; } Unlike the first function, this function correctly fails when you give it an unassigned string variable or an empty string and works for single characters and such... So, good people of stackoverflow please point out to me why the first function is so bad... Thank You.

    Read the article

  • Return the difference between the lowest and highest key

    - by stan
    This is a past exam paper i am attempting and have no way to check if the out put is correct as i am not capable of building one of these things the question is in the title class Tree{ Tree left; Tree right; int key; public static int span(Tree tree) { if ( tree == null ){ return null; } if( tree.left != null) int min = span(tree.left); } if( tree.right != null){ int max = span(tree.right); } return max - min; } } Could anyone suggest what i need to change to get 5/5 marks :D - the only thing we have to do is write the span method, the header was given for us Thanks

    Read the article

< Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >