Posts

Showing posts from June, 2014

tsql - T-SQL: query xml with namespace -

Image
i've done basic xml work in t-sql before, literally 'basic'. now come across more complex xml , flummoxed begin. <?xml version="1.0" encoding="utf-8"?> <calculation:scenario xmlns:calculation="http://www.sap.com/ndb/bimodelcalculation.ecore" schemaversion="2.3" id="adr2" applyprivilegetype="analytic_privilege" checkanalyticprivileges="true" defaultclient="$$client$$" defaultlanguage="$$language$$" visibility="internal" calculationscenariotype="tree_based" datacategory="dimension" enforcesqlexecution="false" executionsemantic="undefined" outputviewtype="projection"> <origin/> <descriptions defaultdescription="adr2"/> <metadata activatedat="2015-04-22 16:13:29.0" changedat="2015-04-22 21:12:59.193"/> <localvariables/> <variablemappings/> <datasour

How to add a specific sidebar to meteor route? -

for example have admin area , want display specific sidebar admin navigation <body> {{#if adminroute}} {{> sidebaradminnav }} {{> yeld }} {{else}} {{> yeld }} {{/if} </body> i guess looking called nested views. this answer gives best option have used far. no "angular ui-router" ideal, job. in layout: {{#if layout.rendersidebar}} {{> sidebaradminnav }} {{/if}} {{> yield }} and in each (sadly) of admin routes: data: function() { return { layout: {rendersidebar: true}, ... }; }

asp.net mvc - how to call a helper method on a button click inside a view in mvc -

i m using third party custom helper opens report. have wrapped inside helper method in view below @helper openreport(string reportname) { @html.mvcreportviewer("/foldername/"+reportname, new { height = 900, width = 900, style = "border: none" }) } i need call helper method on button or anchor click. how can possibly that? i m trying not seem work <a href="#" onclick="@openreport("reportname");return false;" >my report</a> any ideas? thanks

vb.net - Size argument exception -

Image
i experiencing first chance excpetion: i baffled going on here. see in inspector, height 732 , width 1114. looks absolutely fine me. does have idea why error might occur? _companylogo.size gets or sets width , height of control. doesn't contain size of control probably you're looking for dim nsize1 size nsize1.width = _companylogo.width nsize1.height = _companylogo.height

git - How to do "go get" on a specific tag of a github repository -

i trying compile influxdb database (version v0.8.8) using go github.com/influxdb/influxdb but pulls master branch, , need v0.8.8 tag. i have tried do: go github.com/influxdb/influxdb/releases/tag/v0.8.8 fails saying unable find. i tried regular go get of master branch, , manually checking out tag using git in gopath/src/github... in order set corret version. the problem using last approach when try pull dependencies go -u -f ./... tries find them in master branch, , of them not exist on master branch... tl;dr : perform go get on specific github tag, , pull correct dependencies. it not possible using go get tool. instead need use third party go package management tool or create own forks packages wish manage more fine grained. spoke guy works @ google , acknowledged problem/requirement, said vendoring team used bulky , solve official tools soon. read more: reference of third party package management tools blog post golang team discussing approach

java - How to get the code and state from the callback URL of oauth in linkedin authetication -

Image
i trying access linkedin api servlet, using oauth service.i able login application linkedin account.like posting screen shot. this working fine .but problem not able value call url.i.e protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { /*string callbackurl = request.getrequesturl().tostring(); httpsession mysession = request.getsession(); */ string authurl = "https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=787mznyz5nn2nl&redirect_uri=http%3a%2f%2flocalhost:8080%2fconnectsocialmedia%2f&state=dceefwf45a53sdfkef424"; //system.out.println("1st url: "+authurl); response.sendredirect(authurl); string query = request.getquerystring(); system.out.println("query -->"+query); can me code , state after allow access button?? the oauth dance works following: user attempts authentication site/app y

bash - How to copy multiple using shell script -

i beginner in shell script trying copy multiple files. want manually give input how change code echo "please enter file name" read b cp -l ~/downloads/"{$b,$b,$b,$b,$b}" ~/myproj/image not sure of mean "i want manually give input how change code." try : echo "please enter file name" read b in $b cp -l ~/downloads/$i ~/myproj/image done

Excel Make conditional formmating appear as a list in a cell -

Image
i have dataset , have 2 extreme numbers use conditonal formatting work out if numbers in data set dont fit criteria, in formula use below. =or(b3<$e$8,b3>$e$7) im wondering way of making list of cells dont fit criteria appear list, in cell. for example, if had list of 1,2,3,4,5,6,7,8,9 , 2 numbers 3 , 7 fromula gerneate output: 1,2,8,9 enter following u ser d efined f unction in standard module: public function makealist(rng range, u long, l long) string dim r range, s string each r in rng if r.value < l or r.value > u s = s & "," & r.value end if next r makealist = mid(s, 2) end function and use range of values: note: the first argument range of values. the second argument upper limit. the third argument lower limit. user defined functions (udfs) easy install , use: alt-f11 brings vbe window alt-i alt-m opens fresh module paste stuff in , close vbe window if save workbook, udf saved it. if us

rhel - Issue regarding Perl @INC path upgrade at build time -

i trying migrate perl 5.8.8 perl 5.10.1. (basically rhel 5 rhel 6.6 ) per install documentation provided perl, @ time of configuring perl can use "-dotherlibdirs" add additional directories in inc path variable. @ time of building perl 5.10.1, using option includes directories used in perl 5.8.8. for example actual perl 5.10.1 inc list: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . expected perl 5.10.1 inc list: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 **/usr/lib/perl5/site_perl/5.8.8** . so configuration option be -dotherlibdirs="/usr/lib/perl5/site_perl/5.8.8". having option in configuration, build completes but, after installing rpm (created after build) , checking output of "perl -v", added path not visible in inc variable "-dotherlibdirs=&qu

asp.net - Background image issues in a HTML5 emitted by MVC4 application -

i working on mvc4 application , trying put background image url element laying on masterpage file ' _layout.cshtml ' failed, not able see background image @ .my image located in images-> master -> test.bmp i put backgroundimage shown below <body> <header style="background-image:url(../images/master/test.bmp);position: relative; top: -20px;width:100% "> </header> </bpdy> can body suggest me went wrong here? is there syntax issue? or background image not working in mvc4 html5 @ update i created html page , copied contents , in design view can see image.now wonder going wrong on there update i set height , coming ,but issue is not coming in iis,when run in visual studio development server working fine.what reason guess? finally found solution @url.content(~path image) fix kinds of issues

ios - How to update FBRequest.requestForMe() on facebooksdk v4.0.1? -

so, made application on iphone. i'm using login facebook , upgrade facebooksdk lastest version. of code happen have error. below mycode: let request = fbrequest.requestforme() request.startwithcompletionhandler({ (connection, result, error) -> void in if error == nil { if let userdata = result as? nsdictionary { let facebookid = userdata["id"] as! string self.user.name = userdata["name"]as! string // self._fbuser.location = userdata["location"]["name"] string self.user.gender = userdata["gender"] as! string self.user.imgurl = nsurl(string: nsstring(format: "https://graph.facebook.com/%@/picture?type=large&return_ssl_resources=1", facebookid) string) self.user.isfacebookuser = true } } else { if let userinfo = error.userinfo {

php - How to validate user must choose at least one value radio button in CakePHP? -

i have code in view file radio button (cakephp) : echo $this->form->input('publish_flg', array( 'type' => 'radio', 'div' => false, 'label' => false, 'fieldset' => false, 'legend' => false, 'hiddenfield' => false, 'required' => false, 'separator'=> '</div><div class="radio-inline">', 'before' => '<div class="radio-inline">', 'after' => '</div>', 'options' => array(1 => 'yes', 0=> 'no'), 'error' => array( 'attributes' => array('wrap' => 'div', 'class' => 'alert alert-danger', 'escap

activity manager - How to kill background running apps in Android ? -

i want develop task-killer . task of app kill background running applications . have searched lot in internet , found following code kill installed application . list<applicationinfo> packages; packagemanager pm; pm = getpackagemanager(); //get list of installed apps. packages = pm.getinstalledapplications(0); activitymanager mactivitymanager = (activitymanager)context.getsystemservice(context.activity_service); (applicationinfo packageinfo : packages) { if((packageinfo.flags & applicationinfo.flag_system)==1)continue; if(packageinfo.packagename.equals("mypackage")) continue; mactivitymanager.killbackgroundprocesses(packageinfo.packagename); } but code kills installed applications . want kill apps running in background .i not want kill apps without android os shutdown . can me in purpose ?

python - How does the stats.gaussian_kde method calcute the pdf? -

i using scipy.stats.gaussian_kde method scipy generate random samples data. it works fine! have found out method has inbuilt functions calculate probability density function of given set of points (my data). i know how calculates pdf provided set of points. here small example: import numpy np import scipy.stats scipy import stats def getdistribution1(data): kernel = stats.gaussian_kde(data,bw_method=0.06) class rv(stats.rv_continuous): def _rvs(self, *x, **y): return kernel.resample(int(self._size)) #random variates def _cdf(self, x): return kernel.integrate_box_1d(0,max(x)) #integrate pdf between 2 bounds (-inf x here!) def _pdf(self, x): return kernel.evaluate(x) #evaluate estimated pdf on provided set of points return rv(name='kdedist') test_data = np.random.random(100) # random test data distribution_data = getdistribution1(test_data) pdf_data = distribution_data.pdf(test_data) # pdf o

java - Https PUT request with user name and password which send the JSON file as a payload -

i new java. have url, username, password. need make put http request using url, username , password. have send json file payload using http put request system can accept json. i have searched in stackoverflow , found few suggestions can make simple request url without user name , password. our url need authenticated make request. code have used make http request public static void main (string args[]) throws ioexception { string userpassword = ""; string encoding = new string(base64.encodebase64(userpassword.getbytes())); url url = new url(url); httpurlconnection httpcon = (httpurlconnection) url.openconnection(); httpcon.setdooutput(true); httpcon.setrequestmethod("put"); httpcon.setrequestproperty("authorization", "basic "+encoding); outputstreamwriter out = new outputstreamwriter(httpcon.getoutputstream()); out.write("resource content"); out.close(); httpcon.getinputstream(); } use volley li

c++ - How to block the HTTP request to a particular IP in libcurl? -

i'm using libcurl( http://curl.haxx.se/libcurl/ ) fire http request. want block request particular ip address once fqdn resolved ip address. how , can block request particular ip address? libcurl has no block-this-ip-functionality built-in. provide building blocks build own! use curlopt_opensocketfunction , have callback address check, , return failure if "bad" address used , otherwise call normal socket() function.

performance - call to condition on for loop (c++) -

here simple question have been wondering long time : when loop such 1 : for (int = 0; < myvector.size() ; ++i) { // loop } as condition i < myvector.size() checked each time, should store size of array inside variable before loop prevent call size() each iteration ? or compiler smart enough ? mysize = myvector.size(); (int = 0; < mysize ; ++i) { // loop } and extend question more complex condition such i < myvector.front()/myvector.size() edit : don't use myvector inside loop, juste here give ending condition. , more complex condition ? the answer depends on contents of loop–it may modify vector during processing, modifying size. however if vector scanned can safely store size in advance: for (int = 0, mysize = myvector.size(); < mysize ; ++i) { // loop } although in classes functions 'get current size' inline getters: class xxx { public: int size() const { return msize; } .... private: int msize;

xamarin - FluentLayout and control Min/Max Height -

Image
is there way define min/max height of ui element fluentlayout? my situation this: black uiview must atleast 50px high. if of it's child controls (red uiview or bigtextuilabel) exceedes 50px - must stretch accomodate content. if define constraints: blackview.above(table), blackview.height().greaterthanorequalto(50), blackview.height().greaterthanorequalto().heightof(redview) blackview stretch on whole screen (if table empty). on other hand if change constraints: blackview.above(table), blackview.height().greaterthanorequalto(50), blackview.height().equalto().heightof(redview) redview stretched height of red wiew (in example) equal height of black view. first , second uilabels wont in center of black uiview. i couldn't find examples on priority or fullheightof. tell truth don't know how works.

c - Freeing int pointer to pointer array works fine alone, but crashes in main program -

this code snippet works fine on own , once integrate complete main() function, issues free(0 ing, failing @ first iteration, failing @ random , when try free int pointer pointer. int main() { int** gprilistedcoords = calloc(sizeof(int*), gprimaxval); int i; for(i = 0; < gprimaxval; i++) gprilistedcoords[i] = calloc(sizeof(int) , 2); for( = 0; < gprimaxval; i++ ) free(gprilistedcoords[i]); free(gprilistedcoords); return 0; } i create / free char pointers ( pointers ) in same way no issues. i tried catching null pointers, i'm not getting any. gdb stack info: http://i.snag.gy/z3zqv.jpg this code sample looks fine. think problem in other case, do allocated pointers. per man page of free() (emphasis mine) void free(void *ptr); the free() function frees memory space pointed ptr , which must have been returned previous call malloc() , calloc() or realloc() . otherwise, or if free(ptr) has been called bef

html - Why isn't my accessibility tool of enlarging text size working? -

i'm adding accessibility tool of users being able increase font-size of text on page, , being able go default font-size if wanted to. have made second css file holds css rules text increase. when click on icons made text larger/text smaller not work. can understand why? help. html code on home page: <div id="font-size-buttons"> <a href="#" onclick="changecss('notaccessible.css', 2);"><img src="http://www.me14ch.leedsnewmedia.net/slate/images2/fontmin.png" width="25" height"25" alt="switch original text size , colours"></a> <a href="#" onclick="changecss('stylesheet.css', 2);"><img src="http://www.me14ch.leedsnewmedia.net/slate/images2/fontmax.png" width="30" height="30" alt="switch larger text , improved colour contrast"></a> </div> some of default css stylesheet code: .bo

ios - Disable custom app settings -

i have app i'd open settings.app user can enable wi-fi or mobile data, when use uiapplication.sharedapplication().openurl(nsurl(string: uiapplicationopensettingsurlstring)!) i redirected custom settings, have option notifications , 1 use mobile data . is there way either disable these custom settings, or show main settings view, or another way redirect user wi-fi settings? no apple, allows open settings app on app settings selected. as apps settings want disable, not possible since these defaults settings each app.

sql - How to sort by varchar field containing a date in ascending order -

in design time have given [dojingovrservice] field varchar datatype. when trying order parameter( dojingovrservice ) in ascending order not giving desired result. know datatype problem can't change datatype data entered. select ed.class, ed.currentofficeplace, ed.dob, ed.dojincurrentoff, ed.dojingovrservice, ed.dojinsamvarg, ed.empname, ed.homeplace, ed.qualification tbl_emplyeesbiodata ed order dojingovrservice asc date entered in format dd-mm-yyyy (i.e. 28-08-2004). please me this 1 of many reasons why should always use appropriate data types. when have data in table, can change data type using alter table ddl statement: alter table tablename alter column columnname datetime2; however, should copy table first , try alter on copy, if messes data not risk anything. if alter successful on live table. if not, can go different approach, involving these stages: rename dojingovrservice column d

ruby on rails - How to check object structure in controller -

i working on ruby application created controller accepts object/array parameter , process generate output not getting output in proper required format, object/array seems when passed controller there must issues blocking proper output not getting how debug it. def duplicate @job in @pipeline.jobs @job.save end end it tried print object structure getting error. thought use javascript console.log dont know how implement inside controller. is there way check object/array structure or see output on screen.

c# - Log4Net error : “Failed to find configuration section log4net” AdoNetAppender -

i made new project testing. trying use log4net write db. getting error.i think in config missing. log4net:error failed find configuration section 'log4net' in application's .config file. check .config file <log4net> , <configsections> elements. configuration section should like: <section name="log4net" type="log4net.config.log4netconfigurationsectionhandler,log4net" /> assemblyinfo.cs [assembly: log4net.config.xmlconfigurator(configfile = "logging.config", watch = true)] logging.config <!--this root of config file--> <configuration> <!-- level 0 --> <!--this specifies section name is--> <configsections> <!-- level 1 --> <section name="log4net" type="log4net.config.log4netconfigurationsectionhandler, log4net"/> <!-- level 2 --> </configsections> <log4net> <!-- level 1 --> <appender name=&

android - Out of memory exception on inflating layouts -

i getting random out of memory exceptions in app caused inflate exceptions. i have 7 fragment (difficulty) activities launch own activities via buttons. each fragment has scroll view 30 buttons (levels). have set can swipe across each fragment , fragment takes entire screen. occasionally when swipe few times , select random button group of 30 crash. tries load activity , gives out of memory exception inflate exception on random line. line falls on imageview or imagebutton in xml file. activities load grid of imageviews , imagebuttons. i not exception want fix. have looked @ many other out of memory exception questions although none have helped me. have done memory analyser test , shows nothing out of ordinary. i believe imageviews , imagebuttons using memory, although ever have 1 activity open @ once. it because of images loading. when load image , move around page , view image heap increases. continue process of viewing random images heap grows more until app cras

asp.net mvc - Routing static assets -

i have folder structure organize assets serve don't want reflected in urls have. example, have assets css bootstrap less_generated general js bootstrap coffee_script_generated typescript_generated general the folder structure concern me, developer, not resource address. /assets/filename.css filename.css in of listed folders may contain css files, , serve first 1 found. , equivalent .js files. i can't find way route in mvc. routes route controller, , i'd route file resource instead, , writing controller serve static resources seems wrong, behaviour surrounding cache control headers have manually. how can accomplish this?

ios - Custom one annotation on MKMapView -

i fill map mkplacemark , specific address, these mark correspond meeting. i'm trying custom 1 placemark corresponds next meeting. here code: // function add pin corresponding meeting. - (void) addallpins { _mymap.delegate = self; // key of meeting nsarray* allkey = [[vsdataprovider sharedmanager].startevents allkeys]; (nsdate *date in allkey) { (ffevent *event in [[vsdataprovider sharedmanager].startevents objectforkey:date]) { // retrieve clgeocoder latitude , longitude address of event nsstring *localisation = [nsstring stringwithformat:@"%@ %@ %@ %@",event.street,event.zipcode,event.city,event.country]; clgeocoder *geocoder = [[clgeocoder alloc] init]; [geocoder geocodeaddressstring:localisation completionhandler:^(nsarray *placemarks, nserror *error) { if (placemarks && placemarks.count > 0) { clplacemark *topresult = [placemarks objecta

javascript - Getting error on applying transition in d3 -

i trying apply transition effect on bar graph designed in d3. here code- svg.selectall(".bar") .data(data) .enter().append("g") .attr("class", "bar") .append("rect") .attr("rx", barradius) .attr("fill","333" ) // .attr("color_value", "steelblue") .attr("index_value", function(d, i) { return "index-" + d[columns[0]].replace(/[^a-za-z0-9]/g, '', 'gi'); }) .attr("class", function(d, i) { return "bars-bubble-index-" + d[columns[0]].replace(/[^a-za-z0-9]/g, '', 'gi')+div; }) .attr("id", function(d) { return d[columns[0]] + ":" + d[measure1]; }) .attr("onclick", fun)

ios - How can we create slider menu with submenu in swift? -

Image
i working on swift , trying create slider menu, in advance want show submenu menus, trying keep things simple, right done slider menu using tablview show menus facing difficulty create submenu, there more clean way solve problem? you trying create multilevel tableview. simple solution dynamically update number of rows when cell tapped. you need create array of n+1 rows each section: - (section 1), row 1 -- (section 1), row 2 -- (section 1), row 3 - (section 2), row 1 -- (section 2), row 2 -- (section 2), row 3 first row of each section represents top level rows (send money, status checker, etc) , others represent sub-section (personal information, etc). need implement uitableviewdatasource methods display first row of each section. create property contain optional nsindexpath represents selected section . in datasource methods check if there's value in property , return rows correspond appropriate section.

php - Form Values not getting submitted -

Image
i have following php code <form action="admin.php" method="post"> <?php $conn=mysqli_connect("localhost","root","vravi","mrconnect"); if(!$conn) { echo "error establishing connection"; } $sql="select userid,useremail users order userid"; $result=mysqli_query($conn,$sql); if(mysqli_num_rows($result)>0) { while($row=mysqli_fetch_assoc($result)) { echo $row["userid"]; echo $row["useremail"]." ".'<input type=\"text\" name=\"name[]\"/>'."</br>"; } echo '<button type=\"submit\" name=\"submit\" value=\"submit\">'.submit.'</button></br>'; } ?> </form> which gives following output in browser. now have 2 questions. 1)when try insert v

python - celery: get function name by task id? -

i using celery on_failure handler logging failed tasks debugging , analysis. , want know task name(function name) of failed task, how can that? from celery import task class debugtask(task): abstract = true def after_return(self, *args, **kwargs): print('task returned: {0!r}'.format(self.request)) def on_failure(self, exc, task_id, args, kwargs, einfo): func_name = get_func_name_by_task_id(task_id) # how do this? print "{} failed".format(func_name) # expected out: add failed. @app.task(base=debugtask) def add(x, y): return x + y ps: know there task_id , query function name task_id every time not fun, quick @ documentation shows task.name .

hash - Mongoid + Rails + embeds not working -

i have 2 classes in application, paperfield , paper. paper has hash string paperfield named "item_values". when try save paper has paperfield in hash, error returned: nomethoderror: undefined method `bson_type' #<paperfield:0x000000066def10> these classes: class paperfield include mongoid::document field :value, type: string end class paper include mongoid::document field :item_values, type: hash, default: hash.new # hash (string , paperfield) end i used belongs_to didn't work. ideas?

html - Border bottom issue with Chrome -

i using image border bottom only. works fine in ff not in chrome. in chrome taking effect 4 directions ie top left bottom right my code is .aboutbg .menu-box-content-wrapper { border-bottom-width: 5px; -webkit-border-image:url(../images/about-text-bg-box.png) 6 repeat; -moz-border-image:url(../images/about-text-bg-box.png) 6 repeat; border-image:url(../images/about-text-bg-box.png) 6 repeat; border-bottom-style: solid; } in firefox, can see border bottom image in chrome can see border image in directions. any highly appreciated. in advance. you have use border-width: 0 0 5px; instead of border-bottom-width: 5px; . check fiddle here.

javascript - Validate the date in html drop-down list -

i have 3 html drop down lists select year, month , date. if selected year equal current year second , third lists show month , date current date. want code in javascript. here problem facing is, when user select date or month @ first how execute? example below. if month , day selected first, not change unless selected value no longer valid. if not valid, reset 1. html <body> <select name="month" id="month"></select> <select name="day" id="day"></select> <select name="year" id="year"></select> </body> javascript (w/jquery) <script type ="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> <script type="text/javascript"> $( document ).ready(function() { var year = new date().getfullyear(); // load years (var i=2000; i<=year; i++) $("#year").append('<option

asp.net - HTTP Error 404.2 - Not Found while downloading .DLL files from web server -

Image
i have deployed asp.net applications in iis 7.5 under application pool classic .net apppool . now, 1 of application has functionality download .dll files server client machine . so, added extension .dll(application/x-msdownload) mime types , checked requestfiltering whether denies .dll extension. but, throws error while downloading .dll file browser. what settings made in iis download .dll files through web server?

d3.js - d3 js dynamically added child nodes are not working properly -

i trying add nodes dynamically when click node doesnot show child nodes when click next node child nodes of previous node shown.what might problem for example :click on us-east-1a not show childs when click on us-east-1b show child nodes of us-east-1a. ==========html <!doctype html> <html> <head> <meta charset="utf-8"> <style> .node { cursor: pointer; } .node circle { fill: gold; stroke: steelblue; stroke-width: 1.5px; } .node text { font: 10px sans-serif; } .link { fill: none; stroke: #ccc; stroke-width: 1.5px; } </style> <script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script> </head> <body> <script type="text/javascript"> var margin = {top: 20, right: 120, bottom: 20, left: 120}, width = 960 - margin.right - margin.left, height = 800 - margin.top - margin.bottom; var = 0, duration = 750, root; var tree = d

geospatial - ElasticSearch QuadPrefixTree vs GeohashPrefixTree -

i new elasticsearch , want understand difference between using geohashes , quadtree. in reference written: geohashprefixtree - uses geohashes grid squares. geohashes base32 encoded strings of bits of latitude , longitude interleaved. longer hash, more precise is. each character added geohash represents tree level , adds 5 bits of precision geohash. geohash represents rectangular area , has 32 sub rectangles. maximum amount of levels in elasticsearch 24. quadprefixtree - uses quadtree grid squares. similar geohash, quad trees interleave bits of latitude , longitude resulting hash bit set. tree level in quad tree represents 2 bits in bit set, 1 each coordinate. maximum amount of levels quad trees in elasticsearch 50. i don't difference, example if take point: latitude / longitude = 42.9123456, 21.799986 geohash srxs05fq8 . can explain how can calculate quadtree representation? moreover, when better prefer 1 on other? quadtrees more predictable in each level s

R Team Roster Optimization w/ lpSolve -

i new r , have particular fantasy sports team optimization problem solve. have seen other posts use lpsolve similar problems can not seem wrap head around code. example data table below. every player on team, plays particular role, has salary, , has avg points produced per game. constraints need need 8 players. no more 3 players may come 1 team. there must @ least 1 player each role (of 5). , cumulative salary must not exceed $10,000. team player role avgpts salary bears t 22 930 bears b m 19 900 bears c b 30 1300 bears d j 25 970 bears e s 20 910 jets f t 21 920 jets g m 26 980 [...] in r, write in following > obj = df$avgpts > con = rbind(t(model.matrix(~ role + 0, df)), rep(1,nrow(df)), df$salary) > dir = c(">=",">=",">=",">=",&qu

Programmatically create a web site in IIS using C# and set port number -

we have been able create web site. did using information in link: https://msdn.microsoft.com/en-us/library/ms525598.aspx however, use port number other port 80. how this? we using iis 6 if you're using iis 7, there new managed api called microsoft.web.administration an example above blog post: servermanager iismanager = new servermanager(); iismanager.sites.add("newsite", "http", "*:8080:", "d:\\mysite"); iismanager.commitchanges(); if you're using iis 6 , want this, it's more complex unfortunately. you have create web service on every server, web service handles creation of website because direct user impersonation on network won't work (if recall correctly). you have use interop services , similar (this example uses 2 objects, server , site, instances of custom classes store server's , site's configuration): string metabasepath = "iis://" + server.computername + "/w3svc"

verilog - Seven Segment Display -

i'm having problems coding 7 seg display in verilog. want increment 1 digit 1 , have roll on 0 after 9. have done lots of debugging , looked @ examples can't seem find problem. code: module counter(output sega, segb, segc, segd, sege, segf, segg); osch #("2.08") osc_int ( //"2.03" specifies operating frequency, 2.03 mhz. other clock frequencies can found in machx02's documentation .stdby(1'b0), //specifies active state .osc(clk), //outputs clock signal 'clk' net .sedstdby()); reg [21:0] cnt; wire clk_slow = cnt[21]; //clock @ 1 hz reg [3:0] bcd; //represents states of counter @(posedge clk) begin begin cnt <= cnt+1; end begin if(clk_slow) bcd <= (bcd ==4'h9 ? 4'h0 : bcd+4'b0001); //increments state 1 end end reg [6:0] seg; @(*) begin case(bcd) //gfedcba

audio - getDuration() gives 0 output for one file in Android App -

my app loads 2 audio files database , stores them in array. user can play of them selecting 1 radio button group. both mp3. 1 playing fine , it's elapsed , total duration displaying correctly. same functions display 00:00 total duration other. seek bar updates progress 100% in case elapsed time correctly displaying , audio playing fine. please tell problem? why happening.. , how can resolve it?? audio_urdu 's time fine.. error audio_eng . private void updateview(int i) throws jsonexception { idx=0; _imgbtnplay.setclickable(false); _imgbtnstop.setclickable(false); jsonobject jobject=null; jobject=jarray.getjsonobject(i); audiourl_eng=jobject.getstring("audio_eng"); audiourl_urdu=jobject.getstring("audio_urdu"); lbl_tduration.settext("00:00"); lbl_cduration.settext("00:00"); lbl_loading.settext("loading audio files..."); loadaudio(audiourl_eng); } // loading audio files u

ios - Automatically set UIView vertical size based on device vertical size (including Auto Layout changes) -

i've been googling on , can't seem pinpoint answer question have. i'm writing app , vertical space of child uiview maintain height of device or rotation of parent device regardless of orientation , without hardcoding values ahead of time. the structure of layout is: viewcontainer uiview uiscrollview uiview (content view) specifically, have vertical space of content view set native height of device/orientation running on, , when device rotates, vertical space change new vertical height. uiscrollview used pan horizontally only. i using quartz draw in view. set initial height via intrinsiccontentsize ? if how query parent view? i've tried using self.superview within content view doesn't work. how detect change has occurred, , after occurs, how new y resolution , apply it? not want disable auto layout if don't have to. here visual of want if haven't made clear: https://www.evernote.com/l/aai3vfkkbarplypsourjowamiigielf5p-w

javascript - How to get jQuery chat to respond to me -

i trying build front end chat feature on mobile app. have been following youtube series on how it, @ video 14 gentleman went in different direction wanted. want first person type, , have "bot" respond me (in predetermined string). unfortunately how has , bot asks name, respond, , bot says nice meet (name) my question using code i'll provide, how can "bot" respond me after type first? $(function(){ $("#chatsend").click(function(){ var username = "<span class = 'chatusername' =>cnn_news: </span>"; var newmessage = $("#chattextbox").val(); $("#chattextbox").val(""); var prevstate = $("#chatcontainer").html(); if (prevstate.length > 7){ prevstate = prevstate + "<br>"; } $("#chatcontainer").html(prevstate + username + newmessage); $("#chatcontainer").scrolltop($("#chatcontainer").pro

java - How can I read a String array index from a JComboBox into a JLabel? -

i have combobox holding string[]'s values. have several other string[]'s holding numbers. want user able select item combobox(holding string[] names) , according 1 pick, want index associated 1 of other arrays printed out in jlabel display. here's have far: import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*; public class newbuild extends jframe { private static final int width = 900; private static final int height = 350; //create array constants private static final string[] warrior = {"7","6","6","5","15","11","5","5","5"}; private static final string[] knight = {"12","6","7","4","11","8","9","3","6"}; private static final string[] swordsman = {"4","8","4","6","9","16","6","7&

java - Trouble writing 's into a .txt file, using FileOutputStream -

the problem when read string , then, try write each characters in separate line, .txt file, although system.out.println show correct characters, when write them .txt file, 's write weird characters instead. illustrate, here example: suppose have line second subject’s layout of same 100 pages. , want write .txt file, using following code: public static void write(string swrite) throws ioexception { if(!file.exists()){ file.createnewfile(); } fileoutputstream fop=new fileoutputstream(file,true); if(swrite!=null) for(final string s : swrite.split(" ")){ fop.write(s.tolowercase().getbytes()); fop.write(system.getproperty("line.separator").getbytes()); } fop.flush(); fop.close(); } the written file word, subject's : subject’s . have no idea why happens. try following. frees having deal character encoding. printwriter pw = null; try { pw = new printwriter(file); if (swrite!=null)

matlab - How to do bitwise operation decently? -

i'm doing analysis on binary data. suppose have 2 uint8 data values: a = uint8(0xab); b = uint8(0xcd); i want take lower 2 bits a , , whole content b , make 10 bit value. in c-style, should like: (a[2:1] << 8) | b i tried bitget : bitget(a,2:-1:1) but gave me separate [1, 1] logical type values, not scalar, , cannot used in bitshift operation later. my current solution is: make a|b ( a or b ): temp1 = bitor(bitshift(uint16(a), 8), uint16(b)); left shift 6 bits rid of higher 6 bits a : temp2 = bitshift(temp1, 6); right shift 6 bits rid of lower zeros previous result: temp3 = bitshift(temp2, -6); putting these on 1 line: result = bitshift(bitshift(bitor(bitshift(uint16(a), 8), uint16(b)), 6), -6); this doesn't seem efficient, right? want (a[2:1] << 8) | b , , takes long expression value. please let me know if there's well-known solution problem. that or equivalent addition when dealing integers result = bitshif