Posts

Showing posts from March, 2014

c# - Visual Studio shuts down repeatedly when formatting code -

"microsoft visual studio 2013 has stopped working" i format code using ctrl e + d. works, causes visual studio shut down. can't pinpoint why this. perhaps it's setting i'm missing (or accidentally changed)? work computer never this. personal computer. this happens 99% of time on views, not code in classes, css, or js . i've attempted make sure html/code correct (no red underlines or green "for html") when formatting, hoping solves problem. can format code on view, on same view, format again (after changes), , it'll (vs) shut down. does happen else? windows 8 visual studio 2013 ultimate webessentials i don't have resharper installed. i have enough memory cpu isn't 100% its memory problem,please clear recent,%temp% , temp files run command afirst of close windows . eg:in windows press start+r -->run command window appears then type recent , hit enter .then select , delete files then type %temp

javascript - How to display row of images in a repeater control vertically instead of horizontally -

i'm trying make image slider repeater control in asp.net. have div repeater control in images, can't figure out how make display vertically instead of horizontally. can point me correct css style? i've tried using vertical-align property on div. here link javascript file carosuellite <script type="text/javascript" src="scripts/jquery-1.11.3.js"></script> <script type="text/javascript" src="scripts/jquery.jcarousellite.js"> </script> <div class="container"> <div id="navicontainer"> <ul> <asp:repeater id="rptslider" runat="server"> <itemtemplate> <li><a href="#"> <asp:image id="imgslide1" runat="server" imageurl='<%#container.dataitem %>' height="128"

elasticsearch - enabling TTL on an entire index -

question pretty straight forward, there way enable ttl on index level. means types created under index inherit enabled ttl. on documentation said "you can provide per index/type default _ttl value follows", wasn't able request ttl on index level. in case isn't possible, workaround can suggested ? in our environment new types created time, , data has removed after not needed anymore. you can accomplish using default option under mapping. under index , if put configuration under_default_ applied mappings these configurations not defined under same index. curl -xput "http://localhost:9200/test_index" -d'{ "mappings": { "_default_": { "_ttl": { "enabled": true } } } }'

php - File_exists function is not working -

Image
since problem on file_exists() , seems function should goes root directory, when determine file location on file_exists function declare base url because tests file location server not url : wrong code $dir = base_url()."assets/produits/"; foreach ($rows $row) { $nom = $row->nshape; $type = array(".jpeg", ".jpg"); foreach ($type $ext) { echo "<br>i'm in foreach loop <br>"; $file_name = $dir . $nom . $ext; if (file_exists($file_name)) { echo "i'm in file_exists function<br>"; $img_src = $file_name; } else { echo "i'm in else statement <br>"; echo $file_name."\n"; $img_src = $dir . "none.png"; } } } the problem full name there treat doesnot exists, i've made echos check did

Entity Framework 6, Transaction Scope, Context and SaveChanges -

question pertains transaction scope , context.savechanges() . if i'm processing million records foreach , , save after every, let's say, 1000 records calling context.savechanges() inside transaction scope , fails after 10 000 have been processed , savechanges() called, saved data rolled back? example: using(transactionscope ts = new transactionscope( transactionscopeoption.requiresnew, new timespan(0, 10, 0))) { int counter = 0; using (myentities context = new myentities()) { foreach(var item in context.items) { //process item if(counter >= 1000) { context.savechanges(); //if fail here, saved changes rolled back? counter = 0 } } context.savechanges(); } ts.complete();//what here? } the transaction scope takes precedence long dbcontext enrolled in it, default. thus, if don't call transactionscope.complete (e.g. because d

Unable to upload file when using JQuery file upload, Spring MVC and Spring Security. -

i implementing simple website image upload. frameworks in use jquery file upload spring mvc spring security i've implemented form , controller file upload when trying read files, files seems unavailable. i've struggled security _csrf while i've figured out. when try read files no files can read when reaching controller. here source code https://gist.github.com/adelinghanaem/f67b311cda7aa9efe83c after lot of debugging , checking spring security/mvc architecture i've came with: @requestmapping(value = "/upload", method = requestmethod.post) public responseentity<uploadpictureresult> pictureupload(firewalledrequest initialrequest) { defaultmultiparthttpservletrequest request = (defaultmultiparthttpservletrequest) initialrequest.getrequest(); try { multipartfile multipartfile = request.getfile("files[]"); list<multipartfile> multipartfilelist = request.getfiles("files[]");

mysql - select all rows that have more than two matching composite keys in a table -

mysql fiddle i have composite table , i'm trying select rows has both 1 , 2 in pk2 column. can see, i've write query job using join... yeah. it's okay not satisfying. i'm afraid if code messy , slower adding more joins in query when needs more 10 constraints. is there faster & cleaner way same result? assumption: there can more 10 constraints in worst scenario. unlikely possibly. what i've tried far: i tried using union didn't work & thought it's 1 of worst options choose when comes performance efficiency. i tried in (....) it's same or b... not intended. i tried subquerying in clause... more constraints has, worse nightmare becomes. this sounds "set-within-sets" query. approach group by , having . provides flexible logic handling many different situations: select t1.pk1 t1 pk2 in (1, 2) group t1.pk1 having count(*) = 2; this assumes rows in table unique (otherwise use count(distinct) . here s

c# - Code sample not compiling -

i have been trying use sample code provided microsoft. downloaded file hit unblock on file unzipped file clicked on solution called quizgame sample the solution opened in visual studio 2015 the solution automatically registered hundreds of errors i opened c# files in solution explorer see going on , each c# file had tons of errors. each error how related system reference. error cs0246 type or namespace name 'system' not found (are missing using directive or assembly reference?) the warning was warning cannot resolve assembly or windows metadata file 'system.runtime.dll' it shows system imports red lines underneath them. sounds not recognizing system reference. here code using system; using system.collections.generic; using system.linq; using system.text; using system.threading; using system.threading.tasks; using system.runtime.interopservices.windowsruntime; using windows.networking.sockets; namespace p2phelper { public class p

swift - how to parse this kind of JSON API by using SwiftyJSON -

a project using swift , parse json api using library called swiftyjson [{"a":1, "b":"ï¼’", "c":"3", "d":"ï¼”" }, {"a2":12, "b3":"23", "c4":"34", "d5":"45" }] ↑this api , code↓ import uikit import swiftyjson class viewcontroller: uiviewcontroller{ override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. parsejson() } func parsejson(){ let path:string=nsbundle.mainbundle().pathforresource("jsonfile", oftype: "json")as string! let jsondata=nsdata(contentsoffile: path) nsdata! let readablejson=json(data:jsondata, options:nsjsonreadingoptions.mutablecontainers, error:nil) var number=readablejson["a"] nslog("\(number)") } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } } somethings wr

Object-capability security in Racket? -

racket's sandbox seems great running code don't trust, prevent modules call 1 in sandbox being able see or modify 1 another's internal state, code, or behavior. right best way can think of separate sandboxes , modified "require" wraps exported functions in contracts create proxies. there better way? could provide concrete example? if module requires module b, module can't see inside b. module can use functions module b explicitly provided. of these might change internal state in module b.

How to restore cassandra snapshot on a new single node cassandra -

i have done snapshot of 1 of key space has 10 column family. there 10 snapshot folder under each of column family folder.i want restore these snapshot in 1 development server (single node). how can restore on development using sstanbleloader dev node on windows 2012 standard server prod on windows 2012 ent.edition server you don't need use sstableloader in case. think straightforward method "node restart method" described here . there plenty of details in docs, basically: stop node, remove data files data directories, , replace snapshot files.

Function not invoke in the Javascript file in Chrome extension -

functions of background.js file not invoked onclick() method in popup.html . there wrong manifest.jjson file? because funtion work properly. manifest.json { "name": "popping alert", "description": "http://stackoverflow.com/questions/15194198/background-js-not-working-chrome-extension", "background": { "scripts": [ "background.js" ] }, "content_scripts": [ { "matches": ["http://www.google.com/*"], "css": ["print.css","styles.css"], "js": ["background.js"] } ], "version": "1", "manifest_version": 2, "browser_action": { "default_title": "click me", "default_icon": "hello.png"

regex - replace characters in notepad++ BUT exclude characters inside single quotation marks(2nd) -

Image
replace characters in notepad++ exclude characters inside single quotation marks sorry users (especially avinash raj) answered 1st similiar question - did forget 2nd kind of string. (and (that sad thing) - i'm not able adjust solution 1st similiar question 2nd kind of string...) i have 2 different strings in kind: select column_name table_name column_name in ('a' , 'st9u' ,'meyer', ....); a.object_type in (' 'table'', ''mateerialized vie3w' ') i want replace characters in notepad++ upper lower, exclude replacement characters inside single quotation marks. condition: exists no solid structure before/behind/between single quotation marks part! (that means - can not use keyword "in" or signs "," or "(" or ")" or ";" regex ...!) the once thing is, 2 structures single quotation marks possible: 'word|number' or ''word|num

How to unset http.proxy in android -

we can set system proxy system.setproperty("http.proxyhost", host); system.setproperty("http.proxyport", port); how unset system proxy? you can use clearproperty system.clearproperty("http.proxyhost");

Inserting sorted values from one MySQL table into another table -

i have 2 tables, average_table , position_table . have 2 column each. copy sorted data average_table position_table shown below the average_table looks this std_id avr 001 23.4 002 34.7 003 13.9 004 56.8 then position_table should this: std_id avr 004 56.8 002 34.7 001 23.4 003 13.9 when used following sql queries, result no different between average_table , position_table . can 1 me out please? try { string str = "insert position_table select * average_table order avr desc"; rs = st.executequery(str); } catch(sqlexception ce){system.out.print(ce)} in sql world rows aren't sorted. there might way in mysql (in sql server, think clustered might - reason getting rows in order). in other words, inserted row not guaranteed have specific order. sql declarative, have declare how order when query. i don't understand you're trying achieve position table

c# - Universal Windows 10 app background task timer to get notifications -

i want register background task should work if app not running, in task want download string web (empty if no new notifications show) if not empty show push notification. want check web page every 15-30 seconds possible? if please me how. or maybe better ideas? you have implements background task. minimum time between 2 background sync 15 minutes. please refer : https://msdn.microsoft.com/en-us/windows/uwp/launch-resume/support-your-app-with-background-tasks#conditions-for-background-tasks regards

ruby on rails - Rake aborted on multiple machines. CompilationError? -

i've had problem rails application long time now. have time mess don't understand problem is. within phusion passenger error, on ubuntu server error, , @ heroku still see error. i've logged in heroku in terminal heroku login , run rake command: heroku run rake db:version --app tara-crammer-designs . this see error: running `rake db:version` attached terminal... up, run.4434 /app/.ruby_inline/ruby-2.2.0/inline_fastimage_bbac2b6030874ea47494fd3952895412.c:2:16: fatal error: gd.h: no such file or directory #include "gd.h" ^ compilation terminated. rake aborted! compilationerror: error executing "gcc -shared -fpic -o3 -fno-fast-math -g -wall -wextra -wno-unused-parameter -wno-parentheses -wno-long-long -wno-missing-field-initializers -wunused-variable -wpointer-arith -wwrite-strings -wdeclaration-after-statement -wimplicit-function-declaration -wdeprecated-declarations -wno-packed-bitfield-compat -l. -fstack-protector -rdynamic -wl,-

javascript - preventDefault() on a multiselect, different behavior on FF - IE - Chrome -

i'm struggling mouse events on select multiple. didn't expect difference in behavior across browsers in 2015... i'm trying simulate ctrl+click click, easy use. working on chrome, using preventdefault(), cancelling default behaviour (select current option , deselect others) select.addeventlistener('mousedown', function(evt) { evt.preventdefault(); evt.target.selected = !evt.target.selected; return false; }, true); here fiddle, can check different browsers: https://jsfiddle.net/fzvkw1xv/ chrome -> works expected ff -> it's preventdefault() doesn't anything. other options unchecked. ie 11 -> no option selected @ all what want achieve full control on multiselect make better user experience. i couldn't find documentation related this, don't know browser buggy one, or standard expected behavior is. info on appreciated. i'm starting think making checkboxes multiselect box. thanks diffe

ios - viewDidLoad not called when initialising obj viewcontroller from Swift -

in swift code, trying instantiate objective-c view controller below, viewdidload method not being called. let detailmessagevc = detailmessageviewcontroller(nibname:nil, bundle:nil) if instantiate same viewcontroller objective-c code called. there no xib view controller. self.detailmvc = [[detailmessageviewcontroller alloc] init]; does know why happening? have same behaviour when calling swift rely on viewdidload perform various initialisation. xcode 6.3.2 as comment stated, there no link between initialisation of view controller , it's viewdidload callback. you can have viewdidload called before init. because viewdidload called if viewcontroller loaded view. check there : https://stackoverflow.com/a/4862772/1486230 although, wouldn't rely on viewdidload unless know display viewcontroller; using myvc.view . just think initialising viewcontroller (which logic object) different creating view. performance reason, ios won't create graphic objec

c# - How determine where a mouse is wherever it's clicked -

i'm making chess game in c#, , i'm using 64 picturebox s display board. now, i'm trying figure out how determine user clicks allow user move pieces clicking different tiles/pictureboxes. i'm new c#, i'm trying detecting mouse whenever it's clicked. i've been using: void mainformclick(object sender, eventargs e){ point mouseposition = picturebox1.pointtoclient(cursor.position); //picturebox1 in upper-left int indexclicked = (mouseposition.x / tilesize) + (8 * (mouseposition.y / tilesize)); if (indexclicked >= 0 && indexclicked <= 63){ //do code things? } this.text = "chess - " + indexclicked; } i assume isn't working because user isn't clicking on form, on pictureboxes. i'd rather not make 64 picturebox*click methods, there other way should doing or method should using? edit: looked @ how control under mouse cursor . code needs ch

javascript - How can I make only the li value clickable and generate an anchor? -

how can make label (the 1, 2, 3, etc) of li clickable, not contents? <ol> <li value="1">first item</li> <li>second item</li> <li>third item</li> </ol> here's jsfiddle: http://jsfiddle.net/4c11qwxh/ in example, want href around list numbers - ie. on 1, 2, , 3, not contents ("first item", "second item", "third item"). ideally i'd js , html able create anchor tags li elements. if click on 2, create anchor #2 if refresh page, scroll value. thanks! you have generate links javascript in case, because can't make list numbers anchors. it's not difficult jquery. make sure use list start attribute can read this.parentnode.start (or $(this).parent().attr('start') ) , adjust numbers left position , width: $('ol li').append(function(i) { var number = this.parentnode.start + i; return $('<a>', { class: '

Finding strings using an index - MATLAB -

i have character array list , wish tally number of substring occurrences against index held in numerical vector chr: list = ccnncccnnncnncn chr = 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 ordinarily, searching adjacent string pairs i.e. 'nn' , utilise method: count(:,1) = accumarray(chr(intersect([strfind(list,'cc')],find(~diff(chr)))),1); using ~diff(chr) ensure pattern matching not cross index boundaries. however, want match single letter strings i.e. 'n' - how can accomplish this? above method means last letter in each index missed , not counted. the desired result above example 2 column matrix detailing number of 'c's , 'n's within each index: c n 2 2 5 6 i.e. there 2c's , 2n's within index '1' (stored in chr ) - count restarts 0 next '2' - there 5c's , 6n's. [u, ~, v] = unique(list); %// unique la

windows - Visual Studio 2015 not responding -

Image
i have installed windows 10 in dell laptop. see quite visual studio 2015 not responding. is there log can turn on see what's happening in visual studio while loading project, see add-on delaying load? or in task monitor see resource causing slowness disk read or memory? update: as per iinspectable's comment, created dump file task manager. i don't see thread information in file. tried debug (by clicking debug actions menu) after loading data in vs 2015 again. takes while load symbols, @ end see source not available screen , stop there. 11/18/2015: asp.net tools team working on performance issue. you try enabling logging via /log command line option of devenv.exe. see microsoft reference . (devenv.exe being visual studio ide)

c++ - Continuous check in the main loop in Qt 5.5 -

i have device moves on linear path, linear actuator . when device reaches physical ends, hits limit contact sends signal software. need continually check if signal online. i'm having difficulties implementing logic in qt5.5. i've been reading on qtconcurrent , seems viable solution after implementing on test drive found out cannot solve problem without sort of while(true) loop. implementing while(true) loop seems slow down else on code therefore rendering solution useless. i post code given uses libraries , nomenclature of devices of specific niche spare pain if can guide me towards reading on grateful. prefer steer clear of qtthread , manually setting threads since not feel comfortable working them @ point, , have time limit on project best if don't experiment much. tldr : need put code somehow within main loop of program checks boolean value change. said change sent program externally device communicating through ethernet. class checker : public qob

coding style - Is it possible to assign a code block to a switch case twice in Javascript? -

i have javascript processing form send results server through ajax, , want reuse code process common components of question types. let's have 2 question types "forced choice" , "forced choice other", both of use radio buttons force user choose 1 option, in second type, radio button labeled "other" allow them input own answer question box. getting radio button value common between 2 getting "other" value not. acceptable say switch(questiontype) { case 'forced choice': case 'forced choice other': //code radio button value case 'forced choice other': //if value "other", value of textbox break; default: break; } or preferable switch(questiontype) { case 'forced choice': case 'forced choice other': //code radio button value if(val == 'other' && questiontype == 'forced choice other')

javascript - Node JS Form with dropzone -

i using node js express develop form people can upload file , metadata of file. following tutorial , couldn't add form. i using dropzone uploading file, should link server+name_of_file whenever try print values of form, object hold file without fname/lastname <div id="uploader"> <form action="/upload" class="dz" id="i-dz"> <input type="text" name="fname"> <input type="text" name="lastname"> </form> </div> app.post('/upload', function (req, res, next) { console.log(res) //var form = new multiparty.form(); }

MySQL Workbench Error 1064 -

everyone! i'm newbie mysql. i've created new model using workbench tools(i mean, haven't written string of code myself). when trying forward engineer get: executing sql script in server error: error 1064: have error in sql syntax; check manual corresponds mysql server version right syntax use near 'comment '') engine = innodb' @ line 8 sql code: -- ----------------------------------------------------- -- table `university`.`city` -- ----------------------------------------------------- create table if not exists `university`.`city` ( `id_city` int not null comment '', `cname` text(15) null comment '', `population` int null comment '', primary key (`id_city`) comment '') engine = innodb sql script execution finished: statements: 5 succeeded, 1 failed fetching view definitions in final form. nothing fetch moreover, when trying forward engineer default workbench model "

linux - Returning output from bash script to calling C++ function -

i writing baby program practice. trying accomplish simple little gui displays services (for linux); buttons start, stop, enable, , disable services (much msconfig application "services" tab in windows). using c++ qt creator on fedora 21. i want create gui c++, , populating gui list of services calling bash scripts, , calling bash scripts on button clicks appropriate action (enable, disable, etc.) but when c++ gui calls bash script (using system("path/to/script.sh") ) return value exit success. how receive output of script itself , can in turn use display on gui? for conceptual example: if trying display output of ( systemctl --type service | cut -d " " -f 1 ) gui have created in c++, how go doing that? correct way trying accomplish? if not, what right way? and is there still way using current method? i have looked solution problem can't find information on how return values from bash to c++, how call bash scripts c++. we

java - Forcing Tesseract to recognize only digits -

i developing ocr application android. @ point have observed needed recognize digits, trying ocr recognize digits , hyphens, , not letters or other type of character. i have done this: tessbaseapi.init(path, "eng"); tessbaseapi.setvariable(tessbaseapi.var_char_whitelist, "1234156787901299-"); but not getting accurate result. suggestions appreciated. editted: complete code: tessapi.setpagesegmode(tessbaseapi.oem_tesseract_cube_combined); tessapi.setvariable(tessbaseapi.var_char_whitelist, "0123456789"); tessapi.setvariable(tessbaseapi.var_char_blacklist,"abcdefghijklmnopqrstuvwxyzabcdefghijklmopqrstuvwxyz");

Limiting SQL results in Rails using Postgres -

i have app includes music charts showcase top tracks (it shows top 10). however, i'm trying limit charts particular user cannot have more 2 tracks on top charts @ same time. if artist have 4 of top 10 slots, top 2 tracks artist shown (and #11 , #12 on list bumped 2 spots each, presuming aren't artist of course). so, let's top charts section right now: song artist a song b artist b song c artist a song d artist c song e artist d song f artist e song g artist f song h artist a song artist a song j artist g i limit sql results #8 , #9 aren't included (because 2 tracks per artist allowed in query results) , list instead become: song artist a song b artist b song c artist a song d artist c song e artist d song f artist e song g artist f song j artist g song k artist h (previously #11) song l artist (previously #12) fyi, i'm using postgres, , have right now. counts plays per track in last 14 days generate top 10 list. modify desired l

html - How to style a <div> already styled -

i've rule like: div { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; text-align: left; } for special div specific id i'd remove the: text-align:left; to have text centered, can't succeed. i've added, class, id , text not center. please me? may .....id that #special { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; text-align : center !important; }

c# - Cannot convert a string array position(2.6) in double new double array -

i have string array have different types of symbols. divided separate elements, , 1 of them 2.6 . want him convert, gives me error, tried different methods , written me: input string not in correct format. string s = console.readline(); // input "apr\2.6\7\300"; string[] array = s.split('\\'); // array separeted: apr 2.6 7 300 double[] num = new double[3]; num[0] = double.parse(intarray[1]); // me convert ! :) it seems current culture has different decimal separator. you can specify invariant culture parsing, has period decimal separator: num[0] = double.parse(array[1], cultureinfo.invariantculture);

javascript - Create a button for a user to create a screenshot -

i hoping may have solution situation in. have created online web map tool leverages javascript, html5, jquery, , css distribute information such zoning , streets users. problem have run getting page print once user finds looking for. have tried: using css create print setup works across multiple browsers not work correctly , mapdiv not print correctly not center on map instead focuses on certaing portion of did. using html2canvas print canvas, not print mapdiv, print else. using fireshot api creating screenshot, work in friefox have seen. using esri print javascript api tool, not generate desired result either. this being said, create button screen capture user sees , allow them save own disk , print. know javascript , html not natively have functionality because of potential security risks , like, hoping here may have found plugin works create screen capture. okay processing on server if needed, in essence need way of doing alt+prtscr without having user capture seeing.

stl - Expose C++ container iterator to user -

say have class foo , contains kind of container, vector<bar *> bars . want allow user iterate through container, want flexible might change different container in future. i'm used java, this public class foo { list<bar> bars; // may change different collection // user use public iterator<bar> getiter() { return bars.iterator(); // can change without user knowing } } c++ iterators designed raw c++ pointers. how equivalent functionality? following, returns beginning , end of collection iterator user can walk himself. class foo { vector<bar *> bars; public: // user use std::pair<vector<bar *>::iterator , vector<bar *>::iterator > getiter() { return std::make_pair(bars.begin(), bars.end()); } } it works, feel must doing wrong. function declaration exposes fact i'm using vector . if change implementation, need change function declaration. not huge deal kind

r - Extract items in nested lists -

i have problem: work data frame development time (dependent variable) of 5 species according temperature (independent variable) "by" function calculated lm's of 5 species by(dados, dados$especie, function(dados) lm(dados$tempo ~ dados$temp, data = dados) and result got lists nested in other lists yo can see here list of 5 $ c.albiceps :list of 12 ..$ coefficients : named num [1:2] 262.78 -1.76 .. ..- attr(*, "names")= chr [1:2] "(intercept)" "dados$temp" ..$ residuals : named num [1:41] -4.157 -2.394 -0.631 1.131 2.894 ... .. ..- attr(*, "names")= chr [1:41] "1" "2" "3" "4" ... ..$ effects : named num [1:41] -1344.031 -133.548 0.235 1.977 3.72 ... .. ..- attr(*, "names")= chr [1:41] "(intercept)" "dados$temp" "" "" ... ..$ rank : int 2 it's list of 5 elements (one each specie), , each specie lis

android - Adding ProgressBar into WebView Fragment -

i'm finishing app, simple app contains webview fragments , navigation drawer, ok, don't know how add progress bar while webview loading page, got blank screen before page loads. here code... homefragment.java public class homefragment extends fragment { private webview webview; public homefragment() { // required empty public constructor } @override public void onattach(activity activity) { super.onattach(activity); } @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view mainview = (view) inflater.inflate(r.layout.fragment_my_fragment1, container, false); webview webview = (webview)mainview.findviewbyid(r.id.webview); webview.setwebviewclient(new mantenerdominioweb()); webview.getsettings().setjavascriptenabled(true); webview.getsettings().setbuil

Activate Rails link_to ajax , call with jquery -

i have rails view these remote link_to's <%= link_to 'next', next_page_path, remote:true %> <%= link_to 'previous', previous_page_path, remote:true%> i want make possible activate these left , right arrow buttons on keyboard?. there way without using jquery "click" function? edit: misread question, can bind link_to specific key so: <%= link_to 'previous', previous_page_path, :html_options => {:accesskey => "left arrow"} %> old answer (icons): what type of icons wanting use? can make use of .html_safe helper method. here's example fontawesome icon: <%= link_to '<i class="fa fa-heart-o"></i>'.html_safe, {controller: "users", action: "save_user", user: @user} %> and 1 without using helper, using example: <%= link_to next_page_path %> <i class="fa fa-arrow"></i> <% end %> in way if clic

Google sign in website Error : Permission denied to generate login hint for target domain -

i trying integrate google login in website .. i following example: https://developers.google.com/identity/sign-in/web/ i generated client id project , replaced in above code, keep getting error: that’s error. error: invalid_request permission denied generate login hint target domain. i ran issue while doing local development. make sure when running project locally use "localhost" rather "127.0.0.1", "0.0.0.0", etc...

html5 - How to fix jittery audio/video on firefox when playback rate set to .5x using javascript? -

i trying set experiment in playing .mp4 videos , changing playback rates using base javascript (no libraries) , html5 (mac osx 10.10.4). when change playback rate of video .5x, although audio-video slowed down, audio sounds jittery on firefox (version 39.0.3). problem not pronounced on chrome (version 44.0.2403.130, 64-bit), safari (version 8.0.7) or ie (version 11+). there way can make make audio video sound less noisy when using firefox? <script type="text/javascript"> var videos = ['2.4.mp4', '3.2.mp4', '2.8.mp4'] var rates = [.5, 1, .5] function setupstim(){ stim = document.getelementbyid('movie'); stim.addeventlistener('loadeddata', function() { stim.defaultplaybackrate = rates[trialnum]; stim.playbackrate = rates[trialnum]; stim.play(); settimeout(enablebuttons,stim.duration*1000); }, false); } function stimulus(trialnum, moviename,rate,response, rt) { this.trialnum =

c# - AsyncFileUpload postback causes double upload -

i implemented asyncfileupload control on web page. web page requires uploaded files appear in gridview . gridview contains following columns: " file name ", " confidential " check box, , " remove " button remove uploaded file. since asyncfileupload postback not full page postback, need "force" postback on onclientuploadcomplete event of asyncfileupload control in order render gridview after uploading file. in onclientuploadcompleteevent , use javascript call __dopostback . in postback, bind gridview , display file information (i don’t re-save file). the problem: on asyncfileupload ’s first “partial” postback, file uploaded, expected. on second postback force __dopostback , file re-uploaded. can verify using google chrome, displays upload progress. behaviour follows: - after selecting file, progress increments 0% 100% , file uploaded. - after this, __dopostback executes, , can see upload progress increment again 0% 100%. how

osx - Asynchronous dispatch resource hog in Swift -

i new swift programming language, making guis, , using asynchronous dispatches in general, please forgive question — i'd imagine — has excruciatingly simple answer. what attempting disable , re-enable next button in gui based on whether or not valid settings have been selected. these settings found in 2 checkboxes , text field. my idea have process in background continually checking settings , — if valid — enable next button. code block recent attempt: func checkvalidsettings() { let priority = dispatch_queue_priority_default dispatch_async(dispatch_get_global_queue(priority, 0)) { while true { if self.textfield.stringvalue == "test" { dispatch_async(dispatch_get_main_queue()) { self.nextbutton.enabled = false } } else if (self.checkbox1.state == nsoffstate && self.checkbox2.state == nsoffstate){ dispatch_async(dispatch_get_main_queue()) {

php - checkbox group don't work - codeigniter -

i'm using codeigniter , need work checkbox group. in view: <fieldset> <input type="checkbox" id="country" name="country[]" value="cat" />cats <br /> <input type="checkbox" id="country" name="country[]" value="dog" />dogs<br /> </fieldset> in controller: foreach ($this->input->post('country') $country) { echo $country; }; when i'm check or not check - echo ""; try this <fieldset> <input type="checkbox" id="country" name="country" value="cat" />cats <br /> <input type="checkbox" id="country" name="country" value="dog" />dogs<br /> </fieldset>

When I put value in a Java Preference does it automatically flush? -

i using java.util.prefs.preferences store application settings. here sample code- private static final preferences mpreferences = preferences.userroot().node("lab_exam"); public static void setdefaultpath(java.nio.file.path v) { mpreferences.put(default_path, v.tostring()); flush(); } public static void flush() { try { mpreferences.flush(); } catch (backingstoreexception ex) { logger.getlogger(appsettings.class.getname()).log(level.severe, null, ex); } } i flushing mpreference everytime put new value ensure data saved sucessfully. question is, preference automatically flush everytime put something, or doing correct thing? from javadoc of preferences : all of methods modify preferences data permitted operate asynchronously; may return immediately, , changes propagate persistent backing store implementation-dependent delay. flush method may used synchronously force updates backing store. normal terminatio

angularjs - Login with AngulaJS -

i need implement following feature: whenever comes site, sees login form , if didn't logon correctly, other url should show him login form. how can this? i have project inherited , starting in angular, have no idea change first page show , how block unauthorized users accessing other urls to keep explanation basic possible angular works in main index.html file using "controllers" explain client browser do. somewhere in folder hierarchy should folder named "partials" , "templates" , "views" ,or similar. should contain bunch of small .html files. files swapped using ajax embedded angular. there should html element tag contains attribute "ng-app= "whateveryourappsnameishere" within opening element tag, in between tag "angular." angular seems complex @ first, once keep @ it gets easier. within ng-app attribute powered in js files, , there's free resources out there, including [codeschool] ( htt

linux - Ubuntu - bulk file rename -

i have folder containing sequence of files names bear form filename-white.png . e.g. images arrow-down-white.png arrow-down-right-white.png ... bullets-white.png ... ... video-white.png i want strip out -white bit names filename.png . have played around, dry run -n , linux rename command. however, knowledge of regexes rather limited have been unable find right way this. obliged might able out this. if in directory above images, command is rename "s/-white.png/.png/" images/* if current directory images , run rename "s/-white.png/.png/" ./* instead. dry run, attach -n said: rename -n "s/-white.png/.png/" images/* or rename -n "s/-white.png/.png/" ./*

Dynamic resizing of column width of html tables using css -

Image
note: i'm using rendering engine render html pdf disables javascript default, i'm strictly looking answers using *.css . in report have table used accounting purposes 11 columns: 1st column counter (e.g. 1. , 2. , n. ) can range 3 digits. 2nd column 12 digit reference number. 3rd column address of reference number on previous column, can empty or @ least 50 characters long. 4th last column contains amount/currency/price data minimum value 0.00 , maximum can vary 8 digits comma separated number grouping. now let's table's width needs 1024px (varies depending on requirement provided *.pdf rendering engine). on point, want to: automatically make 1st, 2nd, 4th last column compute width based on content (that makes same reports have different column widths depending on longest column content on time of generation). the 3rd column adjust accordingly remaining width left original 1024px , add ellipsis end of line in case of overflow (important) .

grok - Python - Looping over a string -

how loop word user can input example below in python. enter word: python (user can input word) p py pyt pyth pytho python (then loops word inputted user) there may better ways this, simplest: string = 'python' index in range(1, len(string)): print(string[:index])

c++ - What does it mean the RNG should Pass "Chi-square test"? -

does mean should use http://www.cplusplus.com/reference/random/chi_squared_distribution/ in c++? does mean numbers generated don't have same probability instead probability distributed according chi square function? (one number has larger probability generate vs other number?)

java - Getting a permission denied error when I have permission -

i'm writing excel spreadsheet file (.xls) directory have permission, xlsoutput directory made @ root of project full permission (right click directory>properties>resource?rwx 3 groups (owner, group, other) however i'm getting flowing stack trace: java.io.filenotfoundexception: /xlsoutput (permission denied) @ java.io.fileoutputstream.open(native method) @ java.io.fileoutputstream.<init>(fileoutputstream.java:194) @ java.io.fileoutputstream.<init>(fileoutputstream.java:145) @ jxl.workbook.createworkbook(workbook.java:301) @ jxl.workbook.createworkbook(workbook.java:286) @ com.generalatomics.ctg.taxengine.automation.tools.testhelper.writers.exceltemplatewriter.write(exceltemplatewriter.java:33) @ com.generalatomics.ctg.taxengine.automation.tools.testhelper.testclasses.testxmltoxls(testclasses.java:32) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemetho

sorting - Optimize algorithm: Update a collection by other collection with order C# -

problem: have collection need update other collection. length of them not equal , each item not same structure. both of them have identity field detect same. i write generic algorithm use everywhere complexity o(m*n*3). main problem is: there better optimization algorithm? input must should generic ilist<t> , delegate reusable. current approach: source : data collection used display on gui. target : data collection got remote server. remove old items source doesn't existed target via delegate comparer. add new items target source . reorder source target . scenario usage: if have application display 1~2k row on list view. , have interval timer update list item (about 1 seconds). main point here application should smooth, doesn't flick , keep state of object: selected, change data... etc. here source code: using system; using system.collections.generic; using system.linq; namespace updatecollection { /// <summary> /// person