Posts

Showing posts from March, 2011

split - Splitting data from a data.frame of length 1 by using a delimiter in R -

i imported text file r, , have data frame of length 1. had 152 reviews separated * character in text file. each review paragraph long. how can data frame of length 152, each review being 1 in data frame ? used line import file r : myreviews <- read.table("c:/users/norbert/desktop/research/important files/airline reviews/reviews/air_can_review.txt", header=false,sep="*") ( myreview has length if 1 here.)... need 152, number of reviews inside text file. how can split data data frame "*" delimiter, or import text file correctly putting data frame of length 152 instead of 1. edit : example of data i have 152 of kind of data, separated "*" : i boarded air canada flight ac 7354 washington dca next morning, april 13th. after arriving @ dca, discovered dismay suitcase had checked in @ tel aviv not on flight. spent 5 hours @ pearson trying sort out mess resulting bumped connection. *first time in 40 years fly air canada. l...

Heroku Nginx HTTP 413 entity too large -

i'm getting error 413 when uploading 4mb file. have created .user.ini file on public/ folder. allow 10 mb files so used client_max_body_size on nginx.conf , but still 413. location / { index index.php; try_files $uri $uri/ /index.php?$query_string; client_max_body_size 10m; } that configuration because i'm using laravel 5 . this procfile web: vendor/bin/heroku-php-nginx -c nginx.conf public/ did wrong? perhaps bit late, in order fix this, move client_max_body_size 10m; outside of location section. this: client_max_body_size 10m; location / { index index.php; try_files $uri $uri/ /index.php?$query_string; } see https://github.com/heroku/heroku-buildpack-php/blob/beta/conf/nginx/heroku.conf.php#l35 reference on how heroku includes file.

ios - HealthKit Observer not working while app is in background mode -

i have followed apple docs , several threads on stackoverflow on how achieve background fetching of data health store. far have: added healthkit entitlement appid added required background modes added code appdelegate.swift apple suggest ( the snippet below not following oop facility state way here ) this code (swift): if answer in obj-c , works, please state well, have translate it, that's no problem. appdelegate.swift var healthstore: hkhealthstore? var bpmsamples: [hkquantitysample]? func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { let datatypestowrite = [ ] let datatypestoread = [ hkquantitytype.quantitytypeforidentifier(hkquantitytypeidentifierheartrate), hkquantitytype.quantitytypeforidentifier(hkquantitytypeidentifierbodymassindex), hkcharacteristictype.characteristictypeforidentifier(hkcharacteristictypeidentifierdateofbirth) ] if sel...

oracle11g - Oracle SELECT * FROM LARGE_TABLE - takes minutes to respond -

so have simple table 5 or columns, 1 of clob containing json data. i running select * big_table select * big_table rownum < 2 select * big_table rownum = 1 select * big_table id=x i expect fractionally intelligent relational database return data immediately. not imposing order by/group clauses, why not return data , when find it? of forms of select statements above, 4. returned in sub-second manner. unexpected 1-3 returning between 1 , 10 minutes before query shows responses in sql developer. sql developer has standard sql array fetch size of 50 (jdbc fetch size of 50 rows) @ minimum, taking 1-10 minutes return 50 rows simple table no joins on super high-performance rac cluster backed fancy 4-tiered emc disk subsystem. explain plans show table scan. fine, why should wait 1-10 minutes results rownum in clause? what going on here? ok - found issue. rownum not operate thought did , in code above never stops full table scan. this because: rownum assigne...

sorting - Soritng Ascending and descending order after clicking on table header? -

i using selenium webdriver java . have table have click on header of each column , want validate whether sorting functionality working correctly or not. need check both asc , desc order. so have take count of table first , header text click on each col 1-1 , need validate sorting. how can achieve expected result. below html source code: <div> <table cellspacing="0" rules="all" border="1" id="ctl00_contentplaceholder1_gvclinicaltrait" style="border-color:appworkspace;border-collapse:collapse;"> <tr class="gridtitlebar"> <th scope="col"><a href="javascript:__dopostback('ctl00$contentplaceholder1$gvclinicaltrait','sort$traitdate')">date collected</a></th><th scope="col"><a href="javascript:__dopostback('ctl00$contentplaceholder1$gvclinicaltrait','sort$traitdesc')">cli...

java - How to return from a method with an inner class -

i'm new java , have method i'm trying use wrapper async server call parse.com. want return custom object containing info call, "error: unknown class" i'm trying prevent method returning until done() called. im not sure how java handle kind of thing, i'm used working in objective-c. know how can have return statement not called until set properties in done() ? public serverresponse getrestaurauntprofile(){ parsequery<parseobject> profilequery = parsequery.getquery("restaurant"); profilequery.whereequalto("user", parseuser.getcurrentuser()); profilequery.findinbackground(new findcallback<parseobject>() { final serverresponse mresponse = new serverresponse(); @override public void done(list<parseobject> list, parseexception e) { if (e == null) { mresponse.setreturnobject(list.get(0)); mresponse.setreturnexception(null); } else...

html - How to line up text boxes and balance them out? -

i have 12 text boxes shown below. want line them same number of boxes appear on top , bottom always. example, might 2 rows of 6, or @ screen width might 3 rows of 4 boxes. want spaces in between rows looks better. lastly, should line up, noticed bottom row seems have space in top , bottom rows not aligned perfectly. what best way this? <input name="neighborhood1" type="text" id="neighborhood1"> <input name="neighborhood2" type="text" id="neighborhood2"> <input name="neighborhood3" type="text" id="neighborhood3"> <input name="neighborhood4" type="text" id="neighborhood4"> <input name="neighborhood5" type="text" id="neighborhood5"> <input name="neighborhood6" type="text" id="neighborhood6"> <input name="neighborhood7" type="text" id="neighb...

javascript - Issue setting a td id/name in DataTables 1.10.x -

this relates datatables 1.10.x. i'm using this reference create child rows, , it's easy put html inside of javascript code that's genereated, this: function format ( d ) { return '<div class="slider">'+ '<table id="expandinput" cellpadding="5" cellspacing="0" border="0" style="margin: 0 auto;">'+ '<tr>'+ '<td class="dropheader">cost</td>'+ '<td class="dropinfo"><input required type="text" id="cost" name="cost" value="'+d.cost+'"></input></td>'+ '</tr>'+ '</table>'+ '</div>'; } but affects child child that's generated on-click. have no idea how create id or name using standard datatables ...

linux - Use compgen to get autocomplete for another command, which flag to use? -

i have custom auto-completed command (call commanda ) in commandb want steal autocomplete options first argument commanda so, example options argument1 commanda are: abcdef abcabc abc123 i along lines of compgen -? "commanda" or compgen -? "commanda abc" generate list above. you can use complete -p commanda find out function invoked custom completion command. (you need argument -f option. if there other optiond, becomes more complicated.) you need set standard completion environment variables (whose names start comp_) , call function appropiate arguments. fill in compreply variable; if necessary, add other possibilities. see bash manual details.

ruby - A method of telling if object supports a method -

i trying write file handling code opens file, obtains data file, closes file. my first encountered problem if use the file.open(...) |fd| var = fd.size end method of opening file ensures closed @ end, variables inside limited scope of block. one way solve predefine variables outside of block, doesn't seem right... my other solution use ensure block close handles so: def test(file) return if file == nil || file == "" fd = file.open(file, ...) var = fd.size ensure fd.close end but doing if file handle not exist or not created, perhaps logic before handling errors, ensure block throws nil:nilclass exception. is there clean way handle files allows me pull different stats (including reading of contents) in way can guarantee file closes, , don't have predefine variables escape scope of block? (bonus points if works socket handles well) thanks! you can put conditional on method call fail if fd nil. ensure fd.close if fd end...

android - Creating a timer in a Canvas- multithreading -

this code, when app started saw black screen. wanted app add time counter, think multithreading has problems. timecounter.startcount(); while(pressed!=true){ if (!holder.getsurface().isvalid()) continue; canvas c= holder.lockcanvas(); c.drawbitmap(galaxy, 30, 0, null); c.drawbitmap(player, x-(player.getwidth()/2), y-(player.getheight()/2), null); c.drawtext(timecounter.tostring(), 30, 60, timerpaint); holder.unlockcanvasandpost(c); } } the timers class(im not sure thread ok): public class timecounter { private int smallestseconds=0; private int seconds=0; private int minute=0; public timecounter() { smallestseconds=0; seconds=0; minute=0; } public void startcount() { thread t=new thread(); while(pressed!=true) { try{ t.sleep(10); }catch(interr...

javascript - Leaflet.js map has extra grey space on all sides and lets me drag infinitively -

i using leaflet.js generate map layover information. turned on nowrap option world not repeat. however, there lot of unlimited grey on sides. can drag area infinitely. unfortunately, need have drag functionality around map when zoomed in. has run problem? doesn't seem css has effect on problem. information great! kirie var map = l.map('map').setview([41.9, 12.5], 2); l.tilelayer(tileserverurl, { attribution: tileserverattribution, maxzoom: 16, minzoom: 2, nowrap: true }).addto(map); map.keyboard.disable(); var bounds = map.getbounds(); var southwest = bounds.getsouthwest(); var northeast = bounds.getnortheast(); bounds = l.latlngbounds(southwest,northeast); map.setmaxbounds(bounds); you have use "maxbounds" block dragging bounds : here's sample : https://www.mapbox.com/mapbox.js/example...

sonarqube - Sonar analysis fails with NullPointerException in sonar.log -

we have been using sonar 5.1 under java 1.7.0_76 on unix system month on large multi-project repository (mostly java 7, jsp, js, xml , css files). have noticed sonar runner executions failing in cases. please see error sonarqube log below. info: this happening different files in different projects – .java file, .js file -- seems happen consistently same file on each run. the file seems asking in fact exist in our repository. all projects being analyzed same user, has “see source code” permission (actually, has permission). can tell may causing these failures, , how can prevent them? thanks! on server side (in sonar.log) 2015.05.26 02:58:56 error web[o.s.s.w.webserviceengine] fail process request http://sonar.era.nih.gov/api/sources/hash?key=pracs%3asrc%2fjava%2fgov%2fnih%2fera%2fpracs%2fbeans%2fuploadeddocument.java java.lang.nullpointerexception: null @ com.google.common.io.charstreams.copy(charstreams.java:202) ~[guava-10.0.1.jar:na] ...

delphi - IP address of iOS device -

i need ip address of ios device. gstack.getlocaladdresslist returns addresses including 1 cellular interface. how can address associated wifi interface (en0)? @widi if similar question asked on different language platform, doesn't mean there answer 1 specified - read tags - says " delphi " " firemonkey ". it's asking question in c# , rejoice getting code example in cobol . you'd have implement own ip address enumeration returns adapter info. here's example: uses ipaddresshelper, idstack, idglobal; procedure tform2.button1click(sender: tobject); var localips: tidstacklocaladdresslist; i: integer; begin memo1.lines.clear; tidstack.incusage; try localips := tidstacklocaladdresslist.create; try gstack.getlocaladdresslist(localips); := 0 localips.count - 1 begin if localips[i] tidstacklocaladdressipv4ex memo1.lines.add(tidstacklocaladdressipv4ex(localips[i]).ifaname + localips[i].ipa...

sql server - C# class object error as unassigned local Variable -

i using visual studio 2013 ans ms sql 2012 database in windows form application c#. stuck error unassigned local variable private void picturebox3_click(object sender, eventargs e) { //sqlfunctions obj = null; sqlfunctions obj ; if (txtbox_loginid.text !="" && txtbox_loginpassword.text !="") { if (obj.logincheck(int.parse(txtbox_loginid.text), txtbox_loginpassword.text)== 1) { pnl_logincheck.backcolor = color.darkgreen; lbl_login.forecolor = color.white; lbl_login.text = "user id , password entered correct"; lbl_login.font = new font(lbl_login.font.fontfamily, 22); } when run program got error unassigned local variable . , when initialize sqlfunctions obj = null; i got error unhandled null reference exception @ if (obj.logincheck(int.parse(txtbox_loginid.text), txtbox_loginpassword.text)== 1) any appreciated. try sqlfunctions obj = n...

c# - How to handle reading and writing to the same socket -

i establish connection socket server , start reading , writing data enormously. exception occurs immediately: an exception of type 'system.invalidoperationexception' occurred in mscorlib.dll not handled in user code additional information: stream in use previous operation on stream. how can detect _reader.readlineasync(); is receiving data , should wait writing , vice versa? this class used client sends received data server server. public class tcpclientworker2 { private tcpclient _client; private thread _t; private networkstream _networkstream; private streamwriter _writer; private streamreader _reader; public tcpclientworker2() { var iphostinfo = dns.resolve(dns.gethostname()); var ipaddress = iphostinfo.addresslist[0]; _client = new tcpclient(); _client.connect(ipaddress, 10000); _t = new thread(run); } public async void run() { _networkstream = _client.getstream(); ...

http - POST from Ruby to Meteor with Iron Router? -

i've been trying message ruby script webapp built meteorjs using post, i've been facing issues. there isn't documentation online post , method management iron router. my ruby script: meteoruri = uri('http://localhost:3000/newreport'); res = net::http.post_form(meteoruri, 'message' => 'hellofromruby', 'max' => '50') puts "from meteor:\t#{res}" i don't have experience ruby. above code got online. the routing iron router: router.route('/newreport/:message', {where: 'server'}) .post( function(message){ meteor.call('reportinsert', {message: message}, function(error, recordid){ if (error){ alert(error.reason); } else { console.log("inserted " + recordid); } }); }); i trying make ruby make post http://localhost:3000/newreport with message supposed string. the function reporti...

css - jquery-mobile header two icons on right side next to each other -

having 3 icons in data-type='header' how place 1 on left , other 2 on right of header panel? <div data-role="header" data-theme="a" data-position="fixed"> <center><img src="img/logo.png" style="height: 32px;"></center> <a href="#nav-panel" data-icon="bullets" class="ui-alt-icon" data-iconpos="notext" id="headmenu">menu</a> <a href="#" data-icon="recycle" class="ui-alt-icon" data-iconpos="notext" id="refresh">home</a> <a href="#" data-icon="home" class="ui-alt-icon" data-iconpos="notext" id="homebut">home</a> </div> this place third icon in new row, i got work around, html: <div data-role="header" data-theme="a" data-position="fixed"> <di...

PHP doesn't preform calucation -

i've php form user enters height , weight , once click submit info resubmitted form , calucation bmi should excute , display result. i'm little unsure how code , i've checked errors phpcodechecker.com found none, don't result. i'm unsure if calculation happening @ all. on how calculate bmi off info user enters appreciated. the forumal need use bmi = (weight in pounds * 703) / (height in inches) squared note: there 12 inches foot so, if person weighs 150 pounds , 6 feet tall, calculation bmi = (150 * 703) / 72 x 72 (6 feet = 72 inches, squared) code below: <form method="post" action="<?php echo $_server['php_self']; ?>"> <label for="weight">enter weight in pounds:</label><br> <input id="weight" name="weight" type="text" value="<?php echo $weight; ?>" size="30"><br> <label for="height"...

node.js - Where should I define JS function to call in EJS template -

i working on template trying render template using express , ejs. standard structure of node app, have app.js file which contains functions following: app.locals.getflag = function(country) { var flag_img_name = ""; if (country.tolowercase() == "us") { flag_img_name = "flag_us16x13.gif"; } else if (country.tolowercase() == "ca"){ flag_img_name = "flag_ca16x13.gif"; } return flag_img_name; } i have some_template.ejs file calls function follows: <img src="http://some_url_path/<%=getflag(data_point[0].country_name) %>" width="16" height="14" alt="country" > and works fine. however, have around 15-20 functions , don't want define of them in app.js. there other place can define these functions , call them in template same way doing now? if yes, way define them accessible right now. i new node, express , ejs , not sure of different techniques. if shed light on it...

postgresql - Postegres: Queries with INTERVAL operation don work over constraints -

just in matter of simplification, have following query: select * table (date_trunc('day',create_time ) > now() - interval '2 days'); running explain got this: -> seq scan on table (cost=0.00..1.62 rows=10 width=232) filter: (date_trunc('day'::text, create_time) > (now() - '2 days'::**interval**)) as i've highlighted, operation (now() - interval '2 days') returns interval, need timestamp. in case, how can convert interval timestamp or thing ? thank answers, think not explained, here's detailed problem: for performance purposes, have here table named 'transactions' , child tables each day, example 'transactions_2015_05_29'. on each child table have following constraint: constraint transactions_2015_05_29_create_time_check check (date_trunc('day'::text, create_time) = '2015-05-29 00:00:00'::timestamp without time zone) when run following 'explain...

css - media queries mis-read classes they contain -

trying make webstore responsive. i've made set of media queries , 1 max-width:1200px , 1 max-width:768px . in these media queries have 2 classes. media queries work fine .h5_green_left affect .web_description class main css declaration of class (outside of media query ) replaced 768px media query declaration. to see if media queries working, i've exaggerated font-sizes .web_description class. can see in action here . where there product description in upper left corner h5_green_left followed unordered list .web_description . you can see first class change viewport shrinking second class remains same viewport width s , not class declared in original class description. code below: .h5_green_left { font-family: arial, helvetica, sans-serif; font-size: 15px; font-style: normal; font-weight: 400; font-variant: normal; color: #009900; padding-left: 4px; .web_description { font-family: arial, helvetica, sans-serif; font...

how to edit or see the source code for dll files -

i have dll file old game(age of empires) want edit file or see source code. tried reflector toll , others, without result so, 1- how can edit or see dll file?? 2- can know in language file written? it's sort of difficult. mean can @ file hex editor, it's not going nice. however, can use 3 rd party tools in order info can dll: dependency walker - useful dlls dll depends on (and functions need there), exported functions, ... pe explorer - nice tool (i'm not saying it's best) lists lots of info dll (sections, resources, ...) , has disassembler (this reverse engineers dll , displays in form of assembly code). if understand assembly code can modify (by modifying corresponding bytes in dll), that's experts only most written in c . tools listed can tell more. can hex editor @ dll, inside there might references source files if dll has dependencies in form of msvcr###.dll ( # sign placeholder digit) or vcruntime###.dll it's c , if ha...

python - NoneType object is not iterable error in pandas -

i trying pull data stored proc on sql server using python. here code: import datetime dt import pyodbc import pandas pd conn = pyodbc.connect('trusted_connection=yes', driver = '{sql server native client 11.0}',server = '*****, database = '**') pd.read_sql("exec ******** '20140528'",conn) i error: typeerror: 'nonetype' object not iterable i suspect because have cell in sql table value null not sure if that's true reason why getting error. have run many sql statements using same code without errors. here's traceback: in[39]: pd.read_sql("exec [dbo].[] '20140528'",conn) traceback (most recent call last): file "c:*", line 3032, in run_code exec(code_obj, self.user_global_ns, self.user_ns) file "<ipython-input-39-68fb1c956dd7>", line 1, in <module> pd.read_sql("exec [dbo].[] '20140528'",conn) file "c:*", line 467, in rea...

html - Contact form not displaying on the page -

hey trying create contact page rails app. created contact model: class contact < activerecord::base end a contact controller: class contactscontroller < applicationcontroller skip_after_action :verify_authorized def new @contact = contact.new end def create end end ran migration : class createcontacts < activerecord::migration def change create_table :contacts |t| t.string :email t.string :object t.text :content t.timestamps null: false end end end i created route resources :contacts, only: [:new, :create] and created view: <div class="banner"> <div class="container"> <div class= "col-xs-12"> <%simple_form_for @contact |t|%> <%= t.error_notification %> <%= t.input :email, label: 'votre email' %> <%= t.input :object, label: 'objet' %> <%= t.input :content, label: 'votre message' %> <%= t.b...

python - Euler function not giving results -

we have programmed euler function study population changes. he used while loop keep our values in biological range (no births, etc.). when run script, plot axis range -0.6 +0.6 , no graph drawn. does know wrong code? t=np.zeros((n+1)) in range (n): t[i+1]=t[i]+dt s = np.zeros((n+1)) z = np.zeros((n+1)) r = np.zeros((n+1)) s[0] = n-1 z[0] =1 i=0 while s[i]>0 , s[i] <n , z[i] < n , z[i] > 0 , r[i] >0 , r[i] <n , i<n: s[i+1] = s[i]+dt*(-b*s[i]*z[i]) z[i+1] = z[i]+dt*(b*s[i]*z[i]-a*z[i]) r[i+1] = r[i]+dt*(a*z[i]) i=i+1 self.trace(t,s,r,z,i) def trace(self,t, s, r, z, i): plt.plot(t[:i],s[:i],'b') plt.plot(t[:i],z[:i],'r') plt.plot(t[:i],r[:i],'y') plt.show() i see r initialized as: r = np.zeros((n+1)) then in while loop conditions require r[i] >0 . since i=0 , r[i]=0 , condition false loop not execute. perhaps missing initialization of r[0] = ...

php - "Syntax error or access violation" when inserting dates using PDO and SQL Server -

i trying add 2 simple strings , 1 date sql server using pdo in php. i'm using following code so: $data = array( 'omschrijving' => 'mijn mooie omschrijving...', 'toelichting' => 'mijn leuke toelichting...' ); # insert data $sth = $dbh->prepare("insert memo (datum, omschrijving, toelichting) values (now(), :omschrijving, :toelichting)"); $sth->execute($data); it works without date, reason gives me following error when try add date: sqlstate[42000]: syntax error or access violation: 8180 [freetds][sql server]statement(s) not prepared. (sqlexecute[8180] @ /builddir/build/build/php-5.6.9/ext/pdo_odbc/odbc_stmt.c:254) does know i'm doing wrong? thanks in advance! now() mysql function. getdate() sql-server's equivalent. here's documentation on function, https://msdn.microsoft.com/en-us/library/ms188383.aspx . so provided code should become: $data = array( 'omschrijving'...

html - Can Malicious Code Be Executed From A CSS File? -

i have form allows administrators change basic css attributes on website. thinking of creating form advanced admins display entire css file inside text area , allow them edit freely. im not worried file being wiped can restored. worried add code css file cause major damage web server. possible execute malicious code css file? it can if have access modify. below link describes xss , css (cross site scripting). can redirect background 1 example http://www.acunetix.com/websitesecurity/cross-site-scripting/

windows - Javascript runtime error using IE11 on Win7: Unable to set property 'disabled' of undefined or null reference -

i working on ie11 compatibility issues. code functional in compatibility mode optimize last ie5. the affected code follows: /* * function sets specified button state in repair processing form */ function setoperationbutton(buttonid, disabledstate, sourceimage, stylecursor) { var buttonelement = document.frmrepairprocessing.elements[buttonid]; var sourceroot = '<%=helper.getapplicationurl()%>' + '/zimages/' + '<%=localestring%>' + '/'; buttonelement.disabled = disabledstate; buttonelement.src = sourceroot + sourceimage; buttonelement.style.cursor = stylecursor; } so thinking code needs updated use getelementbyid, not quite sure how implement specific form. please note: have tried document.forms().elements() , using .value well. i believe acceptable use below code obtain buttonelement: function setoperationbutton(buttonid, disabledstate, sourceimage, stylecursor) { var buttonelement = document...

iOS Enterprise Deployment review time? -

i'm planning distribute app in-house , know ios developer distribution on app store takes long time. does ios enterprise program have review process? how long take? will app need reviewed again after each update? the point of in-house distribution distribute outside of app store, apps not on it, , not reviewed apple.

java - What is the correct JBoss EAP 6.0.1 cipher-suite configuration for mitigation of Logjam / weakdh.org? -

because of attention logjam , website https://weakdh.org/ (logjam: how diffie-hellman fails in practice) has received in recent days, decided harden ssl configuration on jboss eap 6.0.1 system described here: 13.2.5. ssl connector reference: https://access.redhat.com/documentation/en-us/jboss_enterprise_application_platform/6/html/administration_and_configuration_guide/ssl_connector_reference1.html cross referenced here: http://www.coderanch.com/t/613062/jboss/configuring-ssl-https-jboss the relevant portion of standalone.xml included in obfuscated form below: <connector name="https" protocol="http/1.1" scheme="https" socket-binding="https" secure="true"> <ssl key-alias="**********" password="**********" certificate-key-file="/var/**********/**********.jks" protocol="tlsv1.2" cipher-suite="tls_ecdhe_rsa_with_aes_128_gc...

Visualising complex code flows in Visual Studio -

i have 1 old code-base consists of c++, vb , classic asp nonsense , trying understand code flows there. unfortunately, there many projects written in different languages best way analyse code found search in folders visual studio across whole code-base , setting bookmarks visualise flow , me navigate faster between them. i happy that, visual studio build-in bookmarks seems have poor functionality, example cannot set more 1 bookmark on same line or cannot create nested folders key thing in understanding extremely complex code flows. upd 1. i rephrased question still consider off-topic: how can visualise complex code flows in visual studio? tried use indentation in bookmark name visualise nested calls doesn't work when have move/merge several code flows (i have 're-calcualte' indents) , still not able have multiple bookmarks want put separate flows same line. i don't think it's possible you're looking directly inside vs. why don't use u...

rust - Cannot borrow as immutable - String and len() -

let mut result = string::with_capacity(1000); result.push_str("things... "); result.push_str("stuff... "); result.truncate((result.len() - 4)); however, compile error. borrow checker , possibly mutability. error[e0502]: cannot borrow `result` immutable because borrowed mutable --> <anon>:7:22 | 7 | result.truncate((result.len() - 4)); | ------ ^^^^^^ - mutable borrow ends here | | | | | immutable borrow occurs here | mutable borrow occurs here yet, if change allowed this: let newlen = result.len() - 4; result.truncate(newlen); why? there way change can written in 1 line? (p.s. on rust 1.0) this unfortunate shortcoming of rust borrow checking procedure. happens because result.truncate(result.len() - 2) is equivalent to string::truncate(&mut result, result.len() - 2) and here can see because arguments computed in left-to-right order, result ...

sql server - [OLE DB Source [963]] Error -

i have created data flow task containing oledb source , oledb destination. oledb source has data access mode of: sql command variable. variable called: sqlquery. design time value of sqlquery is: select '' personno person the ssis package throwing following error: [ole db source [963]] error: "output column "personno" (1051)" failed because truncation occurred, , truncation row disposition on "output column "surname" (1051)" specifies failure on truncation. truncation error occurred on specified object of specified component. i not understand error. however, if following seems work: select '1111111111' personno person can specify length of personno in sql query? instead use null like select null personno person

sql - Select only 3 best ranked after rank() over -

i'd select 3 best results of rank() function each partition for instance, in query : select id, rank() on (partition year order ...) rank table1 group year i'd have 3 best ranked every year. i can manage making new : select * ... rank <= 3 but if have equalities, i'll more 3 row per year. do have idea how solve ? we have not information table , query structures, generic solution i'd suggest add row_number() on (order ... desc) rn , filter where rn = 1 here .

c++ - What is the name of CMake's default build target? -

i have custom target, , want depend on default target (the 1 built make ). add_custom_target(foo ....) add_dependency(foo default_target_name_goes_here) what name of default target? i've tried all , all_build , myprojectsname , default ,... finding in cmake documentation unsuccessful adventure... update: seems cmake designed in such way extremely hard fix/implement: bugreport getting +1's since 2009 . indeed have custom target depends on, example, all target? or in other words: ever write make && make test ?... the default build target not exist cmake target @ cmake configure time. exists in generated build system. therefore not possible have default target depend on custom target.

html - Properly centering multiple variable-width children inside a variable width container -

i have copied simplified version of this code jsfiddle . the code tree diagram written html , css. jsfiddle above looks good. however, after playing around have discovered centering of nodes relative parents works if child same size or bigger parent. i still new css, primary issue seems fact all <li> elements floated left. consider this example , child smaller parent. because parent <li> floated left, child <li> gets floated left well. how can fix this? i think playing display set table , inline-table might help. setting display:inline-table ul elements , display:table anchor tags in combination margin: 0 auto seems work. /*now css*/ * {margin: 0; padding: 0;} .tree ul { padding-top: 20px; position: relative; display: inline-table; transition: 0.5s; -webkit-transition: 0.5s; -moz-transition: 0.5s; } .tree li { float: left; text-align: center; list-style-type: none; position: relative; padding: 20px 5px ...

matlab - Get latitude/longitude on click from an image -

i have image on there 5 points. these 5 points have specific latitude/longitude. want way when user click on of these points corresponding latitude/longitude of point. since points in image , not in map form thinking use radio buttons on points , use switch cases map values of latitude/longitude of each point radio button. right way? or there other way accompalish task. will work you? figure, imshow(pic,[]); title('select 4 points'); hold on; [x,y] = ginput; if not not understand question.

backbone.js - Marionette prevent region destroy -

i using marionette region display templates based on user radio input:(text/file). here itemview var filetemplateview = marionette.itemview.extend({ template : "#file-upload-template" }); and region defined regions : { composeregion : "#compose-region", } and event declared events : { "click #msg-input-type input:radio" : "changedradio" } and event trigger function is changedradio : function(evt) { var self = this; var checkedobject = evt.currenttarget; console.log('radio change event'+checkedobject.value); if (checkedobject.value === "file") { if (self.fileview === undefined) { self.fileview = new filetemplateview(); } this.composeregion.show(self.fileview, { preventdestroy: true }); } else if (checkedobject.value === "text") { ...

c# - Cannot read private key on X509Certificate2 -

win 8.1 64-bit. .net 4.5. powershell 4.0. (though think problem related .net in general , not specific powershell.) i generate self-signed certificate this: new-selfsignedcertificate -dnsname 'theincrediblehulk' -certstorelocation cert:\currentuser\my then retrieve cert: $cert = get-item cert:\currentuser\my\9e5a8322b890da1247bd98bdab288ca9d11cf99e the certificate has private key: $cert.hasprivatekey true or it? $cert.privatekey (null) why privatekey member null? how can retrieve private key? for else happens across this, suspect issue related storage provider used new-selfsignedcertificate (see http://blogs.technet.com/b/vishalagarwal/archive/2010/03/30/verifying-the-private-key-property-for-a-certificate-in-the-store.aspx , talks problem microsoft software key storage provider , .net classes). there's powershell script available on technet creates self-signed certificates, , defaults using different storage provider.

Group by date using proc sql in SAS -

i want sum values same cost centre per each year in sas. tried group function in proc sql. proc sql create table incident_data select cost_centre_dim.cost_centre_name, sum(count*amount) tot, occ_date format= year4. incidents, incident_type, cost_centre_dim incidents.incident_code = incident_type.incident_code , incidents.cost_centre_id = cost_centre_dim.cost_centre_id group cost_centre_dim.cost_centre_name, occ_date order [cost centre dim].[cost centre name]; quit; run; the output looks below: 2012 34.41 acci2 2012 34.23 acci2 2014 25.71 infr1 2014 27.82 infr1 2014 22.26 infr2 2014 20.97 infr2 2013 22.64 acci4 2013 19.29 acci4 2013 18.26 acci4 2014 35.82 acci4 2015 97.81 infr3 2015 44.04 infr3 2014 57.09 infr3 i want output show 1 line 1 type of incident per year add amount. sth th...

generator - generate HTML gallery -

i making gallery in html magnific popup, want have 100 images, html markup have looks this <a href="/img/gallery/mdd-2014/img00001.jpg" title="title"> <img src="/img/gallery/mdd-2014/thmb/img00001.jpg" alt="alt"> </a> ... <a href="/img/gallery/mdd-2014/img00100.jpg" title="Škôlka pod lesom - nová baňa"> <img src="/img/gallery/mdd-2014/thmb/img00100.jpg" alt="Škôlka pod lesom - nová baňa"> </a> how can simplest way in sublime text 3 if need create new a > img , increment href , src 100 times? i found simple solution emmet package sublime text! (a[href="/img/gallery/nase-aktivity/img$$$$$.jpg" title="title"]>img[src="/img/gallery/nase-aktivity/thmb/img$$$$$.jpg" alt="alt"])*100

ios - Is it possible to make two UICollectionView with multiple content in single UICollectionView in Swift? -

Image
is possible make 2 uicollectionview, first uicollectionview assigned trigger , second uicollectionview displaying different content of pictures when user select "desire" there 7 pictures , 10 pictures when user select "nature": of course it's possible. need either set different objects serve data source each collection view, or write view controller serve different information each collection view in data source methods. edit: take @ thread: multiple uicollectionview in 1 controller it doesn't use master/detail approach want, should @ least started.

javascript - Using multiple IIFEs in one script file -

i'm working on script file original author has multiple iifes wrapped in one. descendant iifes written use-cases. example there might 1 search functionality, navbar, etc.: (function($) { (function() { var $search = $(".search"); $search.on("focus", function() { // }); }()); (function() { var $nav = $(".nav"), $navlink = $(".nav__link"); $navlink.on("click", function() { // }); }()); // more iifes }(jquery)); is there benefit in doing this? overall redundant create iifes every action? what developer has done purely stylistic approach. separated different parts of ui initialization functions need execute. further info why developer separated them in way instead of naming method each , executing method within context have ask developer himself.

Does Rust have an equivalent to Python's unichr() function? -

python has unichr() (or chr() in python 3) function takes integer , returns character unicode code point of number. rust have equivalent function? more information unichr() can found here: https://docs.python.org/2/library/functions.html#unichr sure, though built-in operator as : let c: char = 97 char; println!("{}", c); // prints "a" note as operator works u8 numbers, else cause compilation error: let c: char = 97u32 char; // error: `u8` can cast `char`, not `u32` if need string (to emulate python function), use to_string() : let s: string = (97 char).to_string(); there char::from_u32 function: use std::char; let c: option<char> = char::from_u32(97); it returns option<char> because not every number valid unicode code point - valid numbers 0x0000 0xd7ff , 0xe000 0x10ffff. function applicable larger set of values as char , can convert numbers larger 1 byte, providing access whole range of unicode code points. ...

javascript - Yeoman composeWith only calling constructor in subgenerator -

i'm trying use composewith , call subgenerator within same generator package. yet reason, constructor of called generator invoked. my generator-package generator-test looks this: package.json generators -- app -- index.js -- base -- index.js my main generator in app looks this: 'use strict'; var yeoman = require('yeoman-generator'); var yosay = require('yosay'); module.exports = yeoman.generators.base.extend({ constructor: function () { console.log('constructing app'); yeoman.generators.base.apply(this, arguments); }, initializing: function() { console.log('initializing app'); var done = this.async(); this.composewith('test:base',{ options: { } }) .on('end', function() { done(); }); } }); my subgenerator in base : 'use strict'; var yeoman = require('yeoman-generator'); module.exports = yeoman...