Posts

Showing posts from July, 2010

How to know if a genetic algorithm is working? -

Image
it important benchmark algorithm before applying specific question. otherwise, garbage in, garbage out. having implemented genetic algorithm (ga) elitism, have no idea how test whether works or not. i have thought printing out statistics, such mean, median, , variance, of each generation. however, not strong indicators of correctness. example, maximum fitness doesn't anything, because random search elitism, have non-decreasing maximum fitness. mean , median not either, because may deteriorate, if ga correct. what effective way of testing if ga working good? my way of deciding if algorithm working draw plot of fitness value on time of execution. this: from question on ga . y-axis fitness level of best individual (less better), x-axis time or number of iterations. ignore red line - not relevant question from graph determine if algorithm stuck in rut , not improve further. however, had advantage of knowing solution , compare solution result of ga execution. ,

c++ - Why is opendir() randomly resulting in ENOENT? -

to retrieve contents of directory (recursively) on linux ubuntu, i'm using following raii struct: struct l_directoryreader { //fields l_pathdata pathdata; dir *dirhandle; struct dirent *currentdirentry; //method declaration happens before constructor, //because used in constructor. void readdir() { errno = 0; this->currentdirentry = readdir(this->dirhandle); //error checking if(errno != 0) { int errorcode = errno; switch(errorcode) { default: { throw os3util::fileh::exc::fileioexception( std::string("failed retrieve contents of dir:") + knewline_str + this->pathdata.relativepath.getfullpath() + knewline_str + "with readdir() errorcode " + os3util::strfunc::inttostring(errorcode)

jquery - JQGrid paging by group instead of rows -

in jqgrid, using grouping 3-15 rows per group. however, pagination set 25 rows per page, show 3 or 4 groups, last group split between pages sometimes. know why happens, there workaround list 25 groups per page instead of 25 rows per page?

java - How to write jUnit tests for random output? -

this question has answer here: how test randomness (case in point - shuffling) 12 answers testing code has predefined input , output parameters relatively easy when compared writing tests code has portion of randomness, must check if random generator biased or not. an example of library uses random numbers java.util.collections.shuffle(list<?> list) shuffles collection of objects, following http://en.wikipedia.org/wiki/fisher%e2%80%93yates_shuffle . how write junit tests code has random output? not shuffle, testing randomness in general. unless writing actual random number generator or kind of encryption library relies on secure random number generators don't need check if random number generator biased or not. job of author of random number generator. your example of collections.shuffle() poor example because built in jdk method. there&#

ios - NSURLRequest - get a cached response AND a current response? -

before continue writing own infrastructure - possible execute request, have return if it's cached, , return later if cached version not match current version? kind of functionality built-in nsurlcache/nsurlrequest? in other words: request mything.json return cached mything.json display user return again if cached version not current update display you can query nsurlcache directly via cachedresponseforrequest: find out whether in it. can issue nsurlrequest , see whether comes different. i'm not aware of built-in mechanism give first that's in cache whatever fetched, if determines needs fetched , if fetched different.

When creating a REST API are there any naming conventions for designating a read only property? -

i thinking useful if property name signaled readonly. take object example: { "id":"12154", "name":"some name", "email":"email@something.com", "joindate":"05/04/2012" } id , joindate of course properties readonly , not allow change through put/post request. there type of convention marking these such? thinking of doing underscores: { "_id":"12154", "name":"some name", "email":"email@something.com", "_joindate":"05/04/2012" } there no naming convention read-only properties in rest. should, of course, feel free establish whatever conventions own api. fiver said in comment, should make sure documented, or conventions combination of (a) confusing, , (b) noise.

rdf - Why do we need both # and / in vocab IRIs? -

i trying job json-ld, , met 2 kind of vocab iris: http://example.com/vocab http://example.com/vocab# why this? have how process documents? the vocabulary in first example (but not necessarily) using 303 uris , 1 in second example using hash uris . both common vocabulary uri design principles, , solutions httprange-14 issue . see section choosing between 303 , hash .

API Pagination Standards -

i have been working on api , pagination required. 25 elements returned in each request. looking around standards , seem see 2 different things going on. the link header link: http://tools.ietf.org/html/rfc5988 example: link: <https://api.github.com/user/repos?page=3&per_page=100>; rel="next", <https://api.github.com/user/repos?page=50&per_page=100>; rel="last" in json response link: api pagination best practices example: "paging": { "previous": "http://api.example.com/foo?since=timestamp" "next": "http://api.example.com/foo?since=timestamp2" } question: should both? , being said; key "paging" correct key? or "links" or "pagination" i depends on structure of data return (and may return in future). if never have nested objects need own links, using link header (mildly) preferable, because it's more correct. i

osx - AppleScript mail formatting -

because filemaker pro doesn't support rtf/html formatting of emails creates have created applescript format email. works! seems format first instance of each variable encounters in script. pointers gladly accepted. tell application "filemaker pro" set field_a cell "email::emailtext_1" of layout "email" set field_b cell "email::emailtext_2" of layout "email" set field_c cell "email::emailtext_3" of layout "email" set field_d cell "email::emailtext_4" of layout "email" set field_e cell "email::emailtext_5" of layout "email" set field_f cell "email::emailtext_6" of layout "email" set field_g cell "email::emailtext_7" of layout "email" set theattachment cell "email::attachmentpath_cleaned" end tell set the_content (field_a & field_b & field_c & " ?? " & field_d & field_e & field_f & f

jquery - Bootstrap - add a loading state to an input box? -

i have got input box: <div id="mydiv" class="col-sm-10"> {# autocomplete text box #} <input class="form-control" type="text" name="myautocomplete" id="myautocomplete1"> </div> and have jquery initialise textbox becomes "autocomplete" box, user types in few letters , can select match list. when jquery loads data (there quite bit, 10,000 entries) takes bit of time - maybe 5 seconds. if user types autocomplete box during time, autocomplete doesn't work because data hasn't finished loading. how can add "loading state" input text field? want similar sort of functionality http://getbootstrap.com/javascript/#buttons - after period of time instead of saying "loading..." becomes active. thanks figured out: i made js function: function addloadingtotextbox(textboxes, text, onload) { (i = 0; < textboxes.length

Parsing UTC Time in JSON.net -

i have json file have deserialized class created called mytype jsonconvert.deserializeobject<mytype>(json); one of json properties time expressed in utc. take utc time , convert datetime object datetime timestamp = datetime.parseexact( jsontime, "o", cultureinfo.invariantculture, datetimestyles.roundtripkind); the above works fine when utc time is: 2014-06-25t00:30:07.9289078+00:00 but pukes on : 2014-06-24t00:31:08.62124+00:00 i suspect it's because of missing trailing "0"s before "+" i playing around json.net , trying use jtoken.parse method seems doing want. var t = newtonsoft.json.linq.jtoken.parse( @"{ ""x"": ""2014-06-24t00:31:08.62124+00:00"" }").value<datetime>("x"); how jtoken.parse converting utc time correctly , how can use in jsonconvert.deserializeobject<mytype>(json); ? i tried set public static jsonserializersettings jsonse

javascript - Adding custom marker text to Google Map -

Image
i'm creating new website new law office. i followed google api embedding maps. added address, add name of firm map... can see in map, doesn't capture name: <iframe width="600" height="450" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/place?key=myapikey&q=883%20farmington%20avenue%2c%20berlin%2c%20ct%2006037%2c%20united%20states"></iframe> so, tried adding name before address in iframe: q=jill+levin+law,address here... but i'm guessing keyword levin pick ups matching firm, soulsby & levin, llc ... though haven't changed address <iframe width="600" height="450" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/place?key=myapikey&q=jill+levin+law,883%20farmington%20avenue%2c%20berlin%2c%20ct%2006037%2c%20united%20states"></iframe> even google api picks wrong 1 ba

python - how to test the same function from various modules using pytest -

i run test function different modules (in 1 module define function calls c++ code , in other module have same function calls different code). way using py.test? you can use metafunc , create conftest.py file pytest_addoption , pytest_generate_tests functions: def pytest_addoption(parser): parser.addoption("--libname", action="append", default=[], help="name of tested library") def pytest_generate_tests(metafunc): if 'libname' in metafunc.fixturenames: metafunc.parametrize("libname", metafunc.config.option.libname) and in function in tests.py file can use importlib , ask libname: def test_import(libname): import importlib tested_library = importlib.import_module(libname) ....... now, running test should provide name of module want test: py.test tests.py --libname=your_name1 (you can add --libname=your_name2 )

bash - Python stdout influenced by TERM setting -

for small project decided give python go first time. got code work fine when handling output of python script noticed strange behavior. it seems terminal setting used influences python's print function outputs. here's simplified version of code: #!/usr/bin/python print 'one two' normal output expect: ~/$test.py 1 2 ~/$ but if try , bash read output, fails. , here's how replicate problem: ~/$ set -x ~/$ ./test.py | while read v1 v2; echo $v1; echo $v2; grep -c "$v1" /myfile; done + ./test.py + read v1 v2 + echo 'one' 1 + echo 2 two + grep -c 'one' /etc/passwd grep: unmatched [ or [^ + read v1 v2 ~/$ set +x notice single quotes around 'one'? , '[' grep complains about. when redirected output file, , loaded in vi, saw control characters in front of output. to fix problem, run command this: ~/$ (term=dumb; ./test.py | while read v1 v2; echo $v1; echo $v2; grep -c "$v1" /myfile; done) this wo

Apps Script to Make a Copy of a Google Document -

just trying make simple script makes copy of doc specified file id , opens copy. the following script makes copy doesn't open document: function doget(e) { var fileid = e.parameters.fileid; if(!fileid){ //fileid = google doc id fileid = '1eenxjdeka0p3xeq6xdm0r2wacc6snp5_7hu3_f4viaa'; } var newid = docslist.getfilebyid(fileid).makecopy('file copied drive').getid(); documentapp.openbyid(newid); } can't figure out why. appreciated. thanks. "opening document" using google-apps-script not mean "open in browser", gives access document using google docslist method, nothing else. the best achieve looking fo throw popup window showing new file url click open (using anchor widget uiapp service or small html ui). this built in limitation of g-a-s , there no way go around it.

haskell - Why does "nub" have O(n^2) complexity when it could be O(n)? -

the nub function data.list has o(n 2 ) complexity. it's clear implementing o(n) algorithm doable , not hard. why doesn't haskell it? nub :: eq => [a] -> [a] base data.list o(n^2). nub function removes duplicate elements list. in particular, keeps first occurrence of each element. (the name nub means `essence'.) special case of nubby, allows programmer supply own equality test. to provide answer has been made rather painfully explicit in comments: premise wrong, nub :: eq => [a] -> [a] can not have o(n) implementation. you thinking of implementation can assume ordering, ordnub :: ord => [a] -> [a] , linear log. or perhaps assuming hashable, bucket-sortable sort of thing. unlike eq , when have ordering information don't need potentially compare every pair of elements. this topic discussed in 2008: http://haskell.1045720.n5.nabble.com/ghc-2717-add-nubwith-nubord-td3159919.html this topic discussed again, different actors in co

ios - NSFetchedResultController Sction Name - Custom Sorting according to dates -

i using nsfetchedresultcontroller. below scenario want achieve. i have table messages attributes messagedate (i.e. nsdate). need sort messages date labels today,yesterday,last week , older. i tried using nssortdescriptor selector method selector method format returns nscomparisonresult object. instead of sorting results, try add sort descriptors in fetch request itself. , create nsfetchedresultcontroller instance fetch request. for example, use code snippet. nssortdescriptor *sortdescriptor = [[nssortdescriptor alloc] initwithkey:@"messagedate" ascending:yes]; nsarray *sortdescriptors = [[nsarray alloc] initwithobjects:sortdescriptor, nil]; [fetchrequest setsortdescriptors:sortdescriptors]; nsfetchedresultscontroller *myfetchedresultscontroller = [[nsfetchedresultscontroller alloc] initwithfetchrequest:fetchrequest managedobjectcontext:managedobjectcontext sectionnamekeypath:@"message" cachename:nil];

php - Every 15 minutes some reason session expire and redirect to login page -

i have in code not seem have affect on server. set session gc_maxlifetime time 4 hours not work. every 15 minutes redirects login page. what can change avoid unexpected session expiration? in local works fine on server create problem. ini_set('session.gc_probability', 1); ini_set('session.gc_divisor', 100); ini_set('session.cookie_secure', false); ini_set('session.use_only_cookies', true); ini_set('session.gc_maxlifetime',14400); //4 hour setcookie("_lid", $lid, time() + 14400); //set cokkies expiretime $sessioncookieexpiretime=8*60*60; session_set_cookie_params($sessioncookieexpiretime); the problem session garbage collection done via cronjob under /etc/cron.d/php or /etc/crontab . this set every 30 minutes afaik. change 0 */4 * * * let job every 4 hours. the cronjob looks like: 09,39 * * * * root [ -x /usr/lib/php5/maxlifetime ] && [ -d /var

android - how to show image grid in a Drawer which has a listview inside it -

in continuation last question how can make multi-level(more 3 level) navigation drawer in android? what's happening: showing filters in navigation drawer has children many levels. whenever click on any, puts selected filter @ top , shows children below simple list. what want: when select filter, want see images of children in grid view inside drawer(which vertically scroll-able) below name of filter. if image selected here, name of children gets added in hierarchy list , see image grid of new children. got upto many levels(safe assume 4-5). i thinking make fragment same colors of drawer , show grid view inside it. lack knowledge in it, how keep fragment below list , inside drawer. kindly provide detailed solution. android noob here.

asp.net mvc - Acessing Value from Global Variable in MVC -

hi developing web application using mvc4 , jquery mobile. in our each controller created user session below. public class homecontroller : basecontroller { private static user currentuser; public actionresult index(string name) { currentuser = (user)session["currentusersession"]; return view(); } public actionresult userdetaiks() { string username = currentuser.userfname; return view() } } above created object user model , assigned session value in index method. value in currentuser lost once entered userdetails. used static while creating object. question correct? or anyother way there. please guide me. thanks guys 1 more doubt, i used below code in form authenticate. httpcookie authcookie = request.cookies[formsauthentication.formscookiename]; if (authcookie != null) { formsauthenticationticket authticket = formsauthentication.decrypt(

Proof of Paper, Scissor, Rock as Monoid Instance in Coq -

so while learning coq did simple example game paper, scissor, rock. defined data type. inductive psr : set := paper | scissor | rock. and 3 functions: definition me (elem: psr) : psr := elem. definition beats (elem: psr) : psr := match elem | paper => scissor | rock => paper | scissor => rock end. definition beatenby (elem: psr) : psr := match elem | paper => rock | rock => scissor | scissor => paper end. i define composition (although should somewhere in standard library) definition compose {a b c} (g : b -> c) (f : -> b) : (a -> c) := fun x : => g (f x). i implement class monoid described here class monoid {a : type} (dot : -> -> a) (unit : a) : type := { dot_assoc : forall x y z:a, dot x (dot y z)= dot (dot x y) z; unit_left : forall x, dot unit x = x; unit_right : forall x, dot x unit = x }. i managed prove can psr forms monoid under compose + , me 1 instance mspr : monoid compose me. spli

Malformed header in svn dump, not dumped revision issue -

hello have tried can find online salvage have left here, had issue lost our last server , backup dump have having issue malformed header in seems revision 1151. there way me recover this? i have attempted remove directory seems issue using svndumpfilter , same issue. unsure can do, new running server (only person around when went down) , assuming cant dump file , remove bad line. svndumpfilter: e140001: dump stream contains malformed header (with no ':') @ '?\179s?\216iw?\247z?\205?\239?\252'xm?\197?\165?\195a;' you dump , remove entire revision, should work, think safer first remove every part of dump after revision 1150 , load in. if gives repo (i think will), can @ remainder of dump, remove offending revision , load in revs 1152+ you have hole in repo after that, , i'm not sure might able recover if dump corrupt.

android - Can't connect to my ejabberd server using Asmack -

getting these errors in logcat: 06-26 02:34:08.352: w/system.err(1261): java.security.keystoreexception: java.security.nosuchalgorithmexception: keystore jks implementation not found 06-26 02:34:08.352: w/system.err(1261): @ java.security.keystore.getinstance(keystore.java:119) 06-26 02:34:08.352: w/system.err(1261): @ org.jivesoftware.smack.servertrustmanager.(servertrustmanager.java:71) 06-26 02:34:08.352: w/system.err(1261): @ org.jivesoftware.smack.xmppconnection.proceedtlsreceived(xmppconnection.java:858) 06-26 02:34:08.352: w/system.err(1261): @ org.jivesoftware.smack.packetreader.parsepackets(packetreader.java:250) 06-26 02:34:08.352: w/system.err(1261): @ org.jivesoftware.smack.packetreader.access$000(packetreader.java:46) 06-26 02:34:08.362: w/system.err(1261): @ org.jivesoftware.smack.packetreader$1.run(packetreader.java:72) 06-26 02:34:08.362: w/system.err(1261): caused by: java.security.nosuchalgorithmexception: keystore jks implementation not

javascript - Cross-Origin Request Blocked with Ajax (box.com) -

i try send request ajax the_document_id, can me fix bug response message "networkerror: 401 unauthorized - https://view-api.box.com/1/documents ” cross-origin request blocked: same origin policy disallows reading remote resource @ https://view-api.box.com/1/documents . can fixed moving resource same domain or enabling cors. as per new policies, cross origin requests blocked ajax requests. (unless have access remote server add http header) if server doesn't permit, can't load resources origin. best workaround loading file server side scripting language (like php) in same origin, requesting file ajax. for more information see here : wikipedia

windows - Git push not working but "git clone" and SSH does -

Image
i set debian server uses ssh shell access , git repos. created bare repo on , using ssh able clone windows 8 workstation, when trying push changes debian server error depicted here: read remote host 174.52.5.192: connection reset peer fatal: sha1 file '<stdout>' write error: invalid argument fatal: remote end hung unexpectedly error: failed push refs 'git@174.52.5.192:/home/git/repos/space-junk.git/' i use work station regularly shell access same server via ssh know inability access ssh isn't problem. does have idea what's going wrong? actually, first push should be: git push -u origin master that link local branch master remote tracking 1 origin/master then, after first push, able (for subsequent push) simple: git push see more @ " why need explicitly push new branch? ".

java - Screenshot of a panel with opened comboboxes -

i have jpanel includes jcombobox . trying take screenshot of panel when jcombobox open. couldn't it. idea? if run code press alt-p when combo open, see problem. public class screenshotdemo { /** * @param args */ public static void main(string[] args) { final jpanel jmainpanel = new jpanel(new borderlayout()); jpanel jp = new jpanel(); jp.add(new jcombobox<string>(new string[] { "item1", "item2", "item3" })); final jpanel jimage = new jpanel(); jmainpanel.add(jp, borderlayout.west); jmainpanel.add(jimage, borderlayout.center); jp.getinputmap(jcomponent.when_in_focused_window).put(keystroke.getkeystroke(keyevent.vk_p, inputevent.alt_down_mask), "screenshot"); jp.getactionmap().put("screenshot", new abstractaction() { @override public void actionperformed(actionevent arg0) { bufferedimage bf =

actionscript 3 - How to solve: Error: value of pendingCustomerTokenList must be a collection in flex 4 -

have app creating in flashbuilder 4, java axis 2 web service , mysql. in app have defined service. have not had problems pulling data , inserting data calling java functions through service. i added new property , made available in flex. displayed on label field, ran app , got following error: error: value of pendingcustomertokenlist must collection @ valueobjects::_super_pendingtokensresponse/set pendingcustomertokenlist()[f:\vengage\flexworkspace\fbagentapp\src\valueobjects\_super_pendingtokensresponse.as:104] @ com.adobe.serializers.utility::typeutility$/assignproperty()[/users/sameer/depot/flex/ide_builder/com.adobe.flexbuilder.dcrad/serializers/src/com/adobe/serializers/utility/typeutility.as:559] @ com.adobe.serializers.utility::typeutility$/converttostrongtype()[/users/sameer/depot/flex/ide_builder/com.adobe.flexbuilder.dcrad/serializers/src/com/adobe/serializers/utility/typeutility.as:498] @ com.adobe.serializers.utility::typeutility$/convertresulthandler()[/users/

contextmanager - How do I write a three-block context manager in Python? -

i have many functions exploit context manager pattern: @contextmanager def f(): # preliminary stuff. yield # final stuff. i use exitstack call of these context managers. i considering pattern: @threeblock_contextmanager def f(): # preliminary stuff. yield # intermediary stuff. yield # final stuff. i've been looking @ the source , thought modify in way. there nice way accomplish this? other option add method each class returns context manager. disadvantage of adding method intuitive linear view of code lost because intermediary stuff in different method rather placed between preliminary , final stuff, consider more logical. as requested, more code: def fire(self, cluster_index, obs_count=1.0): exitstack() stack: link in self.terminal.out: stack.enter_context( link.source_firing(cluster_index, obs_count)) link in self.terminal.in_: stack.enter_context(

java - Why getItem(position) works with a new instance? (should not be zero?) -

i'm trying learn java, read casting, instantiate objects, arrays, hashmaps, etc. making codes android , doing until found myself this: myobject instobject = (myobject)getitem(position); from i've learned far... i'm creating new instance of myobject in instobject, so, think value should zero. then, when call settext(...) , works! =o please try not summarize answer because understand has been difficult me far! speak spanish, know little english not well. public class myclass extends listfragment { list<myobject> instobject; //instobject = 0 ... @override public void onactivitycreated(bundle savedinstancestate){ super.onactivitycreated(savedinstancestate); instobject = new arraylist<myobject>(); myobject item = ... instobject.add(item); //instobject = items } //adapter{ ... @override public view getview(int position, view view, viewgroup parent) { myob

Disabling text box on click of checkbox not working using jquery -

this question has answer here: javascript infamous loop issue? [duplicate] 5 answers i unable delete text , disable text box using jquery code, below code. alert working whether check or uncheck checkbox. please suggest. <script> $(document).ready(function(){ var arr= new array('1','2','3','4','5'); for(var i=0;i<arr.length;i++) { $("#q4x1_"+arr[i]).click(function(){ if($("#q4x1_"+arr[i]).prop('checked',true)) { alert("hi"); $("#q4x2_"+arr[i]).val(''); $("#q4x2_"+arr[i]).prop('readonly',true); } else

spring - ERROR 1215 (HY000): Cannot add foreign key constraint in mysql -

hi iam creating 2 table in mysql onetoone mapping in spring hibernate,but getting error error 1215 (hy000): cannot add foreign key constraint this first table create table `employee` ( `empid` int(11) not null, `empname` varchar(255) default null, `empexp` int(11) not null, `empteam` varchar(255) default null, `teamid` int(11) default null); second table create table `empteam` ( `teamid` int(11) not null, `teamname` varchar(255) default null, primary key (`teamid`) , key `fk1` (`teamid`), constraint `fk1` foreign key (`teamid`) references `employee` (`empid`)); please help,thanks in advance try this create table `empteam` ( `teamid` int(11) not null, `teamname` varchar(255) default null, primary key (`teamid`) , constraint `fk1` foreign key (`teamid`) references `employee` (`empid`)); if have fk1 remove , create agai

c++ - MVP Passive View approach with FLTK -

i have basic problem, trying use fltk mvp passive view described here . managed it, doesn´t feel right way i´m doing it. i´m having fl_window , containing widgets , fl_gl_window opengl functionality. know, can add widgets , stuff fl_window between begin() , end() . , seems have instantiate when add directly in between these calls, got that: (please @ small "story" in comments beside code, because explains i´m doing , want know if fine in case, or maybe can point me way better solution, because feels wrong. ) main.cpp int main(/*arguments*/) { model* model = new model(); ipresenter* presenter = new presenter(model); //presenter knows model @ point iview* view = new view(presenter); //view gets reference presenter... } view.h class view : public fl_window { public: view(ipresenter* presenter); virtual ~view(); private: iview* gl_window; ipresenter* presenter; }; view.cpp view::view(ipresenter* presenter) :fl_window(/*a

vba - Insert a word from a predefined list of words -

Image
i'm looking way create vba script in ms word displays list of predefined words. if user clicks on one, inserted document. google searches showed way create mailings values excel want words hard coded inside vba script (array maybe?) without external files. here small mockup how imagined it: any ideas or tutorial links on how achieve somehing this? doesn't have dialog in image have collection of words in dialog user select. edit: nice if user see human readable label (like 'first name') inserted value variable (like '$firstname'). for creating pop-up list of words, can try this connect displayed value actual value. as inserting text part, this post seems address topic. otherwise here's msdn ( http://support.microsoft.com/kb/212682/en-us )

Can you turn off Peek Definition in Visual Studio 2013 and up? -

in visual studio 2013 , up, there peek definition feature when ctrl + click. @ first thought cool, have found majority of time, need click promote document button, since make lots of changes files ctrl + click on. after googling how turn off peek definition, can't find details on if possible. ctrl + click functionality go opening definition in own tab, in previous versions of vs. possible? tools → options → productivity power tools → other extensions → control click shows definitions in peek

google spreadsheet - Script to wrap range of cells in HTML tags -

i searching simple formatting solution. getvalue(), followed setvalue() same data, wrapped in html tags. , here trouble: can't figure out how range object of cells need , edit them in 1 move. there solution that? there's lib that! sheetconverter library . gist here . here's how html table whole sheet: var range = spreadsheetapp.getactivesheet().getdatarange(); var htmltable = sheetconverter.convertrange2html(range); you'll find other goodies convert ranges arrays of formatted strings, or generate html single cell (including fonts, background colors, text colors, , other formatting elements). disclosure: i'm library author.

java - How to resolve external included modules during reactor build? -

i have common api/toolkit shared classes want include in every project create. toolkit extended, prefer resolved eclipse workspace. therefore include them svn:externals within every project. problem: when mvn package projects, pack sources included externals . , if modify ogiginal toolkit, externals not updated in sync , have still old state. so: not possible i'm trying achieve? this project layout: somewhereelse/project-commons project-master -project-web -externals:project-commons master pom: <modules> <module>project-master</module> <module>project-commons</module> <module>project-web</module> </modules>

android - Google play-service resources error -

i updated sdk yesterday , after restarting eclipse projects using google services broken. show me red "!". [2014-06-27 10:35:38 - basegameutils] c:\program files\android_adt\sdk\extras\android\support \v7\appcompat\res\values-v14\styles_base.xml:24: error: error retrieving parent item: no resource found matches given name 'android:widget.holo.actionbar'. [2014-06-27 10:35:38 - basegameutils] c:\program files\android_adt\sdk\extras\android\support\v7\appcompat\res\values-v14\styles_base.xml:28: error: error retrieving parent item: no resource found matches given name 'android:widget.holo.light.actionbar'. [2014-06-27 10:35:38 - basegameutils] c:\program files\android_adt\sdk\extras\android\support\v7\appcompat\res\values-v14\styles_base.xml:32: error: error retrieving parent item: no resource found matches given name 'android:widget.holo.actionbar.solid'. [2014-06-27 10:35:38 - basegameutils] c:\program files\android_adt\sdk\extras\android\suppor

c# - Calling WCF Service from ASP.NET MVC via Ajax (CORS) -

i have wcf service run on port (25537) , have mvc application. mvc application make post call wcf service. i got error : options http://mylocal.com:25537/authentication request header field content-type not allowed access-control-allow-headers. i had try many options nothing changed. to global.asax protected void application_beginrequest(object sender, eventargs e) { response.appendheader("access-control-allow-origin", "*"); response.appendheader("access-control-allow-headers", "origin, x-requested-with, content-type, accept"); if (httpcontext.current.request.httpmethod == "options" ) { response.appendheader("access-control-allow-methods", "get, post"); response.appendheader("access-control-allow-headers", "origin, x-requested-with, content-type, accept"); response.appendheader(&q

shell - Bash scripting unexpected operator -

i'm writing script git hook , have trouble if statement inside while . file: #!/bin/sh while read oldrev newref ref branch=$(git rev-parse --symbolic --abbrev-ref $ref) if [ "a" == "a" ] echo "condition work" fi echo "$branch" done error: hooks/post-receive: 6: [: a: unexpected operator i'll try variables, double quotes if doesn't work. kind of error here? thanks if [ "a" == "a" ] should if [ "a" = "a" ] . bash accepts == instead of = , /bin/sh isn't bash. so either change == = , or shebang #!/bin/bash

javascript - Gulp for loop not iterating -

this question has answer here: node.js / gulp - looping through gulp tasks 1 answer i working on new gulp build process , reason can not loop, runs fine generates first less file never iterating. var files = ['style.less', 'core.less', 'theme.less'] gulp.task('build', function () { (var = 0; < files.length; i++) { return gulp.src(lessdir + files[i]) .pipe(plumber({ errorhandler: onerror })) .pipe(less()).pipe(notify(files[i] + " rendered!")) .pipe(csscomb()).pipe(notify(files[i] + " sorted!")) .pipe(cssbeautify({ indent: ' ', autosemicolon: true })).pipe(notify(files[i] + " spaced!")) .pipe(gulp.dest(cssdir)) .pipe(minifycss({ keepbreaks: false, processimport

angularjs - Writing a directive for an existing javascript object the "Angular" way -

i'm working on trying make angular directive encapsulates viewer.js functionality pdf.js project because how viewer looks, able pass in variables own angular bindings. now, there 2 angular-pdf-like projects out there sayanee's project ( https://github.com/sayanee/angularjs-pdf ) looks provides basic functionality @ https://github.com/mozilla/pdf.js/blob/master/examples/text-selection/js/minimal.js , anrennmair's project @ https://github.com/akrennmair/ng-pdfviewer these pdf viewers don't good, , how pdf.js viewer shows page after page view , lets scroll through them. don't need functionality of printing, bookmarks, attachments, saving, opening, etc should save @ least work, question this: how write viewer directive? more specifically, in answer previous question , respondent said first github project poorly designed angular-way point of view. what's proper way this? prefer write first time according best practices, i've been unable find clear pr

VB.NET - Access to path %appdata% is denied -

Image
i making mod installer minecraft community, when ended problem: here's code: private sub button1_click(sender object, e eventargs) handles button1.click button1.enabled = false button2.enabled = false combobox1.enabled = false button1.text = "downloading... not quit!" dim selected string dim issel boolean issel = false selected = combobox1.selecteditem if selected = "minecade mod 1.7.2" selected = "5" issel = true end if if selected = "minecade mod 1.7.2 optifine standard" selected = "3" issel = true end if if selected = "minecade mod 1.7.2 optifine ultra" selected = "4" issel = true end if if selected = "minecade mod 1.7.2 optifine standard , minecade capes" selected = "1" issel = true end if if selected = "m

sockets - Ruby TCPServer always delay on dns reverse lookup? - how to disable? -

i created tcpserver ruby gserver. everytime connect remotly server, takes 2-4 seconds until connection established. this happen if connect remote machine. connection same machine has running service send immidiate response. for connection on same machine there no difference if connect via localhost or via machines ip. i think delay depends on reverse lookup can not localize why. in gserver.rb line 263 client = @tcpserver.accept here delay occurs, not know in method. i added machines used during tests local hosts file. changed nothing. same happens when using webrick, tried set also basicsocket.do_not_reverse_lookup = true as direct on resulting server socket socket.do_not_reverse_lookup = true as on client connection socket client.do_not_reverse_lookup = true but changed nothing on delay. whenever connection established, values of remote_host , remote_ip resolved , defined in hosts file. i tried running ruby 2.2.1 on ubuntu 14.04 ruby 1.9

javascript - Why isn't my reactJs re-rendering -

i'm tired of model-binding , trying started react whole stateless idea. went through tutorial , seems straightforward enough. however, in own app confused why component isn't re-rendering on state change. here entirety of app in coffeescript ( _ helpers lodash). mapobject = _.compose _.object, _.map racers = mapobject ['red', 'blue', 'green'], (name) -> [name, (key: name, class: name, position: 0)] advance = (character) -> racers[character].position += 5; console.log character, "position is", racers[character].position view.setstate racers: racers r = react.dom racer = react.createclass getinitialstate: -> @props render: -> r.div (classname: 'racer '+@state.class, style: (left: @state.position)), ""+@state.position racelane = react.createclass render: -> r.li (onclick: _.partial advance, @props.key), racer @props racetrack = react.createclass getinitials