Posts

Showing posts from September, 2011

objective c - How to convert a method name into a String -

i´m developing little game right , want have several levels. i´m asking if it´s first time app gets launched. if it´s user start @ level1. if want start method. have methods like: -(void)level1{}; -(void)level2{}; . . . till level 100 or so. after if got amount of times app got started want call method, fits. tried make like: [self [nsstring stringwithstring:@"level%d", level]]; because "level" has number 1,2,3...,100. tried make level1,level2, level3, , on. error -> unexpected interface name 'nsstring': expected expression. can please me? in advance! peace! you need use nsselectorfromstring() : nsstring* methodname = [nsstring stringwithformat:@"level%d", level]; sel sel = nsselectorfromstring(methodname); [self performselector:sel];

R ggmap ggplot2 error "Error: Discrete value supplied to continuous scale" -

Image
first of all, apologise. i know there numerous threads error, have tried numerous solutions , have not managed solve issue. i have tried transforming data numerous forms still same error, or ggplot2 not support data format. here code: library(ggmap) library(ggplot2) library(data.table) setwd("~/projects/reformat") map <- get_map(location = c(-4,54.5), zoom = 6) data <- read.csv('lonlatprice.csv') colnames(data) <- c('longitude','latitude','price') ggmap(map, extent = "device") + geom_point(aes(x = data$longitude, y = data$latitude), colour = "red", alpha = 0.1, size = 2) this data format like: > head(data) longitude latitude price 1 53.778274 -2.48129 147500 2 52.833819 -0.936527 182000 3 50.792457 0.046043 193000 4 51.476984 -0.612126 580000 5 51.460139 -0.01867 905000 6 52.235942 1.519404 641500 thanks in advance help, have ask

javascript - d3.js to remove two elements with matching attribute when clicked consecutively -

i have 2 elements identical href attributes. clicked, adding class. if, in addition, href of element clicked first equal href of element clicked second, filtered out. removebubble = function(d) { var currentid; currentid = idvalue(d); d3.select(this).classed("clicked",true); // on click add class if (d3.selectall(".clicked").length === 2 && // 2 elements class clicked d3.select(this).prev.attr("href") === // href of 1st elem d3.select(this).next.attr("href")) // href of 2nd elem { // filter here } }; the task: 1. check if elements clicked have matching href how can achieve .prev() , .next() - jquery assessors - effect in d3.js ? so far: uncaught typeerror: a.target.classname.indexof not function here final working solution comments: removebubble = function(d) { var currentid; currentid = idvalue(d); // when clicked attach class var

python - Beautiful soup webscrape into mysql -

the code far downloads , prints onto screen,but how printed material sql database.if wanted data csv files seems python(on day) creates file automatically.obviously transferring mysql assume have create database beforehand in order receive data.my question how data scrape database omitting csv step altogether. in anticipation have downloaded pymysql library.any suggestions aprreciated..looknow from urllib import urlopen bs4 import beautifulsoup html = urlopen("http://www.officialcharts.com/charts/singles- chart/19800203/7501/" ) bsobj = beautifulsoup(html) namelist = bsobj. findall("div" , {"class" : "artist",}) name in namelist: print(name. get_text()) html = urlopen("http://www.officialcharts.com/charts/singles- chart/19800203/7501/" ) bsobj = beautifulsoup(html) namelist = bsobj. findall("div" , {"class" : "title"}) name in namelist: print(name. get_text()) so there

Unity3D Camera jittering when dragging -

i'm making game in want able drag camera across scene. wrote following code: // when dragging if(touchdetection.touchdragging && introbusy == false) { if(dragactive == false) { dragstartpos = touchdetection.touchpositionwp; camerastartpos = camera.main.transform.position; dragactive = true; camerafollowingplayer = false; } vector2 temp = touchdetection.touchpositionwp - dragstartpos; camera.main.transform.position = camerastartpos - new vector3(temp.x, temp.y, 0); } if(touchdetection.touchdragging == false) { dragactive = false; } during drag, however, camera move, has jitter while moving. further away drag, bigger jitter becomes. i've spent hours searching problem, have still not found solution. a couple of points 1. it's practice move cameras in lateupdate rather in update. allows camera render after bodies have been moved.

download - Files downloaded as Binary with Java are corrupted -

i have written downloader should used download text files, images. download files binaries. many of downloads work well, parts of text files , many image files corrupted. errors occur @ same files , @ same places (as long can tell when analysing text files). used code downloading: public file downloadfile(httpurlconnection connection) { return writefiledatatofile(getfiledata(connection)); } //downloads data of file , returns content string private list<byte> getfiledata(httpurlconnection connection) { list<byte> filedata = new arraylist<>(); try (inputstream input = connection.getinputstream()) { byte[] filechunk = new byte[8*1024]; int bytesread; { bytesread = input.read(filechunk); if (bytesread != -1) { filedata.addall(bytes.aslist(filechunk)); filechunk = new byte[8*1024]; } }

javascript - Blocked myself from server with form submissions -

so i've been working on client involving simple form generates url , resultant page outputs table. form explicitly set method="post" , action="" , js handling url so: onsubmit="this.action='{site_url}/entries/'+this.survey.value+'/'+this.job_number.value;" the form works fine, after several dozen submissions (mostly re-submissions of same form), server has blocked ip (via csf). what has caused , how can prevent happening again? the owner of service using either cooperating or not. if he/she cooperating you, should ask them cause of issue. sure give information need know server, not encounter issue again long follow policies. if not cooperating you, well, unlucky event, without solution.

c - A loop to read characters from console till EOF character is encountered using getchar() is not exiting when EOF character is encountered -

this question has answer here: why 2 eof needed input? [duplicate] 2 answers why require multiple eof (ctrl+z) characters? 5 answers here program read character console , print them in reverse order. #include<stdio.h> main() { int ch, count = 0; char a[100]; printf("enter charachters\n"); ch = getchar(); while(ch != eof && count<100) { a[count] = ch; count = count+1; ch = getchar(); } printf("\ncount = %d\n",count); while (count>0) { count = count -1 ; putchar(a[count]); } } my questinon is: when give eof character (ctrl+d) after typing in few characters on console, not exit out of loop. not add count variable not exit loop. if eof character first character after newline character, read , loop exited. eg if sample input

ruby on rails - Bootstrap Grid isn't working properly -

i installed bootstrap rails , decided test out making grid. code. <div class="row"> <div class="span4"> <h1>about creator</h1> <p> </p> </div> <div class="span8"> <h1>about site</h1> <p> </p> </div> </div> this looks like. can see, it's in 2 rows, should in 2 columns. there doesn't seem wrong code far can see. don't think made mistake during installation, because when installed bootstrap, automatically stylized webapp. help? what version of bootstrap using? in recent versions of bootstrap syntax <tag class="col-xs-4"> rather <tag class="span4"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/> <div class="row"> <div class="col-xs-4&

java - ThreadPoolTaskExecutor keep running, how to control shutdown? -

i writing spring boot app threadpooltaskexecutor. here application class: import info.gandraweb.apns.service.messageservice; import info.gandraweb.apns.settings.appsettings; import org.slf4j.logger; import org.slf4j.loggerfactory; import org.springframework.aop.interceptor.asyncuncaughtexceptionhandler; import org.springframework.aop.interceptor.simpleasyncuncaughtexceptionhandler; import org.springframework.beans.factory.annotation.autowired; import org.springframework.boot.springapplication; import org.springframework.boot.autoconfigure.enableautoconfiguration; import org.springframework.boot.autoconfigure.springbootapplication; import org.springframework.context.applicationcontext; import org.springframework.scheduling.annotation.asyncconfigurer; import org.springframework.scheduling.annotation.enableasync; import org.springframework.scheduling.annotation.enablescheduling; import org.springframework.scheduling.concurrent.threadpooltaskexecutor; import java.util.concurrent.exe

Position of point in mantissa -

i trying understand how java works floating point. understand there must sign,exponent , mantissa in 32 bits (float). however, can't understand how java defines decimal part in mantissa. understand mantissa can 0,.... till 9,...... the question how java defines position of point. explain? java doesn't define how float works, ieee does. float binary format possible range of 24-bit mantissa normal numbers 0b1.0000 0000 0000 0000 0000 0000 to 0b1.1111 1111 1111 1111 1111 1111 this represents 1.0 2.0 - 1/2^24 for normal numbers mantissa starts 1 not stored. because values sign * 2^exp * mantissa. the exp adjusted mantissa starts 1. there sub-normal numbers don't this, applies small numbers. if want see how float represented can have at int = float.floattorawintbits(1.5); the i have 32-bit value represents float

Run multiple elasticsearch service on ubuntu -

i'm trying run multiple nodes on pc (ubuntu) learning purpose. try copy /etc/init.d/elasticsearch , rename etc/init.d/elasticsearch1 . both nodes run succesfully seems both use same config etc/elasticsearch/elasticsearch.yml not /etc/elasticsearch/elasticsearch1.yml . here elasticsearch1 init.d file (since file has no extension, did call right?) : https://gist.github.com/anonymous/0b8e21b46909b46f2cab and debug result sudo service elasticsearch1 start : start-stop-daemon --start -b --user "elasticsearch" -c "elasticsearch" --pidfile "/var/run/elasticsearch1.pid" --exec /usr/share/elasticsearch/bin/elasticsearch -- -d -p /var/run/elasticsearch1.pid -- default.config=/etc/elasticsearch/elasticsearch1.yml --default.path.home=/usr/share/elasticsearch --default.path.logs=/var/log/elasticsearch1 --default.path.data=/var/lib/elasticsearch1 --default.path.work=/tmp/elasticsearch --default.path.conf=/etc/elasticsearch in debug result, con

html - CSS - Remove Start Animation -

let me off before ask question. not want use jquery. i want menu grow , shrink on hover so: @keyframes menugrow { 0% { width:25px; height:25px; } 25% { width:20%; height:25px; } 100% { height:100vh; width:20%; } } and shrink so: @keyframes menushrink { 0% { width:20%; height:100vh; } 75% { width:20%; height:25px; } 100% { height:25px; width:25px; } } and here's have activate these two: .menu { background:#1a1a1a; width:25px; height:25px; animation: menushrink 0.3s linear; } .menu:hover { animation: menugrow 0.3s linear; height:100vh; width:20%; } all want there no animation when page loaded. here's jsbin project . i know it's weird i'm answering own question. i figured out answer @daemedeor. here's final result . did put onmouseout directed javascript function menuout() (obviously change that, chose name). javascript code ended being: function men

java - How to add rectangles on top of existing rectangle in canvas -

Image
i'm trying add red rectangles within existing canvas on top of specific boxes expected result image don't appear @ code shows current undesired outcome when deploy app. code create 4 rectangles on top row , 4 rectangles on bottom row want added on top of boxes 2-6 know code needs added red rectangles on top of boxes 1 & 7. know i'm doing wrong , how fix this? appreciated. public class rectangletextview extends view { private final paint mblackpaint = new paint(); private final paint mredpaint = new paint(); private final textpaint mtextpaint; public rectangletextview(context context, attributeset attrs) { super(context, attrs); int valueindp = (int) typedvalue.applydimension(typedvalue.complex_unit_dip, 1, getresources().getdisplaymetrics()); int valueinsp = (int) typedvalue.applydimension(typedvalue.complex_unit_sp, 20, getresources().getdisplaymetrics()); mredpaint.setcolor(color.parsecolor("#cc3333")

Python, Mongodb and timestamp -

this question has answer here: create isodate pymongo 3 answers i 'm doing google api flights python, , put timestamp , , saw json api generates large, serious use mongodb database , store. i'm little lost place timestamp @ mongodb , make these data stored there. give me quick explanation , " stepping stones " ( shall begin , etc.) ? thank you: d some quick googling reveals can use python's datetime module. take at post. also here's example pymongo tutorial : import datetime post = {"author": "mike", "text": "my first blog post!", "tags": ["mongodb", "python", "pymongo"], "date": datetime.datetime.utcnow()} posts = db.posts posts.insert(post)

c# - Efficient search for generic objects without predecessors -

i have genobjectlist of generic objects , openlist of generic objects still needs used. of generic objects depend on each other. generic objects of predecessors used used. implementation use following: var genobjectlist = // generic objects somewhere var openlist = new list<genobject>(genobjectlist); var closedlist = new list<genobject>(); var rand = new random(); while (openlist.count != 0) { var candidatelist = openlist.findall( t => t.predecessors.where(p => genobjectlist.contains(p)).intersect(closedlist).count() == t.predecessors.count(p => genobjectlist.contains(p))); var choosengenobject = candidatelist[rand.next(0, candidatelist.count)]; openlist.remove(choosengenobject); closedlist.add(choosengenobject); // generic object } the part find candidatelist seems inefficient if genobjectlist contains 300 entries. i'm looking bette

c++ - Intuitive way to make something like a member function for an enum class (C++11) -

near can tell ideal thing i'm looking outside of c++11 spec, if otherwise had enum class core of this: enum class color { red, orange, yellow, green, cyan, azure, blue, magenta }; i ideally have wanted have (non-virtual) member functions such define this: color color::complement() const { switch(*this) { case red:return cyan; case orange: return azure; case yellow: return blue; case green: return magenta; case cyan: return red; case azure: return orange; case blue: return yellow; case magenta: return green; } } of course, c++11 spec doesn't allow define member functions enum classes, not possible. now strictly speaking, don't really require complement function regular member function, specifically, if not be, ideally want somehow still specified using color:: scope resolution. static member function have been fine, taking color argument parameter, again... c++11 not allow have static member functions in enum class. on

qt - QML import style file from subdirectory -

i have problem importing style files subdirectory. this concerning section in *.pro file: qml_import_path = \ src/gui/qml/views/startview/ \ src/gui/qml/views/createlocalgameview/ \ src/gui/qml/views/ \ src/gui/qml/components/styles/ \ src/gui/qml/components/ \ src/gui/qml/js/ for example have file mytextfieldstyle.qml placed in src/gui/qml/components/styles/: textfieldstyle { [...] } and have file textarea.qml placed in src/gui/qml/components/: item { [...] textfield { id: textfield style: mytextfieldstyle {} } [...] } now error: textarea.qml: mytextfieldstyle not type if put mytextfieldstyle.qml in same directory textarea.qml (src/gui/qml/components/) works fine. have many components , many styles , want seperate them have better overview. there way can working? it should enough putting @ top of file import statement relative paths. in example, can use import './styles' . as stated in comments, qml_import

algorithm - Search a 16 GB file on disk with 8 GB RAM -

i asked following interview question of late, "you have 8 gb ram , 16 gb file " how perform search on file ? then asked type of file ,what language ?, said format,any language increase confusion ! after while asked me assume text file ! answer per knowledge shared interviewer : edit : use buffered streams custom size , sort data on buffer apply binary search on buffered streams (if it's relevant) ! i believe interviewer not convinced !! i understand question vague ! i want know point missed ask interviewer , probable solution ? guidance or advice on appreciated ! thanks ! i solution search first in first half of file linear search; if search fails perform same action on second half of file. your solution wrong because didn't take account memory limit : how buffer , sort content if can't load in memory (you can have explain how)? same applies binary search: can't use standard algorithm, have customize it. moreover, if you'

MSYS2: Setting up an Opengl development environment -

i have installed msys2 , mingw (mingws 32 bit , 64 bit building). now, want setup opengl libraries development. packages should install using pacman? , compiling application using opengl , other popular opengl libraries linker library flags need? (my main needs glu, glut , glew if inform other libraries available in msys2 great!)

ios - I can't animate UICollectionViewCell subclass or any of it's subviews -

i have animation function use in many other parts of app , works perfectly: class func pulse(view: uiview, sizemultiplier: float, duration: nstimeinterval, repeatcount: float = 1.0) { let pulseanimation = cabasicanimation(keypath: "transform.scale") pulseanimation.duration = duration pulseanimation.tovalue = nsnumber(float: sizemultiplier) pulseanimation.timingfunction = camediatimingfunction(name: kcamediatimingfunctioneaseineaseout) pulseanimation.autoreverses = true pulseanimation.repeatcount = repeatcount view.layer.addanimation(pulseanimation, forkey: nil) } for reason though, can't animate cell in uicollectionview in didselectitematindexpath function (which being called, checked breakpoints), have this: let cell = collectionview.dequeuereusablecellwithreuseidentifier("cell", forindexpath: indexpath) as! modulecell animations.pulse(cell, sizemultiplier: 2.0, duration: 0.2, repeatcount: 2) any ideas?

ios - Could not cast value of type 'UIViewController' -

i trying implement bwwalkthrough in project. error stating unknown class _ttc20bwwalkthroughexample27bwwalkthroughviewcontroller in interface builder file. not cast value of type 'uiviewcontroller' (0x195bca580) 'appname.bwwalkthroughviewcontroller' (0x10042c3a0). (lldb) it pointing @ below code let walkthrough = stb.instantiateviewcontrollerwithidentifier("walk") as! bwwalkthroughviewcontroller i don't know why happening, appreciated, thank you. also feel free ask more code project. your storyboard doesn't seem linked bwwalktroughviewcontroller . find view controller should bwwalktroughviewcontroller , , check if one.

php - extract count of each comma separated array word -

i want extract count of each comma separated word following array. tried multiple functions (recursive/non-recursive) nothing seems work. array_count_values function giving combined count of keys 3 whereas should give output 3 against each word since 3 sub arrays same. actual array array ( [0] => bangalore, chennai, delhi, gurgaon, hyderabad, kolkata, mumbai / navi mumbai, noida, guntur [1] => bangalore, chennai, delhi, gurgaon, hyderabad, kolkata, mumbai / navi mumbai, noida, guntur [2] => bangalore, chennai, delhi, gurgaon, hyderabad, kolkata, mumbai / navi mumbai, noida, guntur ) this link seems quite close & giving following output array ( [bangalore] => 1 [chennai] => 1 [delhi] => 1 [gurgaon] => 1 [hyderabad] => 1 [kolkata] => 1 [mumbai / navi mumbai] => 1 [noida] => 1 [guntur] => 1 ) required output array ( [bangalore] => 3 [chennai] => 3 [delhi] => 3 [gurgaon] =&g

Eclipse/Maven: "Unable to provision" -

having upgraded eclipse mars getting number of errors on each pom file. unable provision, see following errors: 1) error injecting constructor, java.security.nosuchalgorithmexception: error constructing implementation (algorithm: default, provider: sunjsse, class: sun.security.ssl.sslcontextimpl$defaultsslcontext) @ io.takari.aether.connector.aetherrepositoryconnectorfactory.<init>(unknown source) @ classrealm[plexus.core, parent: null] (via modules: org.eclipse.sisu.wire.wiremodule -> org.eclipse.sisu.plexus.plexusbindingmodule) while locating io.takari.aether.connector.aetherrepositoryconnectorfactory while locating java.lang.object annotated * all working fine in previous eclipse installation. have tried updating , cleaning. i had same problem. updated java , worked fine.

javascript - Text fadein/fadeout animation in loop -

i trying create simple animation in loop every time works wrong. how should work? test 1 fadein, wait 2 seconds and test 2 fadein, wait 2 seconds and test 3 fadein, wait 2 seconds and test 4 fadein, wait 2 seconds and fadeout test 1, test 2, test 3, test 4 @ same time (important, can't achieve this) then test 5 fadein, wait 2 seconds and test 6 fadein, wait 2 seconds and test 7 fadein, wait 2 seconds and test 8 fadein, wait 2 seconds and fadeout test 5, test 6, test 7, test 8 @ same time (important, can't achieve this) loop process. my html code: <div class="col-md-12 slogan text-right"> <h1 class="slogan1">test 1</h1> <h1 class="slogan2">test 2</h1> <h1 class="slogan3">test 3</h1> <p class="slogan4">test 4</p> <h1 class="slogan5">test 5</h1>

html - The screen size overwrites the other ones :S -

ive been trying make change of category images depending on screen size. right first screen width size being used. seems though other ones being overridden first row of code (max-width: 769px). (on site: http://origami.directory/ ) what can changes 3 times should do? .category-list-item { float: left; padding: 1em; } @media screen , (max-width: 769px) { .category-list-item { width: 20%; } }; @media screen , (min-width: 480px) { .category-list-item { width: 25%; } }; @media screen , (max-width: 480px) { .category-list-item { width: 33.33%; } }; if me fix super grateful! / martin remove semi-colon ; end of queries. your queries should this: @media screen , (max-width: 769px) { .category-list-item { width: 20%; } } @media screen , (min-width: 480px) { .category-list-item { width: 25%; } } @media screen , (max-width: 480px) { .category-list-item { width: 33.33%; } } your queries conflicting each other making second query obsolete. specify

Why the following SQL Server query returns 12 months data and not 14 months data -

i have following query returns data 12 months. query 14 days , changed day month in datediff method 14 months data getting 12 months data. can please check , see why? select 'playing' activity --,ad.xdate ,min(ad.xdate) xdate ,isnull(sum(t.timeperday),0) timeperday alldates ad (nolock) left join @test t on ad.xdate = t.date group datepart(month, ad.xdate) --order year(datepart(month, ad.xdate)) desc, month(datepart(month, ad.xdate)) desc, day(datepart(month, ad.xdate)) order min(ad.xdate) option (maxrecursion 0) end you need group both month , year parts of ad.xdate. there twelve months of year , should seeing earliest 2 (14 - 2) month of results totals large because represent combination of 2 calendar months. it worked in original version because there more 14 days in month. if tried extend old query beyond 31 days (or 28, 29, 30 months) find same problem on again. ... select 'playing' activity, min(ad.xdate) xdate, isnull(sum(t.

javascript - Can I make a hit counter from this? -

i have personal wiki , have wanted add personal hit counter, isn't third party. know can use php , can locally through javascript in wiki platform don't have access information. however able find this: <input type="hidden" name="name" value="randomnumbersandtext"> which directly associated how track views. there anyway use track views? use javascript track page view information , display on different one? information how track views nice, don't know it. if want yourself. can use php insert visitors ip in mysql database. can count number of rows , display :)

powershell - Created copy taking too much free space -

i found problem using robocopy in powershell. used tool backup files 1 disk (around 220gb) using command: robocopy $source $destination /s /mt:8 the problem created copy took lot of free space in destination location (i stopped making backup when reached around 850gb). know why has happened? may there're loops involved. robocopy has ability skip ntfs junction points can cause copying failures because of infinite loops try run /xj flag or list/log files copied check loops see robocopy help , post it up faces same problem: there infinite loops found using windirstat. application data/documments , settings/users folders

Swift function, two names for one parameter -

this question has answer here: what point of having 2 different names same parameter? 3 answers i have noticed methods e.g. init(nibname nibname: string?, bundle nibbundle: nsbundle?) has 2 "names" 1 parameter except first 1 not possible use inside method. in case not able use bundle can use nibbundle. example, when call super.init(nibname: nibname, bundle: bundle) error "use of unresolved identifier 'bundle'". my question is: (double named parameter) for? how use properly? edit: obvious external parameter names thing. have subclass of uiviewcontroller , override following method. don't nibbundle gets from? apparently not defined in function header. override init(nibname nibnameornil: string?, bundle nibbundleornil: nsbundle?) { super.init(nibname: nibnameornil, bundle: nibbundleornil) let somebundle = nibbundle prin

DAO Setter shows NullPointerException error when setting the BigDecimal value - Java Swing -

i getting following error when set decimal values. please ignore naming convention, sorry being copied legacy application. error exception in thread "awt-eventqueue-0" java.lang.nullpointerexception @ com.shams.mainwindow.btnsaveactionperformed(mainwindow.java:161) @ com.shams.mainwindow.access$200(mainwindow.java:25) @ com.shams.mainwindow$3.actionperformed(mainwindow.java:85) @ javax.swing.abstractbutton.fireactionperformed(abstractbutton.java:2022) @ javax.swing.abstractbutton$handler.actionperformed(abstractbutton.java:2346) @ javax.swing.defaultbuttonmodel.fireactionperformed(defaultbuttonmodel.java:402) @ javax.swing.defaultbuttonmodel.setpressed(defaultbuttonmodel.java:259) @ javax.swing.plaf.basic.basicbuttonlistener.mousereleased(basicbuttonlistener.java:252) @ java.awt.awteventmulticaster.mousereleased(awteventmulticaster.java:289) @ java.awt.component.processmouseevent(component.java:6525) @ javax.swing.jcomponent

security - public key cryptography and authentication for cross-platform network application -

i'm developing network based application control , telemetry on linux based embedded system. i'm using zmq network library , google protocol buffers serialization library communication purposes. i took @ curvezmq there no official binding c++ , not want mess implementation czmq binding. therefore decided not want use curvezmq extension , i want use external library authentication , encryption. i want apply following security measurements application/system: "curve" security mechanism, give me strong encryption on data, , (as far know) unbreakable authentication. client public key authentication. i appriciate library binding many programming languages because client application going run on many different platforms. nice have: curve25519 elliptic curve cryptography (ecc) algorithm. i believe can encapsulate handshake messages in protocol buffers messages.. so idea establish secure tunnel between server , client , somehow enforce client , server

c# - How to navigate to specifically position on ListBox Windows Phone 8.1 -

i have listbox lot of items, , each items when clicked go new page, want when return second page, stay @ same position of item clicked! thats list! <listbox x:name="list" loaded="listview_loaded" selecteditem="true" selectionchanged="searchresultslist_selectionchanged" itemssource="{binding}" background="{x:null}"> <!--<listview.itemcontainerstyle> <style targettype="listviewitem"> <setter property="horizontalcontentalignment" value="stretch"/> <setter property="margin" value="0,0,0,15" /> </style> </listview.itemcontainerstyle>--> <listbox.itemtem

class - In JavaScript, how can you access a property of a superclass' instance? -

in javascript, how can access property of superclass' instance? example, i'd "prop" of superclass' instance set "true", code creates , sets "prop" of subclass' instance "true", leaving superclass' instance's "prop" false: var superclass = function() { this.prop = true; } superclass.prototype.dostuff = function() { if (this.prop) { console.log('superclass a.'); } else { console.log('superclass b.'); } } superclass.prototype.load = function() { this.prop = false; } superclass.prototype.setprop = function(val) { this.prop = val; } function subclass() { superclass.call(this); } subclass.prototype = object.create(superclass.prototype); subclass.prototype.constructor = subclass; subclass.prototype.dostuff = function() { superclass.prototype.dostuff(); if (this.prop) { console.log('subclass a.'); } else {

node.js - npm run gulp with parameters -

i've started learning gulp , i'm dealing small issue. have following file: //test gulp file var gulp = require("gulp"), uglify = require("gulp-uglify"); //scripts task //uglifies gulp.task("scripts", function(){ console.log("run scripts"); gulp.src("public/src/js/home/app.js") .pipe(uglify()) .pipe(gulp.dest("public/src/js/home/bundle")); //use *.js uglify }); gulp.task("default", []); when trying execute file using: npm run gulp scripts it not execute assigned task. however, when add parameters of default: gulp.task("default", ["scripts"]); it work when run npm run gulp i installed gulp locally in project folder. reason why passing "scripts" parameter doesn't work? only npm >= 2 pass arguments scripts, it's part of new features can see in "why 2.0.0?" part here

jquery + codeigniter + knockout + sammy, cannot retrieve post data -

i'm using codeigniter 3.0rc2, jquery 1.11.3, knockout.js 3.3.0 , sammy.js. i'm trying post call , retrieve json data put in viewmodel. my view is: <!-- mails grid --> <table class="mails" data-bind="with: chosenfolderdata"> <thead><tr><th>from</th><th>to</th><th>subject</th><th>date</th></tr></thead> <tbody data-bind="foreach: mails"> <tr data-bind="click: $root.gotomail"> <td data-bind="text: from"></td> <td data-bind="text: to"></td> <td data-bind="text: subject"></td> <td data-bind="text: date"></td> </tr> </tbody> </table> my viewmodel is: function webmailviewmodel() { // data var self = this; self.folders = ['inbox', 'ar

Python: Class attribute vs. List Index -

i have list of 'purchase' objects stored in list. subset of list, complex analysis, , update properties of purchase objects, based on analysis. if grab subset of purchase records using list comprehension, copies of objects, copies of these objects, must have way of going , updating master list. if add 'id' attribute purchase class. can object in master list id, able find index, faster. considered using dictionary key being identity, somehow feel missing obvious solution. to clarify main issue here, list index of subset cannot used find original object in master list want update.

Approaches to create a video in matlab -

what possibilities create videos in matlab? searching , found 3 toolboxes work in field, image processing, image acquisition , control vision... how can without them, create video scratch? i'm interested in various approaches have overview, unable find decent tutorial or consistent source of info on internet. thanks help! here of different ways create movies in (core) matlab. movie2avi %# figure figure, set(gcf, 'color','white') z = peaks; surf(z); axis tight set(gca, 'nextplot','replacechildren', 'visible','off'); %# preallocate nframes = 20; mov(1:nframes) = struct('cdata',[], 'colormap',[]); %# create movie k=1:nframes surf(sin(2*pi*k/20)*z, z) mov(k) = getframe(gca); end close(gcf) %# save avi file, , open using system video player movie2avi(mov, 'mypeaks1.avi', 'compression','none', 'fps',10); winopen('mypeaks1.avi') avifile (deprecated, use

Ruby on rails render file in multiple views -

this question has answer here: rails 4: how create custom 404 page uses asset pipeline? 2 answers i want return same generic invalid page if user not have access page. want make use of invalid page several different views. how can render page without creating them in every view? yes, can create other controller , redirect pages, want url in browser same page person trying access. want render page not redirect. you're going create static page, we'll call invalid.html.erb , place in static_pages directory (or maintain static pages app). make sure create route in routes.rb well: get 'static_pages/invalid' => 'static_pages#invalid' then, in application_controller.rb file, you're going use rescue_from helper call custom method handle error: rescue_from user::notauthorized, :with => :invalid def invalid redirect_t