Daily Archives

Articles indexed Saturday May 29 2010

Page 12/76 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Add autoFill capabilities to jQuery-UI 1.8.1

    - by rockinthesixstring
    here's what I currently have, unfortunately I cannot seem to figure out how to get autoFill to work with jQuery-UI... It used to work with the straight up Autocomplete.js <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js" type="text/javascript"></script> <script src="http://jquery-ui.googlecode.com/svn/tags/latest/external/jquery.bgiframe-2.1.1.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/i18n/jquery-ui-i18n.min.js" type="text/javascript"></script> <script language="javascript" type="text/javascript"> var thesource = "RegionsAutoComplete.axd?PID=3" $(function () { function log(message) { $("<div/>").text(message).prependTo("#log"); $("#log").attr("scrollTop", 0); } $.expr[':'].textEquals = function (a, i, m) { return $(a).text().match("^" + m[3] + "$"); }; $("#birds").autocomplete({ source: thesource, change: function (event, ui) { //if the value of the textbox does not match a suggestion, clear its value if ($(".ui-autocomplete li:textEquals('" + $(this).val() + "')").size() == 0) { $(this).val(''); } else { log(ui.item ? ("Selected: " + ui.item.value + " aka " + ui.item.id) : "Nothing selected, input was " + this.value); } } }).live('keydown', function (e) { var keyCode = e.keyCode || e.which; //if TAB or RETURN is pressed and the text in the textbox does not match a suggestion, set the value of the textbox to the text of the first suggestion if ((keyCode == 9 || keyCode == 13) && ($(".ui-autocomplete li:textEquals('" + $(this).val() + "')").size() == 0)) { $(this).val($(".ui-autocomplete li:visible:first").text()); } }); }); </script> I've used the answer here to get the mustMatch working, but unfortunately if I "tab" away from the input box, I get the "Nothing selected" response instead of an Value and ID. Does anyone know how to extract the ID out of the autocomplete when you don't actually select the field?

    Read the article

  • C Language preprocessing doubt

    - by khanna_param
    Hi, There are different kind of macros in C language, nested macro is one of them. Considering a program with the following macro define HYPE(x,y) (SQUR(x)+SQUR(y)) define SQUR(x) (x*x) using this we can successfully complile to get the result. My question:- As we all know the C preprocessor replaces all the occurrence of the identifiers with the replacement-string. Considering the above example i would like to know how many times the C compiler traverses the program to replace the macro with the replacement values. I assume it cannot be done in one go. Thanks.

    Read the article

  • priority queue with limited space: looking for a good algorithm

    - by SigTerm
    This is not a homework. I'm using a small "priority queue" (implemented as array at the moment) for storing last N items with smallest value. This is a bit slow - O(N) item insertion time. Current implementation keeps track of largest item in array and discards any items that wouldn't fit into array, but I still would like to reduce number of operations further. looking for a priority queue algorithm that matches following requirements: queue can be implemented as array, which has fixed size and _cannot_ grow. Dynamic memory allocation during any queue operation is strictly forbidden. Anything that doesn't fit into array is discarded, but queue keeps all smallest elements ever encountered. O(log(N)) insertion time (i.e. adding element into queue should take up to O(log(N))). (optional) O(1) access for *largest* item in queue (queue stores *smallest* items, so the largest item will be discarded first and I'll need them to reduce number of operations) Easy to implement/understand. Ideally - something similar to binary search - once you understand it, you remember it forever. Elements need not to be sorted in any way. I just need to keep N smallest value ever encountered. When I'll need them, I'll access all of them at once. So technically it doesn't have to be a queue, I just need N last smallest values to be stored. I initially thought about using binary heaps (they can be easily implemented via arrays), but apparently they don't behave well when array can't grow anymore. Linked lists and arrays will require extra time for moving things around. stl priority queue grows and uses dynamic allocation (I may be wrong about it, though). So, any other ideas?

    Read the article

  • Wrong URL's after upload

    - by pcasa
    I must have done something, but am going crazy trying to find my mistake. After my last upload now all my url's are pointing to localhost:3000 instead of the site. It was working before. :(

    Read the article

  • Writing XML in different character encodings with Java

    - by Roman Myers
    I am attempting to write an XML library file that can be read again into my program. The file writer code is as follows: XMLBuilder builder = new XMLBuilder(); Document doc = builder.build(bookList); DOMImplementation impl = doc.getImplementation(); DOMImplementationLS implLS = (DOMImplementationLS) impl.getFeature("LS", "3.0"); LSSerializer ser = implLS.createLSSerializer(); String out = ser.writeToString(doc); //System.out.println(out); try{ FileWriter fstream = new FileWriter(location); BufferedWriter outwrite = new BufferedWriter(fstream); outwrite.write(out); outwrite.close(); }catch (Exception e){ } The above code does write an xml document. However, in the XML header, it is an attribute that the file is encoded in UTF-16. when i read in the file, i get the error: "content not allowed in prolog" this error does not occur when the encoding attribute is manually changed to UTF-8. I am trying to get the above code to write an XML document encoded in UTF-8, or successfully parse a UTF-16 file. the code for parsing in is DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder loader = factory.newDocumentBuilder(); Document document = loader.parse(filename); the last line returns the error.

    Read the article

  • Why is there a constructor method if you can assign the values to variables?

    - by Joel
    I'm just learning PHP, and I'm confused about what the purpose of the __construct() method? If I can do this: class Bear { // define properties public $name = 'Bill'; public $weight = 200; // define methods public function eat($units) { echo $this->name." is eating ".$units." units of food... <br />"; $this->weight += $units; } } Then why do it with a constructor instead? : class Bear { // define properties public $name; public $weight; public function __construct(){ $this->name = 'Bill'; $this->weight = 200; } // define methods public function eat($units) { echo $this->name." is eating ".$units." units of food... <br />"; $this->weight += $units; } }

    Read the article

  • When iterating over values, why does typeof(value) return "string" when value is a number? Javascrip

    - by Mark
    I'm using Google Chrome for this test: Contrary to intuition, the first loop alerts "string" 3 times, while the second loop alerts "number" 3 times. numarray = [1, 2, 3]; //for-each loop for(num in numarray) alert(typeof(num)); //standard loop for(i=0; i<numarray.length; i++) alert(typeof(numarray[i])); I was expecting both loops to alert "number" 3 times. How is the first loop implemented in Javascript? In other words, if the for-each is syntactic sugar, what is its equivalent using a standard loop? Also, is there some way to iterate over an object's namespace using a standard loop? I'm looking to touch every one of some object's methods and attributes using a loop of the second kind. I'm new to Javascript and any help is highly appreciated, thanks.

    Read the article

  • How do I get output into Java from a SELECT stored procedure in Oracle?

    - by Ventrue
    I'm using Java to connect to an Oracle 10 Database. I want to create a stored procedure (don't ask why) that takes no arguments and returns a lot of rows. Specifically, in Java I want to be able to get this data with something like: ResultSet rs = stmt.executeQuery("call getChildless"); where getChildless is the query: SELECT objectid FROM Object WHERE objectid NOT IN (SELECT parent FROM subparts); However, I just cannot for the life of me figure out how to get my output from the stored procedure. I've googled it and I get all this sample code that Oracle won't compile, presumably it's for a previous version. Refcursors seem to come up a lot, but I'm not sure if that's what I actually want, to use it with a ResultSet.

    Read the article

  • Doing will_paginate pages calculation around a record

    - by Anderson De Andrade
    I'm displaying a list of events. I wanted displayed the page with the events for today by default. That was easy accomplished by: page = number_of_records_before_RECORD / number_of_pages + 1 Now I want to display the first item of today's events as the first item in that page. Maybe there is a way to generate page numbers around a record with negative values to get back.

    Read the article

  • Multiple calls to data service from SL3?

    - by Chris
    I have an SL3 that makes asynchronous calls to a data service. Basically, there is a treeview that is bound to a collection of objects. The idea is that as a user selects a specific treeviewitem, a call is made to the data service, with a parameter specific to the selected treeviewitem being passed to the corresponding web method in the data service. The data service returns data back to the SL3 client, and the client presents the data to the user. This works well. The problem is that when users start to navigate through the treeview using the arrow keys on their keyboard, they could press the down arrow key, for example, 10 times, and 10 calls will be made to the data service, and then each of the 10 items will be displayed to the user momentarily, until finishing with the data for the most recently selected treeview item. So - onto the question. How can I put in some form of delay, to allow someone to navigate quickly through a treeview, then, once then stop at a certain treeviewitem, a call is made to the data service? Thanks for any suggestions. Chris

    Read the article

  • Help with django filters

    - by Cato Johnston
    In a django template, I want to get an value from the first object in a list's field. I have the following code {{ list.object|first.field }} But it results in an error. Is there a way to achieve this without writing a loop or doing it in the view?

    Read the article

  • How to handle different screen resolution /screen size when developing a site ?

    - by Misha Moroshko
    I would like to develop a site using jQuery that will work with all major browsers. I thought to start with a basic layout (a header, a couple of tabs with content, and footer). I wonder how should I create this layout to support different screen resolution, screen size, or window size. Should I work in pixels / points / percents when defining width and height of the components ? Are there any jQuery plugins that can help me with this task ? Thanks !

    Read the article

  • what happens to, the controls or the iframe or the div, which is

    - by user287745
    hidden:- does it get transferred to the user side? disabled:- does it get transferred to the user side? what i want is, a aspx page will be having many iframes to display different different pages, there will be many div tags to display css formatted information to understand the what i mean by many:- i have to transfer a complete website with 30 aspx pages into one single page! have simply combined every thing resulting in one extremely huge page my concern is the on local host it works loads fast, but when on online server accessed by numerous people for education purposes, the site ( ONE PAGE ) WILL SLOW DOWN terribly to overcome this i thought of using hidden and disable options. can any one help and possible suggest an improved way of achieving the above yes it sounds silly but this is the requirement thank you

    Read the article

  • C language preprocessor behavior

    - by khanna_param
    There are different kind of macros in C language, nested macro is one of them. Considering a program with the following macro #define HYPE(x,y) (SQUR(x)+SQUR(y)) #define SQUR(x) (x*x) Using this we can successfully compile to get the result. As we all know the C preprocessor replaces all the occurrence of the identifiers with the replacement-string. Considering the above example I would like to know how many times the C preprocessor traverses the program to replace the macro with the replacement values. I assume it cannot be done in one go.

    Read the article

  • datepicker common options but different altField altFormat

    - by Legio X
    Using jquery-ui datepicker I would like to use altField and altFormat to 2 datepickers on the same page but I can't figure out how to add these 2 options which are specific to each datepicker along with my common set of options. Code sample below. #dt1 does not work, but #dt2 works. How can I get #dt1 to work while using the datepickerOpts? var datepickerOpts = { minDate: -2, changeMonth: true, changeYear: true, dateFormat: 'yy-mm-dd' }; $('#dt1').datepicker(datepickerOpts, {altField: '#alt1', altFormat: 'mm-dd-yy' }); $('#dt2').datepicker({ minDate: -2, changeMonth: true, changeYear: true, dateFormat: 'yy-mm-dd', altField: '#alt2', altFormat: '@' });

    Read the article

  • facebook javascript sdk question

    - by goseta
    Hi, I'm trying to use the facebook js sdk to develop an app, but I found the there is 2 version of the sdk, my question, is what is support with the new and what w=not? and if the xdreceive.htm is still needed for the new version, I have read the docs and still can't understand this, can someone with experience in FB can me kind and asnwer me this, thanks for any help!

    Read the article

  • What language is this?

    - by Blue
    got some keys with patterns like 4AC59BAA63A64327DCE12C0B2CD1A397 and B9E685495FECFC9854E7DBA508D91213 they have 32 chars and i would like not to decrypt then but to be able to make my own, its something like a hash of a file

    Read the article

  • Is there a way that I can register an event, on a control that inherits from Canvas, that is fired w

    - by Justin
    I am trying to add horizontal and vertical "Position" attached properties to my canvas control that allow me to set a control's position (e.g. Horizontal: Left, Right, Center). I need a children size changed event handler so that I can adjust the position of an element whose size is changed if it's horizontal or vertical position is Center. Is there a way that I could do this?

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >