Search Results

Search found 1555 results on 63 pages for 'scott f'.

Page 37/63 | < Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >

  • find nearest match to array of doubles

    - by Scott
    Given the code below, how do I compare a List of objects's values with a test value? I'm building a geolocation application. I'll be passing in longitude and latitude and would like to have the service answer back with the location closest to those values. I started down the path of converting to a string, and formatting the values down to two decimal places, but that seemed a bit too ghetto, and I'm looking for a more elegant solution. public class Location : IEnumerable { public string label { get; set; } public double lat { get; set; } public double lon { get; set; } //Implement IEnumerable public IEnumerator GetEnumerator() { return (IEnumerator)this; } } [HandleError] public class HomeController : Controller { private List<Location> myList = new List<Location> { new Location { label="Atlanta Midtown", lon=33.657674, lat=-84.423130}, new Location { label="Atlanta Airport", lon=33.794151, lat=-84.387228}, new Location { label="Stamford, CT", lon=41.053758, lat=-73.530979}, ... } public static int Main(String[] args) { string inLat = "-80.987654"; double dblInLat = double.Parse(inLat); // here's where I would like to find the closest location to the inLat // once I figure out this, I'll implement the Longitude, and I'll be set }

    Read the article

  • Why Solr admin query page interprets UTF-8 as ISO-8859-1

    - by Scott Chu
    I deploy a war to my Tomcat 6.0.35 on Win7 64bit and when I use full-interface query page (I mean form.jsp) in Solr Admin to query 2 Chinese character (say it's C1C2) , the debug info shows: <lst name="debug"> <str name="rawquerystring">æ°è</str> <str name="querystring">æ°è</str> <str name="parsedquery">NEWSID:æ°è</str> <str name="parsedquery_toString">NEWSID:æ°è</str> ... You can see C1C2 becomes æ°è. I deploy same war file to Tomcat on Linux or on another Win7 64bit of my colleagues' computer, the encoding acts well. Does anyone know why and how can I avoid this problem? Thanks in advance!

    Read the article

  • Wordpress > Exclude specific categories from categories listing

    - by Scott B
    I have created some functional categories that I use to show/hide markup elements. However, when I go to list the legit categories, these show up too, which I would expect. I want to list the legitimate categories and omit others. I need to know how you would do it under two circumstances.... 1) Each category that I want to exclude is preceded by an underscore character in its name. 2) Each category that I want to exclude is NOT preceeded by a special character and I will just provide an ID to the script that handles the exclusion listing.

    Read the article

  • GhostScript PDF Merging (Losing Editable Fields)

    - by Scott
    I'm using GhostScript to merge to PDFs into one PDF. One of the PDFs has textbox fields (editable fields) that I created in Adobe Acrobat Pro 9. When I merge these two PDFs with GhostScript I lose the textbox fields. Is there any way to merge these files (using GS or some other free linux software) that keeps the textbox fields intact?

    Read the article

  • Is it faster to loop through a Python set of number or a set of letters?

    - by Scott Bartell
    Is it faster to loop through a Python set of numbers or a Python set of letters given that each set is the exact same length and each item within each set is the same length? Why? I would think that there would be a difference because letters have more possible characters [a-zA-Z] than numbers [0-9] and therefor would be more 'random' and likely affect the hashing to some extent. numbers = set([00000,00001,00002,00003,00004,00005, ... 99999]) letters = set(['aaaaa','aaaab','aaaac','aaaad', ... 'aaabZZ']) # this is just an example, it does not actually end here for item in numbers: do_something() for item in letters: do_something() where len(numbers) == len(letters) Update: I am interested in Python's specific hashing algorithm and what happens behind the scenes with this implementation.

    Read the article

  • What's a good way to write batch scripts in C#?

    - by Scott Bilas
    I would like to write simple scripts in C#. Stuff I would normally use .bat or 4NT .btm files for. Copying files, parsing text, asking user input, and so on. Fairly simple but doing this stuff right in a batch file is really hard (no exceptions for example). I'm familiar with command line "scripting" wrappers like AxScript so that gets me part of the way there. What I'm missing is the easy file-manipulation framework. I want to be able to do cd(".."), copy(srcFile, destFile) type functionality. Tools I have tried: NANT, which we use in our build process. Not a good scripting tool. Insanely verbose XML syntax and to add a simple function you must write an extension assembly. Can't do it inline. PowerShell. Looks great, but I just haven't been able to switch over to this as my primary shell. Too many differences from 4NT. Whatever I do needs to run from an ordinary command prompt and not require a special shell to run it through. Can PowerShell be used as a script executor? Perl/Python/Ruby. Really hate learning an entirely new language and framework just to do batch file operations. Haven't been able to dedicate the time I need to do this. Plus, we're a 99% .NET shop for our toolchain and I really want to leverage our existing experience and codebase. Are there frameworks out there that are trying to solve this problem of "make a batch file in C#" that you have used? I want the power of C#/.NET with the immediate-mode type functionality of a typical cmd.exe shell language. Am I alone in wanting something like this?

    Read the article

  • Using htaccess rewrite to make a subdirectory be its own root for root relative path requests

    - by Scott
    Can I use htaccess to capture requests from a certain subdirectory and make that directory use itself as the root directory for any root relative path requests? For example if I have... http://www.example.com/subFIXED/subANY/restofpath ...where subFIXED is always the same directory, subANY is any immediate subdirectory of subFIXED, and I want a redirection of all href/src requests from any file under subANY to use subANY as the 'root' (sort of like a subdomain), in effect having root level requests use this as the root directory level: http://www.example.com/subFIXED/subANY/ Instead of this: http://www.example.com/ I'm assuming I can put an htaccess file in subFIXED to handle all calls coming from anything under any subANY, but not being very familiar with htaccess rewriting, variables, etc., I can't figure out how to capture which subANY directory is making the root level request and then use that capture to make a rewrite to consider that directory the root level of any root relative path requests from it. Thanks for your help

    Read the article

  • Wordpress > Transfer google verification file to root directory on plugin activation/install

    - by Scott B
    I've got a wordpress plugin which presets several settings in a wordpress site and creates some default pages which are the same for all my sites. I would like to include an html file in my plugin zip package that is placed into the site's root directory "as is" (same file name, etc) The file is my google verification file, which is the same for all my sites, so I'd like to save a few steps and automate the process of installing it, along with my default setup steps that my plugin handles. Any help, much appreciated.

    Read the article

  • How do I use XPath with a default namespace with no prefix?

    - by Scott Stafford
    What is the XPath (in C# API to XDocument.XPathSelectElements(xpath, nsman) if it matters) to query all MyNodes from this document? <?xml version="1.0" encoding="utf-8"?> <configuration> <MyNode xmlns="lcmp" attr="true"> <subnode /> </MyNode> </configuration I tried /configuration/MyNode which is wrong because it ignores the namespace. I tried /configuration/lcmp:MyNode which is wrong because lcmp is the URI, not the prefix. I tried /configuration/{lcmp}MyNode which failed because Additional information: '/configuration/{lcmp}MyNode' has an invalid token. EDIT: I can't use mgr.AddNamespace("df", "lcmp"); as some of the answerers have suggested. That requires that the XML parsing program know all the namespaces I plan to use ahead of time. Since this is meant to be applicable to any source file, I don't know which namespaces to manually add prefixes for. It seems like {my uri} is the XPath syntax, but Microsoft didn't bother implementing that... true?

    Read the article

  • How can I manage building library projects that produce both a static lib and a dll?

    - by Scott Langham
    I've got a large visual studio solution with ~50 projects. There are configurations for StaticDebug, StaticRelease, Debug and Release. Some libraries are needed in both dll and static lib form. To get them, we rebuild the solution with a different configuration. The Configuration Manager window is used to setup which projects need to build in which flavours, static lib, dynamic dll or both. This can by quite tricky to manage and it's a bit annoying to have to build the solution multiple times and select the configurations in the right order. Static versions need building before non-static versions. I'm wondering, instead of this current scheme, might it be simpler to manage if, for the projects I needed to produce both a static lib and dynamc dll, I created two projects. Eg: CoreLib CoreDll I could either make both of these projects reference all the same files and build them twice, or I'm wondering, would it be possible to build CoreLib and then get CoreDll to link it to generate the dll? I guess my question is, do you have any advice on how to structure your projects in this kind of situation? Thanks.

    Read the article

  • How do I open a web browser from C#? Process.Start() isn't working?

    - by Scott Whitlock
    I have a URL and I want to launch it in the default browser. I've tried two methods: Process.Start("http://stackoverflow.com"); ... and the one detailed in this other question using ShellExecute. In both cases I get the error: Windows cannot find 'http://stackoverflow.com'. Make sure you typed the name correctly, and then try again. It shouldn't be trying to open it as a file though... from what I understand, it should recognize it as a URL and open it in the default browser. What am I missing? By the way: OS = Vista, and .NET = 3.5

    Read the article

  • How do you make a WiX project build when dependent files have changes?

    - by Scott Langham
    Hi, I've adopted a Visual Studio solution that contains a number WiX projects. We build the solution from an MsBuild script to generate the product's installer msi. The problem I'm experiencing is that if I build (and don't rebuild), even if exe's and dll's get updated that need to be put in the installer, the WiX build system doesn't seem to detect this and skips building the installer as it thinks it's already up to date. How do I work out what the dependencies are that are needed to build a WiX project, and how do I tell the Wix build system to watch out for them changing so it knows to build instead of skip?

    Read the article

  • Using Django.test.client to check template vars

    - by scott
    I've got a view that I'm trying to test with the Client object. Can I get to the variables I injected into the render_to_response of my view? Example View: def myView(request): if request.method == "POST": # do the search return render_to_response('search.html',{'results':results},context_instance=RequestContext(request)) else: return render_to_response('search.html',context_instance=RequestContext(request) Test: c = Client() response = c.post('/school/search/', {'keyword':'beagles'}) # how do I get to the 'results' variable??

    Read the article

  • Servlet File Upload Memory Consumption

    - by Scott
    Hi, I'm using a servlet to do a multi fileupload (using apache commons fileupload to help). A portion of my code is posted below. My problem is that if I upload several files at once, the memory consumption of the app server jumps rather drastically. This is probably OK if it were only until the file upload is finished, but the app server seems to hang on to the memory and never return it to the OS. I'm worried that when I put this into production I'll end up getting an out of memory exception on the server. Any ideas on why this is happening? I'm thinking the server may have started a session and will give the memory back after it expires, but I'm not 100% positive. if(ServletFileUpload.isMultipartContent(request)) { ServletFileUpload upload = new ServletFileUpload(); FileItemIterator iter = upload.getItemIterator(request); while(iter.hasNext()) { FileItemStream license = iter.next(); if(license.getFieldName().equals("upload_button") || license.getName().equals("")) continue; //DataInputStream stream = new DataInputStream(license.openStream()); InputStream stream = license.openStream(); ArrayList<Integer> byteArray = new ArrayList<Integer>(); int tempByte; do { tempByte = stream.read(); byteArray.add(tempByte); }while(tempByte != -1); stream.close(); byteArray.remove(byteArray.size()-1); byte[] bytes = new byte[byteArray.size()]; int i = 0; for(Integer tByte : byteArray) { bytes[i++] = tByte.byteValue(); } Thanks in advanced!!

    Read the article

  • Edit Settings in web.config

    - by Scott Selby
    I didn't know how to title this question - I am making a request to PayPal's Express Payment API. I am using their dll that helps make the request and parse the response. The instructions for their code to work is to add you authorization credentials in the web.config file. I have done so. My problem is that I want to be able to edit these credentials that are being set dynamically ( probably get from SQL ) because we are going to allow different users to enter their API credentials. Sending the request to PayPal looks like this Dim wrapper As New SetExpressCheckoutReq() wrapper.SetExpressCheckoutRequest = request Dim service As New PayPalAPIInterfaceServiceService() Dim setECResponse As SetExpressCheckoutResponseType = service.SetExpressCheckout(wrapper) There's not much room in there to edit the header of the request , because PayPalAPIInterfaceServiceService() is defined in their dll and applies its own header based on the credentials in the web.config. So, my question is , is there a way to point in the web.config to another location when it looks in web.config? I'm not to sure this is possible , also is there any way to edit the header of a request that is defined in a dll without changing the dll (to stay pci compliant) The line in the web.config is here: <account apiUsername="****" apiPassword="****" apiSignature="****"/>

    Read the article

  • Changing the cursor in WPF sometimes works, sometimes doesn't

    - by Scott
    On several of my usercontrols, I change the cursor by using this.Cursor = Cursors.Wait; when I click on something. Now I want to do the same thing on a WPF page on a button click. When I hover over my button, the cursor changes to a hand, but when I click it, it doesn't change to the wait cursor. I wonder if this has something to do with the fact that it's a button, or because this is a page and not a usercontrol? This seems like weird behavior.

    Read the article

  • JQuery not removing added element

    - by Scott
    What I want to do is add and remove list items. I have got it to add new items to the list and I can remove existing ones but not the ones that have been added. It seem like it would work but it doesn't. Any help would be appreciated! Here the code: JQuery: <script type="text/javascript"> $(function(){ $('a#add').click(function(){ $('<li><a href="#" id="remove">--</a>List item</li>').appendTo('ul#list'); }); $('a#remove').click(function(){ $(this).parent().remove(); }); }); </script> HTML: <a href="#" id="add">Add List Item</a> <ul id="list"> <li><a href="#" id="remove">--</a> List item</li> <li><a href="#" id="remove">--</a> List item</li> <li><a href="#" id="remove">--</a> List item</li> <li><a href="#" id="remove">--</a> List item</li> </ul>

    Read the article

  • How to add a Tooltip to a "td" with jquery?

    - by Scott
    I need to add a tooltip/alt to a "td" element inside of my tables with jquery. Can someone help me out? I tried: var tTip ="Hello world"; $(this).attr("onmouseover", tip(tTip)); where I have verified that I am using the "td" as "this". Edit:I am able to capture the "td" element through using the "alert" command and it worked. So for some reason the "tip" function doesn't work. Anyone know why this would be?

    Read the article

  • How should I store Dynamically Changing Data into Server Cache?

    - by Scott
    Hey all, EDIT: Purpose of this Website: Its called Utopiapimp.com. It is a third party utility for a game called utopia-game.com. The site currently has over 12k users to it an I run the site. The game is fully text based and will always remain that. Users copy and paste full pages of text from the game and paste the copied information into my site. I run a series of regular expressions against the pasted data and break it down. I then insert anywhere from 5 values to over 30 values into the DB based on that one paste. I then take those values and run queries against them to display the information back in a VERY simple and easy to understand way. The game is team based and each team has 25 users to it. So each team is a group and each row is ONE users information. The users can update all 25 rows or just one row at a time. I require storing things into cache because the site is very slow doing over 1,000 queries almost every minute. So here is the deal. Imagine I have an excel spreadsheet with 100 columns and 5000 rows. Each row has two unique identifiers. One for the row it self and one to group together 25 rows a piece. There are about 10 columns in the row that will almost never change and the other 90 columns will always be changing. We can say some will even change in a matter of seconds depending on how fast the row is updated. Rows can also be added and deleted from the group, but not from the database. The rows are taken from about 4 queries from the database to show the most recent and updated data from the database. So every time something in the database is updated, I would also like the row to be updated. If a row or a group has not been updated in 12 or so hours, it will be taken out of Cache. Once the user calls the group again via the DB queries. They will be placed into Cache. The above is what I would like. That is the wish. In Reality, I still have all the rows, but the way I store them in Cache is currently broken. I store each row in a class and the class is stored in the Server Cache via a HUGE list. When I go to update/Delete/Insert items in the list or rows, most the time it works, but sometimes it throws errors because the cache has changed. I want to be able to lock down the cache like the database throws a lock on a row more or less. I have DateTime stamps to remove things after 12 hours, but this almost always breaks because other users are updating the same 25 rows in the group or just the cache has changed. This is an example of how I add items to Cache, this one shows I only pull the 10 or so columns that very rarely change. This example all removes rows not updated after 12 hours: DateTime dt = DateTime.UtcNow; if (HttpContext.Current.Cache["GetRows"] != null) { List<RowIdentifiers> pis = (List<RowIdentifiers>)HttpContext.Current.Cache["GetRows"]; var ch = (from xx in pis where xx.groupID == groupID where xx.rowID== rowID select xx).ToList(); if (ch.Count() == 0) { var ck = GetInGroupNotCached(rowID, groupID, dt); //Pulling the group from the DB for (int i = 0; i < ck.Count(); i++) pis.Add(ck[i]); pis.RemoveAll((x) => x.updateDateTime < dt.AddHours(-12)); HttpContext.Current.Cache["GetRows"] = pis; return ck; } else return ch; } else { var pis = GetInGroupNotCached(rowID, groupID, dt);//Pulling the group from the DB HttpContext.Current.Cache["GetRows"] = pis; return pis; } On the last point, I remove items from the cache, so the cache doesn't actually get huge. To re-post the question, Whats a better way of doing this? Maybe and how to put locks on the cache? Can I get better than this? I just want it to stop breaking when removing or adding rows.

    Read the article

  • Convert Yes/No/Null from SQL to True/False in a DataTable

    - by Scott Chamberlain
    I have a Sql Database (which I have no control over the schema) that has a Column that will have the varchar value of "Yes", "No", or it will be null. For the purpose of what I am doing null will be handled as No. I am programming in c# net 3.5 using a data table and table adapter to pull the data down. I would like to directly bind the column using a binding source to a check box I have in my program however I do not know how or where to put the logic to convert the string Yes/No/null to boolean True/False; Reading a null from the SQL server and writing back a No on a update is acceptable behavior. Any help is greatly appreciated. EDIT -- This is being developed for windows.

    Read the article

  • Simulate stochastic bipartite network based on trait values of species - in R

    - by Scott Chamberlain
    I would like to create bipartite networks in R. For example, if you have a data.frame of two types of species (that can only interact across species, not within species), and each species has a trait value (e.g., size of mouth in the predator allows who gets to eat which prey species), how do we simulate a network based on the traits of the species (that is, two species can only interact if their traits overlap in values for instance)? UPDATE: Here is a minimal example of what I am trying to do. 1) create phylogenetic tree; 2) simulate traits on the phylogeny; 3) create networks based on species trait values. # packages install.packages(c("ape","phytools")) library(ape); library(phytools) # Make phylogenetic trees tree_predator <- rcoal(10) tree_prey <- rcoal(10) # Simulate traits on each tree trait_predator <- fastBM(tree_predator) trait_prey <- fastBM(tree_prey) # Create network of predator and prey ## This is the part I can't do yet. I want to create bipartite networks, where ## predator and prey interact based on certain crriteria. For example, predator ## species A and prey species B only interact if their body size ratio is ## greater than X.

    Read the article

< Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >