Search Results

Search found 4955 results on 199 pages for 'range'.

Page 89/199 | < Previous Page | 85 86 87 88 89 90 91 92 93 94 95 96  | Next Page >

  • SQL Server 2000: Why is this query w/ variables so slow vs w/o variables?

    - by William DiStefano
    I can't figure out why this query would be so slow with variables versus without them. I read some where that I need to enable "Dynamic Parameters" but I cannot find where to do this. DECLARE @BeginDate AS DATETIME ,@EndDate AS DATETIME SELECT @BeginDate = '2010-05-20' ,@EndDate = '2010-05-25' -- Fix date range to include time values SET @BeginDate = CONVERT(VARCHAR(10), ISNULL(@BeginDate, '01/01/1990'), 101) + ' 00:00' SET @EndDate = CONVERT(VARCHAR(10), ISNULL(@EndDate, '12/31/2099'), 101) + ' 23:59' SELECT * FROM claim c WHERE (c.Received_Date BETWEEN @BeginDate AND @EndDate) --this is much slower --(c.Received_Date BETWEEN '2010-05-20' AND '2010-05-25') --this is much faster

    Read the article

  • D3 fisheye on width on bar chart

    - by Dexter Tan
    i have been trying to create a vertical bar chart with a d3 fisheye cartesian distortion with only the x-axis being distorted. I have succeeded in distorting the x position of the vertical bars on mouseover with the following code: var maxMag = d3.max(dataset, function(d) { return d.value[10]; }); var minDate = d3.min(dataset, function(d) { return new Date(d.value[1], d.value[2]-1, d.value[3]).getTime(); }); var maxDate = d3.max(dataset, function(d) { return new Date(d.value[1], d.value[2]-1, d.value[3]).getTime(); }); var yScale = d3.scale.linear().domain([0, maxMag]).range([0, h]); var xScale = d3.fisheye.scale(d3.scale.linear).domain([minDate, maxDate]).range([0, w]).focus(w/2); var bar = svg.append("g") .attr("class", "bars") .selectAll(".bar") .data(dataset) .enter().append("rect") .attr("class", "bar") .attr("y", function(d) { return h - yScale(d.value[10]); }) .attr("width", w/dataset.length) .attr("height", function(d) { return yScale(d.value[10]); }) .attr("fill", function(d) { return (d.value[10] <= 6? "yellow" : "orange" ); }) .call(position); // Positions the bars based on data. function position(bar) { bar.attr("x", function(d) { var date = null; if (d.date != null) { date = d.date; } else { date = new Date(d.value[1],0,1); if (d.value[2] != null) date.setMonth(d.value[2]-1); if (d.value[3] != null) date.setMonth(d.value[3]); d.date = date; } return xScale(date.getTime()); }); } svg.on("mousemove", function() { var mouse = d3.mouse(this); xScale.distortion(2.5).focus(mouse[0]); bar.call(position); }); However at this point, applying fisheye on the width remains a mystery to me. I have tried several methods like using a fisheye scale for width however it does not work as expected. What i wish to do is to have the width of a bar expand on mouseover, the same way a single vertical bar is singled out on mouseover with the cartesian distortion. Any clues or help will be much appreciated! edit: http://dexter.xumx.me to view the visualisation i am talking about for easier understanding!

    Read the article

  • PHP- Curl Download Bandwidth Limiting

    - by snikolov
    Hey guys, I have been trying to limit the bandwidth with PHP. Can you please help here? I can't get the download rate to be limited with PHP. Thanks a million! function total_filesize($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "$url"); curl_setopt($ch, CURLINFO_SPEED_DOWNLOAD,12); //ITS NOT WORKING! curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) ". "Gecko/20071127 Firefox/2.0.0.11"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_NOBODY, true); $chStore = curl_exec($ch); $chError = curl_error($ch); $chInfo = curl_getinfo($ch); curl_close($ch); return $size = $chInfo['download_content_length']; } function __define_url($url) { $basename = basename($url); Define('filename',$basename); $define_file_size = total_filesize($url); Define('filesizes',$define_file_size); } function _download_file($url_file) { __define_url($url_file); // $range = "50000-60000"; $filesize = filesizes; $file = filename; header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="'.$file.'"'); header('Content-Transfer-Encoding: binary'); header("Content-Length: $filesize"); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"$url_file"); curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); // curl_setopt($ch, CURLOPT_RANGE,$range); curl_exec($ch); curl_close($ch); } _download_file('http://rarlabs.com/rar/wrar393.exe');

    Read the article

  • any faster alternative??

    - by kaushik
    I have to read a file from a particular line number and i know the line number say "n": i have been thinking of two choice: 1)for i in range(n) fname.readline() k=readline() print k 2)i=0 for line in fname: dictionary[i]=line i=i+1 but i want to know faster alternative as i might have to perform this on different files 20000 times. is there is any other better alternatives?? thanking u

    Read the article

  • any faster alternative??

    - by kaushik
    cost=0 for i in range(12): cost=cost+math.pow(float(float(q[i])-float(w[i])),2) cost=(math.sqrt(cost)) Any faster alternative to this? i am need to improve my entire code so trying to improve each statements performance. thanking u

    Read the article

  • VBA Excel - Workbook_SheetChange

    - by user2947014
    Hopefully this question hasn't already been asked, I tried searching for an answer and couldn't find anything. This is probably a simple question, but I am writing my first macro in excel and am having a problem that I can't find out a solution to. I wrote a couple of macros that basically sum up columns dynamically (so that the number of rows can change and the formula moves down automatically) based on a value in another column of the same row, and I call those macros from the event Workbook_SheetChange. The problem I'm having is, I change a cell's value from my macro to display the result of the sum, and this then calls Workbook_SheetChange again, which I do not want. Right now it works, but I can trace it and see that Workbook_SheetChange is being called multiple times. This is preventing me from adding other cell changes to the macros, because then it results in an infinite loop. I want the macros to run every time a change is made to the sheet, but I don't see any way around allowing the macros to change a cell's value, so I don't know what to do. I will paste my code below, in case it is helpful. Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) Dim Row As Long Dim Col As Long Row = Target.Row Col = Target.Column If Col <> 7 Then Range("G" & Row).Select Selection.Formula = "=IF(F" & Row & "=""Win"",E" & Row & ",IF(F" & Row & "=""Loss"",-D" & Row & ",0))" Target.Select End If Call SumRiskColumn End Sub Private Sub Workbook_SheetCalculate(ByVal Sh As Object) Call SumOutcomeColumn End Sub Sub SumOutcomeColumn() Dim N As Long N = Cells(Rows.Count, "A").End(xlUp).Row Cells(N + 1, "G").Formula = "=SUM(G2:G" & N & ")" End Sub Sub SumRiskColumn() Dim N As Long N = Cells(Rows.Count, "A").End(xlUp).Row Dim CurrTotalRisk As Long CurrTotalRisk = 0 For i = 2 To N If IsEmpty(ActiveSheet.Cells(i, 6)) And Not IsEmpty(ActiveSheet.Cells(i, 1)) And Not IsEmpty(ActiveSheet.Cells(i, 2)) And Not IsEmpty(ActiveSheet.Cells(i, 3)) Then CurrTotalRisk = CurrTotalRisk + ActiveSheet.Cells(i, 4).Value End If Next i Cells(N + 1, "D").Value = CurrTotalRisk End Sub Thank you for any help you can give me! I really appreciate it.

    Read the article

  • Silverlight DataGrid Exception Reordering Column Headers

    - by Mike
    I'm trying to set the initial display order of the column headers in a silverlight datagrid by changing the column header DisplayIndex values. If I try to set the column order at page load time, I get an out of range exception. If I set the column order (same routine) at a later time like, in a button click handler, it works. Is this just a bug in the silverlight datagrid control? Suggestions for a possible work around?

    Read the article

  • compare two following values in numpy array

    - by Billy Mitchell
    What is the best way to touch two following values in an numpy array? example: npdata = np.array([13,15,20,25]) for i in range( len(npdata) ): print npdata[i] - npdata[i+1] this looks really messed up and additionally needs exception code for the last iteration of the loop. any ideas? Thanks!

    Read the article

  • Common way to compare timestamp in oracle, postgres and SQL Server

    - by Pratik
    I am writing a sql query which involves finding if timestamp falls in particular range of days. I have written that in the postgres but it doesn't works in Oracle and SQL Server: AND creation_date < (CURRENT_TIMESTAMP - interval '5 days') AND creation_date >= (CURRENT_TIMESTAMP - interval '15 days') Is there are common way to compare the timestamp across different databases?

    Read the article

  • SQL query for active users

    - by user344513
    This SQL query gives me today's number of users active in the last 30 days: SELECT COUNT(*) FROM table.users WHERE creation_tsz >= (now() - interval '30 days') How can I modify it to get not a single value, but a table of active users for a range of dates? Thanks, Rob

    Read the article

  • Convert wchar_t to char

    - by Yan Cheng CHEOK
    I was wondering is it safe to do so? wchar_t wide = /* something */; assert(wide >= 0 && wide < 256 &&); char myChar = static_cast<char>(wide); If I am pretty sure the wide char will fall within ASCII range.

    Read the article

  • How to find the ocean using Google Maps API

    - by geejay
    I am trying to figure out where the ocean is in an arbitrary Google Maps view. I actually have the lat lon (a range of points, when joined together form the coastline) of the coastline. But how do I tell which side of this line is the coastline? One possible solution would be to find the latlon of the nearest service or town or business or something, and then the ocean is obviously on the other side (given a small enough enclosing polygon). Is there a better way?

    Read the article

  • RegularExpressionValidator - Windows ID Validation

    - by Albert
    I'd like to setup a RegularExpressionValidator to ensure users are entering valid windows IDs in a textbox. Specifically, I'd like to ensure it's any three capital letters (for our range of domains), followed by a backslash, followed by any number of letters and numbers. Does anyone know where I can find some examples of this type of validation...or can somebody whip one up for me? :)

    Read the article

  • Midlet wake up from bluetooth connection

    - by WhiteTigerK
    Hi, I'm trying to register a midlet for push registration, in order to wake up from a bluetooth connection. The requested behavior is that the application will wake up when a car's kit (hands free) will be in the range of the device. Is it possible at all? If yes, how should it be done? Thanks in advance,

    Read the article

  • JLabel not displaying all the characters even after dynamically changing font size

    - by wniroshan
    Hi all, I am trying to fit a sentence that changes often, in to a few jlabels. Widths of my 3 jlabels stay unchanged all the time. What I am doing is changing the font size so all the characters can fit with out non being out of the display range of the labels. What I do is call below code snippet when ever sentence is changed. Here is my code String sentence = "Some long sentence"; int SentenceLength = sentence.length(); int FontSize = 0; // sum of widths of the three labels int TotalLblLength=lbl_0ValueInWords.getWidth()+lbl_1ValueInWords.getWidth()+lbl_1ValueInWords.getWidth(); /*decide the font size so that all the characters can be displayed with out exceeding the display renge(horizontal) of the 3 labels Inconsolata -> monopace font font size == width of the font*2 (something I observed, not sure if this is true always) */ FontSize=(TotalLblLength/SentenceLength)*2; // max font size is 20 - based on label height FontSize=(FontSize>20)?20:FontSize; lbl_0ValueInWords.setFont(new java.awt.Font("Inconsolata", 0,FontSize)); lbl_1ValueInWords.setFont(new java.awt.Font("Inconsolata", 0,FontSize)); lbl_2ValueInWords.setFont(new java.awt.Font("Inconsolata", 0,FontSize)); int CharCount_lbl0 = width_lbl0 / (FontSize / 2); int CharCount_lbl1 = width_lbl1 / (FontSize / 2); int CharsCount_lbl2 = width_lbl2 / (FontSize / 2); /*Set texts of each label if sentence has more than the number of characters that can fit in the 1st label, excessive characters are moved to the 2nd label. same goes for the 2nd and 3rd labels*/ if (SentenceLength > CharCount_lbl0) { lbl_0ValueInWords.setText(sentence.substring(0, CharCount_lbl0)); if (SentenceLength > CharCount_lbl0 + CharCount_lbl1) { lbl_1ValueInWords.setText(sentence.substring(CharCount_lbl0, CharCount_lbl0 + CharCount_lbl1)); lbl_2ValueInWords.setText(sentence.substring(CharCount_lbl0 + CharCount_lbl1, SentenceLength)); } else { lbl_1ValueInWords.setText(sentence.substring(CharCount_lbl0, SentenceLength)); } } else { lbl_0ValueInWords.setText(sentence); } But even after resetting font size sometimes the last character goes out of the display range. I have removed margines from the jlabels that may cause this. This happens for random length sentences. I can solve the problem for the application by reducing label width used for the calculations(hopefully) Can anyone explain me the reason? Could be because of some defect in the fonts symmetry?

    Read the article

  • how to invisible a column in gridview

    - by Joby Kurian
    how to invisible a column in gridview.I tried to use this---dataGridView.Columns(0).Visible = False.But its getting an error "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index".How to do that?

    Read the article

  • Localized Date Validator

    - by Blithe
    Is there a way to use user's culture to localize the Range Validator for date? I am looking for a good way to validate date and avoiding to provide a fix format (e.g.: do a dd/mm/yyyy using Regular Expression Validator)

    Read the article

  • Color scaling function

    - by Tomas Pajonk
    I am trying to visualize some values on a form. They range from 0 to 200 and I would like the ones around 0 be green and turn bright red as they go to 200. Basically the function should return color based on the value inputted. Any ideas ?

    Read the article

  • Dynamically find other hosts in a LAN in Java

    - by Federico Cristina
    A while ago I developed a little LAN chat app. in Java which allows chatting with other hosts, send images, etc. Although it was created just for fun, now it's being used where I work. Currently, there is no "chat server" on the app. where each client registers, updates it's status, etc. (I liked the idea of symmetric design and not depending on a server running on some other machine). Instead, each host is a client/server which has a hosts.properties file with the hostname of the other hosts, and - for instance - broadcasts to each one of them when sending a massive message/image/whatever. In the beginning there were just a couple of hosts, so this hosts.properties file wasn't an issue. But as the amount of users increased, the need of updating that file was a bit daunting. So now I've decided to get rid of it, and each time the app. starts, dynammically find the other active hosts. However, I cannot find the correct way of implement this. I've tried starting different threads, each one of them searching for other hosts in a known range of IP addresses. Something like this (simplified for the sake of readability): /** HostsLocator */ public static void searchForHosts(boolean waitToEnd) { for (int i=0; i < MAX_IP; i+= MAX_IP / threads) { HostsLocator detector = new HostsLocator(i, i+(MAX_IP / threads - 1)); // range: from - to new Thread(detector).start(); } } public void run() { for (int i=from; i<=to; i++) findHosts( maskAddress + Integer.toString(i) ); } public static boolean findHosts(String IP) { InetAddress address = InetAddress.getByName(IP); if ( address.isReachable(CONNECTION_TIME_OUT) ) // host found! } However: With a single thread and a low value in CONNECTION_TIME_OUT (500ms) I get wrong Host Not Found status for for hosts actually active. With a high value in CONNECTION_TIME_OUT (5000ms) and only one single thread takes forever to end With several threads I've also found problems similar like the first one, due to collisions. So... I guess there's a better way of solving this problem but I couldn't find it. Any advice? Thanks!

    Read the article

< Previous Page | 85 86 87 88 89 90 91 92 93 94 95 96  | Next Page >