Posts

Showing posts from February, 2012

html - How to put a button beside (right) side of another button -

take @ fiddle as can see, got 2 buttons. want dislike button appear next button (after text 1). how it? put buttons , number inside divs , float divs left. https://fiddle.jshell.net/g6lhurae/50/ div {float:left;}

javascript - How can I get draft.js to recognize the escape key? -

i cancel input , clear field in app when user types escape key. tried testing e.which === 27 in keybindingfn, function never invoked when escape key pressed (it invoked fine normal keys, modifier keys, , arrow keys). how can detect escape keypress in draft.js? editor component has onescape property <editor editorstate={this.state.editorstate} onchange={this.onchange.bind(this)} onescape={keyevent=>console.log('escape pressed')} ref="editor" />

Failed to start project error in Visual studio 2012 -

Image
usually run integration packages visual studio 2012,but today when trying run package getting below error before validation. can me why getting error , solution this?

javascript - Not able to send header with xhrfield -

i trying flipkart api data . not able send heder xhrfield here code : $.ajax({ type: 'get', url:'https://affiliate-api.flipkart.net/affiliate/search/json?query=iphone+mobiles&resultcount=3', crossdomain: true, // datatype: 'jsonp', /*xhrfields: { withcredentials: true },*/ // contenttype: 'application/json; charset=utf-8', beforesend : function(xhr) { xhr.withcredentials = true; xhr.setrequestheader('fk-affiliate-id', 'myid'); xhr.setrequestheader('fk-affiliate-token', 'mytoken'); }, /* headers: { 'access-control-allow-origin':'*', 'fk-affiliate-id': 'myid', 'fk-affiliate-token': 'mytoken', 'content-type': 'application/x-www-form-urlencoded' },*/ success: function(data){ ...... } }); as can see comment ahve tried

.Net Framework .resx portability to .Net Core -

in .net core there changes apis resource generated resx/designer.cs files need. specifically type no longer has assembly property directly on it... core gets through type.gettypeinfo().assembly the result designer.cs files incompatible between frameworks, multi-targeted solution cannot use resource files without compilation failing: connectiondetails.designer.cs(42,170): error cs1061: 'type' not contain definition 'assembly' , no extension method 'assembly' accepting first argument of type 'type' found (are missing using directive or assembly reference?) visual studio knows how generate these correctly depending on project/solution type, multi-targeted solutions isn't help. i haven't been able find workaround works both frameworks, since designer.cs generated automatically. has come solution this? this a known bug , caused fact visual studio uses first item in targeted-frameworks list purpose of resx code generation.

go - golang how to redirect panic in C code to a file -

it's easy redirect golang panic file, use recover() capture , use syscall.dup2() redirect. when comes c panic, seems useless, image, console show error message "fatal error: unexpected signal during runtime execution" , stack message. how redirect these error message file package main /* #include <stdio.h> void sayhi(int a, int b) { int c = a/b; } */ import "c" import ( "runtime/debug" "syscall" "os" "log" ) func main() { logfile, logerr := os.openfile("/home/error.log", os.o_create|os.o_rdwr|os.o_append, 0666) if logerr != nil { log.println("fail find", *logfile) os.exit(1) } log.setoutput(logfile) defer func() { if r := recover(); r != nil { syscall.dup2(int(logfile.fd()), 2) debug.printstack() } }() c.sayhi(1, 0) } ps:the key point how redirect error message on terminal screen file? integer di

javascript - Simulate Voiceover page load in single-page pushState web application -

i'm working on single-page application (spa) we're simulating multi-page application html 5 history.pushstate . looks fine visually, it's not behaving correctly in ios voiceover. (i assume wouldn't work in screen reader, voiceover i'm trying first.) here's example of behavior i'm trying achieve. here 2 ordinary web pages: 1.html <!doctype html><html> <body>this page 1. <a href=2.html>click here page 2.</a></body> </html> 2.html <!doctype html><html> <body>this page 2. <a href=1.html>click here page 1.</a></body> </html> nice , simple. voiceover reads this: web page loaded. page 1. [swipe right] click here page 2. link. [double tap] web page loaded. page 2. [swipe right] click here page 1. visited. link. [double tap] web page loaded. page 1. here again single-page application, using history manipulation simulate actual page loads. spa1.htm

Having trouble with phpmyadmin -

Image
whenever want go on phpmyadmin url: locahost/phpmy/admin, shows error message "fatal error: class 'gettext_reader' not found in c:\xampp\phpmyadmin\libraries\php-gettext\gettext.inc on line 140". seeking solution..:) ok, maybe dont solve problem, checked in phpmyadmin 3.5.1 installed using wamp, took error , found this: gettext.inc (error file) has line of code: require('gettext.php'); in line 42, , gettext.php file defines gettext_reader class. if both files right (gettext.inc , gettext.php), imposible error. i think, way error mentioning gettext.php modified/corrupted. or line 42 require('gettext.php'); missing/commented compare gettext.php this: gettext.php

html - Vertical align with flex-box and flex-direction: column -

Image
currently html displaying this: want display this: the buttons need vertically aligned text using flex-box, or method not require padding, margin (margin:auto fine), or offsets. http://codepen.io/simply-simpy/pen/vkpayn html : <ul class="nav"> <li><a href="/about.html">about</a> <button>+</button> <ul> <li><a href="/level-2.html">level 2 nav item</a> <button>+</button> <ul> <li><a href="/level-3.html">level 3 nav item</a></li> <li><a href="/level-3.html">level 3 nav item</a></li> <li><a href="/level-3.html">level 3 nav item</a></li> </ul> </li> </ul> </li> </ul> css .nav { width: 300px; } button { displ

Python compare char to hex -

>>> var = 'g' >>> print hex(ord(var)) 0x67 >>> print hex(ord(var)) == 0x67 false why isn't true in python 2.7? best way compare 'g' hex value 0x67? hex returns string, comparing number. either ord(var) == 0x67 or hex(ord(var)) == "0x67" (the first 1 less error-prone, it's case insensitive)

algorithm - C program that calculates number of days between two dates -

i have written c program calculates number of days between 2 dates. unfortunately, doesn't compile properly. don't know why. can please me fix code? seems there issue scanf , printf functions. don't chance input own date. this output get: illegal date -1607965827 please me. in advance! #include <stdio.h> #include <stdlib.h> int days_in_month[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; struct date { int day; int month; int year; }; int leap_year(int year) { if(year%400==0) return 1; if(year%4==0 && year%100!=0) return 1; return 0; } int correct(struct date d) { if(d.day < 1 || d.day > days_in_month[d.month]) return 0; if(d.month < 1 || d.month > 12) return 0; return 1; } int number_of_days(struct date d) { int result = 0; int i; for(i=1; < d.year; i++) { if(leap_year(i)) result += 366; else result += 365; } for(i=1; < d.mont

Custom link is redirecting without subfolder in URL - Wordpress -

wordpress eating subfolder within links. my wordpress menu set adding pages , custom links under pages. each page has several sections/paragraphs i've link-anchored , i'm using custom links refer url. for example: page "glass" has 2 custom links under - "double pane" , "single pane". "glass" url found @ example.com/glass , 2 custom links @ example.com/glass/#double-pane , example.com/glass/#single-pane respectively. the links work fine homepage. however, when end @ 1 of other pages , click on 1 of custom links browser inputs url without appropriate subfolder. if i'm @ example.com/glass , click on example.com/glass/#double-pane browser inputs example.com/#double-pane spits me out homepage. any ideas on causing this? deactivated plugins , problem persists. my .htaccess looks standard , i'm date on wordpress (4.5.3) try plugin url redirect https://wordpress.org/plugins/redirection/

pointers - c++ combine singleton and visitor pattern -

i'm having problem pointers. background java , i've still not got hand of using pointers. error is: syntax error: identifier 'stockcontroller' from line: virtual void visit(stockcontroller* stock) = 0; i've implemented singleton. i'm looking add visitor pattern. have series of operations ill applying collection of objects. visitor abstract class: #ifndef visitor_h #define visitor_h #include "stockcontroller.h" class visitor { public: virtual void visit(stockcontroller* stock) = 0; }; #endif singleton class: #ifndef stockcontroller_h #define stockcontroller_h #include <iostream> #include "visitable.h" using namespace std; class stockcontroller : public visitable { public: /*returns instance of class */ static stockcontroller* getinstance(); protected: /* prevent initialisation unless through method */ stockcontroller(); stockcontroller(const stockcontroller&); stockcontroller&am

sitecore8 - How to set up many to one relationship in Sitecore -

let me preface saying i'm pretty new both sitecore , c# gentle. i'm setting products sitecore items new website working on. each product have dozens of replacement parts associated it. each part may or may not associated associated multiple products. i'm trying determine best way set taking account creating , possibly reusing parts across products , how best associate parts products. use list data type multilist , treelist (with search) on product template parts. avoid lots of items in single folder can give performance issues in cms. (up 100 okay). create tree structure te parts if have many parts, or use bucket. bucket many thousands of items.

Using KeyboardEvent to navigate through scenes in Flash AS 3.0 without inherited script -

i making simple animation made of 5 looping scenes. want use keyboardevents procede next scene. far have put following code in scene 2; stage.addeventlistener(keyboardevent.key_down, plutofl_keyboarddownhandler); function plutofl_keyboarddownhandler(event:keyboardevent):void { if(event.keycode == keyboard.q) { gotoandplay(1, "scene 3"); } else if (event.keycode == keyboard.w) { gotoandplay(1, "scene 1"); } } the animation advances scenes fine go inherits action scene has left , gets stuck. there simple way keep action script current scene?

cocoa - How to determine a volume supports resolving bookmarks to renamed or moved files? -

- bookmarkdatawithoptions:includingresourcevaluesforkeys:relativetourl:error: documentation states: this method returns bookmark data can later resolved url object file if user moves or renames (if volume format on file resides supports doing so). my question is, how can query if volume supports feature? from trial , error seems (internal?) hard drives support it, looking kind of sure test nsurlvolumesupports???key . nsurlvolumesupportspersistentidskey looks candidate, failed find docs or google-info it. hints?

c# - use android modules in xamarin project -

how use pre-built module codes maven or j-center repositories in android xamarin project? to more specific want use free module date picker : https://github.com/alirezaafkar/sundatepicker i have read page : https://developer.xamarin.com/guides/android/advanced_topics/binding-a-java-library/binding-a-jar/ but since module not jar file , think method explained in page wont useful.

reactjs - Getting a bootstrap element to render on plunker -

i'm brand new react , react-bootstrap figured start out rendering bootstrap component on plunker. this has proven harder imagined , not sure doing wrong. here plunk: http://plnkr.co/edit/mvbvht1fdliydpztr7pj?p=preview <!doctype html> <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.1/react.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.1/react-dom.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react-bootstrap/0.27.3/react-bootstrap.js"></script> <link rel="stylesheet" href="style.css" /> <script> var alert = reactbootstrap.alert; </script> </head> <body> <div id="example"></div> <script src="script.js"></script> </body> </html> in jsx file on plunk: var but

oop - Java - Lists and methods -

i have abstract class named spell. spell class suppose have few subclasses, damagespell, changestatspell etc. the problem technical - in damagespell class - right after declaration of damage method - says can't find getspell (java can't find symbol : method getspell(). how can fix this? i'd appreciate code example describes how fix it. thanks. abstract public class spell { private string name; private int spelllevel; private int manacost; spell(string name, int spelllevel , int manacost){ this.name = name; this.spelllevel = spelllevel; this.manacost = manacost; } string getspellname(){ return name; } int getspelllevel() {return spelllevel; } int getmanacost(){ return manacost; } } public class damagespell extends spell { private int n; private int dice; private int base; private int steplevel; private int maxcasterlevel; damagespell(string name, int spelllevel, int manacost, int n, int dice, int bas

excel - Using string array as criteria in VBA autofilter -

i've searched other posts , found similar issues nothing me specifically. i'm trying take array of strings , use filter criteria. it's tricky because array created function , has variable number of elements , contents. need autofilter take , check column e each 1 of elements. i've tried 2 ways 1) with sheet17 .range("e1").autofilter field:=5, criteria1:=application.transpose(arr) end result: applies filter column e fails select of options 2) for = 0 counter - 1 sheet17 .range("e1").autofilter field:=5, criteria1:=application.transpose(arr(i)) end next note: counter integer representing number of elements in array result: 1 correctly loops through array selects last option on filter - presumably because every time loops through starts on , unchecks every other option end recent option remains checked. you not need transpose single element array , cannot put criteria 5 th field if referencing column e. dim lon

android - Regex Capture not equal to String of equal value -

this question has answer here: how compare strings in java? 23 answers both strings appear same when printed console, not when compared using "==" what doing wrong here? string message = "rejected | ref id: captureme | name:"; pattern pattern = pattern.compile("\\bref id:\\s+(\\s+)"); matcher matcher = pattern.matcher(message); string matchedref = matcher.group(1); system.out.print(matchedref); prints: captureme string myref = "captureme"; if(matchedref == myref){ system.out.print(true); } else{ system.out.print(false); } prints: false to compare strings need use equals() method, not == operator. if(matchedref.equals(myref)){ system.out.print(true); } else{ system.out.print(false); } you can read more string comparisons in this question .

java - How to work with JPA and the Entity Object Life Cycle -

i'm working on simple surveysystem using jpa eclipselink, , i'm quite new @ (jpa , databases) i'm not sure approach should take. the way i've done things far using dao-class database-logic, , entity-relations (hopefully) annotated correctly. my teacher-entity can have multiple surveys, , each survey-entity can have multiple questions. how i've got relation-annotations looking: teacher.java @onetomany(mappedby = "teacher", cascade = cascadetype.all) private list<survey> surveys = new arraylist<survey>(); survey.java @manytoone @joincolumn(name = "teacherid", referencedcolumnname = "id") private teacher teacher; @onetomany(mappedby = "survey", cascade = cascadetype.all) private list<question> questions = new arraylist<question>(); question.java @manytoone @joincolumn(name = "surveyid", referencedcolumnname = "id") private survey survey; in each class, i've go

javascript - AngularJS : drag-n-drop directive not working -

i using following library: https://github.com/marceljuenemann/angular-drag-and-drop-lists i trying move(by dragging) element 1 list another. disclaimer : newbie appreciated , might doing naive mistake. here code: var app = angular.module("app", ['dndlists']); app.controller( 'myctrl', function ( $scope, $http, $log ) { $scope.lists = {serverslist:[], selectedserverslist:[]} $scope.lists.serverslist = { label : "servers", allowedtypes : [ 'server' ], servers : [ { name : "server1", type : "server" }, { name : "server2", type : "server" }, { name : "server", type : "server" } ] }; $scope.lists.selectedserverslist = { label

how to import module only once in python behave step files -

i new python , behave. in step file, test_steps.py , have imported following: from behave import given, when, then, step behave_http.steps import * datetime import datetime import time import pdb import xmltodict import requests if created step file, test2_steps.py , had import above again. there way avoid that? thank help! it's useful know imports given file; however, can following: config.py from behave import given, when, then, step behave_http.steps import * datetime import datetime import time import pdb import xmltodict import requests test2_steps.py from config import * #other code here

php - EntityType Dual list Symfony Form -

Image
i using symfony3 framework , struggling 1 of forms... have 2 entities; object element i trying implement dual list (multiselect) box. have succeeded untill image below: (so got front-end going on, it's something... :s) with code below can choose select (or de-select) "element" entities. form submitted , persisted (succesfully!). but when select 1 "element" can submit form error: an exception occurred while executing 'insert objects_elements (object_id, element_id) values (?, ?)' params [3, 1]: when deselect 1 "element" no error element stays in selected box. this code: // ... class object { /** * @orm\id * @orm\column(type="integer") * @orm\generatedvalue(strategy="auto") */ protected $id; /** * @orm\manytomany(targetentity="element", inversedby="objects") * @orm\jointable(name="objects_elements") */ protected $elements; // ... } class element { /**

Haskell Stack's executable profiling and ghc options fails to build -

i'm trying debug performance problems in haskell project, can't profiling compiled in can use through +rts -p command line arguments. the options ghc in .cabal file are: ghc-options: -threaded -rtsopts -with-rtsopts=-n -wall -werror here's me attempting build it: stack build --executable-profiling --library-profiling --ghc-options="-fprof-auto -rtsopts" which results in: while constructing buildplan following exceptions encountered: -- failure when adding dependencies: base: needed (>=2 && <5), not present in build plan (latest applicable 4.9.0.0) mtl: needed (>=2.1 && <2.3), couldn't resolve dependencies random: needed (-any), couldn't resolve dependencies transformers: needed (>=0.3 && <0.6), couldn't resolve dependencies transformers-compat: needed (>=0.4 && <0.6), couldn't resolve dependencies needed package: monadrandom-0.4

Remove lines that contain certain string in Hebrew from a srt subtitles file -

i'm trying read text subtitles file, read lines , delete lines contain specific string (in case ' היי ' , ' שלום '). the idea while opening file, let user choose folder in go on *.srt files , delete lines containing specific text. the general idea is: have list\array of "bad words" while clicking program\file let user select directory. it search each file in directory , each line @ file if has 1 (or more) of "bad words". 3.1. if - delete specific line. would have written in batch programming language, yet i'm not sure how so. hope have requested possible , appreciate can provide. so far, made code let select directory: @if (@codesection == @batch) @then @echo off setlocal enabledelayedexpansion rem select folder via wsh shell.application browseforfolder method /f "delims=" %%a in ('cscript //nologo //e:jscript "%~f0"') set "folder=%%a" if not defined folder goto :eof cd "%

tftp server does not work behinf tap interface -

i have problem tftp server running under qemu. qemu connected host tap interface. output wireshark shows packed arrived host, hosts udp socket (and put command) ends timeut, netstat -au shows no data arrived. logs wireshark: wireshrk logs tap interface created this: tunctl -g 1000 ip addr add 192.168.7.1 broadcast 192.168.7.255 dev tap0 ip link set dev tap0 ip route add 192.168.7.2 dev tap0 iptabls , firewall disabled. how can start debug this? it seem because in udp packet tftp server not calculate crc , put zeroes there. understand possible behaviur, question why tap interface behave that...

c# - Rewrite sql sub to linq query -

i'm not sure begin on how convert query linq. started reading here , looked few youtube videos not sure here query: select o.replacementitemid, o.itemstatus, o.description, i.itemwarrantyid, o.id originalitemid ( select id, itemstatus, description, itemwarrantyid, replacementitemid item itemstatus = 'obso' )o inner join item on o.replacementitemid = i.id christos provided method chaining example , here's query syntax example: var results = o in (from x in item x.itemstatus == "obso" select new { x.id, x.itemstatus, x.description, x.itemwarrantyid, x.replacementitemid }) join in item on o.replacementitemid equals i.itemi

iOS Swift Rotation Animation Not Staying Put -

i playing around rotating uiimageview. rotation animation works fine @ end of if image goes original orientation. below extension use rotate it: extension uiview { func rotate(duration: cftimeinterval = 1.0, degrees:double, completiondelegate: anyobject? = nil) { let rotateanimation = cabasicanimation(keypath: "transform.rotation") rotateanimation.fromvalue = 0.0 let radians = cgfloat(degrees * m_pi / degrees) rotateanimation.tovalue = cgfloat(radians) rotateanimation.duration = duration if let delegate: anyobject = completiondelegate { rotateanimation.delegate = delegate } self.layer.addanimation(rotateanimation, forkey: nil) } } i have auto-layout turned off. missing? in straight core animation have set property you're animating. animating alone shows effect , pops starting value. while setting fillmode , removedoncompletion work visually , actual value of rotation property on layer remains original value,

email - Which technology is faster text messaging using mobile network or messaging using internet? -

which faster way communicate large number of people, 'text messages(mass sms)' or 'via internet(email, social networks)'. kindly provide technical evaluation also. if send messages multiple people simultaneously using mobile network , via internet, message majority of people receive first?

ruby - Integrate external api client in to rails -

i'm qa quite few rails skills i have api client written in ruby created testing purposes, , simulating of multiple users interactions. here simple usage examples: user = userapi.new @phone <- here new oauth session created user.user <- basic user info user.messages user.send_money @phone2 agent = agentapi.new @phone <- here new oauth session created agent.user otp = agent.otp_creator @amnt, 'cash in' user.sign_operation otp i want create web ui interacting these users. 1 browser session == 1 user. main reason why doing - dev practice, second - provide ui team usage. my question is: how integrate existing client web ui in correct , conventional way? (with minimum client changes)

r - Create this vector using rep() and seq() -

this question has answer here: iterate through numbers using seq() , rep() 2 answers i'm starting r language , have create vector using rep() , seq() . 1 2 3 4 5 2 3 4 5 6 3 4 5 6 7 4 5 6 7 8 5 6 7 8 9 i've been trying stuff but i'm not achieving it. we can try 1:5 + rep(0:4,each=5) #[1] 1 2 3 4 5 2 3 4 5 6 3 4 5 6 7 4 5 6 7 8 5 6 7 8 9

php - SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1 -

can me? when try register new admin, system show me error: sqlstate[21s01] got following code similar question didn't solve question this class.admin.php, contain function register new admin public function registro_admin($auser, $aemail, $apass, $adep, $aname, $alast, $agender, $amatricula){ try{ $new_password = password_hash($apass, password_bcrypt); $stmt = $this->db->prepare("insert admin(admin_user, admin_email, admin_password, admin_departamento, admin_name, admin_lastname, admin_matricula) values(:auser, :aemail, :apass, :adep, :aname, :alast, :agender, :amatricula)"); $stmt->bindparam(":auser", $auser); $stmt->bindparam(":aemail", $aemail); $stmt->bindparam(":apass", $apass); $stmt->bindparam(":adep", $adep); $stmt->bindparam(":aname", $aname); $stmt->bindparam(":alast", $alast); $stmt->bindparam(":ag

java - Android data file transfer by vibration- No WIFI -

i want transfer file between 2 android device generating vibration. have text message , encode message morse code. generate vibration patterns in sender device. want receiver android device vibration , decode morse code. there can that?

android - Unhandled exception in callback -

i developing android app need connect ble medical device( here blood pressure) , transfer measured bp. upgrading code .i.e., have bluetooth 2.0 code connects bp device successfully, writes , reads values device successfully. but in ble, able write value (here bp device requires specific value written starting measuring of values) , when trying enable notifications getting null pointer exception. code writecharacteristic method: public boolean writecharacteristic(bluetoothgatt mbluetoothgatt) throws interruptedexception { if (mbluetoothadapter == null ){ log.w(tag, "bluetoothadapter not initialized"); return false; } if (mbluetoothgatt == null ){ log.w(tag, "bluetoothgatt not initialized"); return false; } //bluetoothgattservice service = mbluetoothgatt.getservice(config_descriptor); bluetoothgattservice service = mbluetoothgatt.getservice(my_uuid); if (s

xamarin - Assign/return value onClick event, return it send/receive on DependencyService -

Image
i need assign value click event in custom dialogalert, return value and, dependency service, read in class. this class calls dependencyservice method: bool respuesta; if (device.os == targetplatform.ios) { respuesta = await displayalert(strings.turno_confirmartitulo, strings.turno_confirmarmensaje, strings.si, strings.btncancelar); } else { respuesta = dependencyservice.get<inttbsmensajes> ().mostrarmensaje( strings.turno_confirmartitulo, strings.turno_confirmarmensaje); } if(respuesta) {// something} and method builds dialogalert: public bool mostrarmensaje(string p_titulo, string p_mensaje) { objbuilder = new alertdialog.builder(forms.context, resource.style.myalertdialogtheme); objbuilder.settitle(p_titulo); objbuilder.setmessage(p_mensaje); objbuilder.seticon(resource.drawable.ic_question); objbuilder.setcancelable(false); bool respuesta = false; objdialog = objbuilder.create(); o

jquery - Automatically Determine Credit Card Type -

i'm trying automatically determine credit card type. code below works, not on mobile. i've tried finding solution mobile, i'm unable @ time. here's jquery: (function($) { $.getcreditcardtype = function(val) { if(!val || !val.length) return undefined; switch(val.charat(0)) { case '4': return 'visa'; case '5': return 'mastercard'; case '3': return 'amex'; case '6': return 'discover'; }; return undefined; }; $.fn.creditcardtype = function(options) { var settings = { target: '#credit-card-type', }; if(options) { $.extend(settings, options); }; var keyuphandler = function() { $("#credit-card-type li").removeclass("active"); $("input[id=authorizenet_cc_type]").val(''); switch($.getcreditcardtype($(this).val())) { case 'visa'

javascript - How to manage playerIds with SignalR and MVC -

in game development signalr , mvc , have manage player id's. with mvc controllers re created each ajax request can't store unless use database or store in cookie. does signalr have tools can use persisting playerids game ease situation? you can't connection id's signalr, can register id per user on onconnected method. override function in hub. there might simpler way it, 1 option pass session key js, , js can pass session key (or other unique identifier) server on every command. for example, while user first connected: onconnected() -> gets user unique id js , saves locally map each user unique id(possibly save id group id can call send msgs user according id). after on each request sent hub can attach unique id , can use like. i'm pretty sure can find easier way define unique identifier , maybe more suitable way save data in hub. now think it, should check this .

reporting services - Unpivot columns of cube for SSRS report -

i need modify report has ton of fields pivot columns. uses ssas cube. don't know mdx , learning task isn't feasible. example: existing date amount salesperson1 salesperson2 manager 1 product nbr 4/1/15 100 jsmtih jdoe tprice 99 new results participant participant role date amount product nbr jsmith salesperson1 4/1/15 100 99 jdoe salesperson2 4/1/15 100 99 tprice manager1 4/1/15 100 99 i rewrite report using sql , unpivot (i did write query), reconstruct report ton of work (it has around 10 cascading parameters, sections collapse/expand, etc.) is modifying mdx unpivot columns easy? couldn't find unpivot mdx , guessing inherent in mdx. mdx code: select nonempty({ [measures].[outstanding balance], [measures].[tm fee], [measures].[upfront fee], [measures].[non recurring fee], [measures].[recurring fee], [me

Automatically return data after selecting an item in AngularJS -

for school i'm making exercise. the exercise follows. when school subject selected must automatically return teacher of school subject. required make use of controller. now tried make , , thought have solution, unfortunately not work , have no idea why. does see goes wrong ? <div ng-app="subjectapp"> <div ng-controller="teachercontroller"> choose school subject: <select name="repeatselect" id="repeatselect" ng-model="data.repeatselect"> <option ng-repeat="option in data.availableoptions" value="{{option.subject}}">{{option.subject}}</option> </select> <br> have chosen, {{data.repeatselect}} given {{data.teacher}}. </div> <hr> </div> <script> var subjectapp = angular.module("subjectapp", []); subjectapp.controller('teachercontroller', function ($sc

android - Google Play Achievement offline unlock and sync -

the google play documentation states: an achievement can unlocked offline. when game comes online, syncs google play games services update achievement's unlocked state. i tried unlocking achievement offline using: games.achievements.unlock(mgoogleapiclient, achievementid); however, received following error: java.lang.illegalstateexception: googleapiclient not connected yet. @ com.google.android.gms.internal.jx.a(unknown source) @ com.google.android.gms.common.api.c.b(unknown source) @ com.google.android.gms.games.internal.api.achievementsimpl.unlock(unknown source) to prevent this, wrapped unlock statement check connection: if (mgoogleapiclient.isconnected()) { games.achievements.unlock(mgoogleapiclient, achievementid); } which solution used in example provided google play games: if (mgoogleapiclient.isconnected()) { // unlock "trivial victory" achievement. games.achievements.unlock(mgoogleapiclient, getst

java - Jsoup remove ONLY html tags -

what proper way remove html tags (preserve custom/unknown tags) jsoup (not regex)? expected input: <html> <customtag> <div> dsgfdgdgf </div> </customtag> <123456789/> <123> <html123/> </html> expected output: <customtag> dsgfdgdgf </customtag> <123456789/> <123> <html123/> i tried use cleaner whitelist.none(), removes custom tags also. also tried: string str = jsoup.parse(html).text() but removes custom tags also. this answer isn't me, because number of custom tags infinity. you might want try this: string[] tags = new string[]{"html", "div"}; document thing = jsoup.parse("<html><customtag><div>dsgfdgdgf</div></customtag><123456789/><123><html123/></html>"); (string tag : tags) { (element elem : thing.getelementsbytag(tag)) { elem.parent().ins

powerbi - Microsoft Power Bi Publish to web embedded : update faster then in an hour -

as know power bi caches report definition , results of queries required view report. it can take approximately 1 hour before changes reflected in version of report viewed users. could interval decrease? or caching turned off? please help! publish web designed internet scale. if you're looking target internal users or part of application, can use 1 of authenticated embedding options -there's no cache there. take @ answer here review of options: how pass url filter power bi publish web report we working on making cache update time fast report metadata. if save file in our service, changes report definition updated immediately. any more details on scenario helpful.

Delete a directory that is not empty on python -

so, need clean directory not empty. have created following function.for testing reasons tried remove jdk installation def clean_dir(location): filelist = os.listdir(location) filename in filelist: fullpath=os.path.join(location, filename) if os.path.isfile(fullpath): os.chmod(fullpath, stat.s_irwxu | stat.s_irwxg | stat.s_irwxo) os.remove(location + "/" + filename) elif os.path.isdir(fullpath): if len(os.listdir(fullpath)) > 0: clean_dir(fullpath) #os.rmdir(location + "/" + filename) shutil.rmtree(location + "/" + filename) return i tried use rmtree , rmdir, fails. the error got using rmtree is: oserror: cannot call rmtree on symbolic link and error got when used rmdir: oserror: [errno 66] directory not empty: '/tmp/jdk1.8.0_25/jre/lib/amd64/server' the code works correctly on windows. reason fails on linu

C++ move constructor not called for rvalue reference -

this question has answer here: on how recognize rvalue or lvalue reference , if-it-has-a-name rule 3 answers class myclass { public: myclass() { std::cout << "default constructor\n"; } myclass(myclass& a) { std::cout << "copy constructor\n"; } myclass(myclass&& b) { std::cout << "move constructor\n"; } }; void test(myclass&& temp) { myclass a(myclass{}); // calls move constructor expected myclass b(temp); // calls copy constructor... not expected...? } int main() { test(myclass{}); return 0; } for above code, expected both object creations in test() call move constructor because b r-value reference type (myclass&&). however, passing b myclasss constructor not call move constructor

Rest api implementation with parameter using JetBrains WebStorm + node.js + express -

first of all, i'm using jetbrains webstorm , used create node.js express app project. my modifications @ app.js app.get('/api/restaurants', function(req, res) { console.log("parameter[0]", req.params.restaurant_id); res.json({ '01010112d8139f13': '0ao123r1' }); }); app.get('/api/restaurants/:id', function(req, res) { console.log("parameter[1]", req.params.restaurant_id); res.json({ 'message': 'worked?' }); }); i'm using postman plugin @ chrome test api , can't access localhost:3000/api/restaurants?restaurant_id=01010112d8139f13 without being routed router.route('/restaurants') instead of router.route('/restaurants/:restaurant_id') at console have: get /api/restaurants?id=01010112d8139f13 200 1.803 ms - 31 if can me, in advance. restaurant_id not query parameter variable part in path. example /restaurants/01010112 , /restaurants/1 both handled s