Posts

Showing posts from January, 2012

Opencv 2.4.11 windows 8 visual stuido 2012 professional The application was unable to start correctly (0xc00007b) -

i follow tutorial on http://docs.opencv.org/doc/tutorials/introduction/windows_visual_studio_opencv/windows_visual_studio_opencv.html#windows-visual-studio-how-to and set project property --> c/c++ directory c:\opencv\build\include and linker--> additonal library directory c:\opencv\build\x64\vc12\lib linker --> input : opencv_calib3d2411d.lib opencv_contrib2411d.lib opencv_core2411d.lib opencv_features2d2411d.lib opencv_flann2411d.lib opencv_gpu2411d.lib opencv_highgui2411d.lib opencv_imgproc2411d.lib opencv_legacy2411d.lib opencv_ml2411d.lib opencv_nonfree2411d.lib opencv_objdetect2411d.lib opencv_ocl2411d.lib opencv_photo2411d.lib opencv_stitching2411d.lib opencv_superres2411d.lib opencv_ts2411d.lib opencv_video2411d.lib opencv_videostab2411d.lib and use test code here http://docs.opencv.org/_downloads/introduction_windows_vs.cpp it built successully when run say: application unable start correctly (0xc00007b)

javascript - video.js is not loading/working in IE 9,10 or 11 -

Image
i have been trying videojs working on ie few days , still can't work. have done point follow general setup instructions in documentation here . i using version 4.12.7 of videojs example. following javascript running on body load: videojs("example_video_1", {}, function(){ this.src({ type: "video/mp4", src: 'http://video-js.zencoder.com/oceans-clip.mp4' }); });` the html follows: <video id="example_video_1" class="video-js vjs-default-skin" controls preload="auto" width="640" height="264" poster="http://video-js.zencoder.com/oceans-clip.png"> <source src="" type='video/mp4' /> <p class="vjs-no-js">to view video please enable javascript, , consider upgrading web browser <a href="http://videojs.com/html5-video-support/" target="_blank">supports html5 video</a></p> </video> ...

mysql - How to reload list view? -

i have run problem. when main form load, call loadsentnbox() public sub loadsentbox() logmysql() try dim sqlquery string logmysql() sqlquery = "select * files_tr `from` = '" + user + "'" mysqlcommand = new mysqlcommand(sqlquery, mysqlcon) 'open db mysqlcon.open() mysqlreader = mysqlcommand.executereader while mysqlreader.read dim listviewitem ltv_sentbox.beginupdate() = ltv_sentbox.items.add(mysqlreader.item("to")) i.subitems.add(mysqlreader.item("filename")) i.subitems.add(mysqlreader.item("size")) i.subitems.add(mysqlreader.item("status")) ltv_inbox.update() ltv_inbox.endupdate() end while mysqlcon.close() 'ltv_sentbox.refresh() catch ex exception msgbox(ex.tostring, msgboxstyle.critical) end try e...

javascript - Need ember model to return array promise not object -

i trying return array promise model can loop through results in template. need contact products return promise array , not promise object. model : app.contacteditorroute = ember.route.extend({ model: function (params) { return ember.rsvp.hash({ contact: this.store.find('contact', params.id), /*need return array not object does*/ contactproducts: this.store.find('contactproduct',params.id), products: this.store.find('product') }) } template: (using emblem markup) each contactproduct in contactproducts p ' quantity contactproduct.quantity ' notes contactproduct.note if want array way have code structured, can do contactproducts: this.store.find('contactproduct',params.id) .then(product => [product]) this approach take when want additional processing on result of find , yet still return promise model designed do. however, poster indicated...

java - Keep adding joptionpane input to console -

you have been past few months! i have quick question regarding joptionpane , writing console. there way run program , each time runs, adds console window? sits, code delete in console window , put in new information write it. my code follows: import javax.swing.joptionpane; public class contacts { private static java.lang.string string; public static <no_option> void main(string[] args) { // contact name string name; // contact number string number; { string = joptionpane .showinputdialog("what contact's full name?"); name = string; string = joptionpane .showinputdialog("what contact's phone number?"); number = string; joptionpane.showmessagedialog(null, "contact added!"); system.out.append("contact list"); system.out.println(); system.out.println("--------------------------------"); ...

parsing - improve the exception handling vb.net -

i have small trouble performance of exception handling. i'm building... aaaaa... soooo...hmmm...a graph db? yeah this... vb.net. i'm building parser, handling basic functions of db(?) happen? user makes research, program tab them, , allow make computation . string handling, but, give complete instrument, implement mathematical functions. there no way know developing-time math kind of value going insert. , especially, there no way know if each row of column comes out traversal has same data type. schema-free db(?). happen...i have implement error handling. integer = 0 pr.r.wsrowcount - 1 try pr.r.wsitem(cix, i) = convert.todouble(pr.r.wsitem(ca.ix, i)) * convert.todouble(pr.r.wsitem(cb.ix, i)) catch pr.r.wsitem(cix, i) = string.empty end try next something this... (psss.. convert.todouble() performant function between cdbl() , double.pars...

java - JavaFX How can I set the location/coordinates of a pane? -

how can manually set coordinates of pane? when click imageview want have different imageview popup @ same location, , scale up. can pop in default top left corner of parent pane imageviews. the short version: use setlayoutx (and y) or settranslatex (and y). the long version: it depends on parent container is. should make familiar working layouts in javafx , node class.

Is there a way to load json file using Backbone.js? -

i want load json file using backbone js , perform sorting , searching functions on data. can done using backbone. have started learning backbone kind of lost. this can done using backbone. here's basic example of mu short suggested: var collection = backbone.collection.extend({ url: 'http://echo.jsontest.com/key/value/one/two', initialize: function() { this.fetch(); this.listento(this, 'sync', this.sort); }, sort: function() { this.each(function(data) { document.write(data.get('key')); // should write "value" }); } }); var collection = new collection(); <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.js'></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js'></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1....

c++ - How to apply a sort function to a string.find( ) to print results alphabetically? -

i have program reads text file struct (members- str author , str title) , gives user option display records in file, search author, or search title. need integrate sort function process, when user searches author or title results listed alphabetically. the following sort function works showall function, have absolutely no idea how can modify search functions alphabetize results. sort function code: void sortbytitle(int counter){ //variable int a, b, minindex; string temp; (a = 0; < counter; a++){ minindex = a; (b = + 1; b < counter - 1; b++){ if (books[b].title < books[minindex].title){ minindex = b; } } if(minindex != a) { temp = books[a].title; books[a].title = books[minindex].title; books[minindex].title = temp; cout << books[a].title << endl; } } } and current title search function: int showbooksbytit...

java - How to store multi data for each users in MySQL -

i have data contain user , text rating. need store database. use mysql database , using java, ide netbeans. after storing these, read , insert new user data. user: data: doing, class: bad yes, me, class how you?, class bad user: b data: doing, class: yes, me, class bad how you?, class bad how can store these mysql (xampp) or other database this? thank you you should learn normalization. proper normalization, have @ least 2 tables, user table , data table. data table this: user | data | rating _________________________________________ | doing | bad | yes, me | | how you? | bad b | doing | b | yes, me | bad b | how you? | bad other things optionally implement: the data table have unique (auto_increment) id used primary key you create user table other user info, such first name, last name, etc. primary key here (a, b) link foreign key in data table. use a...

c# - My WPF/EntityFramework application don't work on other computer (Resolved) -

i have created wpf application uses entity framework/code first on localdb (i have created database on "model" directory , seems fine). it works pretty on laptop , wanted share friend doesn't work. think have sql error on other computer doesn't show it. shows windows application error... think it's when try load database context. my database context : using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.data.entity; namespace modernuinavigationapp1.model { class supcontext : dbcontext { public dbset<infosconnexion> infosconnexions { get; set; } public dbset<infosfichiers> infosfiles { get; set; } public dbset<log> logs { get; set; } } } my app.config : <?xml version="1.0" encoding="utf-8"?> <configuration> <configsections> <!-- more information on entity framework configurat...

c# - Remove ONLY the childrens with LINQ to SQL? -

i want delete childrens of item selected in datagridview linq sql , doesn't work. don't know if it's possible this. don't know how proceed, can please check @ code , tell me wrong? here's code : private void cmdsupprimer_click(object sender, eventargs e) { try { var catact = (from cata in tbcategories.categories cata.categorieid == (int)dgcategories.rows[0].cells[0].value select cata).single(); (int = 0; < catact.jeuxes.count(); i++) { (int j = 0; j < catact.jeuxes[i].personnages.count(); j++) { tbpersos.personnages.deleteonsubmit(catact.jeuxes[i].personnages[j]); } tbjeux.jeuxes.deleteonsubmit(catact.jeuxes[i]); } tbcategories.categories.deleteonsubmit(catact); tbcategories.submitchanges(); dgcategories.datasource = null; dgcategories.datasource = (...

javascript - Primefaces Notification bar working selectively -

i'm having odd problem notification bar in primefaces. actually, notification bar displays on page load without problems, , buttons open/hide work fine. problem in javascript call hiding notification bar - doesnt work. doesn't work if exclude settimeout , call hide function directly. situation same button displaying bar - button works, not working javascript. and checked, if put alert in javascript displays without problems, functions working. any ideas? thanks! <h:form> ... <p:notificationbar position="top" effect="slide" styleclass="top" widgetvar="bar" autodisplay="true"> <p:commandbutton id="baroff" onclick="pf('bar').hide()" type="button" icon="ui-icon-arrow-1-n"/> <h:outputtext value="some text" style="font-size:36px;" /> </...

Change color of text in ActionScript3 after exact character -

i want know if possible change font color in dynamic text field after exact character, example want text after : blue. you can count in string exact character , use length of splited string on character: var my_str:string = "this text black: , text white"; var my_array:array = my_str.split(":"); var testtext:textfield = new textfield(); testtext.text = my_str; addchild(testtext); var format1:textformat = testtext.gettextformat(0, my_array[0].length); format1.color = 0x000000; testtext.settextformat(format1, 0, my_array[0].length); var format2:textformat = testtext.gettextformat(my_array[0].length+1, testtext.length); format2.color = 0xffffff; testtext.settextformat(format2, my_array[0].length+1, testtext.length);

ruby on rails - How to associate a model with a model within a model? -

when user likes comment create_notification triggered in commet_like.rb : class commentlike < activerecord::base after_create :create_notification has_many :notifications belongs_to :user belongs_to :comment validates :user, uniqueness: { scope: :comment } belongs_to :liker, class_name: 'user', foreign_key: :user_id belongs_to :liked_comment, class_name: 'comment', foreign_key: :comment_id private def create_notification notifications.create( comment_like: self, comment: comment, user: comment.user, read: false ) end end i'm trying work in notifications index : <% if notification.comment_like_id %> <% if notification.goal_id %> liked <%= link_to "your comment", notification_goal_path(notification, notification.goal_id) %> <% elsif notification.habit_id %> liked <%= link_to "your comment", notification_h...

json - Get request failing to get track using Soundcloud JavaScript sdk (Chrome extention) -

i developing chrome extension using soundcloud javascript sdk. when click button plays random track soundcloud. my request works when try stream the. code. sc.initialize({ client_id: "2d2d0fb839111694b3877c008ea03a85", }); $(document).ready(function(){ $("#loadtracks").on("click", function(){ sc.get('https://api.soundcloud.com/users/user486627426/tracks', {limit: 1}, function(tracks){ var track = tracks[0]; console.log(track.uri); }); sc.stream('https://api.soundcloud.com/users/user486627426/tracks', function(sound){ sound.play(); }); }); }); i a: get chrome-extension://connect.soundcloud.com/audiomanager/audiomanager.js net::err_failed and here manifest.json { "manifest_version": 2, "name": "soundcloud", "description": "this extension plays random track using soundcloud", "v...

java - Split String on \b's but not on \b's between a substring -

how split string words leave phrases/terms intact? right now, have string[] strarr = str.split("\\b"); , want modify regex parameter accomplished mentioned above. solution doesn't have include regex for example, if str equals "the city of san francisco beautiful!" , term "san francisco" , how split str resulting string[] array looks such: ["the", "city", "of", "san francisco", "is", "truly", "beautiful!"] ? after seeing @radiodef's comment, decided don't require regex per se. if can me solve problem, still appreciated! well that's interesting question. approach write general method in detecting number of word phrases returning simple array of strings. here demo below method, string[] find(string m[], string c[], string catchstr){ string comp = c[0]; arraylist<string> list = new arraylist<string>(); for(int i=0;i<m.len...

Multiple Controllers appropriate with one entity in spring framework -

i'm starting develop website use spring framework.i have 3 controller.there newcustomercontroller , editcustomercontroller , deletecustomercontroller .these controllers mapped view use create update , delete, create customer . so, know.is appropriate declare controllers this. thank the answer question subjective , maybe more topic https://softwareengineering.stackexchange.com/ . however, there spring related comment. there few principles attempt @ guiding developers of how strike balance when thinking designing classes. 1 of single responsibility principle . in object-oriented programming, single responsibility principle states every class should have single responsibility, , responsibility should entirely encapsulated class. services should narrowly aligned responsibility a catchier explanation a class or module should have one, , one, reason change. however, still hard reason properly. nevertheless, spring gives means (think of statem...

linux - Mysterious: after mov instruction, destination register %rax did not get expected value (in memory) -

life full of interesting puzzles, wrestling them makes me cackle ... recently 1 interesting segment fault core dump running instance x86-64 linux in vm (vmware). mov 0x18(%rdi) %rax // move pointer %rax, trick things happens here seems rax did not expected value @ ...// 2 instructions later mov %r8,0x10(%rax) // load value offset of pointer in memory details below. segment fault dump of assembler code function timer_delink: // function: boolean timer_delink(timer_t *timer), timer cycle link list(prev/next never null) 0x42e0f0 <+0>: mov (%rdi),%rcx rdi <= timer; rcx <= timer->parent 0x42e0f3 <+3>: xor %eax,%eax eax <= update_parent <= 0; eax stores return value 0x42e0f5 <+5>: test %rcx,%rcx if (!timer->parent) return(false); 0x42e0f8 <+8>: je 0x42e138 <timer_delink+72> return eax(update_pa...

gawk - using awk for subtraction -

similar post here: awk if statement simple math below great need subtract 20 field $4 if it's less 20 , if greater 20, field 5 can set 0. 31590,foo,70,3.5 28327,bar,291,14.55 25155,baz,583,29.15 24179,food,694,34.7 28670,spaz,67,3.35 22190,bawk,4431,132.93 29584,alfred,142,7.1 27698,brian,379,18.95 24372,peter,22,1.1 25064,weinberger,8,.04 i had similar working there's errors now. {print $0, $4-($4>20?$4:20)} because field $4 less 20, i'm not sure above wok want 20 - $4 not $4 - 20. this gives me $4-20: {print $0, $4-($4<20?20:$4)} need 20-4 if $4 less 20. if $4>20 field $5 0. i think need is {print $0, 20 - ($4 < 20 ? $4 : 20)} or make more straightforward {print $0, ($4 < 20 ? 20 - $4 : 0)} if $4 less 20, returns 20 - $4 fifth field. if $4 greater or equal 20, returns 0 fifth field.

Java - TCP socket only connects in LAN -

i have created small tcp server connects other computers on lan. did forward port still not working. connection method: private boolean connect(){ try { socket = new socket(inetaddress.getbyname(ip), port); system.out.println("socket created"); dataoutput = new dataoutputstream(socket.getoutputstream()); datainput = new datainputstream(socket.getinputstream()); accepted = true; } catch (ioexception e) { system.out.println("unable connect server"); return false; } system.out.println("successfully connected server."); return true; } listen method: private void listenforserverrequest(){ socket socket = null; try{ socket = serversocket.accept(); dataoutput = new dataoutputstream(socket.getoutputstream()); datainput = new datainputstream(socket.getinputstream()); accepted = true; system.out.println("client joined...

function - Infix operator with missing argument -

is possible haskell have operator (infix function) working missing argument ? (rather - meaning subtraction or negative sign) for example, have operator : data1 <*> data2 is possible make work default value if first argument omitted ? <*> data2 not really, no. on other hand, define different operation provides default argument, e.g. withdef data2 = {- default value -} <*> data2 if want use name otherwise operator, can still name partially applied function operator name: ($<*>) data2 = {- default value -} <*> data2 it can used prefix, in ($<*>) data2 , or postfix appropriate ghc extensions, in (data2 $<*>) . parentheses not optional.

c# - Syntax : 'x' is a 'variable' but is used as a 'method' -

public gameobject explosionprefab; void oncollisionenter(collision otherobj) { gameobject explosionobject = instantiate(explosionprefab, otherobj.transform.position, quaternion.identity) gameobject; explosionobject(explosionobject, 5f); <-- line giving error destroy(otherobj.gameobject); } } i in confusion because haven't been doing scripting long , wondering if show me right way this, small test game on unity. wondering how fixed , don't make mistake in future. in general a method declaration: void x() { // } a call method: x(); a declaration of varialble: int x = 0; use of variable: x = 7; //write y = x; //read , assing variable your code you declared variable: gameobject explosionobject = instantiate(explosionprefab, otherobj.transform.position, quaternion.identity) gameobject; but use like method: explosionobject(explosionobject, 5f); <-- line giving error you may missed method name, in case want call m...

python - Quotes within quotes -

in python 3.x: print(""s"") # syntaxerror print("""s""") # prints s print(""""s"""") # syntaxerror print("""""s""""") # prints ""s what reason behind different behaviour, when there different numbers of double quotes in string? in python can create multiline strings """...""" . quoting documentation strings , string literals can span multiple lines. 1 way using triple-quotes: """...""" or '''...''' . in first case , ""s"" parsed this "" (empty string literal) s "" (empty string literal) now, python doesn't know s . why failing syntaxerror . in third case , string parsed this """ "s """ (end of multiline string) ...

nginx - Why are my SSL certs mixing between my websites? -

i'm using nginx webserver , host 3 main websites, xyz.example.com , abc.example.com , example.com itself. example.com , abc.example.com have ssl certificate (two positivessl). bought cert. third website, xyz.example.com . so, problem is: when xyz.example.com works ssl, example.com returns net::err_cert_common_name_invalid because tries use xyz.example.com 's certificate (saw chrome clicking on error code). when delete xyz.example.com 's file nginx sites-available directory, example.com starts working again (but xyz.example.com doesn't work). here 2 nginx configuration files. xyz.example.com: server { listen 80; server_name xyz.example.com; rewrite ^/(.*) https://xyz.example.com/$1 permanent; } server { listen 443 ssl; server_name xyz.example.com; ssl_certificate /var/www/certs/xyz_example/cert_chain.crt; ssl_certificate_key /var/www/certs/xyz_example/key.key; root /var/www/xyz; index index.php; client_max_body_size 5...

node.js - How do I use a pre save hook database value in Mongoose? -

i want value of object before pre-save hook , compare new value. suggested in mongoose db value in pre-save hook , https://github.com/automattic/mongoose/issues/2952 , did post-init hook copied doc._original. issue i'm not sure how access ._original in different hook. fieldschema .post('save', function (doc) { console.log(doc._original); }); fieldschema .post('init', function (doc) { doc._original = doc.toobject(); }); i know doc in post save hook different doc in post init hook, how access original? you can access properties on database have defined in schema. since haven't defined _original property in schema, can't access, or set it. one way define _original in schema. but , set properties not defined in schema: use .get , , .set {strict:false} fieldschema .post('save', function (doc) { console.log(doc.get('_original')); }); fieldschema .post('init', function (doc) { doc.s...

angularjs - google places auto complete not working on redirect -

i have 2 pages, main page , secondary. , in both pages have form auto complete integrated. in main page after choose place(auto complete works here) , click submit button redirected secondary page, results displayed. when use form in secondary page auto complete doesn't work. if reload page, works. i have tried $route.reload , $location.path($location.path()) etc, not helping. location.reload() works, , data stored in services getting reset when use this.

objective c - Cylinder Orientation between two points on a sphere, Scenekit, Quaternions IOS -

i've been trying draw cylinder between 2 points on outer edge of sphere using scenekit. have produced line between these 2 points using primitive geometry , opengl scnrendering delegate, need produce cylinder between these 2 (well, not two, 2 3d vectors sit on surface of sphere). i've been working on 3 days straight now, , i've gone through find on implementing quaternions make happen, stands, can't work. academic articles, scientific studies, , nothing, nothing working realign cylinder between 2 fixed points. need algorithm this. anyway, here's recent code doesn't work, small snippet of 2k lines of code i've worked through far without intended result. know can move more advanced building own scnprogram and/or scnrenderer access glsl, opengl, , metal complexity, seems should possible using scenekit , converting between glkit vector structs , scnvector structs, far it's impossible: code: the following code ingests longitude , latitude coordinate...

c# - An item with the same key has already been added Issue on adding gridvalues to database -

in below code want insert gridview values database.when try insert values throws error "an item same key has been added.".only first row added database remaining rows not getting added.pls me solve issue. protected void btnsave_click(object sender, eventargs e) { string check=string.empty; string branchid = dpbranch.selectedvalue; string classid = dpclassname.selectedvalue; string sectionid = dpsection.selectedvalue; testschool.schoolbusinesslyr.schoolbizclient attendance = new testschool.schoolbusinesslyr.schoolbizclient(); system.collections.generic.dictionary<string, string> assignstudentattendance = new system.collections.generic.dictionary<string, string>(); dataset ds = new dataset(); foreach (gridviewrow row in gdstudentattendance.rows) { string celltext = row.cells[0].text; string registerno = row.cells[2].text; ...

mysql PHP PDO executing 2 queries on a single POST request -

i'm using standard apache2 lamp configuration mysql , php5 , thing changed character encoding onto utf8 . i'm making ajax call upon clicking anchor (the article title), , want run 2 queries. 1 gets article, , other comments related article. i found this post while browsing around, far haven't been able implement he's talking about. message: fatal error: call member function nextrowset() on non-object in /home/shooshte/dropbox/ptc_php/db_queries/articles.php on line 45 . have no idea if right way it. the problem first select statement returns single row (one article), while second select statement returns multiple rows (all comments on article), can't join them 1 statement. anyway here's code (i commented out irrelevant parts): <?php error_reporting(e_all); ini_set('display_errors', 1); try { $hostname = "localhost"; $username = "topdecka_admin"; $password = ""; $db = new pdo("mysq...

tsql - SQL Transactions - allow read original data before commit (snapshot?) -

i facing issue, possibly quite easy solve, new advanced transaction settings. every 30 minutes running insert query getting latest data linked server client's server, table can call importtable . have simple job looks this: begin tran delete importtable insert importtable (columns) select (columns) querygettingresultsfromlinkedserver commit the thing is, each time job runs importtable locked query run time (2-5 minutes) , nobody can read records. i wish table read-accessible time, little downtime possible. now, read possible allow snapshot isolation in database settings solve problem (set false @ moment), have never played different transaction isolation types , not db client's, i'd rather not alter database settings if not sure if can break something. i know have intermediary table records inserted , inserted final table , possible solution, hoping more sophisticated , learning new in process. ps: client's server ...

java - Webdriver does not timeout despite of timeout set -

i have set timeouts in webdriver follows: driver.manage().timeouts().pageloadtimeout(timeoutseconds, timeunit.seconds); driver.manage().timeouts().setscripttimeout(timeoutseconds, timeunit.seconds); but webdriver gets stuck on "transfering data somewebsite.somedomain.com..." , not throw timeout exception. why happening , how rid of situation? i using selenium webdriver version 2.45.0 hi try if explicit wait works, ie: load\navigate page, , use explicit wait on of ui object on page. like: webelement mydynamicelement = (new webdriverwait(driver, 25)) .until(expectedconditions.presenceofelementlocated("by locator")));

Scala Abstract Type Member -

i noticed can instantiate scala trait abstract type member. code below compiles. t.b? trait { type b } val t = new {} the type t.b . trait { type b def f(b: b) } val t = new { def f(b: b) = {} } t.f(0) has error error: type mismatch; found : int(0) required: t.b types don't have "overriden" methods. this type own thing. it's not useful, that's is. like other types, subtype of any , supertype of nothing . seq[t.b](): seq[any] seq[nothing](): seq[t.b] and that's can said it.

javascript - google+ api login not returning email -

i have implemented javascript based google+ login in application using following code: var isgpinitialzed = false; function render() { gapi.signin.render('loginwithgoogle', { 'callback': 'onsignin', 'clientid': 'the client id', 'cookiepolicy': 'single_host_origin', 'requestvisibleactions': 'http://schema.org/addaction', 'scope': 'https://www.googleapis.com/auth/plus.login' }); isgpinitialzed = true; } //google function onsignin(authresult) { if (!isgpinitialzed) { if (authresult['status']['signed_in']) { //get user info gapi.client.load('oauth2', 'v2', function () { gapi.client.oauth2.userinfo.get().execute(function (response) { console.log(response.email); $.ajax({ url: '/account/glogin', ...

load balancing - Should I use Oort or write my own forwarding using CometD, when nodes don't need to know about each other? -

my app work follows: i'll have bunch of replica servers , load balancer. data updates managed outside cometd. edit: still intend notify each cometd server of updates, if necessary, can respond clients. the clients subscribing updates (i.e. read only), cometd server nodes don't need know each other's behavior. am right in thinking have server side "client" instances on load balancer, per client connection, each instance listens on same channel respective client , forwards messages it? if so, there disadvantages approach, instead of using oort? reading docs oort, seems nodes "know" each other, don't need. better me avoid using oort altogether, in case? concern if ended adding many many nodes, fact communicate "each other" mean unnecessary processing? the description of issue specifies data updates managed outside cometd, not detail how cometd servers notified of these data updates. the 2 common solutions a) notify each ...

javascript - Flow Charts and State Machines -

Image
specifically looking @ javascript libraries; javascript infovis toolkit , , d3 draw flow charts , state machines. both of these offer plenty of ways visualize data. none of examples seem meet requirements below (especially flow chart). to clear mean these. flow chart (sourced from: http://philosophy.hku.hk/think/strategy/chart.php ) have branches single start , end point. labels on nodes , branches. have logical flow layout (e.g. not nodes randomly positioned). shapes aren't important. state machine (sourced from: http://www.oracle.com/technetwork/systems/fsm-156381.html ) labels on nodes , branches. shapes aren't important. would either of these libraries able meet requirements? are requirements appropriate use of libraries? cheers, in end went dagre-d3 able needed.

swift - do try in beginSheetModalForWindow -

in swift 2.0, if following: panel.beginsheetmodalforwindow(self.view.window!) { (result) in switch result { // save selected case nsfilehandlingpanelokbutton: self.writefile(filestring, fileurl: panel.url!) // else selected default: break } } with function follows, compiles , works. func writefile(filestring: string, fileurl: nsurl) { { try filestring.writetourl(fileurl, atomically: true, encoding: nsutf8stringencoding) } catch let error nserror { fatalerror("error writing file - \(error)") } } but, if combine 2 this: panel.beginsheetmodalforwindow(self.view.window!) { (result) in switch result { // save selected case nsfilehandlingpanelokbutton: { try filestring.writetourl(fileurl, atomically: true, encoding: nsutf8stringencoding) } catch let error nserror { fatalerror("error writing file - \(error)") } // else selected default: break } } it won't compil...

Reduce Gradle sync time in Android studio -

i'm using mac 16gb memory, ssd hdd , still gradle sync takes 15mins+ every time build, clean or open project, there android studio optimisations possible reduce time. you're using + symbol on libraries added project (and have slow internet connection). example: compile 'com.android.support:support-v4:+' this make on every sync() gradle check online if there's new version. if change specific version number, example: compile 'com.android.support:support-v4:22.2.0' then gradle use cached version been downloaded development machine.

javascript - How to retrieve filtered data from json with double for loop -

so have build json file ( http://www.smartbustracking.be/json/data.json ) , able retrieve data. achieve filter data based on id loop. i able show 1 item of specific id not data related specific id. so have have better understanding of trying explain see code via jsfiddle -> https://jsfiddle.net/r4gkw1w8/1/ var json= [ { "id":"1", "longitude":"4.420556809486086", "latitude":"51.21703476701095", "description":"station van mechelen", "busnummer":"14", "name":"station mechelen", "busuur":"14:45", "bussen":[ { "busnummer":"530", "busnaam":"aarshot - tremelo - keerbergen - mechelen", "bushaltes":[ { "bushalte":"zandpoortvest", "aankomstuur":...

MongoDB - "The dollar ($) prefixed field \'$$hashKey\' in \'fieldName".$$hashKey\' is not valid for storage.'" -

while trying update document i'm getting above error field timestodisplay . mongodb version 2.6.7. the whole model: msg = { 'name': '', 'template': '', 'displaydurinmillisec': 0, 'timestodisplay': [], 'images': [], 'texts': [], 'screen': [] } i guess getting same error other 3 array fields. i've tried using $set sill getting same error. the code: function updatemessage(msg) { var conditions = {_id: msg._id} , update = { 'name': msg.name, 'template': msg.template, 'displaydurinmillisec': msg.displaydurinmillisec, 'timestodisplay': msg.timestodisplay, 'images': msg.images, 'texts': msg.texts, 'screen': msg.screen } messagemodel.u...

javascript - className is not appended to the js object -

var obj = document.createelement('div'); obj.classname = 'classname'; this output div element class appended it. var obj = { dive : function(){ return document.createelement('div')} } obj.dive().classname = 'classname'; this doesnot append class name div element i.e. obj.dive() what reason? how append class obj.dive(); the returned value of obj.dive().classname = 'classname'; statement classname string. code creates element, modifies it's classname property , doesn't anything. if store returned value: var value = obj.dive().classname = 'classname'; then stored value 'classname' string not created element. have create element, store , update classname first snippet. if want create helper function can code: var obj = { dive : function(cls) { var div = document.createelement('div'); if ( cls ) { div.classname = cls; } return div; } } var...

r - How to merge legends for color and shape when geom_hline has a separate (additional) entry in the color legend? -

Image
i have following code, produces following plot: cols <- brewer.pal(n = 3, name = 'dark2') p4 <- ggplot(all.m, aes(x=xval, y=yval, colour = approach, ymax = 0.95)) + theme_bw() + geom_errorbar(aes(ymin= yval - se, ymax = yval + se), width=5, position=pd) + geom_line(position=pd) + geom_point(aes(shape=approach, colour = approach), size = 4) + geom_hline(aes(yintercept = cp.best$slope, colour = "c2p"), show_guide = false) + scale_color_manual(name="approach", breaks=c("c2p", "p2p", "cp2p"), values = cols[c(1,3,2)]) + scale_y_continuous(breaks = seq(0.4, 0.95, 0.05), "test auroc") + scale_x_continuous(breaks = seq(10, 150, = 20), "# number of patient samples in training") p4 <- p4 + theme(legend.direction = 'horizontal', legend.position = 'top', plot.margin = unit(c(5.1, 7, 4.5, 3.5)/2, "lines"), text = element_text(size=15), axi...