Posts

javascript - Preserve text selection in contenteditable while interacting with jQuery UI Dialog and text input -

i have jquery dialog making links in contenteditable span. problem clicking button open dialog causes selection lost, text input inside dialog causes selection lost. i can fix button -moz-user-select:none; -webkit-user-select:none doesn't work in chrome. i can fix input wrapping in iframe, that's messy , clicking anywhere else kills selection, example, dragging dialog around. i've seen solution @ how preserve text selection when opening jquery dialog , doesn't work in many browsers in contenteditable element, real inputs. is there nice solution problem? you save , restore selection using simple functions such following when dialog opened , closed. not familiar enough jquery dialogs know mechanism hooking dialog opening , closing. first, saveselection , returns range or textrange object should store in variable later pass restoreselection : function saveselection() { if (window.getselection) { sel = window.getselection(); if (...

sql - When should you use full-text indexing? -

we have whole bunch of queries "search" clients, customers, etc. can search first name, email, etc. we're using statements in following manner: select * customer fname '%somename%' does full-text indexing in scenario? we're using sql server 2005. it depend upon dbms. believe systems not take advantage of full-text index unless use full-text functions. (e.g. match/against in mysql or freetext/contains in ms sql) here article on when, why, , how use full-text indexing in sql server: understanding sql server full-text indexing

Top ten ordering in Excel based on complex team rules -

i have excel spreadsheet in format similar following... | name | club | status | score | | fred | | gent | 145 | | bert | | gent | 150 | | harry | | gent | 195 | | jim | | gent | 150 | | clare | | lady | 99 | | simon | | junior | 130 | | john | b | junior | 130 | : : | henry | z | gent | 200 | i need convert table list of "top ten" teams. rules are each team score taken sum of 4 members of club. these totals should of best 4 scores except... each team must consist of @ least 1 junior or lady for example in table above team score club 625 not 640 take scores harry(190), bert(150), jim(150), , simon(130). not take fred's(145) score give gents. my question is, can done series of excel formula, or need resort using more procedural? ideally solution needs automatic in team selections, don't want have create separate hand crafted formula each team. not have neatly ordered list of each cl...

Need to accept payments from a linked checking account. What packages/frameworks/apis are available? -

i'm building payments tool site ideally able link customer's personal checking account. have ability pay other parties directly checking accounts. when sign financial accounts ing direct or e-trade, able link checking account taking account # , routing #. does know payment framework being used here? i think authorize.net has functionality. know of others?

algorithm - Randomly dividing a 2d complex enclosed region -

first define: region: big stuff manually created want divide. zone: small stuff want generate. i have map. world map in fact. , want divide small zones. size of zones dependent on region zone in. instance small europe (maybe europe have 200 zones) couple of huge ones atlantic ocean. i can manually create points enclose region. create regions each big space want have different size other spaces. instance create enclosed region europe. got butch of (latitude, longitude) points defining limits of europe region. shape of course not regular , there holes in middle of (i don't want create small zones on mediterranean sea big one). got huge 2d shape filled zones. zones n-sized polygons, number of sizes can randomly chosen or subject other constraints. area of each zone limited random (like 50 plus/minus 40%) although constraint again can relaxed (as exception, not rule). zones can not overlap , whole region must divided. the obvious question, algorithm can used solve prob...

wpf - How to bind non-existing IsEmpty property of listbox? -

i have form , button should enabled if listbox not empty. how can binding case? note: avoid creating custom converter. thanks! multiple options, if you're using mvvm pattern - viewmodel expose shouldshowdetails property, checks itemcount (visualized listbox) , returns boolean. bind enabled properties of dependent controls property. (recommended) write trigger on dependent controls - resets enabled property if value of listbox's itemcount property 0. write itemcount boolean converter , bind listbox's itemcount property directly

c++ - Am I misunderstanding assert() usage? -

i taking @ the assert() reference page , got stuck while read given example: /* assert example */ #include <stdio.h> #include <assert.h> int main () { file * datafile; datafile=fopen ("file.dat","r"); assert (datafile); fclose (datafile); return 0; } in example, assert used abort program execution if datafile compares equal 0, happens when previous call fopen not successful. i totally agree if fopen() fails, assert() abort execution. i'm concerned rightness of example: in opinion assert() there detect cases can't happen (like passing null pointer function documentation states forbidden). in example, failing open file not can't happen . in fact, can see dozens of reasons why fail. file couldn't exist, program run without required privileges, , on. i rather have done like: /* not longer assert example */ #include <stdio.h> #include <assert.h> int main () { file * datafile; datafile=...