Posts

Showing posts from August, 2012

javascript - React.js. Error: Invalid value for <path> attribute d -

i want add svg in react component. use coffeescript without jsx: svg viewbox: '0 0 800 600', path id: 'top' d: 'm300,220 c300,220 520,220 540,220 c740,220 640,540' and error: error: invalid value <path> attribute d="m300,220 c300,220 520,220 540,220 c740,220 640,540" seems reasonable, a cubic bezier defined using c command must have 6 values following it , yet final 1 has 4.

css3 - How to create a pulsing glow ring animation in CSS? -

i way website made rings glow , pulse out , know how did it. i can make similar i'm not good. so able figure out doesn't seem work. css: glowycircleouter.blue .glow4 { box-shadow: 0 0 25px #287ec6; } .glowycircleouter .glow4 { -webkit-animation: glowyglow 3s 2250ms infinite; -moz-animation: glowyglow 3s 2250ms infinite; -ms-animation: glowyglow 3s 2250ms infinite; -o-animation: glowyglow 3s 2250ms infinite; animation: glowyglow 3s 2250ms infinite; animation-name: glowyglow; animation-duration: 3s; animation-timing-function: initial; animation-delay: 2250ms; animation-iteration-count: infinite; animation-direction: initial; animation-fill-mode: initial; animation-play-state: initial; } .glowycircleouter .glow4 { opacity: 0; display: block; position: absolute; left: 50%; top: 50%; width: 200%; height: 200%; -webkit-transform: translate(-50%, -50%); -moz-transform: translate(-50%, -50%); -o-transform: translate(-50%, -50

node.js - How could I get the javascript thread stack from NodeJS -

i working performance issue of our application on nodejs. i wondering if nodejs has mechanism generate java-like core dump? expect contain necessary information of thread / process status, , javascript call stack printed within. thanks!

Is GPS tracking down the exact lane with Google Maps possible? -

the newest google maps release has database of lanes available when near highway exit , highlights lane should in if want take exit. wondering if google maps api has feature track cars down exact lane in. possible? , if so, specific api?

java - Stuck on Android.os.Bundle with Null Object Reference -

i don't know why error happens. have checked code link 1 still doesn't give solution. the ide gimme error : java.lang.nullpointerexception: attempt invoke virtual method 'int android.os.bundle.getint(java.lang.string)' on null object reference @ com.gook.rebill.fragment.homefragment.onattach(homefragment.java:74) i know it's null object reference, still don't cause of error. please me. this code : public class homefragment extends fragment implements internetconnectionlistener, apihandler.apihandlerlistener { private static final string arg_section_number = "section_number"; private final int category_action = 1; private categoryselectioncallbacks mcallbacks; private arraylist<category> categorylist; private listview categorylistview; private string error = null; private internetconnectionlistener internetconnectionlistener;

Why does my c++ compiler seem to be compiling in c -

i using geany (code::blocks wouldnt run programs) compiler compile simple c++ program 1 class. on linux mint 17 on dell vostro 1500. compiling works fine both .cpp files, header file gives error: gcc -wall "morgan.h" (in directory: /home/luke/documents/coding/intro#2) morgan.h:5:1: error: unknown type name ‘class’ class morgan ^ morgan.h:6:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token { ^ compilation failed. this main.cpp : #include <iostream> #include "morgan.h" using namespace std; int main() { morgan morgobject; morgobject.saystuff(); return 0; } this header file (morgan.h): #ifndef morgan_h #define morgan_h class morgan { public: morgan(); void saystuff(); protected: private: }; #endif // morgan_h and class (morgan.cpp): #include <iostream> #include "morgan.h" using namespace std; morgan::morgan() { } void morgan::saystuff(){ cout << &quo

javascript - React - can I find out if a component is currently visible -

when using react, have components change on page depending on route user navigates to, there way detect if component showing? example when user on page not home page, "go home" button show, want remove when user navigates home page (its not quite simple general idea) i'm assuming buttons child components, if have been passed event handlers. perhaps it's time flesh them out little. class gohome extends react.component { constructor(props) { super(props); } state = { visible: "shown" } // while code here execute prior render, // assume happen during page load , after url change, // place in function serves callback // route change event. componentwillmount = () => { // please check regex. var re = /\/home/i; if (re.test(window.location.href)) { this.setstate({ visible: "not-shown" }); }; } // using google's material icons example. render () { let myclass = &

android studio - Junit error in newlly created Androidstudio 2.0 projects -

i'm sorry if question awkward because i'm novice programmer. i use android studio 2, gradle 2.10 , windows 10. after create new project, gradle starts sync project. after sync completes, enable "work offline" mode gradle in settings. sync happens again every new project create. when enable "work offline" receive error during build. how should solve problem? error:(23, 17) failed resolve: junit:junit:4.12 the screenshot of build just remove " testcompile junit:junit:4.12 " build.gradle file: dependencies { compile filetree(dir: 'libs', include: ['*.jar']) testcompile 'junit:junit:4.12' //remove line , sync again... worked me compile 'com.android.support:appcompat-v7:23.3.0' compile 'com.android.support:support-v4:23.3.0' compile 'com.android.support:design:23.3.0' }

javascript - Using chrome.storage.get to get a variable -

i'm making little chrome extension , have used options page use chrome.storage.sync.set set variable pws. however, on pop-up page cannot retrieve variable , use in string. here code goes: weather.open("get", "http://api.wunderground.com/api/"+wu_api_key+"/conditions/q/ca/pws:"+pws+".json", true); weather.send() }) how pws in there variable chrome.sync.storage.get? i tried chrome.storage.sync.get(pws, function(result){ var pws = result.pws console.debug('result:',pws); }); but no avail. if use "pws" key store pws , could: chrome.storage.sync.get("pws", function(result) { var pws = result.pws; console.log("result:", pws); });

r - Order in ggplot2 grouped barchart -

this question has answer here: ordering bar plots ggplot2 according size, i.e. numerical value 1 answer this code: col1<-c(rep("first",2), rep("second",2), rep("third",2), rep("fourth",2), rep("fifth",2), rep("sixth",2), rep("seventh",2), rep("eighth",2)) col2<-gl(2,1,8, labels=c("one","two")) col3<-values d1 <- data.frame(column1=col1, column2=col2, column3=col3) ggplot(d, aes(x=column1, y=column3, fill=column2)) + geom_bar(position=position_dodge()) the bars on plot in alphabetical order, need them in order in col1. how can this? substitute: d1 <- data.frame(column1=col1, column2=col2, column3=col3) for: d1 <- data.frame(column1=factor(col1, levels=unique(col1)), column2=col2, column3=col3) the factor(col1, levels=unique(col1))

c# 4.0 - Efficient way to match regex patterns against huge volume of data -

i have 30 text files (say log files) , size of these files varies 100mb 200mb , have got 1 more text file (pattern.txt) contains around 30 regex patterns. need compare regex patterns against each line in log files in fast , efficient way. reading line line log file , compare against patterns. is there more efficient way achieve without using third party components? when filtering don't use regex ie if need compare line n 30 regexes try , turn regexes string indexof operations ie string in line if compare regex. basic string comparison functions incredibly fast, if performance regex's issue use normal string compare functions first speed things up. following example bit contrived demonstrates filtering using regexes lot faster using regexes. index time: 3492 ms regex time: 81553 ms i created file 70mb alternating lines in ie value="path=/this/is/a/path" initstring="path = " endstring="," /> <pattern value="path=/th

ios - CoreBluetooth peripheral identifier changes -

i using corebluetooth connect number of identical bluetooth scales i've developed using bluegiga ble113 modules. app keeps local copy of each scale's cbperipheral.identifier.uuidstring along related data physical scale can tell them apart. e.g. "scale a" , "scale b" my trouble every device's uuidstring changes. can develop days against device, 1 day uuid different. scale hasn't been reset, app hasn't been restarted , bluetooth hasn't been cycled on phone. i need way identify each bluetooth peripheral (scale) reliably , i'd rather not have hard code identifiers each device during production. is there better method of identifying peripherals long-term? unfortunately, dont think around ios's changing of peripheral uuids. depending on control have change ble services/characteristics on scales, advertise additional service contains characteristic put custom identifier in. on ios scan service , read characteristics va

python - Follow links with regular expressions -

i know how find links on specific page regular expressions: import urllib2 import re url = "www.something.com" page = urllib2.urlopen(url) html = page.read() links = re.findall(r'"((http|ftp)s?://.*?)"', html) however, can't figure out how follow links extract <p> tags. tried this: for link in links: page += urllib2.urlopen(links) html += page.read() paragraphs = re.findall(r'(<p(.*?)</p>)', html) paragraph in paragraphs: print paragraph[0], "\n" how supposed done? (sidenote: regex question, not beautifulsoup question.) it looks have small syntax errors in code snippet. when use re.findall , “captures” expressions in parentheses groups , returns them part of each hit. thus, links list (get it?) not array of strings, array of tuples. e.g., ('https://s.yimg.com/os/mit/ape/w/d8f6e02/dark/partly_cloudy_day.png', 'http'), ('https://s.yimg.com/os/mit/ape/w/d8f6

Tempo Reset API Parameters for Validation API -

we want consume below tempo api(post request) validating whether time sheet period closed or not , unable find document talk required parameter api any regarding api documentation or parameter useful https://myserver/jira/rest/tempo-rest/1.0/worklogs/validation/date thanks you try passing following x-www-form-urlencoded parameters in body of api- ansidate - 2016-04-24 formfieldid - date user - abc planning - false hope helps :)

list-comprehension-like expansion inside Julia expression? -

is possible have list comprehension building complicated expressions in julia? for example, have symbols , types, , want build type them. right now, have like. syms = [:a, :b, :c] typs = [int, float32, char] new_type = :(type foo end) new_type.args[3].args = [:($sym::$typ) (sym,typ) in zip(syms,typs)] this works in new_type expression containing :(type foo a::int64 b::float32 c::char end) but building complicated expressions both extremely error prone (because have intimately knowledgeable expr data type in order know, eg expressions data types of tuple have stored in new_type.args[3].args ) , extremely brittle in change ast of expression being built mean having change where/how every sub-expression stored. so there way like :(type foo $(sym::typ (sym,typ) in zip(syms,typs)) end) and end same expression above? yes, can splat arrays of expressions directly syntax: julia> :(type foo $([:($sym::$typ) (sym,typ) in zip(syms,typs

using Asp.net Identity Framework With DTO in domain Driven Design -

i designing application based on ddd architecture , have following layer presentation(asp.net mvc project) application layer(service layer ,facade underlying layer) domain layer infrastructure layer(repository , unit of work) based on ddd supposed pass dto presentation layer application layer , mapping domain model happen in application layer , problem inheriting usermanagmentservice(application layer) layer asp.net identity frmaework usermanager , , when calling usermanagmentservice.createasync(); method expect domain model entity cant pass dto usermanagmentservice , below code presentation layer (mvc) public actionresult create(formcollection collection) { try { var userapplicationservice = new usermanagmentservice<int>(); var userdto=new userdto(); userdto.name="some name" //the below line doesnt work because expecting type nherited identityuser , in case domain model , not dto usera

angularjs - Pass common params to all states UI router -

i newbie in ui router. need pass global param states. there way config have global params in ui router? i prefer in way. extend $stateparam app.factory('extendedstateparam', function($http, $stateparam, $state){ $stateparam['global_param'] = $state.$current.global_param; return $stateparam; }

java - Spock mock the parent class method -

i have method looks this public class bookitemreader extends staxeventitemreader<book> { protected list<book> doread() { list<book> booklist= null; try { booklist = converttobookimport((book) super.doread()); } catch (exception ex) { //do nothign } return booklist; } } for above method, trying write test mocking method super.doread() staxeventitemreader<book> staxeventitemreader = spy(staxeventitemreader) staxeventitemreader.doread() >> new book() but, control invoking super class method doread . can guide me mock super class method, can stop invoking super class method in test? i tried this solution , mock referring child class method. bookitemreader reader = mockito.spy(new bookitemreader ()) mockito.doreturn(new book()).when((staxeventitemreader) reader).doread()

ubuntu - Docker installation on 16.04 LTS -

how install docker on ubuntu 16.04 lts easiest run in bash terminal: wget -qo- https://get.docker.com/ | sh you can @ these instructions:- docker installation using script official documentation install docker for installing private docker registry, use link. should work fine ubuntu16.04:- docker private registry

javascript - Factory vs Service object design Angular -

i'm creating web application allows users post messages (each message have associated tags in 1 categorize/filter messages). i'm having trouble understanding how design service these messages. from understanding 5 possible functions create services in angular (providers, services, factories, values, , constants), services , factories being common. a service wrapper around provider(), abstracting away of $provide configuration (i.e. $get). return value (a service object -> represents service instance) 1 use expose via controller. a factory wrapper around service() , uses $injector new constructor function defined said service, believe returning constructor function opposed service object. so service messages far looks (i arbitrarily chose go service(), have no real justification on why used on factory()). question add tags function, , how can write in way makes more sense point of view of service property; two things i'd point out: 1) tags temporary array us

php - Why doesn't "exec" perform a command until I print its output? -

i onubuntu 14.04, php 5.5.9. there, have simple file a.php : <?php $a = exec('clear'); print($a); if run script get: $ php a.php <screen cleared> # nothing displayed in screen # "clear" performed however, if comment print($a) have file this: <?php $a = exec('clear'); then nothing happens: $ php a.php $ # nothing happened, see previous line above to understanding, call variable $a makes clear performed. doesn't make sense, since exec() docs says: exec — execute external program is there reason why clear doesn't performed until print() called? note related question clear cmd-shell php asking here why happens. actually, clear gets executed when calling exec. don't see action on screen until output it.

ios - How to save selected images from gallery through ALAssetsLibrary to document directory of app -

i have fetched images gallery collection view through alassetslibrary . , have done successfully. now, want save selected image collection view document directory of app. and selecting images code-- -(void)done { nsmutablearray *imagearray = [[nsmutablearray alloc] initwithcapacity:[selectedindexarr count]]; [selectedindexarr enumerateobjectsusingblock:^(id obj, nsuinteger idx, bool *stop) { alassetslibrary *library = [[alassetslibrary alloc] init]; [library assetforurl:obj resultblock:^(alasset *asset) { alassetrepresentation *representation = [asset defaultrepresentation]; uiimage *latestphoto = [uiimage imagewithcgimage:[representation fullscreenimage]]; [imagearray addobject:latestphoto]; if ([imagearray count]==[selectedindexarr count]) { if ([self.delegate respondstoselector:@selector(ims_pickercontroller:didfinishpickingmediaitems:)]) { [self.delegate ims_pickercontroller:self didfinishpickingmediait

extjs3 - extjs customise number of rows to display in Ext.grid.ColumnModel -

how should customize change how many rows of columnmodel table gets displayed in web app before table scrolls new ext.panel({ items : [{ xtype : 'panel', id : 'abc', height : 250, autoscroll : false, frame : false, items : [{ xtype : 'editorgrid', id : 'abc-grid', store : abc.store, cm : abc.col, sm : new ext.grid.rowselectionmodel(), height : 100, frame : false, clickstoedit : 2, striperows : true, view: gridview, viewconfig : { headersdisabled : true }, listeners : { } }] }] });

javascript - Jquery subtotal function conflicting with js gst function -

o.k today starting 1 step forward , 2 steps back. have jquery function price x qty = subtotal in form , each subtotal calculated total, fine , dandy. have plain js function took total value , added gst , further subtotal figure created on it's own , works @ point when tried move on gst , finial total functions won't work , can't error codes out of either. @ point can assume js script can't talk jquery script or wrong. // jquery script <script type="text/javascript"> jquery(function($) { $(".qty, .tradeprice").change(function() { var total = 0; $(".qty").each(function() { var $qty = $(this), $row = $qty.closest('tr'), $tradeprice = $row.find('.tradeprice'), $subtotal = $row.find('.subtotal'); subtotal = parseint($qty.val(), 10) * parsefloat($tradeprice.val()); total += subtotal; $subtot

ruby - Discrepancies when executing a command in Rails controller vs Rails console -

i trying run df command display statistics of disks attached server. however, returns size of disk 0. if run same command in rails console within production environment, returns size of disk. here's how code structured, class disk def self.metrics `df -h` end end and how call in controller, class diskcontroller def metrics @metrics = disk.metrics end end but returns nil when try see result in view. same command works in rails console. i've tried using system , popen returns same result. also, same thing works in development (mac osx) not in production (linux ubuntu). your console running under user have logged in. rails app running under user, dedicated run web server. believe call whoami within controller code show user name. user restricted run df command. though not recommended, possible solution grant user execute df command (via /etc/sudoers .) i go approach, though. add cron job, execute df -h on behalf of permitted

onchange - AngularJs ng-change event fire manually -

<input type="checkbox" value="" ng-model="filterprivatedoccheckbox" ng-click="dl.filterprivatedocument(filterprivatedoccheckbox, $event)"> <input st-search="target" class="input-sm form-control" ng-model="dl.documenttarget" ng-change="dl.change()" /> function filterprivatedocument(val) { if(val) this.documenttarget = 'private'; } when clicked on checkbox set value text box, saw ng-change event doesn't fired. why? and when type value in text box observe ng-change event gets fired. any fix problem? according the docs : the ngchange expression evaluated when change in input value causes new value committed model. it not evaluated: if value returned $parsers transformation pipeline has not changed if input has continued invalid since model stay null if model changed programmatically , not change input value so not tr

Samsung android 6.0 how to get dual sim call logs with sim slot id? -

samsung(dual sim) before offical android 6.0(not cm) device, call logs sim slot id, samsung(dual sim) android 6.0+ device issue: string slotid = cursor.getstring(cursor.getcolumnindex(calllog.calls.phone_account_id)); <i>slotid</i> = null; in device (huawei mate 8) work fine did samsung modify com.android.providers.contacts , contacts2.db? can guide through solution this? update news : find 1 solution boolean s_bsamsung; if (build.version_codes.m <= build.version.sdk_int && s_bsamsung){ uri = uri.parse("content://logs/call"); }else { uri = uri.parse(calllog.calls.content_uri); } use sim_id find sim slot

PHP basic auth setHeader if data incorrect -

i'm building api endpoint. endpoint needs secured http basic auth. if api requests access show http basic auth, if data incorrect throw 403 forbidden message. if data correct show "correct" @ moment. here's code: $username = null; $password = null; // if data sent if (isset($_server['php_auth_user']) && isset($_server['php_auth_pw']) ) { $username = $_server['php_auth_user']; $password = $_server['php_auth_pw']; //perforn check if data correct if($username == 'as' && $password = 'pass'){ die(var_dump("correct")); } //if data uncorrect throw 403 code else header('http/1.0 403 forbidden'); } //request http auth if nothing sent if (!isset($_server['php_auth_user']) && !isset($_server['php_auth_pw'])) { header('www-authenticate: basic realm="my realm"');

apache - IronMQ push queue sending unknown HTTP requests -

i setup push queue endpoint post /iron , works fine. i'm getting bunch of other requests too. these iron.io? what's point of them? they're filling apache log. server returning 500 errors of them (500 instead of 404 in development mode). post /webhooks post /orders/webhook post /api/orders/webhook edit: looked using multicast , noticed first server getting these weird requests. seem totally unrelated iron.io. guess it's coincidence they're webhook requests , noticed them now. put server endpoint webhooks. >_< ironmq won't send "unknown" requests. if endpoint doesn't return 200, push queue keep retrying message until either a) receives 200, or b) fails "max_retries" number of times. also per featilion's answer, check multicast/unicast/subscriber setup well. if getting requests other endpoints there's subscriber setup. feel free jump live chat if don't figure out answer rather quickly.

Warning in svm-scale libsvm -

i'm using libsvm-3.21 epsilon-svr . have training data many non zeros (sparse format). when use svm-scale scale features range [0, 1], i'm getting warning warning: original #nonzeros 503981 > new #nonzeros 6450944 if feature values non-negative , sparse, use -l 0 rather default -l -1 should ignore warning, affect predictions ? sparse inputs can processed more efficiently. if can scale data in way preserve zeros training model might quite bit faster. and model takes less time train might end giving better results since have more time optimising parameters.

java - Android Fingerprint Login - Possible or not -

i developing 1 app in user able login fingerprint. far know storage of fingerprint local o.s dependent. if want achieve through server end how can make work ? ex. if user enter user name, or asked enter password or use finger print login. based on username , fingerprint his/her desired role recognized. please add valuable replies. you're correct fingerprint data handled os. in fact, app won't able distinguish between different enrolled fingerprints. all can faster login using device enrolled fingerprints (although aware enrolled fingerprint can used authenticating user). may android developer's blogpost can further details.

xml - Android custom row layout not showing up in listview -

i can't see row i've added list view , wondering if has layout or listviewadapter. in debug can see array filled data passed arraylist playerlist, , see data in toast nothing shows on screen. mainactivity xml: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <textview android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/txtv_battingorder_title" android:textsize="20sp" /> <button android:id="@+id/button1" style="?android:attr/buttonstylesmall" android:layout_width="wrap_content" android:layout_height="wrap_content" a

How to identify a row or a key in Android Keyboard -

i need identify each row or keys in row. since row or key not have "id" attribute,we cannot find using findviewbyid. iam wondering there way of identifying rows , keys in keyboard.you can find keyboard's xml file below. <?xml version="1.0" encoding="utf-8"?> <keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keywidth="10%p" android:horizontalgap="0px" android:verticalgap="0px" android:keyheight="60dp" > <row> <key android:codes="49" android:keylabel="1" android:keyedgeflags="left"/> <key android:codes="50" android:keylabel="2"/> <key android:codes="51" android:keylabel="3"/> <key android:codes="52" android:keylabel="4"/> <key android:codes="53" android:keylabel="5"/> <key android:codes

c++ - Access mmap memory from another process -

i've started playing mmap. i'm trying create example workspace extended real case. this want achieve: process 1: mmap file (actually device, it's okay generate example text file) process 2: (not foked process 1; independent process) read memory mapped process 1 change bits write new file i've read several examples , documentations, still didn't find how achieve this. i'm missing is: how can process 2 access memory mapped process 1, without knowing opened file? how can put mmap content in new file? suppose have ftruncate new file, mmap file , memcpy content of process 1 memory map process 2 memory map (then msync) side info, have message queue opened between 2 processes, can share messages if needed (ex. memory address/size, ...). any hints? thanks in advance! mix this answer considers trying stuff on linux/unix. how can process 2 access memory mapped process 1, without knowing opened file? process 1 passes mmap

How to get all input element vlaues in div tag in jquery? -

i need input element values using jquery... using outerhtml got 1 input element values. need 2 input elements values.. <div class="selectator_element single options-hidden disable_search"> <span class="selectator_textlength" > <div class="selectator_chosen_item_remove">x</div> </span> <div class="selectator_chosen_items"> <div class="selectator_chosen_item selectator_value_2"> <div class="selectator_chosen_item_left"> </div> <div class="selectator_chosen_item_title">fehlerhaft</div> <div class="selectator_chosen_item_remove">x</div> </div> </div> <input class="selectator_input" readonly="readonly" autocomplete="false" style="width: 0px;

vb.net - How to enable Visual Basic support for XNA game studio? -

i did read latest version of xna game studio visual basic support added. downloaded xna game studio 4.0 refresh , installed it. source: http://www.microsoft.com/en-us/download/details.aspx?id=27599 . added xna visual studio templates visual c# 2010 express , not visual basic 2010 express. both ides date (sp1). how can enable xna support visual basic also? thanks help

ecmascript 6 - TypeScript | Array.from | error TS2339: Property 'from' does not exist on type 'ArrayConstructor' -

i googling, cannot find information , how should add project allow me using es6 methods array.from __ edit: removed prototype word you can extend existing types so: interface array { from(arraylike: any, mapfn?, thisarg?): array<any>; } the problem here add function array instances , not static function require. can done so: interface arrayconstructor { from(arraylike: any, mapfn?, thisarg?): array<any>; } then should able use array.from . try out on playground . edit if need polyfill implementation (because environment in intend run doesn't have it), how: interface arrayconstructor { from(arraylike: any, mapfn?, thisarg?): array<any>; } array.from = function(arraylike: any, mapfn?, thisarg?): array<any> { // place code mdn here } the polyfill code in mdn . 2nd edit based on comment, i'm adding typed version: interface arrayconstructor { from<t, u>(arraylike: arraylike<t>, mapfn

php - list more than one field in lists laravel method -

i using zizaco/entrust laravel package , suppose want fetch users teacher role. i want return selected users , name , family combination : [ 1 => 'ali nasiri', 2 => 'majid basirati' ] for that, wrote code : $teachers = role::where('name', 'teacher')->first()->users()->lists('name', 'users.user_id'); but returns : { "1": "ali", "2": "majid" } means name field returned because can define 1 field in first parameter of lists method. how can , best solution ? in user model , add custom attribute( accessor ): <?php use zizaco\entrust\traits\entrustusertrait; class user extends eloquent { use entrustusertrait; // add trait user model ... protected $appends = ['full_name']; //setter of full name attribute public function getfullnameattribute() { return $this->name.' '.$this-

Store Table in Java Object - Datastructure -

i have store data structured table in java. besides columnnames , data store different metadata data type of column. @ moment i'm using object. public class data { private final map<string, list<object>> values; private final map<string, integer> columnspec; private int rowsize; //getter , setter as can see save data columnoriented. have itterate on data in specific column. on specific rows. i'm looking structre can switch column row layout (or vice versa). which object suggest? how can reach maximum performance (less iteration change layout)? table can have on 1 million lines in cases. if using library not problem, can use guava table structures. of avaliable structures are: treebasedtable , hashbasedtable , immutabletable , arraytable . can pick suitable one.

java - Error when deploy web-application on JBoss AS 7 -

i use jboss 7.1.1 final , i've 1 problem when try deploy application: jbas014775: new missing/unsatisfied dependencies: service jboss.naming.context.java."\n\t\t\tjava:jboss".datasources."carsds\n\t\t" (missing) dependents: [service jboss.persistenceunit."springtest.war#carspu"] 20:33:58,250 error [org.jboss.as.server.deployment.scanner] (deploymentscanner-threads - 1) {"jbas014653: composite operation failed , rolled back. steps failed:" => {"operation step-2" => {"jbas014771: services missing/unavailable dependencies" => ["jboss.persistenceunit.\"springtest.war#carspu\"jboss.naming.context.java.\"\n\t\t\tjava:jboss\".datasources.\"carsds\n\t\t\"missing[jboss.persistenceunit.\"springtest.war#carspu\"jboss.naming.context.java.\"\n\t\t\tjava:jboss\".datasources.\"carsds\n\t\t\"]"]}}} this standalone.xml file:

ios - Jsqmessageviewcontroller image upload and show on the screen is very slow touch is not responding -

whenever scroll chat page taking long time fetch images somtime not responding 1 me on this. whenever scroll chat page taking long time fetch images somtime not responding 1 me on this. - (id<jsqmessagedata>)collectionview:(jsqmessagescollectionview *)collectionview messagedataforitematindexpath:(nsindexpath *)indexpath { jsqmessage *messageforrow; nsstring * chart = [[dataarray objectatindex:indexpath.row] objectforkey:@"message"]; nsstring * imageurl = [[dataarray objectatindex:indexpath.row] objectforkey:@"media"]; if (chart == nil) { nsurl *imageurl = [nsurl urlwithstring:imageurl]; nsdata *imagedata = [nsdata datawithcontentsofurl:imageurl]; uiimage *image1 = [uiimage imagewithdata:imagedata]; jsqphotomediaitem *item = [[jsqphotomediaitem alloc] initwithimage:image1]; messageforrow = [[jsqmessage alloc] initwithsenderid:[[dataarray o

smartcard - What is an analog CryptSetProvParam(PP_SIGNATURE_PIN) analog in CryptoAPI NG? -

i'm writing application smartcards. know how application can obtain pin using method cryptsetprovparam, don't know how same thing when i'm using cryptoapi ng. want prevent pin request ui window pop up. setting cspparameters.keypassword equivalent calling cryptsetprovparam pp_keyexchange_pin (or pp_signature_pin). flag not supported default microsoft crypto-service-provider (it intended use smartcard-based csps).

Nested Conditional Operators in C -

this question has answer here: scanf not taking in data 3 answers i having little trouble working nested conditional operators in c. int is_correct() { char yn ; printf( "y or n : " ) ; scanf( "%c", &yn ) ; yn = toupper( yn ) ; return ( yn == 'y' )? 1 : ( yn == 'n' )? 0 : is_correct() ; } i under impression last line of code return 1 or 0 if 'y' or 'n' entered or call again if unexpected character entered. instead continuously calls no matter input. probably scanning failing, , you're not verifying it. you don't specify if "continuously" means "without stopping read more input", of course should do. note, instance, toupper() uses int -typed argument , results, , expecting values of type unsigned char might hit undefined behavior there. this conf

python - How to nest 2 for loops into one if statement -

how put 2 loops inside if statement? ships = [ ["aircraft carrier", 5], ["battleship", 4], ["submarine", 3], ["destroyer", 3], ["patrol boat", 2] ] ships_left = ["a","b","s","d","p"] if [ship ship in ships_left name name in ships if name[0][0] == ship]: print(name[0]) expected output: aircraft carrier this because if both iterate once ship should equal "a" , name should ["aircraft carrier", 5] , name[0][0] should "a" . how code independently iterate through both lists , branch on given statement associating 2 lists? calculate ships left first , before using if test if there any: left_names = [name name, size in ships if name[0] in ships_left] if left_names: print(left_names[0]) by calculating ships left first, can re-use result both if test , print() function; otherwise you'd have make s

how to create customized edittextbox android? -

Image
i'm trying make customized edit textbox . when getting string of numbers want present them this: instead of regular way this: i have tried ways none of them gave me results pictures above, , don't have more ideas. do have idea how create simply? now using button widget: <button android:id="@+id/licenceplatecontainer" android:layout_width="@dimen/licenceplate_width" android:layout_height="@dimen/licenceplate_height" android:layout_alignparenttop="true" android:layout_centerinparent="true" android:layout_marginbottom="20dp" android:layout_margintop="5dp" android:background="@drawable/rectangle" android:text="00-000-00" android:textsize="45sp" /> but problem when number user , setting text: button btnlicenceplate = (button) findviewbyid(r.id.licenceplatecontainer); btnlicenceplate.settext(txtlicenceplate.gettext().t

java - To skip empty records from a CSV file using Apache Commons CSV -

if csv file contains 3 columns , if values given below a,b,c //empty line ,,, a,b,c there 2 valid records. using apache commons csv parser, skip record has empty lines. when records contain null values, how skip then? to overcome this, i'm using string equals() constructed empty record. here sample implementation. list<string[]> csvcontentslist = new arraylist<string[]>(); csvformat csvformat = csvformat.default.withnullstring(""); csvparser csvparser = new csvparser(filereader, csvformat); string[] nullrecordarray = { null, null, null}; string nullrecordstring = arrays.tostring(nullrecordarray); (csvrecord csvrecord : csvparser) { try { string values[] = { csvrecord.get(0),csvrecord.get(1),csvrecord.get(2) }; if (!nullrecordstring.equals(arrays.tostring(values))) //linea csvcontentslist.add(values); } catch (exception e) { // exception handling } } when don't use line marked 'linea&

Why icon in my magento did not load properly -

Image
how remove chinese icon?

typescript - Migration from Angular2 beta1 to Angular2 beta15 - .map() error -

i'm trying migrate project angular2 beta1 angular2 beta15 , have issues. i have error message : 'map' property not exists on 'observable< response >' example of code error : import { injectable } 'angular2/core'; import { http, response, headers } 'angular2/http'; import { observable } 'rxjs/observable'; import { helpermodule } './helpers.module'; import { blogpost } './model'; import 'rxjs/add/operator/map'; /** * service dealing blog data */ @injectable() export class dataservice { constructor(private http: http) { } /** * call api list available blog posts */ listblogposts() { return this.http.get(helpermodule.urlbuilder.buildpostlisturl()).map(res => (<response>res).json()); } } code available here : https://github.com/adrientorris/aspnet5angular2playground edit : i'm using rxjs 5.0.0-beta6 , typescript 1.8.10 , targetting es6 try