Posts

Showing posts from June, 2010

python - Uploaded image is broken after writing to file -

i have image got post request. want save in files directory. use following code write file, afterwards file doesn't show image. how correctly save file? img = form.imagen.data filename = secure_filename(img) path=os.path.join(app.config['upload_folder'], filename) open(path, 'wb+') f: f.close() don't open , write file use flask framework abstract you img = request.files['imugen'] filename = secure_filename(img.filename) img.save(os.path.join(app.config['upload_folder'], filename))

sql server - Inserting values automatically in sql -

i have following stored procedure insert purchasing of vouchers, recieving user_id foreign key in voucher table, other fields entered automatically, here stored procedure` create proc insertpurchasevouchers ( @user_id int = null, @amount decimal(18,2) ) begin set nocount on if not exists ( select * voucher [user_id] = @user_id) insert voucher ( voucher_id, voucher_amount, voucher_expiritydate, voucher__purchasedate, [user_id] ) values( 1, @amount, dateadd(m,3,getdate()), getdate(), @user_id ) set...

jasper reports - JasperReports reprint table header when table footer in next page -

i have problem jasper table. if count of elements in table more 18, table footer carry on next page, table header not reprint. how solve this? try using column header instead of table header . this link seems reverse of question.

javascript - How to load foreign image via POST request in browser? -

my web application (html5 + javascript) needs display png images generated foreign web service. however, web service supports post requests only . (more exactly, provide requests, have transmit large arguments, due url becomes long.) also, web service has different domain web application, , doesn't supply proper cors headers, ajax (xmlhttprequest) doesn't work. is still possible web application load , display foreign image via post request? i'm asking solution is different following nasty workarounds , well-known me: without setting local proxy translates request (and circumvents same-origin policy) without using remote proxy of stranger without using flash without using java applets without using os specific functionality such activex controls however, solution fails work internet explorer acceptible. firefox or chrome specific solution appreciated. horrible hack: submit form iframe , have image displayed in iframe. (but don't this, s...

unix - provide custom terminal session to incoming ssh connections in c++ -

we have server run functionality. want enable users ssh authentication if ssh session initiated clients on port server, sever provide custom terminal supports few commands have decided implement. my question is: how can listen (in cpp) incoming ssh connections, , after successful authentication provide them terminal application. is there package supports of functionality? thanks! sshd of course configurable, , can made listen on different ports. these discuss @ length: change default ssh port getting ssh listen different ports on different interfaces the underlying issue 1 this. has been asked before, suggestions setup restricted shell (including using chroot ). discussion, see how create restricted ssh user port forwarding? how restrict ssh users predefined set of commands after login? securing restricted shell environments best practices unix chroot() operations

radio button checked javascript - no jquery -

below function seems not working.. function mycalculator () { var operator = document.getelementsbyname("operator"); var output = document.getelementbyid("output"); var firstdig = parseint(document.getelementbyid("firstdig").value); var seconddig = parseint(document.getelementbyid("seconddig").value); (var i=0; i<operator.length; i++){ var currentoperator = operator[i].id; if(currentoperator.checked == "add"){ var add = firstdig + seconddig; output = add; }; }; } somehow "if" parameter returning false but, got element property checked...im making simple calculator...below html... <fieldset> <label>enter number:</label> <input type="text" id="firstdig" /> <input type="text" id="seconddig" /> <br/> <br/> <label>s...

lua - Y Velocity is inconsistent moving between 8 and something else? -

i added entity framework code (sorta half done) , after added noticed wrong y velocity of player seems fluctuate between 1 , 0. stumped why has occurred assume it's current physics i've put in not sure happening. code below: collisions.lua -- btw not code needed aabb work right function iscolliding(a,b) if ((b.x >= a.x + a.width) or (b.x + b.width <= a.x) or (b.y >= a.y + a.height) or (b.y + b.height <= a.y)) return false else return true end end -- 'a' must entity can move -- 'b' can static object -- both need height, width, x , y value function ifcolliding(a, b) if iscolliding(a,b) if a.y + a.height < b.y a.y = b.y - a.height a.yvel = 0 elseif a.y - a.height > b.y - b.height a.y = b.y + b.height a.yvel = 0 end end end entitybase.lua local entitybase = {} lg = love.graphics ...

javascript - Detect owl carousel drag direction -

i need help. need detect owl carousel dragging direction. function startcallback(event) { // if drag left $(".owl-item").css("transform", "rotate(-10deg)"); //if drag left $(".owl-item").css("transform", "rotate(10deg)"); } function endcallback(event) { } i need detect drag direction when start. please help. thank you.

javascript - Getting null in json_decode -

i have text file has json on it. example below: {'something' : 'ss'} i trying read on php , convert array using json_decode . $temp = ''; $fh = fopen( '/quiz' . $testid . '.txt' ,'r'); while ($line = fgets($fh)) { $temp .= $line; } fclose($fh); $temp = str_replace("\n","",$temp); //to remove new line $temp = str_replace("\r","",$temp); $temp = json_decode($temp); but im getting null if don't json_decode it.. can string. i hope can me this. thanks, e you don't need parsing prior calling json_decode $contents = file_get_contents('/quiz' . $testid . '.txt'); $temp = json_decode($contents); if you're still getting null, json invalid, can use json_last_error diagnose it.

angularjs - Display content from multiple json on to a single div using ng-repeat -

here scenario. have 3 separate json objects. want have 3 object values displayed in single div. i.e (first values of imagelist, headinglist , pricelist in first div , second). trying use ng-repeat 1 shown below. shows error. there other way can achieve this? <div ng-controller="bannercontroller"> <div ng-repeat="image in imagelist, heading in headinglist, price in pricelist"> <div style="background-image: url({{image.url}}); width: 1000px; height: 320px;"> <h1>{{heading.title}}</h1> <p>{{price.price}}</p> </div> </div> below index.html , script.js index.html <!doctype html> <html ng-app="myapp"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"> </script> <script src="script.js"></script> <t...

python - How can I strip namespaces out of an lxml tree? -

following on removing child elements in xml using python ... thanks @tichodroma, have code: if can use lxml , try this: import lxml.etree tree = lxml.etree.parse("leg.xml") dog in tree.xpath("//leg1:dog", namespaces={"leg1": "http://what.not"}): parent = dog.xpath("..")[0] parent.remove(dog) parent.text = none tree.write("leg.out.xml") now leg.out.xml looks this: <?xml version="1.0"?> <leg1:mor xmlns:leg1="http://what.not" ocount="7"> <leg1:order> <leg1:ctemp id="fo"> <leg1:group bnum="001" ccount="4"/> <leg1:group bnum="002" ccount="4"/> </leg1:ctemp> <leg1:ctemp id="go"> <leg1:group bnum="001" ccount="4"/> <leg1:group bnum="002" ccount="4...

c# - How to validate GET url parameters through ModelState with data annotation -

i have web api project... respect rest principles, should have method , post method... have search, think matches method, because after search obtain result , show in page... if not find must create object... action post... now have problem... must validate filters of search, because filters tax code , alpha-numeric code (6 chars)... have done client side validation. should server side validation. untill now, have used data annotation validate request, get... method has signature: [httpget] public ihttpactionresult getactivationstatus(string taxcode, string requestcode) { if (modelstate.isvalid) { ... } } but how can validate modelstate data annotation? thank you create own model... public class yourmodel { [//dataannotation ...] public string taxcode { get; set; } [//dataannotation ...] public string requestcode { get; set; } } and change signature of server side controller: [httpget] public ihttpactionresult getactiv...

ios - How to remove duplicates in an array by using only one for loop? -

nsarray *inputarray = @[11, 45, 54, 32, 11, 56, 45, 76, 23, 87, 54, 45]; nsarray *outputarray = @[11, 45, 54, 32, 56, 76, 23, 87]; how can achieve in objective c without sorting , because sorting using 1 for loop. try this: nsarray *inputarray = @[11, 45, 54, 32, 11, 56, 45, 76, 23, 87, 54, 45]; nsarray *outputarray = [inputarray valueforkeypath:@"@distinctunionofobjects.self"]; hope helps!!

javascript - Protractor - Element is not clickable at point (x,y) when using ng-change -

<select id="cbcategory" ui-select2 name="cbcategory" ng-model="categorycombo.category" class="show-tick form-control comboblue" ng-change="loadprice()" required> <option ng-repeat="category in categories" value="{{category}}" {{category.name}}</option> </select> when have select this, without ng-change , works in both solutions: 1. element.all(by.repeater('category in categories').row(0)).click(); 2. element(by.id("cbcategory")).sendkeys('category1'); but when have ng-change in select, both solutions not working. click select before clicking option , e.g.: var selectelement = element(by.id("cbcategory")); selectelement.click(); var option = selectelement.all(by.tagname("option")).first(); option.click(); you may want make working select->option easier making abstraction, see: select -> o...

puphpet - Why 'vagrant up' cannot start a VM instance? -

im trying launch vm via vagrant config made puphpet.com host machine: windows 7 64 virtualbox: 4.3.10 vagrant: 1.7.2 the process freezes @ stage: "setting vm name..." if open system process list dont see vboxheadless process here can see "vagrant --debug" log, last 30 lines: debug subprocess: waiting process exit. remaining timeout: 32000 debug subprocess: exit status: 0 info warden: calling in action: #<vagrant::action::builtin::handleforwardedportcollisions:0x26d1ad0> debug environment: attempting acquire process-lock: fpcollision debug environment: attempting acquire process-lock: dotlock info environment: acquired process lock: dotlock info environment: released process lock: dotlock info environment: acquired process lock: fpcollision info handle_port_collisions: detecting forwarded port collisions... debug handle_port_collisions: in use: [] debug handle_port_collisions: remap: {} debug ha...

c# - RDLC: how to merge rows dynamically -

Image
how merge rows in rdlc vertically? i've read answers not possible work around? i've tried solution specified here not working. i wish achieve result column below: if belongs in same group header, detail or footer must allowed merge cell, if in different groups not possible.

ios - XMPP How can I get the notification or an event when current user get offline? -

i have implemented chatting application using xmpp ios framework openfire server. i want notification or event when current user disconnect xmpp. i implement delegate xmppreconnectdelegate & method - (void)xmppreconnect:(xmppreconnect *)sender diddetectaccidentaldisconnect:(scnetworkreachabilityflags)connectionflags but problem is, not called in ios 7.1 & working in ios 8. is there other method or delegate ? thank in advance. following method call when user disconnect xmpp server. (void)xmppstreamdiddisconnect:(xmppstream *)sender witherror:(nserror *)error { }

Converting javascript array to ViewBag or ViewData to acces data from controller -

i have dynamic table in form on save button click accessing whole table , storing array using javascript. following javascript function savedata() { var medicinename = new array(); var batchno = new array(); var expirydate = new array(); var qty = new array(); var freeqty = new array(); var purrate = new array(); var mrp = new array(); var sellrate = new array(); var unit = new array(); var amount = new array(); var discper = new array(); var discamt = new array(); var grossamt = new array(); var vatper = new array(); var vatamt = new array(); var addvatper = new array(); var addvatamt = new array(); var netamt = new array(); $("table#tbl1 tr").each(function (row, tr) { medicinename[row] = $(tr).find('td:eq(1)').text() batchno[row] = $(tr).find('td:eq(2)').text() expirydate[row] = $(tr).find('td:eq(3)').text() qty[row] = $(tr).find('td:eq(4)').t...

android - code for scanning ble4.0 with HMsoft10 in nexus 5 -

i trying connect ble4.0 hmsoft-10 it's working times it's not work in nexus 5 this? please replay fast advance thanks. thanking you...! my code private void scanledevice() { new thread() { @override public void run() { mbluetoothadapter.startlescan(mlescancallback); try { thread.sleep(scan_period); } catch (interruptedexception e) { e.printstacktrace(); } mbluetoothadapter.stoplescan(mlescancallback); } }.start(); } private bluetoothadapter.lescancallback mlescancallback = new bluetoothadapter.lescancallback() { @override public void onlescan(final bluetoothdevice device, final int rssi, byte[] scanrecord) { runonuithread(new runnable() { @override public void run() { if (device != null) { if (mdevices.indexof(device) == -1) mde...

c# - Comma separated using string.Join with LINQ -

i used string.join in lambda expression form comma seperated values i achieved using following code: var viewdata = queue.select(items => new companyqueuewithseginfo() { segmentname = string.join(",", items.select(i => i.seginfo.trim())); }).asqueryable() } the output : ab ,cd but need output as ab, cd i tried this: string.join(" ,",items.select(i => i.segminfo)).replace(",", ", ").replace(" ,","") can me this? didn't work. if seginfo string , how trim them first , then join ", " ? string.join(", ", items.select(i => i.seginfo.trim())); also should check item null or not prevent nre like; string.join(", ", list.where(s => s != null).select(i => i.trim())) or can use isnullorempty others mentioned.

email - Embed gvis object (image stored as HTML) as inline in mailR - R -

i working on googlevis chart , wanted embed gvis object (image stored html) inline using mailr package. i have below code send mail sever - library(mailr) send.mail(from = "admin_xxx@apsmail.xx.xxx.xx", = c("first.second@jba.com"), subject = paste("batch job stats on",now), body = paste("dear sir/madam,<br><br> please find below image",".<br><br>", "<img src=\"d:/xx/batch_processing/batch_processing_run/rplot1.png\">",".<br><br>" ), html = true,inline = true, smtp = list(host.name = "xxxx01.xxx.xxx.xx"), authenticate = false, send = true) the above code working fine - , embedding image (present in d drive of server) now using googlevis create chart , storing them in html file. (present in d drive of server)...

html - AngularJS - text area text with respect to ngBindHtml -

i have text area <textarea placeholder="answer" ng-model="answer"> </textarea> in displaying answer question. text need convert using ng-bind-html. need html text should display after conversion. please suggest you can use content editable div instead of pure textarea. and if want full set of features these in edit mode use wysiwyg editors ckeditor http://ckeditor.com/

scala - When I convert an object to json with json4s in a SBT task, it reports errors, how to fix? -

i'm writing sbt task, convert objects json , output, has errors. code is: project/plugins.sbt librarydependencies ++= seq( "org.scala-lang" % "scalap" % "2.10.4", "org.json4s" %% "json4s-native" % "3.2.6", "org.json4s" %% "json4s-core" % "3.2.6", "org.json4s" %% "json4s-ext" % "3.2.6" ) build.sbt name := "json4s-210-test" version := "1.0" scalaversion := "2.10.4" import scala.tools.scalap.scalax.rules.scalasig.scalasigsymbol lazy val json = taskkey[unit]("output json json4s") json := { case class config(name: string) case class project(name: string, configs: seq[config]) implicit val formats = org.json4s.defaultformats val project = project("myproject", seq(config("conf1"))) val json = org.json4s.native.serialization.write(project) println(json) } when run sbt json ,...

django - Celerybeat service not starting -

i'm trying celery running service , i'm having problem celerybeat_opts parameter. can start celery service fine , i'm able start celerybeat fine via command line this: celery -a base beat -s djcelery.schedulers.databasescheduler -l debug --pidfile=/tmp/celerybeat.pid but when start celerybeat service this: sudo service celerybeat start it doesn't start. here's celerybeat config file @ /etc/default/celerybeat: export django_settings_module="settings" # absolute or relative path 'celery' command: celery_bin="/path/to/.virtualenvs/django/bin/celery" # chdir @ start. celeryd_chdir="/srv/myproj/" # arguments celerybeat # when below line commented out, service starts!?! celerybeat_opts="-s djcelery.schedulers.databasescheduler" celerybeat_log_file="/var/log/celery/beat.log" celerybeat_pid_file="/var/run/celery/beat.pid" # workers should run unprivileged user. # need create user man...

mysql - How to get total time in sql -

good day, need though have looked/searched other question mine it's not looking for. that want total time kind of data format. have tried getting total date query: select datediff(max(date(in_out)), min(date(in_out))) datediffs, `tbl_tmpdtr` userid = 1002 and needed, want total time , have tried far query: select max(time(in_out))-min(time(in_out)) minus `tbl_tmpdtr` date(in_out) = '2015-05-01' but result whole number this: minus 90000 what missing? or lacking. want query total time date='2015-05-01'. after achieving that, total time id=1002. i have data in database(mydb) table(tbl_tmpdtr): id | userid | in_out | status 1 | 1002 | 2015-05-01 09:00:00 | in 2 | 1002 | 2015-05-01 18:00:00 | out 3 | 1002 | 2015-05-02 09:00:00 | in 4 | 1002 | 2015-05-02 18:20:00 | out 5 | 1002 | 2015-05-03 09:30:00 | in 6 | 1002 | 2015-05-03 18:10:00 | out

javascript - Radial Gradient in canvas doesn't fade properly -

Image
i trying make radial gradient javascipt/html canvas. problem gradients don't overlap if alpha channel isn't working. this code using: var gradient1 = ctx.createradialgradient(300, 300, 300, 300, 300, 0); gradient1.addcolorstop(0,"rgba(0, 0, 0, 0)"); gradient1.addcolorstop(1,"#ff0000"); ctx.fillstyle = gradient1; ctx.fillrect(x1, y1, 600, 600); ctx.fillrect(x1, y1, 600, 600); here picture: this reason fades black-like color rather staying red. leads act weird when 2 of these gradients of different colors touching. how can make react normally? cause the gradient defined is red-black , both color , alpha channel interpolated . @ 50% halfway between red , black, 50% visible why becoming black-ish. cure to fix make sure both color stops same color alpha channel changed. keep color same way: gradient1.addcolorstop(0, "rgba(255, 0, 0, 0)"); // red, transparent gradient1.addcolorstop(0, "#f00"); // ...

angular - How to get component properties from main component in Angular2? -

been scratching head crazy on this. basically want in index.html like: <app hero="iron man"></app> in main index.html file, able read value of hero in component class. been @ week, no avail. here's non-functioning plunkr: http://plnkr.co/edit/fnonsg0jmbwscsbi4kbt?p=preview thanks time , response! unfortunately, in scenario you're still not retrieving properties of object, you're putting second object inside first , retrieving properties. good news though else trying figure out, it's confirmed bug! https://github.com/angular/angular/issues/1858#event-305799002

loopbackjs - loopback connector for ElasticSearch -

there @ least 2 different packages available on npm, loopback-connector-elastic-search , loopback-connector-es . have not been able connect basic loopback api es instance, , sparse documentation on these 2 connectors not helping. any guidance appreciated on how can create api app using loopback , elasticsearch. originally loopback-connector-elastic-search published drakerian hasn't been under development since oct 1st, 2014 if peek commits: https://github.com/drakerian/loopback-connector-elastic-search loopback-connector-es fork original effort , under active development please use that. https://github.com/strongloop-community/loopback-connector-elastic-search and you'll notice hosted on github under strongloop-community means has future if current author (me) gets hit truck :) if after referring instructions here: https://github.com/strongloop-community/loopback-connector-elastic-search#loopback-connector-elastic-search ... have questions jump chat r...

How to write oauth client in spring? -

i find example online, use curl or link such http://localhost:8080/demo4ssh-security-oauth2/oauth/token?client_id=mobile_1&client_secret=secret_1&grant_type=password&username=wangwu&password=234567 test oauth. wil access token . , use http://localhost:8080/demo4ssh-security-oauth2/json?access_token=5aa5e5f9-43eb-49e3-8149-69406884cbd9 resource how can 2 actions in spring mvc code?? have no concept start? see spring security oauth2 example ( sparklr , tonr ). still can't figure out write actions in tonr . please give me simple example or explain how this, thank you it's provided spring. check out springoauth2resttemplate , enableoauth2client annotations. it's suggested first have idea oauth2 dance have better understanding. suggested blog . related sof question illustrate how configure , user oauth2 protected resource.

osx - What is happening to my sprite when using init(rect:inTexture:)? -

Image
i'm writing isometric game using spritekit , swift, , i'm having trouble sprites sheep. have basic ai randomly moves them around, when draws 2 big black horizontal lines instead of sheep. i'm using init(rect:intexture:) take first sub-image of sprite sheet. i'm doing 1 sheep test code. here's code: // // animal.swift // anointed // // created jacob jackson on 4/26/15. // copyright (c) 2015 thinkmac innovations. rights reserved. // import foundation import spritekit /* defines animal */ class animal : skspritenode { let animalname: string //name let descript: string //description let spritesheetname: string //image name item icon var deltat = 0.0 var starttime = 0.0 init( name: string, desc: string, sheetname: string ) { animalname = name descript = desc spritesheetname = sheetname let texture = sktexture(rect: cgrect(x: 0, y: 0, width: 32, height: 32), intexture: sktexture(imagenamed: spri...

xcode - removeobjectAtIndex: causes index to be -1; -

i have nstableview populated array called tablearray. have button supposed remove selected item array. in removeitem: method: [tablearray removeobjectatindex:[tableview selectedrow]; [tableview reloaddata]; but error: 2015-05-13 18:16:45.283 fileshedb1.0[979:303] *** -[__nsarraym objectatindex:]: index 18446744073709551615 beyond bounds [0 .. 0] 2015-05-13 18:16:45.288 fileshedb1.0[979:303] ( 0 corefoundation 0x00007fff8d35ff56 __exceptionpreprocess + 198 1 libobjc.a.dylib 0x00007fff93119d5e objc_exception_throw + 43 2 corefoundation 0x00007fff8d2ed392 -[__nsarraym objectatindex:] + 274 3 fileshedb1.0 0x00000001000028a9 -[mpomainwindowcontroller tableviewselectiondidchange:] + 201 4 foundation 0x00007fff8cca0d0e __-[nsnotificationcenter addobserver:selector:name:object:]_block_invoke_1 + 47 5 corefoundation 0x0...

java - Finding Mode of a Data Set using HashMap and ArrayList. Can't figure it out -

this question has answer here: what's simplest way print java array? 23 answers so i'm trying make set of methods find mode of set of ints given (in form of array), , return array holding of modes, including possibility of no modes. sat down while writing these snippets of code , couldn't work, after extensive debugging. code isn't in great style want know if figure out going wrong. way, main() method there test out method. here's code: public static int[] getmode(int[] numset) { map<integer, integer> vals = new hashmap<integer, integer>(); arraylist<integer> modes = new arraylist<integer>(); int highcount = 0; for(int num : numset) { if(vals.containskey(num)) vals.put(num, vals.get(num) + 1); else vals.put(num, 0); } if(allvaluesequal(vals)) return ...

c# - Retrieving an Attribute Value from an XNode -

i have xml file loaded , select last element. here code: xdocument doc = xdocument.load("something.xml"); var last = doc.root.lastnode; the code above outputs last element on xml file. here code: <link num="4" url="yahoo.com">yahoo</link> i want able select value 4 of num . here code: num="4" how can select number 4 last node? try this: xdocument xdoc = xdocument.parse(xml); string num = xdoc.root.elements().last().attribute("num").value; console.writeline(num); make sure have added following using: using system.linq; using system.xml.linq;

amazon web services - Enterprise private Docker registry best practices -

this question sprang mind preparing on rolling out our own private registry. enterprise best practice , why? q1: run multiple registries 1 s3 storage backend? each registry have setting makes push dev, qa or prod (top level) folders in same s3 bucket. run 1 registry 1 s3 storage backend dev/qa/prod environments? since whole point of docker have image run anywhere same, provide different docker run parameters, since docker image same across env, run arguments pass different. run 1 registry , 1 s3 storage backend per env q2: what best practice promoting image dev way prod? tool sets involved. example have central gitlab our dockerfiles, when check in our new dockerfile, there hook triggers jenkins build image dockerfile , check in registry. way promote (unless chose option 2 earlier q1) images next level - qa, , prod? q3: if update 1 of base images, way make sure change propagates upstream other images in registry? example update customized base ubuntu dockerfile new ...

ios - Don't invoke edit mode on 'swipe to delete' -

i have implemented edit button in swift app self.navigationitem.leftbarbuttonitem = self.editbuttonitem() . when swipe cell on table view delete, edit mode invoked. there way make swipe delete not invoke edit mode? have make own edit mode?

r - How to find the cross correlation between two time series over different periods? -

i have 2 time series. each point in either time series week. week here not calendar week, first week in calendar year starts jan 1, , other weeks in same year follow that, , last week of year may contain more 7 days no more 13 days. the first time series stored in compressed (.gz) text file a.gz, looks (each week , corresponding time series value separated comma in line): week,value 20060101-20060107,0 20060108-20060114,5 ... 20061217-20061223,0 20061224-20061230,0 20070101-20070107,0 20070108-20070114,4 ... 20150903-20150909,0 20150910-20150916,1 the second time series b stored in compressed (.gz) text file b.gz, on subset of period of a, looks like: week,value 20130122-20130128,509 20130129-20130204,204 ... 20131217-20131223,150 20131224-20131231,148.0 20140101-20140107,365.0 20140108-20140114,45.0 ... 20150305-20150311,0 20150312-20150318,364 i wonder how calculate cross correlation between 2 time series , b (up specified maximum lag), , plot , b in single plot, in r? ...

jquery - Why is my javascript not functioning? -

Image
i'm using layout codepen: http://codepen.io/trhino/pen/ytoqv and have put parts of code html not functioning. can tell me why , can fix it? want codepen tutorial actual image gallery effect , 'click expand' , 'collapse' buttons. here site looks @ minute (ignore stretched photos, correcting once have sorted javascript) http://me14ch.leedsnewmedia.net/portfolio/photo.html really appreciate help! code: <h2>(click on box expand gallery)</h2> <div class="wrap"> <div id="picture1" class="deck"> <img src="http://www.me14ch.leedsnewmedia.net/portfolio/gallery/newyork1.jpg"> </a> </div> <div id="picture2" class="deck"> <img src="http://www.me14ch.leedsnewmedia.net/portfolio/gallery/newyork2.jpg"> </a></div> <div id="picture3" class="deck"> <img src=...

python - Cross Entropy for batch with Theano -

i attempting implement rnn , have output predictions p_y of shape (batch_size, time_points, num_classes). have target_output of shape (batch_size, time_points), value @ given index of target_output integer denoting class (a value between 0 , num_classes-1). how can index p_y target_output probabilities of given class need compute cross-entropy? i'm not sure how in numpy. expression p_y[target_output] not give desired results. you need use advanced indexing (search "advanced indexing" here ). theano advanced indexing behaves differently numpy knowing how in numpy may not helpful! here's function setup, note order of dimensions differs yours. use (time points, batch_size, num_classes). assumes want use 1-of-n categorical cross-entropy variant. may not want sequence length padding either. def categorical_crossentropy_3d(coding_dist, true_dist, lengths): # 0 out false probabilities , sum remaining true probabilities remove third dimension. index...

javascript - Rendering dynamically generated {{link-to}} links in an Ember.js Handlebar template expression -

i have ember template rendering text handlebar expression, i.e. {{caption}} . text being rendered has hashtags in it, each of need make clickable, , going specific route in ember app. i created helper parse text , replace each hashtag link necessary route combined hashtag, handlebar expression looks like: {{clickable-hashtags caption}} . however, helper creates links using regular html <a href> tags, , returned using ember.handlebars.safestring. i use ember's {{#link-to}} helper method each hashtag instead, can't seem figure out how that. possible handlebars parse out link-to tags within template's {{caption}} expression? well, computed property the caption: this #hashtag caption in controller: computedcaption: function () { var words = caption.split(" "); return words.map(function (e) { var ishashtag = e.charat(0) === "#"; return {ishashtag: ishashtag, text: e}; }); }.property(...

algorithm - Storing vertex in a priority queue base on the weight of edges (C++) -

i having difficult time trying implement code. created class called vertex, each vertex points other vertices creating graph , adjacency list, implement created struct inside class vertex called edge. each edge has weight , vertex pointing to. heres code give better understanding. vertex { public: void setpq() { for( int = 0; < adjlist.size(); ++i) { pq.push( adjlist[i].node ); } } private: struct edge { vertex* node; // vertex edge pointing int thatvertex; float weight; egde( ) { thatvertex = 0; weight = 0; } bool operator<( const edge & rhs) { return this.weight < rhs.weight; } }; vector< edge > adjlist; int thisvertex; int dist; bool known = false; piority_queue< vertex*, vector<vertex*>, edge > pq; }; i'm implementing dijkstra algorithm thats why have known , dist , other stuff. want in each vertex (...

javascript - How to disable onload on this js -

i'd disable onload popup , show after clicking url link (onlick="echosec()" ). did 2nd step, after pressing button works good, shows @ page load too. don't want that. there no onload function in code. me? /* * project: jquery echosoc - social sharer init * description: echosoc light weight jquery plugin social shares. * author: dvl-den * license: copyrights dvl-den. rights reserved. */ ;(function ($, window, document, undefined) { // create defaults once var pluginname = 'echosoc'; var defaults = { title : 'echosoc social sharer', facebook_button : true, facebook_url : window.location.origin, twitter_button : true, twitter_url : window.location.origin, twitter_message : 'echosoc social sharer tweet message!', google_button : true, google_url : window.location.origin, timeout : 30, message : 'like, tweet or +1 unlo...

c# - QueryString Out of Encoded URL -

i have encoded url. http%3a%2f%myurl.test.me%2fsometjing%2fproduct%2fsearch%3fq=tomato i trying query string out of url "tomato". using following code returns null. var parsedquery = httputility.parsequerystring((url)); console.write(parsedquery["q"]); // null you're missing few steps. need decode url, pull out query string, , parse query string: string decoded = httputility.urldecode("http%3a%2f%2fmyurl.test.me%2fsometjing%2fproduct%2fsearch%3fq=tomato"); var uri = new uri(decoded); var parsedquery = httputility.parsequerystring(uri.query); console.writeline (parsedquery["q"]); // tomato also, encoded url little malformed. 1 in post decoded looks this: http:/%myurl.test.me/sometjing/product/search?q=tomato i think missed 2f after % right before myurl.test : http%3a%2f%2fmyurl.test.me%2fsometjing%2fproduct%2fsearch%3fq=tomato