Search Results

Search found 3 results on 1 pages for 'plusplus'.

Page 1/1 | 1 

  • Per query relevance elevation for solr?

    - by plusplus
    I want to tune the relevance of solr search results on a per user basis - based on the number of times the user has clicked through a result before. Frequently hit items FOR THAT USER should rise to the top of their search results. Is there a way to provide custom boost/elevation for particular document ids on the query? I'm thinking in the order of ~100s of particular documents to elevate. The elevation should have no effect if the rest of the query doesn't find those documents. Alternatively, if this isn't possible, what is a sane way for setting up an alternative indexing approach that would make this possible? Could I add a field per user in the index to store their scores? I'm thinking in the order of 1000 users. The major drawback of that approach is the number of times a document would need to be reindexed (i.e. each time it was used by the user).

    Read the article

  • Why avoid increment ("++") and decrement ("--") operators in JavaScript?

    - by artlung
    I'm a big fan of Douglas Crockford's writing on JavaScript, particularly his book JavaScript: The Good Parts. It's made me a better JavaScript programmer and a better programmer in general. One of his tips for his jslint tool is this : ++ and -- The ++ (increment) and -- (decrement) operators have been known to contribute to bad code by encouraging excessive trickiness. They are second only to faulty architecture in enabling to viruses and other security menaces. There is a plusplus option that prohibits the use of these operators. This has always struck my gut as "yes, that makes sense," but has annoyed me when I've needed a looping condition and can't figure out a better way to control the loop than a while( a < 10 )do { a++ } or for (var i=0;i<10;i++) { } and use jslint. It's challenged me to write it differently. I also know in the distant past using things, in say PHP like $foo[$bar++] has gotten me in trouble with off-by-one errors. Are there C-like languages or other languages with similarities that that lack the "++" and "--" syntax or handle it differently? Are there other rationales for avoiding "++" and "--" that I might be missing? UPDATE -- April 9, 2010: In the video Crockford on JavaScript -- Part 5: The End of All Things, Douglas Crockford addresses the ++ issue more directly and with more detail. It appears at 1:09:00 in the timeline. Worth a watch.

    Read the article

  • Why is my GreaseMonkey function unexpectedly being called multiple times?

    - by Ryan Fisher
    I am missing something, I'm not sure why the function 'addIcon()' is being called multiple times. Given: <div class="ticketpostcontainer">Some text</div> <div class="ticketpostcontainer">Some text</div> <div class="ticketpostcontainer">Some text</div> Using the utility function waitForKeyElements, the result is that each div element receives my "collapse icon" three times: // ==UserScript== // @name Collapse Kayako Response // @grant Sandbox // @namespace http://my.chiromatrixbase.com/fisher.chiromatrix.com/collaps_div.js // @include http://imatrixsupport.com/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js // ==/UserScript== /*jslint plusplus: true, undef: true, sloppy: true, vars: true, white: true, indent: 2, maxerr: 30 */ //Enable or disable GreaseMonkey function, GM_log var GM_Debug = 1; if (!GM_Debug) { var GM_log = function () {}; } //If FireBig is active, send GM log events to FB. if (unsafeWindow.console && GM_Debug) { var GM_log = unsafeWindow.console.log; } GM_log("Running collapse kayako response script"); //Don't run on frames or iframes. if (window.top !== window.self) { return; } waitForKeyElements(".ticketpostcontainer", addIcon); function addIcon() { var i, toCollapse = document.getElementsByClassName('ticketpostcontainer'), j = toCollapse.length; GM_log("Number of elements to collapse: " + toCollapse.length); for (i = 0; i < j; i++) { var curElement = toCollapse[i]; var p = document.createElement('p'); var a = document.createElement('a'); var span = document.createElement('span'); styleLink(a); styleParagraph(p); styleSpan(span); p.appendChild(a); p.appendChild(span); a.appendChild(document.createTextNode('-')); span.appendChild(document.createTextNode(' Some text')); a.addEventListener("click", toggle, false); curElement.parentNode.insertBefore(p, curElement); } function toggle(e) { if (this.firstChild.nodeValue === '-') { this.parentNode.nextSibling.style.display = 'none'; this.firstChild.nodeValue = '+'; this.nextSibling.style.display = 'inline'; } else { this.parentNode.nextSibling.style.display = 'block'; this.firstChild.nodeValue = '-'; this.nextSibling.style.display = 'none'; } e.preventDefault(); } function styleLink(a) { a.href = '#'; a.style.fontWeight = 'bold'; a.style.background = '#F6F1E7'; a.style.border = '1px solid #cccccc'; a.style.color = '#B24C58'; a.style.textDecoration = 'none'; a.style.width = '15px'; a.style.height = '15px'; a.style.textAlign = 'center'; a.style.fontSize = '100%'; a.style.margin = '0 5px 5px 8px'; a.style.cssFloat = 'left'; a.style.display = 'block'; a.style.lineHeight = '13px'; } function styleParagraph(p) { p.style.margin = '0 0 0 0'; p.style.lineHeight = '16px'; p.style.clear = 'both'; p.style.height = '15px'; } function styleSpan(span) { span.style.display = 'none'; } }

    Read the article

1