Search Results

Search found 4580 results on 184 pages for 'faster'.

Page 125/184 | < Previous Page | 121 122 123 124 125 126 127 128 129 130 131 132  | Next Page >

  • Is there a way to make this C# method shorter and more readable with the help of Linq?

    - by Hamish Grubijan
    The following works, but I figured - since it is all based on IEnumerable, Linq can come handy here is well. By the way, is there an equivalent to Directory.GetFiles() which would return an IEnumerable instead of the array? If it exists, then would it make the code run any faster? The last part of the question is inspired by Python language which favors lightweight generators over concrete lists. private IEnumerable<string> getFiles(string strDirectory, bool bCompressedOnly) { foreach (var strFile in Directory.GetFiles(strDirectory)) { // Don't add any existing Zip files since we don't want to delete previously compressed files. if (!bCompressedOnly || Path.GetExtension(strFile).ToLower().Equals(".zip")) { yield return strFile; } } foreach (var strDir in Directory.GetDirectories(strDirectory)) { foreach (var strFile in getFiles(strDir, bCompressedOnly)) { yield return strFile; } } }

    Read the article

  • Which index is used in select and why?

    - by Lukasz Lysik
    I have the table with zip codes with following columns: id - PRIMARY KEY code - NONCLUSTERED INDEX city When I execute query SELECT TOP 10 * FROM ZIPCodes I get the results sorted by id column. But when I change the query to: SELECT TOP 10 id FROM ZIPCodes I get the results sorted by code column. Again, when I change the query to: SELECT TOP 10 code FROM ZIPCodes I get the results sorted by code column again. And finally when I change to: SELECT TOP 10 id,code FROM ZIPCodes I get the results sorted by id column. My question is in the title of the question. I know which indexes are used in the queries, but my question is, why those indexes are used? I the second query (SELECT TOP 10 id FROM ZIPCodes) wouldn't it be faster if the clusteder index was used? How the query engine chooses which index to use?

    Read the article

  • Transform LINQ Dataset into a Matrix for export

    - by Mad Halfling
    Hi folks, I've got a data table with columns in which include Item, Category and Value (and others, but those are the only relevant ones for this problem) that I access via LINQ in a C# ASP.Net MVC app. I want to transform these into a matrix and output that as a CSV file to pull into Excel as matrix with the items down the side, the categories across the top and the values in the row cells. However, I don't know how many, or what, categories there will be in this table, nor will there always be a record for each item/category combination. I've written this by looping round, getting my "master category" list, then looking again for each item, filling in either blank or Value, depending on whether the item/category record exists, but as there are currently 27000 records in the table, this isn't as fast as I'd like. Is there a slicker and faster way I can do this, maybe via LINQ (firing into a quicker SQL statement so the DB server can do the leg-work), or will any method essentially come back to what I am doing? Thx MH

    Read the article

  • UITableView with Shake and play.

    - by avural79
    hi all i am trying to make a musical app for iphone. the app is simple. there is a couple of musical note sample (caf) files. when user taps the predefined positions on uiview(like strings). app plays note sample and add a string value to a nsmutablearray about note. played note lists displays in a table. now i want to add a shake and play mode to app. when user shake iphone, recorded notes start to play from first record to last record and loop again. also if user shake iphone harder notes will plays faster. how can i do that. any idea? thanks

    Read the article

  • Is there a 'catch' with FastFormat?

    - by Roddy
    I just read about the FastFormat C++ i/o formatting library, and it seems too good to be true: Faster even than printf, typesafe, and with what I consider a pleasing interface: // prints: "This formats the remaining arguments based on their order - in this case we put 1 before zero, followed by 1 again" fastformat::fmt(std::cout, "This formats the remaining arguments based on their order - in this case we put {1} before {0}, followed by {1} again", "zero", 1); // prints: "This writes each argument in the order, so first zero followed by 1" fastformat::write(std::cout, "This writes each argument in the order, so first ", "zero", " followed by ", 1); This looks almost too good to be true. Is there a catch? Have you had good, bad or indifferent experiences with it? CW on this question, as there's probably no right answer...

    Read the article

  • Python: Access members of a set

    - by emu
    Say I have a set myset of custom objects that may be equal although their references are different (a == b and a is not b). Now if I add(a) to the set, Python correctly assumes that a in myset and b in myset even though there is only len(myset) == 1 object in the set. That is clear. But is it now possible to extract the value of a somehow out from the set, using b only? Suppose that the objects are mutable and I want to change them both, having forgotten the direct reference to a. Put differently, I am looking for the myset[b] operation, which would return exactly the member a of the set. It seems to me that the type set cannot do this (faster than iterating through all its members). If so, is there at least an effective work-around?

    Read the article

  • Java - Optimize finding a string in a list

    - by Mark
    I have an ArrayList of objects where each object contains a string 'word' and a date. I need to check to see if the date has passed for a list of 500 words. The ArrayList could contain up to a million words and dates. The dates I store as integers, so the problem I have is attempting to find the word I am looking for in the ArrayList. Is there a way to make this faster? In python I have a dict and mWords['foo'] is a simple lookup without looping through the whole 1 million items in the mWords array. Is there something like this in java? for (int i = 0; i < mWords.size(); i++) { if ( word == mWords.get(i).word ) { mLastFindIndex = i; return mWords.get(i); } }

    Read the article

  • Styled Javascript Popup that Connects to Database

    - by user269799
    I want to create a javascript popup box that contains text fields. I want to be able to style this box - using CSS - and I want the textfield entries to be Inserted into a MySQL database. Is this possible? I would be familiar with doing this through web forms and server side scripting but I need it to be a bit more client side this time to make things seem a bit faster. I am thinking I may need to learn some AJAX but any pointers would be a help. GF

    Read the article

  • Expression parser library for Android.

    - by Malx
    What is the best way to evaluate simple conditional statements like: "a>b" ? "x-4<10+y & y>x" ? Expressions are loaded from external file. Variables are set in application. Syntax used is not essential. It may be "&" or "and" or any other supported with language/library. I need to take different action depending on result of evaluation - is it true or false. Could I use any parser already included with Andorid? Is there some way to use JS "eval" from browser component? Is it possible to use sqlite expressions to get true/false result without selecting anything? Those libraries are implemented in native code. Will it be faster and less battery expensive?

    Read the article

  • what is a good way to do countif in python

    - by tolomea
    I want to count how many members of an iterable meet a given condition. I'd like to do it in a way that is clear and simple and preferably reasonably optimal. My current best ideas are: sum(meets_condition(x) for x in my_list) and len([x for x in my_list if meets_condition(x)]) The first one being iterator based is presumably faster for big lists. And it's the same form as you'd use for testing any and all. However it depends on the fact that int(True) == 1, which is somewhat ugly. The second one seems easier to read to me, but it is different from the any and all forms. Does anyone have any better suggestions? is there a library function somewhere that I am missing?

    Read the article

  • "Send it to a friend" button on a webpage

    - by kender
    Hey, How often do we see stuff like "Send this page to a friend" on a webpages? Well, I see them quite often. My question is, how do you guys see it's effectiveness? If I hit a webpage that's interesting, and I think my friend would enjoy it, I can just copy the URL from my browser bar, paste it into the email and press "Send" button. In my opinion, it's usually faster and less mistake-aware then the button/link like this on the webpage. In addition, I'm not really sure what this website does with the emails I enter there - don't they store it and then sell for $1/100 addresses to spammers? My question is - when you design a website, do you put such links on the pages (it's often seen on sites with some news/articles)? Does it even make sense?

    Read the article

  • Performance: Subquerry or Joining

    - by Auro
    HelloHello I got a little Question about Performance of a Subquerry /Joining another table INSERT INTO Original.Person ( PID, Name, Surname, SID ) ( SELECT ma.PID_new , TBL.Name , ma.Surname, TBL.SID FROM Copy.Person TBL , original.MATabelle MA WHERE TBL.PID = p_PID_old AND TBL.PID = MA.PID_old ); This is my SQL, now this thing runs around 1 million times or more. Now my question is what would be faster? if I change TBL.SID to (Select new from helptable where old = tbl.sid) or if I add helptable to the from and do the joining in the where? greets Auro

    Read the article

  • Java Or C++ Or What???

    - by Kronass
    Hi, My friends and I are starting a new project and we are shifting from windows to linux (for some reasons) and all of us are .Net background. for the new platform I decided to go with Java since many parts are similar with .Net but my friend is insisting on C++ saying it is much faster very mature and working with it will not effect on the productivity and development speed. The project that we will work on it will have threading, extensive string and datetime manipulation, some socket programing and of-course work with RDBMS (MySql Or Postgre not decided yet). I have some fears with java since oracle acquired sun and these people will do anything to make money out of it. some have advised in python and ruby and I like python but don't know should I make it the default language in this project. the project is not web application and we will make services and executables. what do you think, if you have other opinion you very welcome. Hint: Mono is not an option

    Read the article

  • Is it bad practice to select upstream servers based upon the HTTP method?

    - by PartlyCloudy
    I'm wondering if it is bad practice to have a reverse proxy that selects the upstream server depending on the HTTP method used? The background is that I have an abitrary web server that handles POST requests with some logic behind. The same resources also contain static content, that can be retrieved using GET. After some benchmarking I realized that nginx would handle the static content way faster than my abitrary web server doing this. I checked the option to forward incoming requests internally using nginx, which is feasible. But this would lead to the fact that different servers would serve a distinct resource, only depending on issuing a GET or POST, including different header fields.

    Read the article

  • build adobe air to use YouTube API v2.0

    - by Hadi
    I'm trying to use YouTube API v2.0 to let users authenticate into their YouTube account and be able to upload videos from there... but I want to do this application in AS3 as an adobe air application. I searched the api but I couldn't find any proof that I can do this with AS3? thought to drop a line here and ask if it's possible at all? specially being able to upload videos through the adobe air desktop app? If possible, is there any link you could give me to get me started faster?

    Read the article

  • Can I use WCF in this case?

    - by BDotA
    We have a third party application that provied its web services to us by ASMX and it is created at the time of .NET 1.1 in the old days we were using VB 6.0 and connected to it by a PocketSOAP, etc... bt now we want to replace the VB 6.0 with C# 3.5 WinApps and still use that third party web services. so I wish to know what are my options for doing this? which one do you recommend and which one has a faster learning curve? Thanks All.

    Read the article

  • Population count of rightmost n integers

    - by Jason Baker
    I'm implementing Bagwell's Ideal Hash Trie in Haskell. To find an element in a sub-trie, he says to do the following: Finding the arc for a symbol s, requires ?nding its corresponding bit in the bit map and then counting the one bits below it in the map to compute an index into the ordered sub-trie. What is the best way to do this? It sounds like the most straightforward way of doing this is to select the bits below that bit and do a population count on the resulting number. Is there a faster or better way to do this?

    Read the article

  • what happens when I don't manage to call `recv` fast enough?

    - by amn
    Hi all, I want to account for a possible scenario where clients of my TCP/IP stream socket service send data to my service faster than it manages to move the data to its buffers (I am talking about application buffers, naturally) with recv and work with it. So basically, what happens in such scenarios? Obviously, some sort of service beneath my service which is a user application, has to receive incoming stream and store it somewhere until I issue 'recv', right? Most certainly the operating system. I don't want to re-open old questions, but I can't seem to find an answer to this seemingly obvious one?

    Read the article

  • Gmail zend imap - latency when fetching messageids

    - by T.B Ygg
    i have this code to fetch emails from gmail using imap with the zend framework. i go back 2 days in my search (as i do not want all messages) all works well but it takes forever to load the messages and i need to do this for 5+ users, it seems like the search goes through the entire gmail message archive in getting the newest ones. my code looks like this: $dato = date('j-F-Y', strtotime($Date. ' - 2 days')); $dato = "SINCE ".$dato; $messageids = $imap->search(array($dato)); any ideas on how to make zend work faster?

    Read the article

  • For each level of factor aggregate values over all levels except the current one (in R)

    - by Andrey Chetverikov
    For each level of factor I need to extract values aggregated over all subsets of data.frame except the current one. For example, there is a several subjects doing a reaction time task during several days, and I need to compute mean reaction time for all subjects and all days, but not including the subject for whom the mean is computed. Currently, I do it like this: library(lme4) ddply(sleepstudy, .(Subject, Days), summarise , avg_rt=mean(sleepstudy[sleepstudy$Subject!=Subject&sleepstudy$Days==Days,"Reaction"]), .progress="text") It works fine for small data sets, but for large ones it can be very slow. Is there a way to do it faster?

    Read the article

  • ASP SaveToDisk method takes an incredible amount of time

    - by burnt_hand
    This is a method in ASP Classic that saves a file to disk. It takes a very long time but I'm not sure why. Normally, I wouldn't mind so much, but the files it handles are pretty large so need this needs to faster than 100kB a second save. Seriously slow. (old legacy system, band aid fix till it gets replaced...) Public Sub SaveToDisk(sPath) Dim oFS, oFile Dim nIndex If sPath = "" Or FileName = "" Then Exit Sub If Mid(sPath, Len(sPath)) <> "\" Then sPath = sPath & "\" '" Set oFS = Server.CreateObject("Scripting.FileSystemObject") If Not oFS.FolderExists(sPath) Then Exit Sub Set oFile = oFS.CreateTextFile(sPath & FileName, True) For nIndex = 1 to LenB(FileData) oFile.Write Chr(AscB(MidB(FileData,nIndex,1))) Next oFile.Close End Sub I'm asking because there are plenty of WTF's in this code so I'm fighting those fires while getting some help on these ones.

    Read the article

  • What is the best way to do multiple listviews in android?

    - by Nicos
    Hi all, i am writing a software that i have to drill down on content a lot. For example when the program starts a listview is displayed. When user clicks on an item, then a second listview must be displayed. For example: Select Continent Select Country Select State Select City Select Address What is the best way to do this (less memory, faster, easier to code etc)? To create multiple listviews with multiple adapters? Or 1 listview with multiple Adapters? Lists are loaded from an external XML File. So far i am creating a new adapter and setting it to the listview. How do i create a second listview and after clicking on 1st listview displaying the second one, with animation. Any examples? Extend my class to ListActivity or Activity? Best regards and thanks for helping, Nicos

    Read the article

  • Do you prefer to code on a Laptop or a Desktop, or both ?

    - by CAD bloke
    What is your primary development machine - a Desktop or a laptop? Why? Do you use both - if so, do you use source control to keep them synched? This might seem like a dumb question but I'm on the steep part of the learning curve & I'd be interested in your insights. [edit] - Using a laptop assumes hanging an Imax-sized screen off it when it is docked. Using a desktop assumes 2x Imax screens. [edit] - This is faster than Twitter! IDE is VS2008 - laptop is 17 (or 15) inch, 1920x1200

    Read the article

  • How to improve the speed of a loop containing a sqlalchemy query statement as conditional

    - by LtPinback
    This loop checks if a record is in the sqlite database and builds a list of dictionaries for those records that are missing and then executes a multiple insert statement with the list. This works but it is very slow (at least i think it is slow) as it takes 5 minutes to loop over 3500 queries. I am a complete newbie in python, sqlite and sqlalchemy so I wonder if there is a faster way of doing this. list_dict = [] session = Session() for data in data_list: if session.query(Class_object).filter(Class_object.column_name_01 == data[2]).filter(Class_object.column_name_00 == an_id).count() == 0: list_dict.append({'column_name_00':a_id, 'column_name_01':data[2]}) conn = engine.connect() conn.execute(prices.insert(),list_dict) conn.close() session.close() edit: I moved session = Session() outside the loop. Did not make a difference.

    Read the article

  • What is the most efficient method to find x contiguous values of y in an array?

    - by Alec
    Running my app through callgrind revealed that this line dwarfed everything else by a factor of about 10,000. I'm probably going to redesign around it, but it got me wondering; Is there a better way to do it? Here's what I'm doing at the moment: int i = 1; while ( ( (*(buffer++) == 0xffffffff && ++i) || (i = 1) ) && i < desiredLength + 1 && buffer < bufferEnd ); It's looking for the offset of the first chunk of desiredLength 0xffffffff values in a 32 bit unsigned int array. It's significantly faster than any implementations I could come up with involving an inner loop. But it's still too damn slow.

    Read the article

< Previous Page | 121 122 123 124 125 126 127 128 129 130 131 132  | Next Page >