Search Results

Search found 14236 results on 570 pages for 'times square'.

Page 13/570 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • HttpWebRequest times out with multiple network adaptors enabled

    - by Tim
    On my Win7 PC I have a couple of virtual network adaptors that are used for VMWare server. My HttpWebRequest times out when I have these adaptors enabled. Should I really have to tell it which adaptor to bind to? HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url.AbsoluteUri + "etc.txt"); request.Timeout = 2000; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { using (StreamReader reader = new StreamReader(response.GetResponseStream())) { return reader.ReadToEnd(); } }

    Read the article

  • Get number of times in loop over Hash object

    - by Matt Huggins
    I have an object of type Hash that I want to loop over via hash.each do |key, value|. I would like to get the number of times I've been through the loop starting at 1. Is there a method similar to each that provides this (while still providing the hash key/value data), or do I need to create another counter variable to increment within the loop?

    Read the article

  • Is derived table executed once or three times?

    - by AspOnMyNet
    Every time you make use of a derived table, that query is going to be executed. When using a CTE, that result set is pulled back once and only once within a single query. Does the quote suggest that the following query will cause derived table to be executed three times ( once for each aggregate function’s call ): SELECT AVG(OrdersPlaced),MAX(OrdersPlaced),MIN(OrdersPlaced) FROM ( SELECT v.VendorID, v.[Name] AS VendorName, COUNT(*) AS OrdersPlaced FROM Purchasing.PurchaseOrderHeader AS poh INNER JOIN Purchasing.Vendor AS v ON poh.VendorID = v.VendorID GROUP BY v.VendorID, v.[Name] ) AS x thanx

    Read the article

  • Find if there is an element repeating itself n/k times

    - by gleb-pendler
    You have an array size n and a constant k (whatever) You can assume the the array is of int type (although it could be of any type) Describe an algorithm that finds if there is an element(s) that repeats itself at least n/k times... if there is return one. Do so in linear time (O(n)) The catch: do this algorithm (or even pseudo-code) using constant memory and running over the array only twice

    Read the article

  • sum of Times in SQL

    - by LIX
    Hello all, I have some records like this: ID Personel_Code Time --- ------------- ------ 1 0011 05:50 3 0011 20:12 4 0012 00:50 I want to have the sum of times for each person. in this example I want to have the result like this : Personel_Code Time ------------- ----- 0011 26:02 0012 00:50 Thank you.

    Read the article

  • Python: Pass parameter one time, but use more times

    - by Gabriel L. Oliveira
    I'm trying to do this: commands = { 'py': 'python %s', 'md': 'markdown "%s" "%s.html"; gnome-open "%s.html"', } commands['md'] % 'file.md' But like you see, the commmands['md'] uses the parameter 3 times, but the commands['py'] just use once. How can I repeat the parameter without changing the last line (so, just passing the parameter one time?)

    Read the article

  • Pass parameter one time, but use more times

    - by Gabriel L. Oliveira
    I'm trying to do this: commands = { 'py': 'python %s', 'md': 'markdown "%s" "%s.html"; gnome-open "%s.html"', } commands['md'] % 'file.md' But like you see, the commmands['md'] uses the parameter 3 times, but the commands['py'] just use once. How can I repeat the parameter without changing the last line (so, just passing the parameter one time?)

    Read the article

  • Challenging question find if there is an element repeating himself n/k times

    - by gleb-pendler
    here how it's goes: You have an array size n and a constant k (whatever) you can assume the the array of int type tho it kind be of whatever type but just for the clearane let assume it's an integer. Describe an algorithm that finds if there is an element/s that repeat itself at least n/k times... if there is return one - do it in linear time running O(n) Imortent: now the catch do this algorithm or even pseuo-code using a constant usage of memory and running over the array only TWICE!!!

    Read the article

  • Selecting and Copying a Random File Several Times

    - by user1252778
    [Edit: see below for final code] I have the following code and I'm trying to figure out where to insert the random.choice code to make it select a single file, copy it, and repeat (here 6 times). import os import shutil import random dir_input = str(input("Enter Source Directory: ")) src_files = (os.listdir(dir_input)) for x in range (0,5): print ('This is the %d time' % x) for file_name in src_files: full_file_name = (os.path.join(dir_input, file_name)) if (os.path.isfile(full_file_name)): print ('copying...' + full_file_name) shutil.copy(full_file_name, r'C:\Dir')) else: print ('Finished!')

    Read the article

  • Cloning an element and adding it to Dom multiple times

    - by Praveen Prasad
    //I am cloning a dom element and inserting it in dom element multiple times <div class='toBeCloned'>some text</div> <div id='target'></div> var _clone=$('.toBeCloned').clone(true);//create clone var _target=$('#target'); //this is target _target.append(_clone); //append target _target.append(_clone); //append target _target.append(_clone); //append target //this should add 3 elements but it's adding only one

    Read the article

  • Any chances to imitate times() Ruby method in C#?

    - by Alexander Prokofyev
    Every time I need to do something N times inside an algorithm using C# I write this code for (int i = 0; i < N; i++) { ... } Studying Ruby I have learned about method times() which can be used with the same semantics like this N.times do ... end Code fragment in C# looks more complex and we should declare useless variable i. I tried to write extension method which returns IEnumerable, but I am not satisfied with the result because again I have to declare a cycle variable i. public static class IntExtender { public static IEnumerable Times(this int times) { for (int i = 0; i < times; i++) yield return true; } } ... foreach (var i in 5.Times()) { ... } Is it possible using some new C# 3.0 language features to make N times cycle more elegant?

    Read the article

  • MySQL Query to find consecutive available times of variable lenth

    - by Armaconn
    I have an events table that has user_id, date ('2013-10-01'), time ('04:15:00'), and status_id; What I am looking to find is a solution similar to http://stackoverflow.com/questions/2665574/find-consecutive-rows-calculate-duration but I need I need two additional components: 1) Take date into consideration, so 10/1/2013 at 11:00 PM - 10/2/2013 at 3:00AM. Feel free to just put in a fake date range (like '2013-10-01' to '2013-10-31') 2) Limit output to only include when there are 4+ consecutive times (each event is 15 minutes and I want it to display minimum blocks of an hour, but would also like to be able to switch this restriction to 1.5 hours or some other duration if possible). SUMMARY - Looking for a query that provides the start and end times for a set of events that have the same user_id, status_id, and are in a continuous series based on date and time. For which I can restrict results based on date range and minimum series duration. So the output should have: user_id, date_start, time_start, date_end, time_end, status_id, duration CREATE TABLE `events` ( `event_id` int(11) NOT NULL auto_increment COMMENT 'ID', `user_id` int(11) NOT NULL, `date` date NOT NULL, `time` time NOT NULL, `status_id` int(11) default NULL, PRIMARY KEY (`event_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1568 ; INSERT INTO `events` VALUES(1, 101, '2013-08-14', '23:00:00', 2); INSERT INTO `events` VALUES(2, 101, '2013-08-14', '23:15:00', 2); INSERT INTO `events` VALUES(3, 101, '2013-08-14', '23:30:00', 2); INSERT INTO `events` VALUES(4, 101, '2013-08-14', '23:45:00', 2); INSERT INTO `events` VALUES(5, 101, '2013-08-15', '00:00:00', 2); INSERT INTO `events` VALUES(6, 101, '2013-08-15', '00:15:00', 1); INSERT INTO `events` VALUES(7, 500, '2013-08-14', '23:45:00', 1); INSERT INTO `events` VALUES(8, 500, '2013-08-15', '00:00:00', 1); INSERT INTO `events` VALUES(9, 500, '2013-08-15', '00:15:00', 2); INSERT INTO `events` VALUES(10, 500, '2013-08-15', '00:30:00', 2); INSERT INTO `events` VALUES(11, 500, '2013-08-15', '00:45:00', 1); Desired output row |user_id | date_start | time_start | date_end | time_end | status_id | duration 1 |101 |'2013-08-14'| '23:00:00' |'2013-08-15'|'00:15:00'| 2 | 5 2 |101 |'2013-08-15'| '00:00:15' |'2013-08-15'|'00:30:00'| 1 | 1 3 |500 |'2013-08-14'| '00:23:45' |'2013-08-15'|'00:15:00'| 1 | 2 4 |500 |'2013-08-15'| '00:00:15' |'2013-08-15'|'00:45:00'| 2 | 2 5 |500 |'2013-08-15'| '00:00:45' |'2013-08-15'|'01:00:00'| 2 | 1 *except that rows 2 and 5 wouldn't appear if duration had to be greater than 30 minutes Thanks for any help that you can provide! And please let me know if there is anything I can further clarify!!

    Read the article

  • Crystal Report displaying Group Header multiple times

    - by Ravi Gupta
    Hi I am using Crystal Reports 10 to generate my reports. In one of the reports I see that a group header is getting repeated 2 times in the output document while in the design tab I can that it is present only one time. I am having my query as a "Union All" of 2 data sets. Please advise what could be the cause. Thanks.

    Read the article

  • Package start and end times

    - by abkl
    Hi , I wanted to know if there is any system variable which is can use to access package execution start and end times. My requirement is that i need to store this in 2 relevant fields in a table in the database. Thank you. Abhi

    Read the article

  • Java API Method Run Times

    - by Mike
    Is there a good resource to get run times for standard API functions? It's somewhat confusing when trying to optimize your program. I know Java isn't made to be particularly speedy but I can't seem to find much info on this at all. Example Problem: If I am looking for a certain token in a file is it faster to scan each line using string.contains(...) or to bring in say 100 or so lines putting them to a local string them performing contains on that chunk.

    Read the article

  • python count number of times the date has appeared

    - by Rajeev
    From the following array,how to count the dates for the number of times it has occured in the array.The output should be in the following format [date,count] new_dates = [['2012-12-02', 14],['2012-12-03',2],....] Input: dates = [['2012-12-02', 17], ['2012-12-01', 5], ['2012-12-02', 15], ['2012-12-02', 8], ['2012-12-02', 17], ['2012-12-02', 15], ['2012-12-11', 6], ['2012-12-02', 1], ['2012-12-02', 9], ['2012-12-02', 11], ['2012-12-03', 13], ['2012-12-03', 10], ['2012-12-02', 18], ['2012-12-02', 11], ['2012-12-02', 12], ['2012-12-05', 14], ['2012-12-02', 3], ['2012-12-02', 6], ['2012-12-06', 10], ['2012-12-07', 0], ['2012-12-08', 3], ['2012-12-09', 12], ['2012-12-02', 6]]

    Read the article

  • ThicknessAnimationUsingKeyFrames doesn't work the first time, but second and all subsequent times wo

    - by 110022530536665626169
    I have the following Storyboard: 'LayoutMargin' is a dependency property defined in the ancestor Window. This is the problem I'm having: The first time I run the animation it doesn't work - as if the LayoutMargin.Value isn't set. However, the second time I run the animation, and all subsequent times I run the animation, it work just fine. At first I suspected the LayoutMargin.Value was not set prior to the first animation, but it is set. Does anyone have any ideas about why this is happening?

    Read the article

  • How to loop X times in Django?

    - by Mark
    I have user reviews on my site. Each review has a rating of 1-5 stars. I want to print that many stars. How do I do it? I only see {% for X in Y %} which lets you iterate over a list, but not a certain number of times.

    Read the article

  • Take input through Buttons in java

    - by stash211
    I understand that the title might not be descriptive enough, but I'm making a magic square game in Java and basically, I'm trying to replicate user input as found in the sudoku game here: http://www.websudoku.com/. What I have is a n x n grid of Buttons (not JButton) as the board and what I want the user to be able to do is when the user clicks on one of the buttons, similar to the game above, it allows the user to type in his guess in the button itself instead of popping up a dialog box with an input field of some sort. I don't know where to start, I am a beginner in Java (not very beginner, but my knowledge with the various Java APIs is very limited), so I'm trying to find out if this would be possible and if it is, how would I go about doing it? Thanks for any help.

    Read the article

  • Code runs 6 times slower with 2 threads than with 1

    - by Edward Bird
    So I have written some code to experiment with threads and do some testing. The code should create some numbers and then find the mean of those numbers. I think it is just easier to show you what I have so far. I was expecting with two threads that the code would run about 2 times as fast. Measuring it with a stopwatch I think it runs about 6 times slower! void findmean(std::vector<double>*, std::size_t, std::size_t, double*); int main(int argn, char** argv) { // Program entry point std::cout << "Generating data..." << std::endl; // Create a vector containing many variables std::vector<double> data; for(uint32_t i = 1; i <= 1024 * 1024 * 128; i ++) data.push_back(i); // Calculate mean using 1 core double mean = 0; std::cout << "Calculating mean, 1 Thread..." << std::endl; findmean(&data, 0, data.size(), &mean); mean /= (double)data.size(); // Print result std::cout << " Mean=" << mean << std::endl; // Repeat, using two threads std::vector<std::thread> thread; std::vector<double> result; result.push_back(0.0); result.push_back(0.0); std::cout << "Calculating mean, 2 Threads..." << std::endl; // Run threads uint32_t halfsize = data.size() / 2; uint32_t A = 0; uint32_t B, C, D; // Split the data into two blocks if(data.size() % 2 == 0) { B = C = D = halfsize; } else if(data.size() % 2 == 1) { B = C = halfsize; D = hsz + 1; } // Run with two threads thread.push_back(std::thread(findmean, &data, A, B, &(result[0]))); thread.push_back(std::thread(findmean, &data, C, D , &(result[1]))); // Join threads thread[0].join(); thread[1].join(); // Calculate result mean = result[0] + result[1]; mean /= (double)data.size(); // Print result std::cout << " Mean=" << mean << std::endl; // Return return EXIT_SUCCESS; } void findmean(std::vector<double>* datavec, std::size_t start, std::size_t length, double* result) { for(uint32_t i = 0; i < length; i ++) { *result += (*datavec).at(start + i); } } I don't think this code is exactly wonderful, if you could suggest ways of improving it then I would be grateful for that also.

    Read the article

  • Counting number of times an item occurs in a linked list

    - by HanaCHaN92
    Here is the assignment: Here's the assignment: Implement a method countValue() that counts the number of times an item occurs in a linked list. Remember to use the STL list. int countValue(list front, const int item); Generate 20 random numbers in the range of 0 to 4, and insert each number in the linked list. Output the list by using a method which you would call writeLinkedList which you would add to the ListP.cpp. In a loop, call the method countValue() , and display the number of occurrences of each value from 0 to 4 in the list. Remember that all the above is to be included in the file ListP.ccp Run: 2 3 4 0 1 0 2 4 2 3 3 4 3 3 3 0 0 2 0 2 0 : 5, 1 : 1, 2 : 5, 3 : 6, 4 : 3 and here is what I have so far: #include<iostream> #include<list> #include<tchar.h> int countValue(list<int> front, const int item); using namespace std; int _tmain(int argc, _TCHAR* argv[]){ list<int> front; int listCount; cout << "Enter the size of the list: "; cin >> listCount; for (int i = 1; i <= listCount; i++) front.insert(rand()%5); cout << "Original List of Values: " << endl; //writeLinkedList(front, " "); cout << endl; for(int j=0;j<5;++j) cout << countValue (front,j) << endl; cout << endl; return 0; } int countValue(list<int> front, const int item) { int count0; int count1; int count2; int count3; int count4; list<int> *List; for(list<int>::iterator i = front.begin(); i != front.end(); i++) { if(List->item == 0) { count0++; } if(List->item == 1) { count1++; } if(List->item == 2) { count2++; } if(List->item == 3) { count2++; }if(List->item == 4) { count4++; } } } And here are the errors: error C2065: 'list' : undeclared identifier line 5 error C2062: type 'int' unexpected line 5 error C2661: 'std::list<_Ty>::insert' : no overloaded function takes 1 arguments line 16 error C3861: 'countValue': identifier not found line 21 IntelliSense: no instance of overloaded function "std::list<_Ty, _Ax>::insert [with _Ty=int, _Ax=std::allocator<int>]" matches the argument list line 16 IntelliSense: too few arguments in function call line 16 error C2039: 'item': is not a member of 'std::list<_Ty>' lines 34, 38, 42, 46, 49 IntelliSense: declaration is incompatible with "int countValue" (declared at line 5) line 25 IntelliSense: class "std::list<int, std:: allocator<int>>" has no member "item" lines 34, 38, 42, 46, 49 I just want to know what I've done wrong and how to fix it and also if someone could help me figure out if I'm doing the countValue function wrong or not based on the instructions I would really appreciate it. I've read the chapter in our textbook several times, looked up tutorials on youtube and on Dream in Code, and still I can not figure this out. All helpful information is appreciated!

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >