Search Results

Search found 5942 results on 238 pages for 'total starnger'.

Page 148/238 | < Previous Page | 144 145 146 147 148 149 150 151 152 153 154 155  | Next Page >

  • Balanced Search Tree Query, Asymtotic Analysis..

    - by AGeek
    Hi, The situation is as follows:- We have n number and we have print them in sorted order. We have access to balanced dictionary data structure, which supports the operations serach, insert, delete, minimum, maximum each in O(log n) time. We want to retrieve the numbers in sorted order in O(n log n) time using only the insert and in-order traversal. The answer to this is:- Sort() initialize(t) while(not EOF) read(x) insert(x,t); Traverse(t); Now the query is if we read the elements in time "n" and then traverse the elements in "log n"(in-order traversal) time,, then the total time for this algorithm (n+logn)time, according to me.. Please explain the follow up of this algorithm for the time calculation.. How it will sort the list in O(nlogn) time?? Thanks.

    Read the article

  • mysql select query optimization

    - by Saharsh Shah
    I have two table testa & testb. CREATE TABLE `testa` ( `id` INT(10) NOT NULL AUTO_INCREMENT, `name` VARCHAR(50) DEFAULT NULL, PRIMARY KEY (`id`) ); CREATE TABLE `testb` ( `id` INT(10) NOT NULL AUTO_INCREMENT, `name` VARCHAR(50) DEFAULT NULL, `aid1` INT(10) DEFAULT NULL, `aid2` INT(10) DEFAULT NULL, `aid3` INT(10) DEFAULT NULL, PRIMARY KEY (`id`) ); Currently I am running below query for retrieving all rows where id in testa table matches with any columns of aid1,aid2,aid3 in tableb. The query is retreiving acurate result but it is taking minimum 30 seconds to execute which is too much. I have also tried to optimise my query using UNION but failed to do so. SELECT a.id, a.name, b.name, b.id FROM testb b INNER JOIN testa a ON b.aid1 = a.id OR b.aid2 = a.id OR b.aid3 = a.id ; How do i optimize my query so it's total execution time is within 2-3 seconds? Thanks in advance...

    Read the article

  • Entry points on different urls possible?

    - by user246114
    Hi, I've got a typical gwt project, but am using some url rewriting techniques such that urls entered like: www.mysite.com/johndoe www.mysite.com/janedoe all get served by my main entrypoint project.jsp file. This works great when deployed. When I'm running in hosted mode, it's a total bummer because changing the url in the browser breaks the link with the hosted-mode debugging, such that when I make changes to the source in eclipse and refresh, those changes are not immediately shown. I need to recompile the app and relaunch, and we all know how long that takes. Is there any way to somehow get the hosted-mode environment to recognize that the same webapp is being served on these different urls, and just reconnect the debugging connection? We basically get: http://localhost:8888/myproject.jsp?gwt.codesvr=192.168.1.2:9997 when launching hosted mode, I'd like: http://localhost:8888/johndoe to just reconnect to the debugger, if possible. Thanks

    Read the article

  • c++ function overloading, making fwrite/fread act like PHP versions

    - by Newbie
    I'm used to the PHP fwrite/fread parameter orders, and i want to make them the same in C++ too. I want it to work with char and string types, and also any data type i put in it (only if length is defined). I am total noob on c++, this is what i made so far: size_t fwrite(FILE *fp, const std::string buf, const size_t len = SIZE_MAX){ if(len == SIZE_MAX){ return fwrite(buf.c_str(), 1, buf.length(), fp); }else{ return fwrite(buf.c_str(), 1, len, fp); } } size_t fwrite(FILE *fp, const void *buf, const size_t len = SIZE_MAX){ if(len == SIZE_MAX){ return fwrite((const char *)buf, 1, strlen((const char *)buf), fp); }else{ return fwrite(buf, 1, len, fp); } } Should this work just fine? And how should this be done if i wanted to do it the absolutely best possible way?

    Read the article

  • Full GC real time is much more that user+sys times

    - by Stas
    Hi. We have a Web Java based application running on JBoss with allowed maximum heap size of about 1.2 GB (total machine physical memory is 2 GB). At some point the application stops responding (to clients) for several minutes. After some analysis we found out that the culprit is the Full GC. Here's an excerpt from the verbose GC log: 74477.402: [Full GC [PSYoungGen: 3648K-0K(332160K)] [PSOldGen: 778476K-589497K(819200K)] 782124K-589497K(1151360K) [PSPermGen: 102671K-102671K(171328K)], 646.1546860 secs] [Times: user=3.84 sys=3.72, real=646.17 secs] What I don't understand is how is it possible that the real time spent on Full GC is about 11 minutes (646 seconds), while user+sys times are just 7.5 seconds. 7.5 seconds sound to me much more logical time to spend for cleaning <200 MB from the old generation. Where does all the other time go? Thanks a lot.

    Read the article

  • In SQL Server, can multiple inserts be replaced with a single insert that takes an XML parameter?

    - by Mayo
    So I have an existing ASP.NET solution that uses LINQ-to-SQL to insert data into SQL Server (5 tables, 110k records total). I had read in the past that XML could be passed as a parameter to SQL Server but my google searches turn up results that store the XML directly into a table. I would rather take that XML parameter and insert the nodes as records. Is this possible? How is it done (i.e. how is the XML parameter used to insert records in T-SQL, how should the XML be formatted)? Note: I'm researching other options like SQL bulk copy and I know that SSIS would be a good alternative. I want to know if this XML approach is feasible.

    Read the article

  • MySQL: check whether two fields on a model are always the same?

    - by AP257
    Sorry if this is a duplicate question, I'm a total database newbie and I'm probably using the wrong terminology to search for answers. I have a MySQL table as follows: +------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+---------------+------+-----+---------+-------+ | placeid | int(11) | NO | PRI | NULL | | | grid | varchar(120) | YES | | NULL | | | vill | varchar(300) | YES | | NULL | | +------------+---------------+------+-----+---------+-------+ I'd like to find out whether 'grid' and 'vill' always occur in the same combinations or not. Maybe it'd be clearer with an example: placeid, grid, vill 1, TM1, Suffolk 2, TM1, Suffolk 3, WA8, Newcastle 4, WA8, Newcastle 5, WA8, York I'd like to construct a query that returns 'WA8' but not 'TM1', because 'WA8' occurs in combination with more than one vill. I would be SO grateful for any help!

    Read the article

  • Cheap shared windows hosting

    - by Elangovan
    Hi I have recently purchased a domain from go daddy, now I am looking for a cheap windows hosting. Following are my requirements Shared Windows hosting Should be cheap in price Should have at least one SQL server Db and one mysql db. Should support atleast asp.net 3.5 and php Will be good if it has support for asp.net mvc (no problem even if it is not available also) Should be able to install third party blog sites. Bandwidth, total space and performance are not very important. Silverlight is also an added advantage (no problem even if it is not available also). There should be no advertisement or banner added by the hosting company in the site.

    Read the article

  • Adding a decorator that converts strings to lowercase in Python

    - by user2905382
    So I am new to learning decorators and I have gone through countless tutorials and while I understand and can mostly follow all of the examples, I think the best way to learn, would be to implement a decorator myself. So I am going to use this example below. I realize a decorator is not at all necessary to do this, but for the sake of learning, I would like to add a decorator that filters the strings like dog name and breed and turns them into lowercase. Any ideas or pointers in the right direction would be appreciated. class Dogs: totalDogs = 0 dogList=[] def __init__(self, breed, color, age): self.breed=breed self.color=color self.age=age Dogs.dogList.append(self.breed) Dogs.totalDogs += 1 def displayDogs(self): print "breed: ", self.breed print "color: ",self.color print "age: ",self.age print "list of breeds:", Dogs.dogList print "total dogs: ", Dogs.totalDogs def somedecorator(*args): #now what terrier=Dogs("TeRrIer", "white", 5) terrier.displayDogs() retriever=Dogs("goldenRETRIEVER", "brown", 10) retriever.displayDogs()

    Read the article

  • Increase the TCP receive window for a specific socket

    - by rursw1
    Hi, How to increase the TCP receive window for a specific socket? - I know how to do so for all the sockets by setting the registry key TcpWindowSize, but how do do that for a specific one? According to MSFT's documents, the way is Calling the Windows Sockets function setsockopt, which sets the receive window on a per-socket basis. But in setsockopt, it is mentioned about SO_RCVBUF : Specifies the total per-socket buffer space reserved for receives. This is unrelated to SO_MAX_MSG_SIZE and does not necessarily correspond to the size of the TCP receive window. So is it possible? How? Thanks.

    Read the article

  • Is there any project estimator tool to give estimate for web design/ developemnt work?

    - by jitendra
    Is there any project estimator tool to give estimate for web design/ development work? I don't have to calculate Price jusr want to calculate estimated time. for things like Just for example Page creation (layout in XHTML) CSS creation Content creation (Word to HTML including images in some pages) Bulk PDF upload PHP Script for Form Testing all pages I need like Items Quantity Time for each task(min.) Estimated total (in hour) PDF upload x 30 = 2 min = 60 Min pages with images x 30 = 15 min for each = 60 Min is there any simple jquery calculator power with jquery . Where we can add add remove custom thing to calculate time.? or any other free online/offline tool

    Read the article

  • Experiences with OpenLaszlo?

    - by itsmatt
    In a related question, I asked about Web Development. I came across something called OpenLaszlo yesterday and thought it looked interesting for doing some website development. The site has a bunch of good information on it and they've got some nice tutorials and such, but being a total novice (as far as web development goes), I'm wondering whether anyone here would recommend this. As I stated in my other question, this is a new world for me and there are a lot of directions I could go. Can you compare/contrast this and other web development you've done? Obviously, this is somewhat subjective, but I haven't heard much about it on SO and I'm hoping to get some opinions on this.

    Read the article

  • Java escape HTML - string replace slow?

    - by cpf
    Hi StackOverflow, I have a Java application that makes heavy use of a large file, to read, process and give through to SolrEmbeddedServer (http://lucene.apache.org/solr/). One of the functions does basic HTML escaping: private String htmlEscape(String input) { return input.replace("&", "&amp;").replace(">", "&gt;").replace("<", "&lt;") .replace("'", "&apos;").replaceAll("\"", "&quot;"); } While profiling the application, the program spends roughly 58% of the time in this function, a total of 47% in replace, and 11% in replaceAll. Now, is the Java replace that slow, or am I on the right path and should I consider the program efficient enough to have its bottleneck in Java and not in my code? (Or am I replacing wrong?) Thanks in advance!

    Read the article

  • Inconsistent values in network switch throughput values

    - by Marcus Hughes
    Quite simple, I have a network switch with SNMP, and need to calculate the throughput of the switch port, so simply I use ifOutOctets. We transfer a file which is 145MB and if we use the total from the start, subtracted from the value at the end then the value is : 158901842 I simply can't get the value to match, or be anything similar to what the real transfer is. I understand that there may be excess traffic etc but I just can't get it to be anywhere similar (the server being tested has no traffic when this is not running) We have tried for a long time and suspect there may be an issue with the recording on the HP switch, do you have any suggestions, or how should we be calculating it? Thanks a lot in advance We have a HP ProCurve 1810G on 2.2

    Read the article

  • How can I intercept a Tomcat request at socket level?

    - by Miguel Pardal
    Hi, I'm doing a performance study for a web application framework running on Apache Tomcat 6. I'm trying to measure the time overhead of handling HTTP requests. What I would like to do is: / // just before first request byte is read long t1 = System.nanoTime(); // request is processed... // just after final byte is written to response long t2 = System.nanoTime(); / Then I would compute the total time (t2 - t1). Is there a way to do this? Thanks for your help!

    Read the article

  • Another Permutation Word Conundrum... With Linq?

    - by CraigF
    I have seen many examples of getting all permutations of a given set of letters. Recursion seems to work well to get all possible combinations of a set of letters (though it doesn't seem to take into account if 2 of the letters are the same). What I would like to figure out is, could you use linq (or not) to get all possible combinations of letters down to 3 letter combinations. For example, given the letters: P I G G Y I want an array of all possible cominations of these letters so I can check against a word list (scrabble?) and eventually get a list of all possible words that you can make using those letters (from 3 letters up to the total, in this case 5 letters).

    Read the article

  • How Likely Is It That I'll Get Sued Developing Software?

    - by yar
    It has been a practically unanimous truth on StackOverflow that if you work as an independent consultant, you should probably form a corporation (as seen here), to limit personal liability, supposedly to protect you in case of lawsuit. It seems to me that developing software does not result in many lawsuits, but this is an empirical (objective [and not community wiki]) question: How likely is it that a lone software developer will be sued? Also, by whom (a disgruntled company, coworker)? Since incorporating is basically taking out insurance, the likelihood of catastrophe needs to be taken into account. Also, aren't there standard laws covering, for example, total screw-ups with corporate data that mean that protect the lone cowboy/girl/person/coder?

    Read the article

  • How to calculate the audio file duration in core audio?

    - by mystify
    I have this info variable which is of this type: struct AudioStreamBasicDescription { Float64 mSampleRate; UInt32 mFormatID; UInt32 mFormatFlags; UInt32 mBytesPerPacket; UInt32 mFramesPerPacket; UInt32 mBytesPerFrame; UInt32 mChannelsPerFrame; UInt32 mBitsPerChannel; UInt32 mReserved; }; How could I calculate the total duration of the audio file, in seconds?

    Read the article

  • why arrayfun does NOT improve my struct array operation performance

    - by HaveF
    here is the input data: % @param Landmarks: % Landmarks should be 1*m struct. % m is the number of training set. % Landmark(i).data is a n*2 matrix old function: function Landmarks=CenterOfGravity(Landmarks) % align center of gravity for i=1 : length(Landmarks) Landmarks(i).data=Landmarks(i).data - ones(size(Landmarks(i).data,1),1)... *mean(Landmarks(i).data); end end new function which use arrayfun: function [Landmarks] = center_to_gravity(Landmarks) Landmarks = arrayfun(@(struct_data)... struct('data', struct_data.data - repmat(mean(struct_data.data), [size(struct_data.data, 1), 1]))... ,Landmarks); end %function center_to_gravity when using profiler, I find the usage of time is NOT what I expected: Function Total Time Self Time* CenterOfGravity 0.011s 0.004 s center_to_gravity 0.029s 0.001 s Can someone tell me why? BTW...I can't add "arrayfun" as a new tag for my reputation.

    Read the article

  • How fast are App Engine db.get(keys) and A.all(keys_only=True).filter('b =', b).fetch(1000)?

    - by Liron Shapira
    A db.get() of 50 keys seems to take me 5-6 seconds. Is that normal? What is the time a function of? I also did a A.all(keys_only=True).filter('b =', b).fetch(1000) where A.b is a ReferenceProperty. I did 50 such round trips to the datastore, with different values of b, and the total time was only 3-4 seconds. How is this possible? db.get() is done in parallel, with only one trip to the datastore, and I would think that looking up an entity by key is a faster operation than fetch.

    Read the article

  • (Python) algorithm to randomly select a key based on proportionality/weight

    - by LaundroMat
    Hi - I'm a bit at a loss as to how to find a clean algorithm for doing the following: Suppose I have a dict k: >>> k = {'A': 68, 'B': 62, 'C': 47, 'D': 16, 'E': 81} I now want to randomly select one of these keys, based on the 'weight' they have in the total (i.e. sum) amount of keys. >>> sum(k.values()) >>> 274 So that there's a >>> 68.0/274.0 >>> 0.24817518248175183 24.81% percent change that A is selected. How would you write an algorithm that takes care of this? In other words, that makes sure that on 10.000 random picks, A will be selected 2.481 times?

    Read the article

  • issue running a batch script to kill a process

    - by user657064
    I am using the following script on a command line to kill a hypothetical notepad process (using a Korn shell in Windows XP, if that matters): kill $(tasklist | grep -i notepad.exe | awk '{print 2}') Now I take this line, and put it into a batch file c:\temp\testkill.bat, thinking that I should just as well be able to kill the process by running the batch file. However, when I run the batch file, I get the following awk error about unbalanced parentheses: C:/Temp ./testkill.bat C:\Tempkill $(tasklist | grep -i notepad.exe | awk '{print $2}') awk: unbalanced () Context is: {print $2}) <<< C:/Temp So I'm baffled as to why I am getting this error about unbalanced parentheses when I run this script via a batch file, but have no issues when I run the command directly from the command line? (Btw, I'm not necessarily tied to this way of killing a process - as a total noob to shell scripting, I am additionally wondering why if I write the following on the command line: tasklist | grep -i notepad.exe | awk '{print $2}' | kill the process ID that comes out of the tasklist/grep/awk calls doesn't seem to properly get piped to kill...)

    Read the article

  • List of items with same values

    - by user559780
    I'm creating a list of items from a file BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("H:/temp/data.csv"))); try { List<Item> items = new ArrayList<Item>(); Item item = new Item(); String line = null; while ((line = reader.readLine()) != null) { String[] split = line.split(","); item.name = split[0]; item.quantity = Integer.valueOf(split[1]); item.price = Double.valueOf(split[2]); item.total = item.quantity * item.price; items.add(item); } for (Item item2 : items) { System.out.println("Item: " + item2.name); } } catch (IOException e) { reader.close(); e.printStackTrace(); } Problem is the list is displaying the last line in the file as the value for all items.

    Read the article

  • javascript - switch not working

    - by Fernando SBS
    function FM_log(level, text) { // caso não seja log total escolhe o que loga var log = false; switch (level) { case "addtoprio()":log = true; case "alternaTropas()":log = false; case "sendtroops()":log = false; defalt: log = false; } if ((logTotal == false) && (log == true)) GM_log(horaAtual() + " - "+level+", "+text); else if (logTotal == true) GM_log(horaAtual() + " - "+level+", "+text); } how to do that switch is a way it works?

    Read the article

  • SQL Server Service Broker Service Disappearing (Automatically Deleted)?

    - by mwigdahl
    I've implemented a messaging system over SQL Server Service Broker. It is working great, with the sole exception that every once in a while (maybe once per week per server) my initiator service just vanishes without a trace. The corresponding queue is still there, but the service is missing. Obviously this causes problems in my system. It's a simple matter to recreate the service by hand, but I'm confused as to what might cause this behavior. I understand that automatic poison message handling causes queues to be disabled, but I don't see anything that indicates services can be disabled or deleted automatically. When this happens, I usually have a large backlog of messages in multiple application queues, but nothing extreme. Total message backlog is around 200,000. Does anyone know what might be happening here?

    Read the article

< Previous Page | 144 145 146 147 148 149 150 151 152 153 154 155  | Next Page >