Search Results

Search found 972 results on 39 pages for 'highest'.

Page 22/39 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • Splitting a double vector into equal parts

    - by Cosmin
    Greetings, Any input on a way to divide a std::vector into two equal parts ? I need to find the smallest possible difference between |part1 - part2|. This is how I'm doing it now, but from what you can probably tell it will yield a non-optimal split in some cases. auto mid = std::find_if(prim, ultim, [&](double temp) -> bool { if(tempsum >= sum) return true; tempsum += temp; sum -= temp; return false; }); The vector is sorted, highest to lowest, values can indeed appear twice. I'm not expecting part1 and part2 to have the same numbers of elements, but sum(part1) should be as close as possible to sum(part2) For example if we would have { 2.4, 0.12, 1.26, 0.51, 0.70 }, the best split would be { 2.4, 0.12 } and { 1.26, 0.51, 0.70 }. If it helps, I'm trying to achieve the splitting algorithm for the Shannon Fano encoding. Any input is appreciated, thanks!

    Read the article

  • Does the order of case in Switch statement can vary the performance?

    - by Bipul
    Let say I have a switch statement as below Switch(alphabet){ case "f": //do something break; case "c": //do something break; case "a": //do something break; case "e": //do something break; } Now suppose I know that the frequency of having Alphabet e is highest followed by a, c and f respectively. So, I just restructured the case statement order and made them as follows. Switch(alphabet){ case "e": //do something break; case "a": //do something break; case "c": //do something break; case "f": //do something break; } Will the second Switch statement better perform(means faster) than the first switch statement? If yes and if in my program I need to call this switch statement say many times, will that be a substantial improvement? Or if not in any how can I use my frequency knowledge to improve the performance? Thanks

    Read the article

  • Keeping DB Table sorted using multi-field formula (Microsoft SQL)

    - by user298167
    Hello Everybody. I have a Job Table which has two interesting columns: Creation Date and Importance (high - 3, medium 2, low - 1). Job's priority calculated like this: Priority = Importance * (time passed since creation). The problem is, Every time I would like to pick 200 jobs with highest priority, I dont want to resort the table. Is there a way to keep rows sorted? I was also thinking about having three tables one for High, Medium and Low and then sort those by Creation Date. Thanks

    Read the article

  • algorithm to find Best 8 minute window in a 1 hour run

    - by Arun
    I have a requirement like, an activity runs for about more than an hour. I need to get the best 8 minute window where some parameters are maximum. say a value x, which is dynamic for every second. if my activity runs for one hr,i get 3600 values for x. I need to find the best continuous 8 minute time interval where x value was the highest among all the others. if i capture say from 0th minute to 8th minute, there may be another time frame like 0.4 to 8.4 where it was maximum. the granularity is one second. every second we need to consider. basically the peak 8 minute window where x was maximum. please help me with the design

    Read the article

  • Detecting Available Qualities of YouTube Videos

    - by Langdon
    I'm writing a Boxee app that makes use of YouTube videos and I want to be able to display the highest quality version available. I was looking through the YouTube API, but I can't seem to find a way to detect if 720p and/or 1080p versions of the video are available. Does anyone know how to do this? I'm already using their Data API to collection information about the video, but there doesn't seem to be anything in the payload about different qualities consumable on the web: http://gdata.youtube.com/feeds/api/videos/NWHfY_lvKIQ I could just hard code fmt=22 and let it default to a lesser quality version, but then I miss out on 1080p (fmt=387).

    Read the article

  • Obtaining photo 'stars' rating using PHP

    - by DarwinIcesurfer
    I am trying to extract the photo 'stars' rating from .jpg files using php code. My intent is to show the highest rated images as part of a slideshow. I found that using the PHP_JPEG_Metadata_Toolkit_1.11 I am able to get the rating of the file if the rating is set from within Vista (Right click - Properties - Details - Set rating by clicking on stars) by reading the array returned by the Metadata_Toolkit $exif = get_EXIF_JPEG( $photodir . "/" . $filename ); $rating = $exif[0][18246]['Data'][0]; However if I set the rating using Adobe Bridge, I can see the 'stars' in Vista, but the $exif[0][18246]['Data'][0] returns a null value. Is PHP code available to read the ratings applied by both Windows Vista AND Adobe Bridge?

    Read the article

  • What's a good way to detect wrap-around in a fixed-width message counter?

    - by Kristo
    I'm writing a client application to communicate with a server program via UDP. The client periodically makes requests for data and needs to use the most recent server response. The request message has a 16-bit unsigned counter field that is echoed by the server so I can pair requests with server responses. Since it's UDP, I have to handle the case where server responses arrive out of order (or don't arrive at all). Naively, that means holding on to the highest message counter seen so far and dropping any incoming message with a lower number. But that will fail as soon as we pass 65535 messages and the counter wraps back to zero. Is there a good way to detect (with reasonable probability) that, for example, message 5 actually comes after message 65,000? The implementation language is C++.

    Read the article

  • How can I find the nearest intersection via the Google Maps API?

    - by dusoft
    How can I find the closest intersection of the street I have coordinates of? For instance, say I have street A running from south to north that is crossed by street X on the north and by street Y on the south. Does the Google Maps API allow for finding coordinates of the nearest crossroad (either X or Y) of street A? I couldn't find it mentioned anywhere. PS: The only solution I am aware of is to guess the lowest number and the highest number of building on the street A and to draw polyline between them. I am not sure about this though.

    Read the article

  • PHP given a series of arbitrary numbers, how can I choose a logical max value on a line graph?

    - by stormist
    I am constructing a line graph in PHP. I was setting the max value of the line graph to the max value of my collection of items, but this ended up making the graph less readable you are unable to view the highest line on the graph as it intersects with the top of it. So what I need is basically a formula to take a set of numbers and calculate what the logical max value of on the line graph should be.. so some examples 3500 250 10049 45394 434 312 Max value on line graph should probably be 50000 493 412 194 783 457 344 max value on line graph would ideally be 1000 545 649 6854 5485 11545 In this case, 12000 makes sense as max value So something as simple as rounding upward to the nearest thousandth might work but I'd need it to progressively increase as the numbers got bigger. (50000 instead of 46,000 in first example) The maximum these numbers will ever be is about a million. Any recommendations would be greatly appreciated, thank you.

    Read the article

  • SQL Query in NHibernate diction

    - by Jan-Frederik Carl
    I have a SQL Query which works in SQL Management Studio: Select Id From table t Where t.Date= (Select Max(Date) From ( Select * From table where ReferenceId = xy) u) Reason is, from all entries with a certain foreign key, I want to receive the one with the highest date. I tried to reform this Query for use in NHibernate, and I got IQuery query = session.CreateQuery(String.Format( @"Select t.Id From table t Where t.Date = (Select Max(Date) From (Select * From table t where t.ReferenceItem.Id = " + item.ReferenceItem.Id + ")u)")); I get the error message: "In expected" How do I have to form the NHibernate query? What does the "In" mean?

    Read the article

  • Search relevance from XML docs (XQuery?) vs MySQL

    - by Marius
    Hello there, I have a website where documents are saved in xml documents, all with the same structure. I need a search engine where I am able to choose documents with the highest relevance according to the key words given by a searching user. I thought it could (?) be a good idea to have one using XQuery rather than having the information stored twice (in XML docs + mysql database) and querying the mysql database for relevance searches. Is XQuery any good for this, and how, and what speed can I expect on +1000 documents of about 7kb each. Thank you for your time. Kind regards

    Read the article

  • Efficient most common suffix algorithm?

    - by taw
    I have a few GBs worth of strings, and for every prefix I want to find 10 most common suffixes. Is there an efficient algorithm for that? An obvious solution would be: Store sorted list of <string, count> pairs. Identify by binary search extent for prefix we're searching. Find 10 highest counts in this extent. Possibly precompute it for all short prefixes, so it doesn't ever need to look at large portion of data. I'm not sure if that would actually be efficient at all. Is there a better way I overlooked? Answers must be real time, but it can take as much preprocessing as necessary.

    Read the article

  • How can I possibly sort this in JavaScript?

    - by orokusaki
    I've been pounding my head on the wall trying to figure out how to sort this in JavaScript (I have to work with it in this format unfortunately). I need to sort it based on Small, Medium, Large, XL, XXL (Small ranking the highest) in each variationValues size field. The problem is that I need to sort the variationCosts and variationInventories at the same time to match the new order (since each value in order corresponds to the values in the other fields :( Input I have to work with var m = { variationNames: ["Length", "Size" ], variationValues: [ ["26.5\"", "XXL"], ["25\"", "Large"], ["25\"", "Medium"], ["25\"", "Small"], ["25\"", "XL"], ["25\"", "XXL"], ["26.5\"", "Large"], ["26.5\"", "Small"], ["26.5\"", "XL"] ], variationCosts: [ 20.00, 20.00, 20.00, 20.00, 20.00, 20.00, 20.00, 20.00, 20.00 ], variationInventories: [ 10, 60, 51, 10, 15, 10, 60, 10, 15 ], parentCost: 20.00 }; Desired output var m = { variationNames: ["Length", "Size" ], variationValues: [ ["25\"", "Small"], ["26.5\"", "Small"], ["25\"", "Medium"], ["25\"", "Large"], ["26.5\"", "Large"], ["25\"", "XL"], ["26.5\"", "XL"] ["25\"", "XXL"], ["26.5\"", "XXL"], ], variationCosts: [ 20.00, 20.00, 20.00, 20.00, 20.00, 20.00, 20.00, 20.00, 20.00 ], variationInventories: [ 10, 10, 51, 60, 15, 15, 15, 10, 10 ], parentCost: 20.00 };

    Read the article

  • Tag Cloud Data Backend

    - by Waldron
    I want to be able to generate tag clouds from free text that comes from any number of different sources. For clarity, I'm not talking about how to display a tag cloud once the critical tags/phrases are already discovered, I'm hoping to be able to discover the meaningful phrases themselves... preferable on a PHP/MySQL stack. If I had to do this myself, I'd start by establishing some kind of index for words/phrases that gives a "normal" frequency for any word/phrase. eg "Constantinople" occurs once in every 1,000,000 words on average (normal frequency "0.000001"). Then as I analyze a body of text, I'd find the individual words/phrases (another challenge!), find frequencies of each within the input, and measure against the expected freqeuncy. Words that have the highest ratio against expected frequency get boosted priority in the cloud. I'd like to believe someone else has already done this, WAY better than I could hope to, but I'll be damned if I can find it. Any recommendations??

    Read the article

  • ImageMagick help -- need to change DPI

    - by StackOverflowNewbie
    I have a 1000x1000 300dpi image that I need to convert to a 100x100 96dpi thumbnail. How do I do this in ImageMagick? I'm after the smallest possible file size at the highest possible quality. Doing something like this: convert myimage.png -quality 100 -resize 100 PNG8:mynewimage.png .... does change the dimension, but still maintains the DPI. If I can get this to change to 96dpi, I should get a smaller file size. I've tried -density, etc., but can't seem to make them work for me. Maybe I put the commands in the wrong order or passed the wrong parameters. Any assistance is greatly appreciated. Thanks.

    Read the article

  • find a duplicate entry in an array in constant space and O(n) time [closed]

    - by Anubhav Agarwal
    Possible Duplicate: Algorithm to find a duplicate entry in constant space and O(n) time Given an array of N integer such that only one integer is repeated. Find the repeated integer in O(n) time and constant space. There is no range for the value of integers or the value of N For example given an array of 6 integers as 23 45 67 87 23 47. The answer is 23 (I hope this covers ambiguous and vague part) I searched on the net but was unable to find any such question in which range of integers was not fixed. Also here is an example that answers a similar question to mine but here he created a hash table with the highest integer value in C++.But the cpp does not allow such to create an array with 2^64 element(on a 64-bit computer).

    Read the article

  • Updating or inserting high scores in SQL

    - by Roger Gilbrat
    I've been racking my brain over this for the past few days and I'm not sure it's possible, but figured I ask here. Is it possible for a single SQL statement to update a high score if your score is greater or insert it if your first score? My Score table has a UserID, Level and Score columns and I like it to follow the following logic: If your new score is greater than your last score for this Level, then replace it. If you don't have a score for this Level then add it. If your score for this Level is less than your highest score for this Level then do nothing. Is this possible in a single SQL statement or do I have to use two, one to see if you have a new high score and if so, replace it? Each UserID would have only one score in the table for each Level. I'm using MySQL.

    Read the article

  • Running sites on "localhost" is extremeley slow.

    - by seanxe
    Hello all, Having real trouble using my local host to test sites. It runs extremely slow! Sometimes up to a minute to load a page. I'm using firefox and the sites i'm testing run fine on other developers in my office local machines/ on the production server. I've gone through the normal things :- Disabled IPv6 Not running in debug mood Put the site in the highest app pool (High Isolated) on IIS 6. Taking of firewalls etc. The problem only seems to occur when hitting pages which contain some form of .net code in the code-behind. Appreciate that this a little bit of a vague topic / stab in the dark but would appreciate any sort of advice - it's horrible waiting a minute each refresh to try out a change! Cheers, Sean.

    Read the article

  • [Seamless Handover of WiFi] Can we program to automatically join the WiFi with the most strongest si

    - by Dobby
    Hi all, I am making a iphone program, I wish that: it can sense and display the current signals of wifi, with strength, - as I checked, this cannot be done by official SDK, but there were some private library that can handle. 2. i wish it can always automatically join the best wifi with the most highest strength ( assume that all wifi APs have no password, and all are not remembered into the used-list inside iphone), which is something like "seamless handover"... I just guess that, there should be some APIs to let the system join one designated wifi signal from the list, and wish someone could help me. I would like to appreciate a lot : ) Thanks a lot!

    Read the article

  • sorting, average and finding the lowest number from a static array Java

    - by user3701322
    i'm trying to input students and input their results for course work and exams and what i'm having trouble with is finding the average total score, the lowest total score and printing all students in order of total scores highest - lowest import java.util.*; import java.text.*; public class Results { static String[] name = new String[100]; static int[] coursework = new int[100]; static int[] exam = new int[100]; static int count = 0; public static void main(String[] args) { Scanner input = new Scanner(System.in); boolean flag = true; while(flag) { System.out.println( "1. Add Student\n" + "2. List All Students\n" + "3. List Student Grades\n" + "4. Total Score Average\n" + "5. Highest Total Score\n" + "6. Lowest Total Score\n" + "7. List all Students and Total Scores\n" + "8. Quit\n"); System.out.print("Enter choice (1 - 8): "); int choice = input.nextInt(); switch(choice) { case 1: add(); break; case 2: listAll(); break; case 3: listGrades(); break; case 4: average(); break; case 5: highestTotal(); break; case 6: lowestTotal(); break; case 7: order(); break; case 8: flag = false; break; default: System.out.println("\nNot an option\n"); } DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); Date date = new Date(); System.out.println(dateFormat.format(date)); } System.out.println("\n\nHave a nice day"); }//end of main static void add() { Scanner input = new Scanner(System.in); System.out.println("Insert Name: "); String names = input.nextLine(); System.out.println("Insert Coursework: "); int courseworks = input.nextInt(); System.out.println("Insert Exam: "); int exams = input.nextInt(); name[count] = names; coursework[count] = courseworks; exam[count] = exams; count++; } static void listAll() { for(int i=0;i<count;i++) { System.out.printf("%s %d %d\n", name[i], coursework[i], exam[i]); } } static void listGrades() { for(int i=0;i<count;i++){ if(coursework[i] + exam[i] > 79) { System.out.println(name[i] + " HD"); } else if(coursework[i] + exam[i] > 69) { System.out.println(name[i] + " DI"); } else if(coursework[i] + exam[i] > 59) { System.out.println(name[i] + " CR"); } else if(coursework[i] + exam[i] > 49) { System.out.println(name[i] + " PA"); } else { System.out.println(name[i] + " NN"); } } } static void average() { } static void highestTotal() { int largest=exam[0]; String student=name[0]; for(int i=0; i<exam.length; i++){ if(exam[i]>largest){ largest = exam[i] + coursework[i]; student = name[i]; } } System.out.printf(student + ": "+ largest + "\n" ); } static void lowestTotal() { int min = 0; for(int i=0; i<=exam[i]; i++){ for(int j =0; j<=exam[i]; j++){ if(exam[i]<=exam[j] && j==exam[j]){ min = exam[i] + coursework[i]; } else{ continue; } } } System.out.printf(name + ": "+ min + "\n" ); } static void order() { } }

    Read the article

  • What video codecs have most amount of content and thus popular at present/in future?

    - by goldenmean
    Hi, I want to find out if I can get some data on the percentage wise distribution of video content, for different video codecs currently used for video encoding. I know there are different applications/use-case scenarios which have different encoder used but i want to consdier all that and have a overall usage number(%) My guess is(highest to lowest % of content) - H.264(AVC) DivX MPEG2 VP6 Where do H.263, MPEG4, VC-1, RV, Theora, etc. fit in here. How may this look like in future? PS:I would like this to be community wiki to have get wider range of inputs, if someone with privileges can do it for me please. thank you. -AD

    Read the article

  • How do I play flash files in pure C?

    - by CDR
    As part of a customized media player written in C (Win32), I need to enable my app play flash movies (.swf files) inside the player window. Can someone please indicate the most C compatible low level way to achieve this, giving me highest control? Specially control on display window and network access. I am looking for reference to a Windows DLL like flash_player.dll (if there is such thing) with documentation. Or at least a COM/ActiveX controls. Note that ActiveX is harder to use in C, than in say VB.

    Read the article

  • Why does this VBS scheduled task (to call a URL) not work in Windows Server 2008?

    - by user303644
    This same script worked in older server OS environments, and even on my desktop; and allows me to kick off a nightly process on my website's URL. It simply will not execute the URL in my Windows Server 2008 environment. It does not generate any errors, claiming task completion I can pull the same URL up just fine in the server's web browser I have the script running with "highest privileges" I even tried to create a batch file which executes it, so I can explicitly "Run as Administrator" and it still will not execute the URL (but will not generate any errors either). I'm baffled as to why the task claims to have completed successfully, yet the script never reaches the URL. Call LogEntry() Sub LogEntry() 'Force the script to finish on an error. On Error Resume Next 'Declare variables Dim objRequest Dim URL Set objRequest = CreateObject("MSXML2.ServerXMLHTTP") 'Put together the URL link appending the Variables. URL = "http://myURL/AutorunNightlyTasks.aspx" 'Open the HTTP request and pass the URL to the objRequest object objRequest.open "GET", URL, False 'Send the HTML Request objRequest.send() 'Set the object to nothing Set objRequest = Nothing End Sub

    Read the article

  • 3 fixed Columns (header and footer) using DIVs, NO Absolute DIVs, IE friendly, ALL columns stretch e

    - by Phillip Schein
    Left to right, Col1 id 560px wide with 10 px padding, middle column, 250px wide with 5px padding and Col3 (siderbar) is 200px wide with 3px padding. Background coloR, no matter text length in any column should stretch vertically equal. No javascript (jQuery workarounds) to make it work. It needs to be pure Semantic Markup with CSS. Each Column should have a nested column of color were content will go. Column 1 should be SEO prominant which means the highest nested column for Google and other Search Engines to crawl. I have used 'The Holy Grail" layout, articles at "A List Apart" and these solution are so convoluted that they push the main columns left and than the nested columns push them with padding back right. This is crazy! I try to adjust these examples, but they're not editable by just adjusting a width in the CSS or the padding, etc. Can you please help me?

    Read the article

  • How to join table to itself and select max values in SQL

    - by Jakub Konop
    I have a contracts table: contractId date price partId 1 20120121 10 1 2 20110130 9 1 3 20130101 15 2 4 20110101 20 2 The contract with greatest date being the active contract (don't blame me, I blame infor for creating xpps) I need to create query to see only active contracts (one contract per part, the contract with highest date). So the result of the query should be like this: contractId date price partId 1 20120121 10 1 3 20130101 15 2 I am out of ideas here, I tried self joining the table, I tried aggregation functions, but I can't figure it out. If anyone would have any idea, please share them with me..

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >