Search Results

Search found 9 results on 1 pages for 'awshepard'.

Page 1/1 | 1 

  • JQuery UI Autocomplete showing as bullets

    - by awshepard
    The JQuery UI Demo page for autocomplete (link) has a nice looking search box and drop down with nice colors and highlights and such. When I implement it for myself, I end up with a bulleted list. How do I get my drop down of suggestions to look like theirs? A few notes/code fragments: I'm working in .NET land, so I'm using the <asp:ScriptManager> tag with <asp:ScriptReference>s inside it to get the hosted jquery.min.js (1.4.2) and jquery-ui.min.js (1.8.1) files from Google. My input box is fairly simple: <div class='ui-widget'> <label for="terms">Term: </label> <input id="terms" class="ui-autocomplete-input"> </div> My autocomplete looks like: $(""#terms"").autocomplete({source:""GetAttributesJSON.aspx"",minLength:2}); I get the correct data back, so that's not the issue. I just want fancy graphics. Any thoughts would be much appreciated.

    Read the article

  • Robust LINQ to XML query for sibling key-value pairs

    - by awshepard
    (First post, please be gentle!) I am just learning about LINQ to XML in all its glory and frailty, trying to hack it to do what I want to do: Given an XML file like this - <list> <!-- random data, keys, values, etc.--> <key>FIRST_WANTED_KEY</key> <value>FIRST_WANTED_VALUE</value> <key>SECOND_WANTED_KEY</key> <value>SECOND_WANTED_VALUE</value> <!-- wanted because it's first --> <key>SECOND_WANTED_KEY</key> <value>UNWANTED_VALUE</value> <!-- not wanted because it's second --> <!-- nonexistent <key>THIRD_WANTED_KEY</key> --> <!-- nonexistent <value>THIRD_WANTED_VALUE</value> --> <!-- more stuff--> </list> I want to extract the values of a set of known "wanted keys" in a robust fashion, i.e. if SECOND_WANTED_KEY appears twice, I only want SECOND_WANTED_VALUE, not UNWANTED_VALUE. Additionally, THIRD_WANTED_KEY may or may not appear, so the query should be able to handle that as well. I can assume that FIRST_WANTED_KEY will appear before other keys, but can't assume anything about the order of the other keys - if a key appears twice, its values aren't important, I only want the first one. An anonymous data type consisting of strings is fine. My attempt has centered around something along these lines: var z = from y in x.Descendants() where y.Value == "FIRST_WANTED_KEY" select new { first_wanted_value = ((XElement)y.NextNode).Value, //... } My question is what should that ... be? I've tried, for instance, (ugly, I know) second_wanted_value = ((XElement)y.ElementsAfterSelf() .Where(w => w.Value=="SECOND_WANTED_KEY") .FirstOrDefault().NextNode).Value which should hopefully allow the key to be anywhere, or non-existent, but that hasn't worked out, since .NextNode on a null XElement doesn't seem to work. I've also tried to add in a .Select(t => { if (t==null) return new XElement("SECOND_WANTED_KEY",""); else return t; }) clause in after the where, but that hasn't worked either. I'm open to suggestions, (constructive) criticism, links, references, or suggestions of phrases to Google for, etc. I've done a fair share of Googling and checking around S.O., so any help would be appreciated. Thanks!

    Read the article

  • Reconstructing trees from a "fingerprint"

    - by awshepard
    I've done my SO and Google research, and haven't found anyone who has tackled this before, or at least, anyone who has written about it. My question is, given a "universal" tree of arbitrary height, with each node able to have an arbitrary number of branches, is there a way to uniquely (and efficiently) "fingerprint" arbitrary sub-trees starting from the "universal" tree's root, such that given the universal tree and a tree's fingerprint, I can reconstruct the original tree? For instance, I have a "universal" tree (forgive my poor illustrations), representing my universe of possibilities: Root / / / | \ \ ... \ O O O O O O O (Level 1) /|\/|\...................\ (Level 2) etc. I also have tree A, a rooted subtree of my universe Root / /|\ \ O O O O O / Etc. Is there a way to "fingerprint" the tree, so that given that fingerprint, and the universal tree, I could reconstruct A? I'm thinking something along the lines of a hash, a compression, or perhaps a functional/declarative construction? Big-O analysis (in time or space) is a plus. As a for-instance, a nested expression like: {{(Root)},{(1),(2),(3)},{(2,3),(1),(4,5)}...} representing the actual nodes present at each level in the tree is probably valid, but can it be done more efficiently?

    Read the article

  • jQuery droppable accordion

    - by awshepard
    I've been playing around with trying to create a droppable accordion for a little while, and haven't gotten it to be very responsive. When I drag an item over the accordion, it takes 5+ seconds for the accordion element to open (if it does at all). Sometimes I have to "wave" the dragged element over the accordion element. I know I read something a while back about event processing in javascript - something along the lines of the browser not always passing control to the javascript engine when you think it does, or something like that, resulting in weird timing. Has anyone else seen tried to do this before? Have you found jquery/javascript to be this slow? Do you have any references for how to get a responsive droppable accordion (the jQuery UI site doesn't seem to, and I didn't find anything on SO or Google). Thanks!

    Read the article

  • Build number increment not reflected in AssemblyVersion

    - by awshepard
    I've browsed through some of the discussion on auto-incrementing build numbers, but in the impatience of youth decided to roll my own and re-invent the wheel. I know there are probably better ways to go about this (which I'm definitely going to investigate), but my question centers more around the Assembly and/or Version classes. My approach was to write a separate exe (BuildIncrementer) that takes a command line parameter for file name, does a regex match on the contents to grab the [assembly: AssemblyVersion...] string, do the modifications that I want (increment the build number, etc.), then write the contents back to the file. This approach works as-is. The next thing I did was in the project that I wanted to use this on, I set up a pre-build command line that is simply the command to execute that BuildIncrementer.exe on this project's AssemblyInfo.cs file. This too works, updating the assembly info as desired. The problem comes when I run the project, it sends an email containing the current version, obtained with Assembly.GetExecutingAssembly().GetName().Version.ToString(). BUT, the version showing up is the previous version. When my AssemblyInfo.cs says [assembly: AssemblyVersion("1.0.2.49667")], I get sent 1.0.1.45660, which was the previous build. Anyone have any ideas why that might be?

    Read the article

  • Reducing time in C# Forms Control.set_Text(string) function

    - by awshepard
    Hoping for a quick answer (which SO seems to be pretty good for)... I just ran a performance analysis with VS2010 on my app, and it turns out that I'm spending about 20% of my time in the Control.set_Text(string) function, as I'm updating labels in quite a few places in my app. The window has a timer object (Forms timer, not Threading timer) that has a timer1_Tick callback, which updates one label every tick (to give a stop-watch sort of effect), and updates about 15 labels once each second. Does anyone have quick suggestions for how to reduce the amount of time spent updating text on a form, other than increasing the update interval? Are there other structures or functions I should be using?

    Read the article

  • Code/Approach Golf: Find row in text file with too many columns

    - by awshepard
    Given a text file that is supposed to contain 10 tab-delimited columns (i.e. 9 tabs), I'd like to find all rows that have more than 10 columns (more than 9 tabs). Each row ends with CR-LF. Assume nothing about the data, field widths, etc, other than the above. Comments regarding approach, and/or working code would be extremely appreciated. Bonus for printing line numbers of offending lines as well. Thanks in advance!

    Read the article

  • C++ arrays as parameters, subscript vs. pointer

    - by awshepard
    Alright, I'm guessing this is an easy question, so I'll take the knocks, but I'm not finding what I need on google or SO. I'd like to create an array in one place, and populate it inside a different function. I define a function: void someFunction(double results[]) { for (int i = 0; i<100; ++i) { for (int n = 0; n<16; ++n) //note this iteration limit { results[n] += i * n; } } } That's an approximation to what my code is doing, but regardless, shouldn't be running into any overflow or out of bounds issues or anything. I generate an array: double result[16]; for(int i = 0; i<16; i++) { result[i] = -1; } then I want to pass it to someFunction someFunction(result); When I set breakpoints and step through the code, upon entering someFunction, results is set to the same address as result, and the value there is -1.000000 as expected. However, when I start iterating through the loop, results[n] doesn't seem to resolve to *(results+n) or *(results+n*sizeof(double)), it just seems to resolve to *(results). What I end up with is that instead of populating my result array, I just get one value. What am I doing wrong?

    Read the article

  • C++ arrays as parameters, EDIT: now includes variable scoping

    - by awshepard
    Alright, I'm guessing this is an easy question, so I'll take the knocks, but I'm not finding what I need on google or SO. I'd like to create an array in one place, and populate it inside a different function. I define a function: void someFunction(double results[]) { for (int i = 0; i<100; ++i) { for (int n = 0; n<16; ++n) //note this iteration limit { results[n] += i * n; } } } That's an approximation to what my code is doing, but regardless, shouldn't be running into any overflow or out of bounds issues or anything. I generate an array: double result[16]; for(int i = 0; i<16; i++) { result[i] = -1; } then I want to pass it to someFunction someFunction(result); When I set breakpoints and step through the code, upon entering someFunction, results is set to the same address as result, and the value there is -1.000000 as expected. However, when I start iterating through the loop, results[n] doesn't seem to resolve to *(results+n) or *(results+n*sizeof(double)), it just seems to resolve to *(results). What I end up with is that instead of populating my result array, I just get one value. What am I doing wrong? EDIT Oh fun, I have a typo: it wasn't void someFunction(double results[]). It was: void someFunction(double result[])... So perhaps this is turning into a scoping question. If my double result[16] array is defined in a main.cpp, and someFunction is defined in a Utils.h file that's included by the main.cpp, does the result variable in someFunction then wreak havoc on the result array in main?

    Read the article

1