Posts

Showing posts from June, 2015

data.table in R - multiple filters using multiple keys - binary search -

i don't understand how can filter based on multiple keys in data.table . take built-in mtcars dataset. dt <- data.table(mtcars) setkey(dt, am, gear, carb) following vignette , know if want have filtering corresponds am == 1 & gear == 4 & carb == 4 , can say > dt[.(1, 4, 4)] mpg cyl disp hp drat wt qsec vs gear carb 1: 21 6 160 110 3.9 2.620 16.46 0 1 4 4 2: 21 6 160 110 3.9 2.875 17.02 0 1 4 4 and gives correct result. furthermore, if want have am == 1 & gear == 4 & (carb == 4 | carb == 2) , works > dt[.(1, 4, c(4, 2))] mpg cyl disp hp drat wt qsec vs gear carb 1: 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 2: 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 3: 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2 4: 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2 however, when want have am == 1 & (gear == 3 | gear == 4) & (carb == 4 | carb == 2) , plausible > dt[.(1, c(3

ios - Swift - Getting double ?? error when working with UIImage -

i having trouble working images parse. have created function take image files parse class, , save them dictionary (with key value being objectid). idea why and/or how fix? below codes: private func generatedictionaryofimages(imagekeytolookup: string, dictionarykeytoreturn: string) { object in objectlist { var currentobjectid = object.objectid! var image = uiimage() let imagefile = object[imagekeytolookup] as! pffile imagefile.getdatainbackgroundwithblock({ (data: nsdata?, error: nserror?) -> void in if data != nil { if let imagedata = data { image = uiimage(data: imagedata)! } } }) // imagedictionary copied downloadedclientimages variable separately self.imagedictionary[currentobjectid] = image } } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("prof

python - Create a dictionary/list from a CSV file -

i have sheet , want group dictionary. imported , in comma-separated format accession,a,b,o,k,g,f 3364,+,-,+,-,+,- 3365,-+,-,+,-,+,- 3366,+,-,-,-,+,+ i want put this: {'3364': {'a': '+', 'b': '-', 'o': '+','k': '-', 'g': '+', 'f': '-'}} how can that? jon right, here hint: d = {} = '3364,+,-,+,-,+,-' n, *pm = a.split(',') d[n] = {chr(i+65): v i, v in enumerate(pm)} print(d)

angularjs - Update $scope values from bootstrap datepicker -

i have bootstrap datepicker set todays date. html: <input type="text" class="form-control" datepicker-popup="{{dateformat}}" ng-model="parent.dateregarding" is-open="dateopened" datepicker-options="dateoptions" ng-required="true" ng-click="dateopened = true" close-text="close" max-date="parent.dateregarding" /> angularjs function: function activate() { // format , options datepicker $scope.dateformat = 'yyyy-mm-dd'; $scope.tiemformat = 'hh:mm'; $scope.dateoptions = { formatyear: 'yy', startingday: 1 }; // default dates datepicker var dateregarding = new date(); var timeregarding = new date(); $scope.parent = { 'dateregarding': dateregarding, 'timeregarding': timeregarding}; } the picker works fine, how update $scope.parent.dateregarding when user changes date?

Stata: How do I transpose the oneway summary table? -

it difficult explain gave concrete example. please see link below detail (codes, screenshots , explanation). https://www.dropbox.com/s/oxwyyqszqxzlqa2/question.pdf?dl=0 the code having right follows (also contained in link) sysuse auto, clear tabout foreign using tablep1.tex, /// cells(mean mpg sd mpg mean weight sd weight mean length sd length) /// clab(mpg_mean sd weight_mean sd length_mean sd) /// sum npos(tufte) /// replace /// style(tex) bt cl2(2-3 4-5 6-7) cltr2(.75em 1.5em) /// topf(top.tex) botf(bot.tex) topstr(10cm) botstr(auto.dta) here, followed ian watson's tutorial http://www.ianwatson.com.au/stata.html

.net - MemoryStream: Encoding -

i'm trying encrypt long text using public , private keys of x509 certificate. specifically, i'm trying reproduce msdn code: https://msdn.microsoft.com/en-us/library/system.security.cryptography.x509certificates.publickey(v=vs.90).aspx however, instead of encrypting file, want encrypt string. i'm trying adapt code use memorystreams. the problem every time try read content of stream, has strange caracters. when try call webservice (asmx) , sending cipher text, crashes. this code. have tried using utf32, utf8, utf7 , ascii. private shared function encrypttext(byval token string, byval rsapublickey security.cryptography.rsacryptoserviceprovider) string dim aesmanaged new security.cryptography.aesmanaged() dim transform security.cryptography.icryptotransform = nothing dim outstreamencrypted security.cryptography.cryptostream = nothing dim outfsaux new io.memorystream() dim outfs new io.streamwriter(outfsaux, text.encoding.ascii) dim infs new i

c# - Saving image from PictureBox after drawing to it -

i have picturebox image , use paint event draw line on , when save image, image without line been drawn private void picbox_paint(object sender, painteventargs e) { e.graphics.drawline(pen, end, start); e.graphics.flush(); e.graphics.save(); } //and save picbox.image.save("directory"); what missing here? you want drawtobitmap() method: private void button1_click(object sender, eventargs e) { bitmap bmp = new bitmap(picbox.clientsize.width, picbox.clientsize.height); picbox.drawtobitmap(bmp, picbox.clientrectangle); bmp.save("...filename here..."); }

python - Django 1.8.3 adding ForeignKey for existing database -

i'm following django tutorial 4 adding permissions api resources. http://www.django-rest-framework.org/tutorial/4-authentication-and-permissions/ i have existing database in postgres i'm able read/write values using django api. want add permissions via user.auth needs addition of column in db. following error when browsing api: programmingerror @ /server/ column server.owner_id not exist this server model: class server(models.model): discovered = models.booleanfield() status = models.smallintegerfield() serialnumber = models.charfield(max_length=100, null=true) hostname = models.charfield(max_length=250) description = models.charfield(max_length=250, blank=true, null=true) created = models.datetimefield(auto_now_add=true) fk_server_model = models.foreignkey('servermodel', db_column='fk_server_model') fk_licensing = models.foreignkey(licensing, db_column='fk_licensing', blank=true, null=true) fk_networ

javascript - jQuery Typeahead - Uncaught TypeError: Cannot read property 'name' of undefined -

Image
i using bootstrap-3 typeahead plugin bootstrap tag input plugin . use this: <input type="text" id="name" name="test" data-provide="typeahead"> and jquery: $.get('/design/assets/advertisements/countries.json', function(data) { $("#name").typeahead({ source: data }); $('#name').tagsinput({ typeahead: { source: data } }); }, 'json'); however, typeahead , tags works point. whenever enter words, suggestions, whenever i've selected suggestion, whatever writing added after tag input. example: if write " bah " , select " bahamas ", looks this: (where believe delete "bah") i error - don't know if that's reason: uncaught typeerror: cannot read property 'name' of undefined the error called file: bootstrap3-typeahead.js i've downloaded non-min version of bootstrap-3 typeahead plugi

drawing - Processing in Java - drawn clearing rectangle breaks after calling a method -

i using processing in java perpetually draw line graph. requires clearing rectangle draw on drawn lines make room new part of graph. works fine, when call method, clearing stops working did before. clearing works drawing rectangle in front of line at below 2 main methods involved. drawgraph function works fine until call redrawgraph redraws graph based on zoom. think center variable cause of problem cannot figure out why. public void drawgraph() { checkzoom(); int currentvalue = seismograph.getcurrentvalue(); int lastvalue = seismograph.getlastvalue(); step = step + zoom; if(step>offset){ if(restartdraw == true) { drawongraphics(step-zoom, lasty2, step, currentvalue); image(graphgraphics, 0, 0); restartdraw = false; }else{ drawongraphics(step-zoom, lastvalue, step, currentvalue); image(

javascript - How can I change the text of the back button on this dropdown pie chart? -

when click on 'recycled materials' section of pie chart drops down more info section. the problem button has default text 'back brands' in , can't find anywhere in code change that. my code follows: java: $(function () { // create chart $('#container').highcharts({ credits: { enabled: false }, chart: { plotbackgroundcolor: null, plotborderwidth: null, plotshadow: false, type: 'pie' }, title: { text: 'green amount recycled' }, subtitle: { text: 'click recycled materials slice more information.' }, plotoptions: { pie: { allowpointselect: true, cursor: 'pointer', datalabels: { enabled: false }, showinlegend: true } }, tooltip: { headerformat: '<span style="font-size:11px&quo

vba - Type Mismatch Error - charting data -

sub button2_click() dim lastrow long dim xtitle range dim xdata range dim ycolumn long dim ytitle range dim ydata range dim graphrange range 'find last row data lastrow = activesheet.cells(activesheet.rows.count, "a").end(xlup).row 'set x-axis title , data set xtitle = range("a1") set xdata = range("a2" & lastrow) 'find cap, set y-axis title = range("b1") 'set y-axis data **ydata = range("b2" & lastrow)** 'set total graph range set graphrange = union(xtitle, xdata, ytitle, ydata) 'create chart activesheet.shapes.addchart.select activechart.charttype = xlxyscatter activechart.setsourcedata source:=graphrange activechart.location where:=xllocationasnewsheet activechart.setelement (msoelementlegendnone) activechart.charttitle.text = "mm index" activechart.setelement (msoelementprimarycategoryaxistitleadjacenttoaxis) selection.caption = xtitle activechart.setelement (msoelem

javascript - random picture script for new app -

i creating app through appmaker , want random picture appear when clicks icon. found script online. entered script in (where accept html on screen) , doesn't seem run when test it. created several test pictures , uploaded them online site , ran script. appreciated. script follows: <script type="text/javascript"> var total_images = 2; var random_number = math.floor((math.random(2)*total_images)); var random_img = new array(3); random_img[0] = '<a href="http://mymoonspirit.com/images/tarot1.jpg"><img src="images/tarot1.jpg"></a>';; random_img[1] = '<a href="http://mymoonspirit.com/images/tarot2.jpg"><img src="images/tarot2.jpg"></a>';; document.write(random_img[random_number]); </script>` i've looked around , looks best solution; var image-number = math.floor(math.random() * random_img.length); var image = random_img[image-

windows - My program has a missing operator even though the value is set previously. (batch) -

i made program user sets value of %bet%. when %bet% used in file says "missing operator" set /p %bet= this code set bet, code below code pretends %bet% doesn't exist. :bjwinplayer echo have won! set /a %money%=%money%+%bet% set bet=0 echo play again? set /p %a5= y/n if %a5%==y goto bjbet if %a5%==n goto casgenerate if %a5%==y goto bjbet if %a5%==n goto casgenerate set /a %money%=%money%+%bet% should be: set /a money=%money%+%bet% but simple set /a money=money+bet also works, , simpler set /a money+=bet works also...

C# run-time completely skips lines of code - why? -

i put break point on line indicated below. when execution hits nothing happens. line , next 1 after skipped. can tell me occurring here? can't figure 1 out. string correctname; string testingonetwothree; int indexofspace = 0; textinfo storelocation = new cultureinfo("en-us", false).textinfo; foreach(storelocation sl in storelocations) { correctname = storelocation.totitlecase(sl.name); correctname = correctname.substring(9); <breakpoint here> indexofspace = correctname.indexof(" "); //i added line during runtime it's ignored. - placed break point , nothing happens. testingonetwothree = "hello " + "world"; //after got paranoid , added line see if being crazy. line skipped well. correctname = correctname.tolower(); correctname = char.toupper(correctname[0]) + correctname.substring(1); sl.name = correctname; sl.state = lookupfullstatename(sl.state); } return storelocations;

ios - Switch Statement for UITableView -

i know cannot switch on nsdictionary, here trying have nsdictionary such: mydict = {"one":@["foo", "bar"], "two":@[@"see", "tee"]} the acutely dictionary longer , has more elements point. i not trying switch kind of cell use in uitableview depending on key of dict. in ideal world switch (mydict) { case "one": //do stuff break; case "two": //do stuff break; default: break; } how achieve same thing? thanks help

How to import css file in UIWebView when I am using loadHTMLString() method in swift (iOS) -

i have common css file , dynamic html text. trying load css file disk , use dynamic html text display in uiwebview instead of putting same css text on , on again html text. i trying way. var sometext = "<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"></head>" + "<body><p>some text goes here</p></body></html>" let mainbundle = nsbundle.mainbundle().bundlepath let bundleurl = nsurl(fileurlwithpath: mainbundle) self.webview.loadhtmlstring(sometext, baseurl: bundleurl) now problem css not getting applied html. there 1 out there can help, think stuck. please help. thanks! i had same problem. code same russell posted. adding css file project not enough. had reference file in "copy bundle resources" list in build phase settings. how reference file in xcode 7: select build phase tab scroll down "copy bundle resources"

java - "FragmentLandscape" cannot be converted to Fragment -

i followed tutorial multiple layout fragments got error , have no idea is. i've searched v4 can't understand , don't know how apply code package com.example.renboy94.fragmentsresponsive; import android.app.activity; import android.app.fragmentmanager; import android.app.fragmenttransaction; import android.content.res.configuration; import android.os.bundle; public class mainactivity extends activity{ @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); fragmentmanager fragmentmanager = getfragmentmanager(); fragmenttransaction fragmenttransaction = fragmentmanager.begintransaction(); configuration configinfo = getresources().getconfiguration(); if(configinfo.orientation == configuration.orientation_landscape){ fragmentlandscape fragmentlandscape = new fragmentlandscape(); fragmenttransaction.repl

java - RHive package connection with hadoop -

i beginner , trying connect r hadoop using r package rhive . codes following: at hadoop prompt: u/users/seeker $ export hadoop_home=/usr/bin/hadoop u/users/seeker $ export hive_home=/usr/bin/hive at r console: library(rjava) library(rhive) rhive.init() rhive.connect() i getting error: error: java.lang.classnotfoundexception please me fix issue. appreciated!

Bound value in a conditional binding must be of Optional type [IOS - SWIFT] -

i trying make to-do list app in xcode using swift, , encounter error writing 1 of function methods on "if let path = indexpath {" line says "bound value in conditional binding must of optional type". func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("cell", forindexpath: indexpath) as! uitableviewcell if let path = indexpath { let currentstring = datasource[path.section][path.row] cell.textlabel?.text = currentstring } return cell } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("cell", forindexpath: indexpath) as! uitableviewcell cell.textlabel?.text = datasource[indexpath.section][indexpath.row] return cell } use

javascript - How can I properly promisify these two database methods for nodejs? -

i have database module handles connection setup , pooling, , query module relies on database module execute queries. i'm adapting both of them use promises asynchronous calls. far, i've adapted query module - wish convert database module. here's problem: database module should usable both directly , implicitly query module (which relies on callbacks). how can use promises in both modules' methods without turning maze of twisty little passages? here's i've done far: database module getconnection: function(callback) { //this should return promise this.pool.getconnection(function(error, connection){ callback(error, connection); }); }, query module should then on getconnection promise, execute query, , reject/resolve it's caller request: function(queryrequest) { return new promise(function(resolve, reject){ database.getconnection(function(error, connection){ if(error) {

scala - Play framework: Add routes from sub-projects dynamically -

i'm developing system discover subprojects @ compile time. works. see here . issue subproject's route file being ignored. i know normal way include route file in main route file hardcoding latter former. defy goal of dynamic subprojects. i bet there's way to, in build.scala, discover route file , append main route file. i'm beginner , have no idea how it. please me out? alternatively, if there's no way @ compile time, maybe there's way load @ runtime? know there's api intercept requests . if can read routes implement dynamic routing way. idea? your submodules implement own routing dsl . see example in api doc . optionally, hook compile task in root project , append routes main routes file programmatically.

c# - What gulp plugin should I use to build ASP.NET 5 on Mac? -

visual studio code docs https://code.visualstudio.com/docs/tasks provides example of gulp task building c# code. var program = "myapp"; var port = 55555; gulp.task('default', ['debug']); gulp.task('build', function() { return gulp .src('./**/*.cs') .pipe(msc(['-fullpaths', '-debug', '-target:exe', '-out:' + program])); }); gulp.task('debug', ['build'], function(done) { return mono.debug({ port: port, program: program}, done); }); but there no info gulp plugin. can build aspvnext app gulp? asp.net 5 (vnext) apps not "built" per se. read wiki learn more how use dnx , dnu commands: asp.net wiki: command line asp.net wiki: dnx utility you use gulp shell run these commands

Use residuals of regression to calculate another regression (inside function) in R -

i'm using function calculate regressions. need residuals relationship relate variable. because change facet grid several times. this code: modelregression = function(file) { mod2 = lm(y ~ x,data=file) mod = lm(mod2$residuals ~ anotherx,data=file) mod_sum = summary(mod) formula = sprintf("y= %.3f %+.3f*x", coef(mod)[1], coef(mod)[2]) r = mod_sum$r.squared r2 = sprintf("r2= %.3f", r) x = cor.test(~mod2$residuals + anotherx,data=file) r0 = sprintf("r= %.3f", x[4]) p1 = pf(mod_sum$fstatistic[1],mod_sum$fstatistic[2],mod_sum$fstatistic[3],lower.tail=f) p =sprintf("p = %.3f", p1) n0 = length(mod_sum$residual) n1 = sprintf("n = %.f", n0) data.frame(formula=formula, r=r0,r2=r2, p=p,n=n1, stringsasfactors=false) } modelregression_math = ddply(file, c("database","level"), modelregression) the runs without problem, coefficients zero. how can fix this? you need residuals reside "ins

ios - Cast id to a long type crashes -

i'm trying cast id value, returned json, long value (timestamp purposes). xcode sais me: -[__nscfstring longvalue]: unrecognized selector sent instance 0x15d3f220 terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[__nscfstring longvalue]: unrecognized selector sent instance 0x15d3f220' the next lines break code. long time_now = [self gettimestamp]; long fdate = [[results2 objectforkey:@"pll_first_date"] longvalue]; long sdate = [[results2 objectforkey:@"pll_second_date"] longvalue]; what i'm doing wrong? id type not dynamic type casted? after comments, possible solution: long long time_now = [self gettimestamp]; long long fdate = [(nsstring *)[results2 objectforkey:@"pll_first_date"] longlongvalue]; long long sdate = [(nsstring *)[results2 objectforkey:@"pll_second_date"] longlongvalue]; t

Android : Use Camera to display image to ImageView and Save to Gallery -

i making app has option image camera or gallery , display in imageview. got android developers tutorial. using dialoginterface one: private void selectimage() { final charsequence[] items = { "take photo", "choose library", "cancel" }; alertdialog.builder builder = new alertdialog.builder(reportincident.this); builder.settitle("add picture"); builder.setitems(items, new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialog, int item) { if (items[item].equals("take photo")) { takepictureintent = new intent(mediastore.action_image_capture); // ensure there's camera activity handle intent if (takepictureintent.resolveactivity(getpackagemanager()) != null) { // create file photo should go try {

python - Toggling between 2 graphs in HTML/Javascript -

hello wondering if there way toggle between 2 graphs(pygal graphs) i'm creating in python , passing through flask jinja template. have graph weekly information , monthly information , want (not button) sort of thing click show 1 @ time. i'd appreciate input. it depends lot on how webpage designed. have think if user understand if don't put button or relates in obvious way change. sometimes design think obvious if end user doesn't understand it, it's of no use. if in page have more data showing information week or month, maybe it's better put button filters month/week. 1 tiny 1 :) if send picture template can try give ideas.

java - Loading Texture in Android OpenglEs 2.0 result in no color at all -

Image
i had working method before, saw there not optimized. trying upload textures rgb_565 or argb_4_4_4_4 color scheme, using 3 bytes first , 4 last one. in fact if use rgb_565 needing 2 bytes (5+6+5 bits), same second. did modifications it's not working, , sure forgot or did bad. you can find old code commented out in function if wish compare. appreciated. this code: /// // load texture inputstream // private int loadtexture(inputstream is) { int[] textureid = new int[1]; bitmap reversedbitmap, bitmap; bitmapfactory.options opts = new bitmapfactory.options(); opts.inpreferredconfig = bitmap.config.rgb_565; reversedbitmap = bitmapfactory.decodestream(is, null, opts); //reversedbitmap = bitmapfactory.decodestream(is); if (reversedbitmap == null) { throw new runtimeexception("texture.loadtexture: depuracion"); } int width = reversedbitmap.getwidth(); int height = reversedbitmap.getheight(); matrix flip = new matr

javascript - ReactJs, Generating events outside of reactjs app -

while trying out reactjs, facing below design issue: below simple html trying simulate chat app, building list of online members , trying work out code add new members list. the below react app consists of following class in dom hierarchy. chatapp > memberlist > member in react class chatapp, able use setinterval update members collection , generate new dom new member, want try same outside chatapp class. so have added button 'add member' , call function on click in turn add new member list. but, how should instance of react chatapp , setstate method outside of react app? <html> <head> <style> .onlinelist{ width:300px; height:500px; display:inline-block; overflow:auto; border:1px solid lightgray; } .onlinelist a{ display:inline-block; width:100%; padding:10px; box-sizing:border-box; tex

django - How can I group a checkbox element with a number type element and work with it in html5? -

i creating app in django , have next problem: in html5 template, have next structure represents kids , chocolate bars want eat. {% kid_information in result %} <br/><input type="checkbox" name="kid" id="kid" value="{{kid_information.name}}" /> <label for="kid"><b>{{ kid_information.name }}</b></label> chocolate-bars: <input type="number" name="chocbars"> {% endfor %} <br/><br/> as can see, have 'for' structure represent list of kids have, , show name, , field let user select how many chocolate bars give each kid. want 'checkbox' structure, let user select kids , number of chocbars of each kid. this inserted in 'form' structure, when click on "submit" button, treat selection in correspondent view. in view, know if next, list of selected checkbox items: selected_kids = request.post.getlist(

java - What is the difference between automating using http requests vs selenium webdriver? -

i bot developer in selenium webdriver java , i'm using browser htmlunitdriver headless it's complicated when have deal javascript, so, better when have automate page? sending http , post requests or continue using webdriver? i'm confused because, example, how can click button , wait page load (example: when open page ad.fly) , have wait 5 seconds until button ready sending http request, confused by, lot answers!! use http requests if want make calls (i.e. rest services). use selenium (or other web automation tools) if need simulate browser behaviour (i.e. run javascript in page). http preferable if have option - services more stable page structure (particularly if there's published interface) , more oftened designed machine-readable. web pages designed humans using web browsers, can change frequently, , adds lot of overhead doesn't make sense in machine interface. so, i'd suggest - through sequence of user actions you're trying automate.

android - Can't remove TITLE BAR -

i know question has been asked million times. none of answers helped me. every time want remove title bar on mainactivity extends actionbaractivity, application crashes or nothing happens. have tried - changed androidmanifest settings, added: requestwindowfeature(window.feature_no_title); and supportrequestwindowfeature(window.feature_no_title); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); in possible way oncreate method. nothing seems work properly. hope has answer because getting frustrating. don't extend actionbaractivity causing error, instead use activity . unless min api level not below 11, won't change ( here can read why, appcompatactivity cause same error). if extends activity , can use getwindow().getdecorview().setsystemuivisibility(view.system_ui_flag_fullscreen) (min api lvl 15).

sql - Removing part of where clause depending on input -

i have following query in want omit filter created_by = @searchby if @searchby 's input 1 . how can this? create proc [dbo].[rptcashcollectioninner] @branchid int, @searchby int, @paiddate datetime begin select id reading created_by = @searchby , branch_id = @branchid end; you can short-circuit search element or operator: create proc [dbo].[rptcashcollectioninner] @branchid int, @searchby int, @paiddate datetime begin select id, reading (@searchby = 1 or created_by=@searchby) , branch_id=@branchid end; or, more elegantly, in operator: create proc [dbo].[rptcashcollectioninner] @branchid int, @searchby int, @paiddate datetime begin select id, reading @searchby in (1, created_by) , branch_id=@branchid end;

android - Unable to find module with Gradle path ':volley'. Linking to library 'volley-unspecified' instead -

i have tried tutorial link , works me in 1 app when trying apply different app, giving warning warning:unable find module gradle path ':volley'. linking library 'volley-unspecified' instead. right click project, select "configure project subset ..." , select module, rebuild project.

How can we install multiple apache servers at different ports in aws ec2 linux instance -

i want install multiple apache servers on ec2 linux servers operating @ different ports , having different file structures in 1 ec2 linux machine. please guide me on how can install multiple apache servers in 1 machine. you can run single apache server using virtualhost directive. for example: <virtualhost *:80> servername www.example.org documentroot /www/otherdomain-80 </virtualhost> <virtualhost *:8080> servername www.example2.org documentroot /www/otherdomain-8080 </virtualhost> will listen both port 80 , 8080 running same apache server. running 2 apache instances on same server possible it's kinda messy. keep in mind port > 1024 protected linux, able bind ports 443 , 80 apache, otherwise has ports 1025 , above. more information here: http://httpd.apache.org/docs/2.2/vhosts/examples.html

javascript - How to upload android and iso app containing mysql / php and wrap with phonegap -

i trying make android , ios app using html, css , passing mysql php through json can use wrap phone gap . all functions working when tested on browser how can upload app , server side function github repository can build using phone gap cloud. use github repository when develop apps without mysql. if upload mysql remove server , app github, how link it. below php connection database <?php header('access-control-allow-origin: *'); $user="root"; $pass="xxxx"; $dbh = new pdo('mysql:host=localhost;dbname=uxxxmobile', $user, $pass); ?> here login function ' <script> $(document).ready(function(){ $('#loginform').on('submit',function(e){ var myform = new formdata($(this)[0]); var host = 'http://example.com/uixxxmobile/connections'; $.ajax({ type:'post', url: host + '/login.php', data : new formdata($(this)[0]),

Here android sdk sample code showing blank screen -

i have downloaded here android sdk 90 day eval. tried run basic map sample application, getting blank in map frame. able see hello world text. seperately have here maps app running on mobile, runs without problem. have internet connection , location settings on. help? have included app_id/app_code , lisence key(if using premium edition) in maifest file, mentioned here : https://developer.here.com/mobile-sdks/documentation/android/topics/credentials.html otherwise try debugging app adding break point in mapfragment.init() method , example using code on following link , try putting break point on line (error == onengineinitlistener.error.none) to check if there error. https://developer.here.com/mobile-sdks/documentation/android/topics/app-simple.html

performance - Python speed up the code for reconstructing lists -

what have been trying reconstructing lists such as: [42351, 4253, 1264, 5311, 3651] # first number in list id [42352, 4254, 1244, 1246, 5311, 1264, 3651] [42353, 1254, 1264] into format this: # id \t 1 \t the_second_number_in_a_list \t id \t 2 \t the_third_number_in_a_list \t id \t 3 \t the_forth_number_in_a_list ... 42352 1 4254 42352 2 1244 42352 3 1246 42352 4 5311 42352 5 1264 42352 6 3651 42353 1 1254 42353 2 1264 42351 1 4253 42351 2 1264 42351 3 5311 42351 4 3651 my idea creating intermediate dictionary desired format: list_dic = {42352: [42352, 1, 4254, 42352, 2, 1244, 42352, 3, 1246, 42352, 4, 5311, 42352, 5, 1264, 42352, 6, 3651], 42353: [42353, 1, 1254, 42353, 2, 1264], 42351: [42351, 1, 4253, 42351, 2, 1264, 42351, 3, 5311, 42351, 4, 3651]} and save txt file separated tab. however, realized in reality may have hundreds of thousands of lists, , way slow , computationally expensive.

hadoop - Will sequence file help in improve performance for reading in HDFS compared to Local File System? -

i want compare performance hdfs , local file system 1000 of small files (1-2 mb). without using sequence files, hdfs takes double time reading 1000 files compared local file system. heard of sequence files here - small files problem in hdfs want show better response time hdfs retrieving these records local fs. sequence files or should else? (hbase maybe) edit: i'm using java program read files here hdfs read though java yes, simple file retrieval grabbing single sequence file quicker grabbing 1000 files. when reading hdfs incur more overhead including spinning jvm (assuming you're using hadoop fs -get ... ), getting location of each of files namenode, network time (assuming have more 1 datanode). a sequence file can thought of form of container. if put 1000 files sequence file, need grab 32 blocks (if blocksize set 64mb) rather 1000. reduce location lookups , total network connections made. run issue @ point reading sequence file. binary format. hba

android - Cannot update the column information in table parse.com -

i have table lets call "post" has 3 columns "usera"<parseuser> , " userb" , "status"<string> . data consists of usera currentuser, userb parseuser, status => when going update status "a" "b" throw me error com.parse.parseexception: java.lang.illegalargumentexception: cannot save parseuser not authenticated. can me please? you need logged in user you're trying modify. possible solution call cloud code function , use master key this. the cloud code guide here: https://parse.com/docs/cloud_code_guide

c++ - Print to stdout, in hex or decimal, a std::string as a sequence of bytes -

this question has answer here: uint8_t can't printed cout 8 answers the api working returns sequence of bytes std::string. how print stdout, formatted sequence, either in hex or decimal. this code using: int8_t i8array[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }; std::string i8inlist(reinterpret_cast<const char*>(i8array), 16); std::string i8returnlist; client.getbytes(i8returnlist, i8inlist); cout << "getbytes returned "; std::copy(i8returnlist.begin(), i8returnlist.end(), std::ostream_iterator<int8_t>(std::cout << " " )); i expecting receive same input, in reverse order. code prints is: getbytes returned ☺☻♥♦♣ ♫☼ note: sequence of bytes arbitrary sequence of bytes, not representation of written

How to write Python's super() call at the end of an __init__ block in C#? -

i've been porting lot of python code on c# , regularly come across super().__init__ call @ end of __init__ block in python. problem comes in when python code in derived classes __init__ block before calling base constructor. in c#, it's assumed base constructors required derived constructors work, , called first, before "stuff" done in derived constructor. usual workaround write static method , call inside of base (ex. public c : base( dostuff(somevariable) ) . worked okay when had 1 argument base constructors. if have 3 arguments? don't want repeat __init__ block code 3 times using 3 different static methods, instead wrote 1 method returns first argument , sets other arguments in local variables. is there better way accomplish doing stuff two+ variables in derived constructor before passing results base constructor in c#? here testing code wrote observe behavior of workaround: using system; namespace basesupertest { class program {

javascript - Can't display x-axis value in Highcharts title -

here example how need work highchart example if hover on spot see apr dog: 2323 so display xaxis value in tooltip. have made own display chart name instead of xaxis value. my highchart xaxis: { title: { text: 'date' }, categories: data.categories }, what do wrong? replace have in tooltip formatter- should work tooltip: { formatter: function () { return '<b>'+this.series.name+'<br>'+this.x + ':' + this.point.y; }

ruby on rails - Filtering polymorphic association by type for a view -

i have polymorphic association looks this: class event < activerecord::base belongs_to :eventable, :polymorphic => true end with bunch of types: class nap < activerecord::base include eventable end class meal < activerecord::base include eventable end module eventable def self.included(base) base.class_eval has_one :event, :as => :eventable, :dependent => :destroy accepts_nested_attributes_for :event, :allow_destroy => true scope :happened_at, -> (date) { where("events.happened_at >= ? , events.happened_at <= ?", date.beginning_of_day, date.end_of_day).order("events.happened_at asc") } base.extend(classmethods) end end module classmethods define_method(:today) self.happened_at(date.today) end end end and on. here's other end of relationship: class person < activerecord::base has_many :events has_many :meals, { :through

angularjs - Restangular prevent 'preflight' OPTIONS call -

i'm trying figure out how prevent options call firing on every call our api server. i'm trying right now: .config(function(restangularprovider) { restangularprovider.setdefaultheaders({"x-requested-with" :"", "content-type": "text/plain"}); }) but it's not doing me good. still thinks it's application/json fires off preflight call. there can do? check out: options requests call pre-flight requests in cross-origin resource sharing (cors). they necessary when you're making requests across different origins. this pre-flight request made browsers safety measure ensure request being done trusted server. meaning server understands method, origin , headers being sent on request safe act upon. your server should not ignore handle these requests whenever you're attempting cross origin requests. how disable options request?