Posts

Showing posts from February, 2012

debugging - lldb unresolved breakpoint via c++ api -

i have got executable module icoretest.exe , wich dynamicly loaded library irtest.rs . want debug via lldb c++ api. when create "icoretest.exe" process under lldb throug lldb::sbtarget::launch(..); works fine. fine, mean can set breakpoints breakpointcreatebylocation , when debugger stops on event sblistener.waitforevent(); problems begins when want attach running process. create target , attach process m_debugdata->currenttarget=m_debugdata>debugger.createtarget(executable.c_str()); m_debugdata->currentprocess = m_debugdata>currenttarget.attachtoprocesswithname(m_debugdata->listener, processname.c_str(), false, error); load module "irtest.rs" auto module = m_debugdata->currenttarget.addmodule("irtest.rs", "i386-pc-windows-msvc", nullptr); after lldb stops on "ntdll.dll`dbgbreakpoint + 1" i execute command m_debugdata->currentprocess.continue(); so, icoretest.exe running.. add breakpoi

sql server - SQL How do i change my batch_date column from first day of the month to last day of the month -

i'm working in sql server management studio 2008. have column called batch_date has entries in format 2007-01-01 00:00:00 . need these changed 2007-01-31 00:00:00 format. please help. bhatiaashish answered question , pressed green checkmark him/her. question answered. declare @month datetime set @month='2007-01-01 00:00:00' select dateadd(s,-1,dateadd(mm, datediff(m,0,@month)+1,0))

php - How i can prevent form from refreshing page after submit -

i'm using chat script internet,very simple , effective when press submit button refreshes whole page.i want refresh form not entire page because use tabs.i use 3 tabulators: workspace , chat, , news , when click chat opens tabulator , when click submit refresh whole page , starts workspace tab. here code. function ajax(){ var req = new xmlhttprequest(); req.onreadystatechange = function(){ if(req.readystate == 4 && req.status == 200){ document.getelementbyid('chat').innerhtml = req.responsetext; } } req.open('get','chat.php',true); req.send(); } setinterval(function(){ajax()},1000); .chat_s { margin-top:20px; padding:20px; width:100%; height:200px; background-color: #f1f1f1; border-radius: 3px; } .chat_s textarea { width:400px; background-color:#f9f9f9; height:70px; border:none; resize: none; outline:none; font-size:13px; paddi

self contained - How can JWT be verified outside the authorization server -

recently, i'm trying implement oauth2.0 server using json web token (jwt) access token. i'm confused self-contained feature of jwt. notice jwt can verified anywhere, not mandatorily in authorization server because self-contained. how feature work? claims should included in jwt in order realize self-contained feature? another question that, if jwt stateless, means server should not store jwt. how jwt verified? can't forged? i'm rookie in field, wish me out:) jwt contains claims can signed, encrypted or both. these operations performed using cryptographic keys. keys can symmetric (e.g. oct et keys) asymmetric (e.g. private/public key pairs such rsa or ec keys). when want verify jwt (i.e. jws), have perform following steps: check header (algorithm supported, critical claims in payload , value understood). check claims (especially exp , iat , nbf , aud ). check signature. to check signature, need key and, depending on algorithm, key can be

php - Symfony/Twig: how to pass additional data to a form? -

i'm looking way manage form data within myformtype.php . far i've label , placeholder , i'd store additional string, e.g. "more details" . appbundle\form\type\myformtype.php // ... $builder->add('fieldname', texttype::class, [ 'label' => 'my label', 'attr' => ['placeholder' => 'my placeholder'], 'additionaldata' => ['info' => 'more information] // <- ??? ]); // ... myform.html.twig label: {{form_label(form.fieldname)}} textfield: {{form_widget(form.fieldname)}} info: {{form_additionaldata(form.fieldname, 'info')}} {# ??? #} i thinking passing data via data-* -attribute like: // ... 'attr' => ['data-info' => 'more information'] // ... but how read data in way, without buggy workarounds? any best/good practise issue? thanks in advance! by using form type extension way if it's

Sorting 2 excels into 1 -

there n number of excel sheets contain n number of worksheets in each . need: need combine worksheets of each excel single excel in ascending order using macros i assume mean excel workbooks several worksheets in each? if case, right click tab want copy new destination, click "move or copy..." , follow instructions copy new book. sure check "create copy" box if want retain worksheet in original location making copy. just clear, can name new workbook , move or copy other tabs it.

ios - How to get VCF data with contact images using CNContactVCardSerialization dataWithContacts: method? -

i'm using cncontacts , cncontactui framework , picking contact via this cncontactpickerviewcontroller *contactpicker = [cncontactpickerviewcontroller new]; contactpicker.delegate = self; [self presentviewcontroller:contactpicker animated:yes completion:nil]; and -(void)contactpicker:(cncontactpickerviewcontroller *)picker didselectcontact:(cncontact *)contact { nsarray *array = [[nsarray alloc] initwithobjects:contact, nil]; nserror *error; nsdata *data = [cncontactvcardserialization datawithcontacts:array error:&error]; nslog(@"error_if_any :: %@",error.description); } this contact object have contact.imagedata , coming in logs. when tried cross check data by nsarray *contactlist = [nsarray arraywitharray:[cncontactvcardserialization contactswithdata:data error:nil]]; cncontact *contactobject = [contactlist objectatindex:0]; this getting null //contactobject.imagedata need why i'm getting null , contact has imag

iphone - How to detect if a table view cell is tapped in xcode 7 -

how detect if table view cell tapped. guides , tutorial on web follow approach of adding button table cell view - prototype cell. button remains same rows , when tapped, returns index of row or cell. i want without button. how can invoke @ibaction when cell tapped , perform segue inside function. how should go it? i added following code, not print anything class moreviewcontroller: uiviewcontroller, uitableviewdatasource, uitableviewdelegate { let appdelegate = uiapplication.sharedapplication().delegate as! appdelegate let moreoption = [ ("my profile"), ("settings"), ("logout") ] override func viewdidload() { super.viewdidload() // additional setup after loading view. self.navigationcontroller!.navigationbar.bartintcolor = uicolor(red: (48/255.0), green: (187/255.0), blue: (197/255.0), alpha: 1.0); self.navigationcontroller!.navigationbar.tintcolor = uicolor .whitecolor(); self.navigationcontroller!.navi

Laravel Class 'Socialite' not found -

using composer, have installed socialite package local machine. works well. upload vendor/laravel/socialite directory server. on server, in composer.json added line - "laravel/socialite": "^2.0" also, in config/app.php make below changes - in provider section add line - laravel\socialite\socialiteserviceprovider::class, in aliases section add line - 'socialite' => laravel\socialite\facades\socialite::class, then, per documentation add below code in config/services.php file - 'facebook' => [ 'client_id' => '{{my_client_id}}', 'client_secret' => '{{my_secret_key}}', 'redirect' => 'http://mydomain/public/callback', ], the controller, using has included use socialite; @ top. bur now, gives me error class 'socialite' not found on server. works fine on local machine. missing upload on server? your appreciated. thanks. you need d

Swift 3: String search backwards -

i want search backwards in string. examples found not running on current swift 3.0. ".backwardssearch" not option available on xcode 8. idea, how can done? example: let rpos = rindex(sourcestring, searchstring) or let rpos = sourcestring.rindex(of: searchstring) xcode autocomplete suggest this: let rpos = sourcestring.range(of:searchstring, options:string.compareoptions.backwards, range:nil, locale:nil) however, range , locale have defaults of nil, can omit them: let rpos = sourcestring.range(of:searchstring, options:string.compareoptions.backwards) and options of type string.compareoptions need last part: let rpos = sourcestring.range(of:searchstring, options:.backwards) (thanks @martinr pointing out shortened versions)

react-native-router-flux: Actions.KEY doesn't work inside function that is passed to onPress -

i have following code: _rendermenuitem(name) { return ( <touchablehighlight onpress={() => this._onitemclicked(name) }> <text>{name}</text> </touchablehighlight> ) } _onitemclicked(name) { actions.categoryscreen() this.props.dispatch(updateactivepage(name)) // close navigationdrawer actions.refresh({ key: 'drawer', open: false }) } the actions.refresh() works fine actions.categoryscreen() doesn't -looks nothing happens. if replace parameter passed onpress onpress={actions.categoryscreen} works fine , categoryscreen shown. however, not me cause there more stuff want when onpress triggered , need pass 'name' parameter. any ideas, anyone? thanks in advance. i found solution this reported issue on react-native-router-flux's repository. there seems bug when 2 actions triggered 1 after other, second 1 works. workaround people posted , worked me trigger second act

java - changing the content-type from application/octet to image/jpeg in MTOM message multipart requeste using jax-ws webservice client -

while using imageupload webservice exposed .net application getting soap fault exception when run generating client wsimport , sending request. whereas soap ui + mtom request works perfect. my code given below. public class testclass { public static void main(string args[]) { string remoteurl = "myurl"; string port = ""; string imagefilepath = ""; string imagename = "70d08e54-4a5e-4c95-88ba-4c791c2da55e.bmp"; string correlationid = "70fd8ae9-56c9-43b3-b4d9-3d497da05b12"; string createdts = "yyyy-mm-dd't'hh:mm:ss'z'"; string sentts = "yyyy-mm-dd't'hh:mm:ss'z'"; string = "guid"; string messageid = "guid"; string sessionguid = "guid"; try { url serviceurl = new url(remoteurl); imagestoreservice iimagestoreservice = new imagestoreservice(

sql - Data Masking options is exist in Databases -

i have database secure data in tables(5 tables) when bring database local environment need mask data special characters. for example : table 1 : name code mohan 100 raju 200 i need see data name code m@#$n 1#0 r@#u 2#@ for of tables sensitive data when db backup data when i'm restoring data local need see data . can please suggest me best ways or features in sql server mask data. i don't think can achieve in single backup/restore step using sql server 2012. either need write masking scripts , use in etl workflow or consider data masking products offer on-the-fly masking (masks data while copying source destination). if don't want write own masking scripts use free dataveil platform data masking tool , use redact mask. disclaimer: work dataveil.

Docker Hub API v2 token authentication issue -

currently, i'm working on light version of docker containers orchestrator , have able image digest public docker hub registry. want use docker registry api v2 purposes. i'm trying authorization token using following api call: curl https://auth.docker.io/token?service=index.docker.io&scope=repository:alpine:pull ... , response following: {"token":"eyjhbgcioijfuzi1niisinr5cci6ikpxvcising1yyi6wyjnsuldthpdq0fku2dbd0lcqwdjqkfequtcz2dxagtqt1bruurbakjhtvvrd1fnwurwuvferxp0uk5gb3ppa2rytjbrnldgulfsrhbjvfrsuk9rovvwrmc2tmtgrlf6cfnuve5et2tgu01rttzumfkztnpwq1zrvkjpa2xhulvrnlexazftekflrncwee5qqtfnekv5txpvne5uzgfgdzb4tnpbmu16rxlnelu0tlrkyu1fwxhsrejdqmdovkjbtvrpmuv6uzfrnlfqskpnenbhujfot09qslhxrta2utbwwff6cfvnmhhpt2tvmlyxwtznbgsyvhpwwlfwbeppbghqvtbrnlzfuljtvg8wvwtwre1ga3dfd1lis29asxpqmenbuvljs29asxpqmerbuwneuwdbrvo0nkvlv3vksxhxothuuc9gweu3u3vyoxlkz3c3k2fkcndxeglxn004vhfua0n0dzbqzm1ss2vldexwaxntrfu4lzzsewz3qufwzwh6shdtwmxzr2dxt0jzaknccnpbt0jntlziuthcqwy4rujbtuncnef3

javascript - Angular inline Filter "controller side" -

i have selection of categories returned after selection correctly html view {{cat}} display comics if comics selected list $scope.selectcategory = function (newcategory) { console.log(newcategory); $scope.cat = newcategory; selectedcategory = newcategory; $scope.selectedpage = 1; } however want filter array of objects category controller side not usual inline filters in view i'm aware of if manually add category in example below comics $scope.edition_products = $filter('filter') ( $scope.filtereditems, {approved: true, category: "comics"}); only category comics approved true returned filter works but how make dynamic injecting inline $scope.cat e.g. $scope.edition_products = $filter('filter') ( $scope.filtereditems, {approved: true, [$scope.cat]} note not work filter in controller doesn't automatically trigger. have run filter each time select category, in selectcategory fun

Login to liferay using jmeter -

after lot of problems got liferay sign in through jmeter work. worked twice. first 1 user in thread group. , used 10 users out of 3 logged in. means way of doing has no problem (since successful on 4 occasions). next time onward, stopped working. suspicious observation have requests getting same auth token (p_auth) no matter how many times or how many users run with. restarted jmeter. why generate same token consistently different requests through jmeter? when try browser, works (comes different token every time). how working? appreciated! liferay introduces token (p_auth) csrf protection. token can used once, , that's problem performance tests. should disable token during tests execution, remember enable again after tests. auth.token.check.enabled=false

html - How to change color of button in active state using inline CSS? -

is there way change background color and/or border color of button when in active state (i.e. clicked) using inline css? <button class="btn btn-xs btn-primary btn-inverse dropdown-toggle" type="button" data-toggle="dropdown" style="margin-top: 12px; background-color: rgba(0, 0, 0, 0); border-color:rgba(0, 0, 0, 0); margin-right:20px"> something when button clicked? considering css :active css pseudo-class , not dom property or attribute can't have inline equivalent that. but, if in case, click event valid alternative, can that... <script> function togglebg(element, color) { if(!color) { color = element.dataset.normalcolor; } else { element.dataset.normalcolor = element.style.backgroundcolor; } element.style.backgroundcolor = color; } </script> <button onmousedown="togglebg(this,'red')" onmouseup="togglebg(this)"

java - Migrating only a subset of Flyway migrations -

how force flyway apply subset of migrations , ignore rest using java? callbacks handy can't stop migration happening. you need implement migrationresolver , migrationexecutor in order catch situations. i must though, sounds precarious solution implement sake of repeatable schema evolution. perhaps elaborate on situation requires this.

MySql - Varchar will be faster or Int while sorting -

i have large table , have sort records using tag_id column varchar values numeric in this. will there performance improvement if convert column datatype varchar integer?? below quesry have write: select * xxx table order tag_id ;

javascript - How do I implement recursive promises? -

i have written retry mechanism should return promise: private connect(): promise<any> { return new promise((resolve, reject) => { if(this.count < 4) { console.log("count < 4, count:"+this.count); this.count++; return this.connect(); } else { resolve("yes"); } }); } if call: t.connect().then((data:any)=>{ console.log("yes:"+data)}); i once count >= 4 , resolve called able trigger above "then". you need resolve inner promise new one, return this.connect() not enough: function connect(): promise<any> { return new promise((resolve, reject) => { if (this.count < 4) { console.log("count < 4, count:" + this.count); this.count++; resolve(this.connect()); } else { resolve("yes"); } }); } note, how resolve new recursive promise res

python - How to temporarily disable foreign key constraint in django -

i have update record have foreign key constraint. have assign 0 column defined foreign key while updating django don't let me update record. foreignkey many-to-one relationship. requires positional argument: class model related. it must relation (class) or null (if null allowed). cannot set 0 (integer) foreignkey columnn.

Android volley request using curl command -

i want pass content web server on format curl -h "content-type:application/json" -x post -d {"email":"someone@example.com","first_name":"fname","last_na‌​me":"lname","passwor‌​d":"pass123"}' 192.xxx.xxx.xxx:1111/register_user this how need pass values server. can 1 me. how possible using volley? in advance yes can in way jsonobjectrequest jsonrequest = new jsonobjectrequest(request.method.post, "192.xxx.xxx.xxx:1111/register_user", new jsonobject("{"email":"someone@example.com","first_name":"fname","last_na‌​me":"lname","passwor‌​d":"pass123"}"), new response.listener<jsonobject>() { @override public void onresponse(jsonobject jsonobject) { //call successful } }, new response.e

java - Wicket Apache get tomcat session setted time -

i'm trying send user message/popup when thier session expires. problem have have set session time out time in tomcat settings, can't find way how time left of tomcat session. found way's set/make yourself, that's want. you should able use httpsession.getmaxinactiveinterval() to access httpsession can use: ((httpservletrequest) getrequest().getcontainerrequest()).getsession(); ((httpservletrequest) requestcycle.get().getrequest().getcontainerrequest()).getsession(); keep in mind session timer reset once user sends request. ajax functionality wouldn't make sense. additionally session invalidated before inactive timer runs out (typically in login/logout scenario).

cloudfoundry - Staging Error while Pushing a Spring Application to Cloud Foundry -

i getting following error while pushing sample hello world spring application on cloudfoundry. using manifest file c:\users\i321571\desktop\helo\hello\manifest.yml updating app hello in org trial / space i321571 i321571... ok uploading hello... uploading app files from: c:\users\i321571\desktop\helo\hello uploading 20.1k, 46 files done uploading ok stopping app hello in org trial / space i321571 i321571... ok starting app hello in org trial / space i321571 i321571... -----> downloaded app package (12k) cloning '/tmp/buildpacks/java-buildpack'... -----> java buildpack version: b050954 | https://github.com/cloudfoundry/java-buildpack.git#b050954 [buildpack] error compile failed exception #<runtimeerror: no container can run application. please ensure you've pushed valid jvm artifact or artifacts using -p command line argument or path manifest entry. information valid jvm artifacts can found @ https://github.com/cloudfoundry/java

java - Bidirectional messaging system using kafka -

is there possible develop bi-directional messaging system using apache kafka ? need subscribe topic consumer need send message consumer. you 1 of 2 ways. either set prefix system message keys or put content inside of message allows consumer avoid messages has produced. now whether should design this, depends on message traffic. if you're not slamming events, might better consider thrift way have message components bidirectional communication. kafka excels relative complexity when need produce , consume massive volumes of data. might not case you. for example, 1 common use case kafka hook service storm, apex or samza doing distributed processing of hundreds of gb or tb of data. if system has high throughput requirement, architecture 1 consider starting point kafka handling messages. storm, if need send messages reprocessing, can use kafka bolt republish message kafka ensure gets reprocessed.

How to draw polygon with radius around polyline in ios swift -

Image
i have problem drawing polygon around polyline(( have coordinates polyline , want buffer coordinates coordinates of polygon around polyline. i have this : . but want make this : please help... you can draw 2 polylines same path. let's you've created variable thepath buffered coordinates. you've created polyline path. let redpolyline = gmspolyline() redpolyline.path = thepath redpolyline.map = mapview create one. let redpolyline = gmspolyline() redpolyline.path = thepath redpolyline.strokewidth = 6.0 // change accordingly redpolyline.strokewidth = uicolor.redcolor().colorwithalphacomponent(0.5) // change accordingly redpolyline.map = mapview remember redpolyline's zindex should higher bluepolyline because can see in image you've provided, redpolyline on top of other one.

Can I have S/MIME as part of a multipart/mixed message? -

i trying send s/mime encrypted email through pre-defined email distribution system. i give them valid email, right headers , correctly encrypted content. the problem is, system rips email apart , creates new 'multipart/mixed' message it, smime.p7m attached attachment. though thunderbird somehow manages encrypt content right way, others outlook don't , show empty message. my question here is: is possible have s/mime message part of multipart message? an example of how newly created message looks like: ... mime-version: 1.0 content-type: multipart/mixed; boundary="_=_swift_v4_1474547127_a48edcebcdce51b8c8f455_=_" --_=_swift_v4_1474547127_a48edcebcdce51b8c8f455_=_ content-type: application/x-pkcs7-mime; smime-type=enveloped-data; name=smime.p7m content-transfer-encoding: base64 content-disposition: attachment; filename=smime.p7m mimdul4gcsqgsib3dqeha6cda7pomimdukkcaqaxggjumiicagibadbsmeuxczajbgnvbaytakfv ... --_=_swift_v4_1474547127_a48edcebcdce5

c# - Xamarin.Auth AccountStore not deleting values? -

whenever call method removes accountstore in xamarin, deletes , says there 1 less thing in list. method below called first dependency service. public void deletesecurevalue(string appname, string key) { var account = accountstore.create().findaccountsforservice(appname).firstordefault(); if (account.properties.containskey(key)) account.properties.remove(key); var props = account.properties; // when debugging, props doesn't contain value passcode } xamarin.forms.dependencyservice.get<istoragehandler>().deletesecurevalue(globalconstants.app_name, "passcode"); var account = accountstore.create().findaccountsforservice(globalconstants.app_name).firstordefault(); var props = account.properties; // when debugging, props has value passcode when shouldn't why value passcode seem come back? you manipulating dictionary in memory in deletesecurevalue . have write changes storage. public void deletesecurevalue(string appname,

php - Apply 2 preg_split with regex to text -

context: have split email several customers’ reservations details received every day, set of rules. example of email: a n k u n f t 11.08.15 *** neubuchung *** 11.08.15 xxx xxx x3 2830 14:25 17:50 18.08.15 xxx xxx x3 2831 18:40 f882129 dsdsaidsaia f882129 xxxyxyagydaysd sadsdsdsdsadsadadssda sadsdsdsdsadsadadssda **«cut here2»** n k u n f t 18.08.15 *** neubuchung *** 11.08.15 xxx xxx x3 2830 14:25 17:50 18.08.15 xxx xxx x3 2831 18:40 f881554 zxcxzcxcxzccxz f881554 xcvcxvcxvcvxc f881554 xvcxvcxcvxxvccvxxcv **«cut here»** 11.08.15 xxx xxx x3 2830 14:25 17:50 18.08.15 xxx xxx x3 2831 18:40 f881605 xczxcdfsfdsdfs f881605 zxccxzxzdffdsfds **«cut here»** so has cut whenever last f999999 appears (where 9 can digit), because f999999 reservation code.* inserted text: «cut here» better understand cut. *note: reservation code may have following formats: f999999, a999999, e999999 or 999999. so apply working preg_split followin

Coffeescript - Finding substring with "in" -

in coffeescript following gives true "s" in "asd" # true but gives false "as" in "asd" # false why this? it happens strings more 1 character? is in not suited task? x in y syntax coffeescript expects y array, or array object. given string, convert array of characters (not directly, iterate on string's indexes if array). so use of in : "as" in "asd" # => false is equivalent "as" in ["a","s","d"] # => false this way easier see why returns false. the little book of coffeescript has on in : includes checking see if value inside array typically done indexof(), rather mind-bogglingly still requires shim, internet explorer hasn't implemented it. var included = (array.indexof("test") != -1) coffeescript has neat alternative pythonists may recognize, namely in. included = "test" in array behind s

bots - C# executes both try and catch -

i've question try catch function in c#. i'm using in discord bot executes both. try , catch. why this? did write wrong or missed little thing? code: private void registerkickcommand() { commands.createcommand("kick") .parameter("a", parametertype.unparsed) .alias(new string[] { "k" }) //add alias .addcheck((cm, u, ch) => u.serverpermissions.kickmembers) .do(async (e) => { await e.channel.sendmessage(e.getarg("a")); if (e.message.mentionedusers.firstordefault() == null) { await e.channel.sendmessage(e.user.mention + " that's not valid user!"); } else { try { await e.message.mentionedusers.firstordefault().kick(); await e.channel.sendmessage(e.getarg(&qu

Pass JSON Array in Retrofit 2.1 -

how can pass jsonarray in api call using retrofit 2.1 json { "address":[ { "addresstype":"home", "addressline1":"m12/150, vidhyanagar flates", "addressline2": "op. himmatlal park, satelite", "city":"ahmedabad", "state":"gujarat", "zipcode":"380015", "country_id":"109", "latitude":"23.13213", "longitude":"72.313213", "isdefault":"0" } ] } response { "status": 1, "message": "address stored successfully.", "result": [ { "id": 16, "user_id": 33, "addresstype": "home", "addressline1": "m12/150, vidhyanagar flates", "addressline2": "op. himmatlal park,

.htaccess - codeigniter remove index.php form url -

i trying remove "index.php" url in codeigniter. know how remove index.php base url example.com/controller . but don't know how remove "index.php" in sub folder example.com/folder/index.php/controller because have different projects in codeigniter. second project have uploaded in sub folder. .htaccess #original #rewriteengine on #rewritecond $1 !^(index\.php|images|robots\.txt) #rewriterule ^(.*)$ index.php/$1 [l] #modify rewriteengine on rewritecond $1 !^(index\.php|resources|robots\.txt) rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?/$1 [qsa,l] rewritebase / rewritecond %{http_host} ^www\.(.*)$ [nc] rewriterule ^(.*)$ http://%1/$1 [r=301,l] the above program base url. change in program work on sub folder. write code in .htaccess file # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-

Laravel 5.3 - Best way to implement Entrust role on signup? -

i'm working laravel 5.3 , i'm trying set role when signs up, i've used zizaco entrust library. i'm unsure on best way achieve this. i tried inside registercontroller 's create method below: protected function create(array $data) { return user::create([ 'name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password']), ]); $user = user::where('email', '=', $data['email'])->first(); // role attach alias $user->attachrole($employee); } but that's not right. i'm bit unsure on best practice sort of thing. if, comment on op suggests, want assign same role registered user, can use model observer - it's simple. // app/observers/userobserver.php <?php namespace app\observers; use app\models\user; use app\models\role; // or namespace zizaco role class class userobserver {

vuforia SDK for an IBM MobileFirst -

i need implement few vuforia functionalities in ibm mobilefirst existing project. however see vuforia has provided sdks android, ios, uwp , unity. how integrate vuforia sdk existing ibm mobilefirst project? mobilefirst enables create either hybrid (web) apps ala cordova, or native apps. end result native project other. so once you've generated xcode project in mobilefirst studio (assuming you're using mobilefirst 7.1 , below), can continue integration steps supplied vuforia. need not supply special integration tools ibm mobilefirst.

vba - Highlight values based on a range of values. Excel -

Image
in excel, in range of cells (say a1 a100) highlight values contain of values in specified range (say a101 150). duplicates among a1 a100 should not highlighted. has solution? give try. select b2:b15893 > go conditional formatting 'use formula determine cells format' > enter formula =and(countif($b$2:$b$15893,b2)>1,countif($b$15895:$b$15924,b2)>0) > format yellow fill > click ok. the first logic test in and() function tests if value duplicate in range $b$2:$b$15893 , second test if value exists in range of values @ bottom. if both logic tests true value highlighted. here screenshot of smaller example. hope helps!

R: Understanding formulas -

i'm trying better understanding of r formulas mathematically mean. for example: lm(y ~ x) fit line y = ax + b would lm(y ~ x + z) fitting plane y = ax + bz + c ? lm(y ~ x + z + x:z) fitting plane y = ax + bz + cxz + d ? your understanding correct! though may helpful understand bit more abstractly. linear model (lm) means it's fitting parameters on one-dimensional dependance (ax not ax^2 or asin(x) or fancier that). but not mean fits 1 3 parameters. imagine foods represent dimensions: grains, fruits, vegetables, meats, , dairy make our 5 "dimensions of food". these things relatable--and maybe not independent--but still not totally describable in same ways. can think of our model tool gauges our coefficients--which in food example can imagine "flavors", sweet, spicy, sour, etc. our model takes points in different dimensions (food groups) , attempts relate them coefficient values (flavors) function. model allows describe other foods/fl

python - Avoid out of memory error for multiprocessing Pool -

how avoid "out of memory" exception when lot of sub processes launched using multiprocessing.pool? first of all, program loads 5gb file object. next, parallel processing runs, each process read 5gb object. because machine has more 30 cores, want use full of cores. however, when launching 30 sub processes, out of memory exception occurs. probably, each process has copy of large instance (5gb). total memory 5gb * 30 core = 150gb. that's why out of memory error occurs. i believe there workaround avoid memory error because each process read object. if each process share memory of huge object, 5gb memory enough multi processing. please let me know workaround of memory error. import cpickle multiprocessing import pool multiprocessing import process import multiprocessing functools import partial open("huge_data_5gb.pickle", "rb") f huge_instance = cpickle(f) def run_process(i, huge_instance): return huge_instance.get_element(i) p

ruby on rails - No such file to load -- 'gem name' using require -

i using gem differ https://github.com/pvande/differ i have helper require 'differ' module answershelper def self.getdiff (text1, text2) differ.format = :html diff = differ.diff_by_word(@current, @original) end end but error no such file load -- differ if remove require line error @ line differ.format = :html uninitialized constant questionscontroller::differ when tried following commands in rails console worked require 'differ' diff = differ.diff_by_word("text1","text2) i have gem differ in gemfile , tried require_relative 'differ' and require './differ' upd: seems restarting server helps, i'll check right now restarting server helped........

java - How can I use arrays in a loop and have multiple outputs -

this question has answer here: what causes java.lang.arrayindexoutofboundsexception , how prevent it? 13 answers my goal have program asks relevant information create invoice. if user wishes add product/service, program loop , array increment, output provide description , price products. when running code error when try add product description: exception in thread "main" java.lang.arrayindexoutofboundsexception: 1 i hope explained problem clearly. import cs1.keyboard; public class invoice_obj{ // object creates invoice public void invoice(){ char answer; int descnum = 1; int pricenum = 1; system.out.print("enter invoice #\t\t: "); string invoicenum = keyboard.readstring(); //user inputs invoice number system.out.print("enter date\t\t: "); string date = keyboard.

python - Adding alpha channel to RGB array using numpy -

i have image array in rgb space , want add alpha channel zeros. specifically, have numpy array shape (205, 54, 3) , want change shape (205, 54, 4) additional spot in third dimension being 0.0's. numpy operation achieve this? you use 1 of stack functions ( stack / hstack / vstack / dstack / concatenate ) join multiple arrays together. numpy.dstack( ( your_input_array, numpy.zeros((25, 54)) ) )

Rails - complex model/associations -

in app building learn rails (rails 5), have following end result try in place: i want users able tag content of pdf (attached either annotation record or document record). after annotation or document pdf attached has been classified document type (e.g. po, delivery note, etc.). tag, when added, associated predefined list of tag types (matching document type of annotation respectively of document document type of tag type). when adding tag, want capture content tagged (e.g. po number or orderer name) , coordinates in pdf. first part of question 2 objects (classes / models) annotation , document have 1-to-many relationship object (class / model) tag (similar order order_item): has_many :tags, dependent: :destroy the model tag has 1-to-1 relationship model tagtype: belongs_to :annotation, :document one single tag-record however, can belong 1 annotation / document , needs deleted when respective annotation / document gets deleted (i set dependent: :destroy that). so,

scala - Spark: java.io.NotSerializableException -

i want pass path function saveastextfile runs in spark streaming. however, java.io.notserializableexception . in similar cases use skeleton object, in particular case don't know how solve issue. can me please? import java.util import java.util.properties import com.fasterxml.jackson.databind.{deserializationfeature, objectmapper} import com.fasterxml.jackson.module.scala.defaultscalamodule import com.fasterxml.jackson.module.scala.experimental.scalaobjectmapper import com.lambdaworks.jacks.jacksmapper import org.sedis._ import redis.clients.jedis._ import com.typesafe.config.configfactory import kafka.consumer.{consumer, consumerconfig} import kafka.utils.logging import org.apache.log4j.{level, logger} import org.apache.spark.sparkconf import org.apache.spark.streaming.kafka.kafkautils import org.apache.spark.streaming.{seconds, streamingcontext} class kafkatestconsumer(val zkquorum: string, val group: string, val topicmessag