Posts

Showing posts from January, 2010

android - Most precise way of updating the UI based on markers from an AudioTrack? -

i needing precise syncing between audiotrack , screen. screen content standard views created xml. screen updates simple, consisting (currently) of switching single small images through viewflipper ui component. changes occuring once every 2 seconds 3 times second, , i'm using onmarkerreached() of audiotrack , updating ui on main thread way. this working pretty good, except on low end devices there appears inconsitency between audio , when screen updates, not acceptable. classes should looking @ in order update screen more precisely? understanding surface can update screen off main thread, going way go? i continue use java audiotrack implementation, if possible.

WebStorm projects do not work outside of WebStorm -

i creating project in webstorm class in. seems when view project , test in webstorm uses localhost in url. when go files in root folder files don't seem work. there have export project works when not specifying port number? here link project if care look https://github.com/joeythomaschaske/wotcompanion sounds don't have web server set up! webstorm comes built in web server makes debugging , running apps/websites smoother, if want able view site outside of webstorm you're going have set own webserver. a common open-source 1 apache , there many others can use desired results. there many guides on how set own web server, , many questions on stack overflow deal too. search around , i'm sure you'll find something.

swift - Set desktop background image for all Spaces (possibly using com.apple.desktop) -

i want change desktop background image of user's spaces @ same time. after research found a solution relies on accessing .plist file named "com.apple.desktop". when try access file using line of code, value nil : let desktopdict = nsuserdefaults.standarduserdefaults().persistentdomainforname("com.apple.desktop") yet, if try same thing string ie: "com.apple.dock" dictionary expected. know syntax right, seems way access com.apple.desktop plist has changed in past couple years. can still use com.apple.desktop change wallpaper spaces @ once? or there other way should doing this? thanks.

caching - Android - [Glide] Using Disk Cache -

i developing app shows images in recyclerview of amazing library glide . number of image gets higher, memory usage. thing is.. when check cache usage of app using es file explorer, says 0kb , weird.. used : glide.with(context) .load(youtubesharethumbnailurl) .diskcachestrategy(diskcachestrategy.all) .skipmemorycache(true) .centercrop() .into(((objectviewholder) holder).userpostshareyoutubeimage); am understanding "cache" wrong? think : memory cache shows on android monitor, in "memory" tab, , disk cache app cache shown in es file explorer. exceeding memory cache app cause oom error, whereas disk cache doesn't have limit stored in storage. i'm sorry if don't question right, if tying cache image in disk suggest rid of skipmemorycache(true) bit. , afaik glide loads image once , saves them disk cache further use (if enabled) therefore use of memory (ram) not noticable when load same image or image sets second time :)

angularjs - Clearing input field on firebase function after angular submit -

the function works , submits user input firebase "back-end" cannot figure out clear function empty out input field after using ng-submit. input tied var "emailinput" ng-model. suggestions! var newemailref = new firebase("https://nevermind.com"); $scope.email = $firebasearray(newemailref); $scope.addemail = function(email) { $scope.email.$add(email); $scope.emailinput = ''; }; i needed assign key email input , empty object. $scope.emailinput = {}; var newemailref = new firebase("https://archerthedog.firebaseio.com/email"); $scope.email = $firebasearray(newemailref); $scope.addemail = function(email) { $scope.email.$add(email); $scope.emailinput = {}; };

.htaccess - htaccess URL fingerprinting -

is there way use mod_rewrite , htaccess implement url fingerprinting without having change file names every update? this file structure on server (irrelevant files omitted): /apps /foo /public /js file1.min.js file2.min.js /css file1.css file2.css /bar /public /js file1.min.js file2.min.js /css file1.css file2.css my pages in application folders. <script> elements in pages @ moment: <script src='public/js/file1.min.js'></script> <script src='public/js/file2.min.js'></script> i'd implement url fingerprinting elements this: <script src='public/js/file1.1a516fba.min.js' integrity='sha384-...'></script> <script src='public/js/file2.faf315f3.min.js' integrity='sha384-...'></

codefluent - How filter in a grid view like '% value %'? -

how can use method search generate query search(name) select * person name '% name %' , how set method filter gridview? see option startwith , endwith cfql supports concatenation operation, can use following cfql method: search(name) name '%' + @name + '%' if edit model directly in xml, have escape character % : <cf:method name="searchsample" body="search(name) name '%%' + @name + '%%'" /> formal grammar of codefluent query language (cfql)

php - Wordpress: how to add custom post category to the permalink -

i'm using cherry framework . , theme includes custom post type: portfolios , i've created 2 categories under post type: readers stories(slug: readers-stories) , readers tips(slug: readers-tips) . when create post under portfolios , assign them 1 of category(ex: readers stories) permalink post this: mysite.com/portfolios/example_post but want url be: mysite.com/portfolios/readers-stories/example_post how can achieve this? i tried use custom post type permalinks plugin. did not desired result. here register_post_type function portfolios post type: register_post_type( 'portfolio', array( 'label' => theme_locals("portfolio"), 'singular_label' => theme_locals("portfolio"), '_builtin' => false, 'public' => true, 'show_ui' => true, 'show_in_nav_menus' => true, 'hierar

knockout.js - Scroll to a Div in KnockoutJS -

i trying create similar jquery scroll functionality scroll div when pressed button didn't find solution in knockoutjs. please suggest approach? $('html,body').animate({ scrolltop: $('#mydivwheretobescrolled').offset().top }, 1000); you need call function in model , there need add code, <button data-bind="click: yourfunction">scroll</button> and in model this.yourfunction = function(){ $('html,body').animate({ scrolltop: $('#mydivwheretobescrolled').offset().top }, 1000); } let me know need. i have created plunkr, please have http://plnkr.co/edit/j0dglzjt8sr2pj0u83fs?p=preview

php - not able to display data in the table -

Image
i need retrieve data mysql database using jquery. had tried both methods ($.getjson & $.ajax) none of them produced desired results. though data coming in browser's console(netwaork tab), not displayed in table. my php file. above code generates desired json structure when viewed in browser. here jquery code. (using $ajax method) $(document).ready(function() { var jsonobj = []; $.ajax({ url: "reg_data_table_js.php", success: function(data) { //alert(data) jsonobj = data; var tr; (var = 0; < jsonobj.length; i++) { tr = $('<tr/>'); tr.append($("<td>" + jsonobj[i].id + "</td>")); tr.append($("<td>" + jsonobj[i].firstname + "</td>")); tr.append($("<td>" + jsonobj[i].lastname + "</td>")); tr.append($("<td>" + jsonobj[i].email + "</td>")); tr.append($("<td>" + jsonobj[i].zipcode + &quo

debugging - Bluemix app - list whole activity log (events) -

i debugging happened our app on bluemix , list entries activity log viewlet (since "beginning of time" if possible) because of full of error message , no 1 can read happened before. error message. an instance of app crashed: failed accept connections within health check timeout i have tried cf events app_name , seems result list same. please, how can longer list of previous app events? thank you. you can retrieve information using cf api rest call. can find cf apis documentation here: https://apidocs.cloudfoundry.org/197/events/list_all_events.html in specific case curl call in order retrieve latest 100 events: curl " https://api.ng.bluemix.net/v2/events?results-per-page=100 " -x -h "authorization: bearer eyj0exaioijkv1qilcjhbgcioijiuzi1nij9.eyj1c2vyx2lkijoidwfhlwlkltc5iiwizw1hawwioijlbwfpbc01mebzb21lzg9tywlulmnvbsisinnjb3blijpbimnsb3vkx2nvbnryb2xszxiuywrtaw4ixswiyxvkijpbimnsb3vkx2nvbnryb2xszxiixswizxhwijoxndiyotkwody3fq.rlrrvs

javascript - AngularJs form validation doesn't work -

i new on angular js, working on form validations. have done still validation doesn't work. here code: <form role="form" name="studentform" class="form-horizontal" novalidate> <div class="form-group"> <label for="student_email" class="col-sm-2 control-label">email</label> <div class="col-sm-10"> <input type="email" name="student_email" ng-model="studentemail" class="form-control" id="student_email" required> <div role="alert" class="error-msg" ng-messages="studentform.student_email.$error"> <p ng-message="required">your email required.</p> </div> </div> </div> </form> script: angular.module('app', ['ngmessages']); here working demo

cuda - Caffe installation -

i'm installing caffe. i'm using ubuntu 14.04. i tried install cuda. on caffe site written need install library , latest standalone driver separately. i downloaded driver there . tried every product type, same error: you not appear have nvidia gpu supported 346.46 nvidia linux graphics driver installed in system. further details, please see appendix supported nvidia graphics chips in readme available on linux driver download page @ www.nvidia.com. and then you appear running x server; please exit x before installing. further details, please see section installing nvidia driver in readme available on linux driver download page @ www.nvidia.com. and installation has failed. please see file '/var/log/nvidia-installer.log' details. may find suggestions on fixing installation problems in readme available on linux driver download page @ www.nvidia.com. i successfuly installed cuda , cudnn. then downloaded caffe

cyclomatic complexity - How to draw a control flow graph for a nested for loop? -

for(num2 = 0; num2 <= 3; num2++) { for(num1 = 0; num1 <= 2; num1++) { cout<< num2<< " " << num1<< endl; } } how draw control flow graph above code segment? thanks in advance :) i studying test on , it's still kind of vague, might wrong, think should this: o< /| \ / v / | o< | | \ | v / | o \ >o please let me know if got same result, or if graph unclear i'll make proper one.

mysql - Joining two tables with sub-queries from one -

my database features multiple groups host events @ 1 or more venues. times 1 venue, groups have two. keep things simple, following data set small , imaginary: 'groups' table +--------------+--------------+--------------+ | name | pri_venue_id | alt_venue_id | +--------------+--------------+--------------+ | fast fingers | 3 | 0 | | data dishers | 4 | 0 | | leet hacks | 5 | 2 | +--------------+--------------+--------------+ 'venues' table +----------+-------------------------+-----------------+ | venue_id | name | location | +----------+-------------------------+-----------------+ | 1 | public archives | querytown | | 2 | storage function centre | drive bay | | 3 | key convention centre | qwertyville | | 4 | head-spin mall | drive park | | 5 | fast storage facility | memory bay

Matlab .NET assembly with C# -

im having strange issue integrating matlab .net assembly c#. when try using dll in console application project works fine. when change project class library (without changing adding constructor class) exception when attempting load instance of matlab object. exception is: system.typeinitializationexception: type initializer 'mathworks.matlab.net.utility.mwmcr' threw exception. ---> system.exception: trouble initializing libraries required .net assembly. @ mathworks.matlab.net.utility.mwmcr..cctor() --- end of inner exception stack trace --- @ mtlobj..cctor()} any appreciated! thanks can check differences in .csproj file after changed it? (on file level) and can try remove reference , add it, maybe console application adds reference tag class library not expecting.

wordpress - Accessing Defined Javascript Function in WooCommerce -

i trying access few functions woocommerce js files in wordpress plugin. file location : woocommerce/assets/js/admin/meta-boxes-order.js file url : https://github.com/woothemes/woocommerce/blob/master/assets/js/admin/meta-boxes-order.js i have included file in using default wp functions , here javascript code jquery(function ($) { jquery('#customer_user').on('change', function () { var user_id = $('#customer_user').val(); var post_id = $('#post_id').val(); $.wc_meta_boxes_order_items.reload_items(); if (user_id) { $.ajax({ url: ajaxurl, data: { action: 'rbp_admin_order_register', userid: user_id, orderid: post_id }, method: 'post', }).done(function () { //rbp_admin_order_metabox_unblock(); }) } else {

Bluemix Spark: spark-submit failing when downloading stderr and stdout? -

i using spark service in ibm bluemix. trying launch java piece of code executing spark process using spark-submit.sh script. my command line is: ./spark-submit.sh --vcap ./vcap.json --deploy-mode cluster --class org.apache.spark.examples.javasparkpi \ --master https://169.54.219.20 ~/documents/spark/javasparkpi.jar i using latest spark-submit.sh version (as of yesterday). ./spark-submit.sh --version spark-submit.sh version : '1.0.0.0.20160330.1' this worked fine couple of weeks ago (with old spark-submit.sh) getting following error: downloading stdout_1461024849908170118 % total % received % xferd average speed time time time current dload upload total spent left speed 0 89 0 89 0 0 56 0 --:--:-- 0:00:01 --:--:-- 108 failed download workdir/driver-20160418191414-0020-5e7fb175-6856-4980-97bc-8e8aa0d1f137/stdout stdout_1461024849908170118 downloading stderr_1461024849908

excel - Inability to install Spreadsheet::ParseXLSX or Spreadsheet::XLSX using ppm with ActivePerl v5.22.1 -

i need read .xlsx , .xlsm files perl scripts, having trouble installing xlsx parser using ppm. using activeperl version 5.22.1. i have no problem installing , using spreadsheet::parseexcel (which works on .xls files excel 2003): ppm install spreadsheet-parseexcel downloading www.sisyphusion.tk.ppm packlist...not found downloading spreadsheet-parseexcel-0.65...done unpacking spreadsheet-parseexcel-0.65...done generating html spreadsheet-parseexcel-0.65...done updating files in site area...done 30 files installed but ppm install spreadsheet-parsexlsx gives: downloading www.sisyphusion.tk.ppm packlist...not found ppm install failed: can't find package provides spreadsheet-parsexlsx and similar spreadsheet-xlsx. i tried getting around problem using lower-level package spreadsheet::read; worked fine on excel 2003 .xls file gave error message no xlsx parser installed when tried on .xlsx file -- spreadsheet parser dependencies on parsexlsx won't help. i've sp

sql - Rows are not affected when comparing datetime column value -

update production set mylocalcol = '22/4/2016 06:13:55 am' (localcol = '2016-04-18 11:51:00 ') mylocalcol datatype nvarchar , localcol datatype datetime . when execute above query, affect row ie 2518 row but when executing .. after 2518 ie 2519 update production set mylocalcol = '22/4/2016 06:13:55 am' (localcol = '2016-04-18 11:56:29 ') zero rows affected per comment, localcol of type datetime; said, storing milliseconds. first query might affecting rows fortunately because of 00 milliseconds. please check data , change query accordingly. can try: update production set mylocalcol = '22/4/2016 06:13:55 am' (localcol >='2016-04-18 11:56:29 am' , localcol <'2016-04-18 11:56:30 am')

javascript - jQuery selected value always 0 -

i'm using laravel jquery webapplication. when submit empty form, redirect page old values filled in ( form model binding ), works expected. the problem @ jquery part. have several sections not shown when value of radio group 0 (unchecked), , showed when changes 1 (checked). works fine when fill in page, bugs when redirect if have validation error in form. when have form error, , redirected page old values filled in, , read selected values of radio groups, values still 0. why val() 0 when radio has selected value of 1? var r4 = $('input[name="configtype"]'); var s4 = $('#comprehensive'); initsec(r4, s4); function initsec(radio, togglesection){ console.log(radio.val()); //when being redirected page radio selected @ value '1', //console.log still shows 0 if (radio.val() == 1) { togglesection.toggle(); } } edit var r4 = $('input[name="configtype"]:checked'); can

javascript - Slider of images with undefined height -

Image
i'm trying create slider of images (previous/next) images slide left when click "previous" , right when click "next" 0.5s of slowness, takes animation. , when reach last image , click "next", want images "run backwards" first one, same when i'm in first 1 , click "previous", "run forward" until last one. i want same behaviour this jsfiddle shows. (but don't need timer move images automatically , don't need "triggers" buttons, "previous" , "next"). the problem here images don't have fixed size. define width in percentage , can't define height because have responsive design, image resizes resize browser window. the jquery previous/next actions pretty easy, can't find way add animation when remove/add "active" class images (so become visible or not). i have tried putting images side side , showing first 1 (setting container width equals image width),

javascript - Python - How to export JSON in JS -

i want export json string in python js variable. <script type="text/javascript"> var data = json.parse('{{ datajson }}'); console.log(data) </script> if print content of datajson get: [{"offset":0,"total":1,"units":[{"village_id":37,"village_name":"glim but in js this: json.parse('[{&#34;offset&#34;:0,&#34;total&#34;:1,&#34;units&#34;:[{&#34;village_id&#34;:37 i use jinja2 template engine: http://jinja.pocoo.org/docs/dev/templates/#if how can fix that? you need mark data safe: var data = {{ datajson|safe }}; this prevents being html-escaped. there no need use json.parse() way; json valid javascript subset (at least insofar python json module produces valid subset). take account doesn't make javascript safe . may want adjust json serialisation. if using flask, tojson filter provided ensures javascript-safe valid json: var

parsing - What kind of parser is a pratt parser? -

i'm implementing pratt's top down operator precedence parser , i'd know in formal category falls - lr(1)? pratt parser not lr parsers. , they're not ll parsers either. in fact, pratt parsers hand-coded in general purpose programming language; technique not based on abstraction push-down finite state automata. makes more difficult prove assertions given pratt parser, such recognizes particular formal language. in general, pratt parsers can designed recognize language if grammar operator precedence grammar, can considered dual of operator precedence parsing, though operator precedence parsing bottom-up , pratt parsers nominally top-down. tracing pratt parser , transitions of operator precedence parser same language show similarity. so suppose might possible come formalism pratt parsers, far know, none exists.

javascript - Which highstock options can I use to remove inbetween xAxis -

Image
i'm implementing highstock line graph in app , facing difficulty fix xaxis. eventhough data daily, there "hour" @ 12:00 between nodes. which option can use remove inbetween "12:00" xaxis? have tried several options doc http://api.highcharts.com/highstock results same. my series data : [ { "name": "check", "data": [ [ 1460505600000, 778475 ], [ 1460592000000, 778031 ], [ 1460678400000, 802150 ], [ 1460764800000, 700420 ], [ 1460851200000, 641872 ], [ 1460937600000, 778706 ], [ 1461024000000, 227841 ] ] }, { "name": "okay", "data&qu

android - Open Google Map from link -

i'm developing webapplication (using angular). in application there link should open navigator. on desktop browser opens googlemaps , on android should opens google maps app. this code: var intent = 'intent://maps.google.it/maps?es_sm=91&biw=120&bih=213&um=1&ie=utf-8&fb=1&gl=it&geocode=kqv869munxhhmwoijqsfotsc&daddr={0}&gmm=cgigaq%3d%3d&entry=s#intent;scheme=http;package=com.google.android.apps.maps;end'.format(this.plussizeaddress(address)); var win = window.open(intent, '_blank'); win.focus(); it works on chrome using android webview error net::err_unknown_url_scheme is there way open correctly on webview? thanks lot

java ee - CDI as a factory? -

i have endpoint on jax-rs java ee application: public class searchendpoint implements isearchendpoint { @inject protected searchservice searchservice; @override public response search() { return response.ok().entity(this.searchservice.search()).build(); } } in searchservice's search method: public class searchservice { @inject private queryvisitor visitor; public list<?> search() { (expression<?> group : groups) group.accept(this.visitor); } } and in queryvisitor , @override public esentitypathpointer<?> visit(expression<?> expr, esentitypathpointer<?> context) { switch ((entitytype)expr.getmetadata().getelement()) { case digitalinput: if (context == null) context = new digitalinputesentitypathpointer(); break; case followupactivity: if (context == null) context = new followupactivi

symfony - No route found for "GET /login -

when try login wrong credentials says "try again, wrong credentials", after entering correct credentials gives error no route found "get /" (from " http://localhost/bdayproj/web/app_dev.php/login "). below configuration of security.yml security: encoders: fos\userbundle\model\userinterface: bcrypt role_hierarchy: role_admin: role_user role_super_admin: role_admin # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers providers: in_memory: memory: ~ fos_userbundle: id: fos_user.user_provider.username firewalls: # disables authentication assets , profiler, adapt according needs dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false main: pattern: ^/ form_login: provider: fos_userbundle csrf_token_generator: security.csrf.token_manager logout: true anonymous: true #

utf 8 - UPS/FedEx shipment request special characters -

recently i've been working on implementation of label generation fedex , ups couriers using external service. have problem special characters printed on label. within response i'm getting correct text on label special chars replaced dummy signs. according ups&fedex docs supports such characters on labels till passed utf-8 , encoding node in xml present (pointing utf-8). did faced similar problem? maybe there official note them they'r not supporting such case i'm not aware of. ups , fedex apis supports latin-1 chars. dummy chars assigned auto utf-8 cast in 1 of internal methods (dicttoxml) results in double utf-8 encoding.

ruby on rails - Unicorn restart error -

when tried restart unicorn throws following error couldn't reload, starting 'cd /var/www/myapp; bundle exec unicorn -d -c /var/www/myapp/config/unicorn.rb -e production' instead /var/www/myapp/vendor/bundle/ruby/2.2.0/gems/kgio-2.10.0/lib/kgio.rb:31:in `require': incompatible library version - /var/www/myapp/vendor/bundle/ruby/2.2.0/gems/kgio-2.10.0/lib/kgio_ext.so (loaderror) can me out why getting error , how resolve it? i had troubled similar issue & fixed below way listen 3000, reuseport: true reuseport: true unicorn.rb i think

php - Symfony 2 many to one -

i learning symfony 2. in documentation saw example many 1 relations. tried in code. have 2 entities: products , categories. /** * @orm\manytoone(targetentity="category",inversedby="products") * @orm\joincolumn(name="category_id", referencedcolumnname="id") */ private $category; in entity product have such code. executed app\console doctrine:generate:entities appbundle , app\console doctrine:schema:update --force . table category has appeard, in table products don't have field category_id. cleared cache doesn't work. wrong? product <?php namespace appbundle\entity; use doctrine\orm\mapping orm; use appbundle\entity\category; /** * product * @orm\entity * @orm\table(name="product") */ class product { /** * @orm\column(type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ private $id; /** * @orm\column(type="string",length=1

sharepoint - Delete a wiki page with powershell -

i need code. first tried create new wiki page in sharepoint 2013 , worked perfectly. i'm trying delete wiki page , doesn't work well. my code: add-type –path "c:\users\benutzername\appdata\local\apps\officedevpnp.powershell.v15.commands\modules\officedevpnp.powershell.v15.commands\microsoft.sharepoint.client.dll" add-type –path "c:\users\benutzername\appdata\local\apps\officedevpnp.powershell.v15.commands\modules\officedevpnp.powershell.v15.commands\microsoft.sharepoint.client.runtime.dll" function delete-wikipage ([microsoft.sharepoint.client.clientcontext]$context, [string]$wikilibrarytitle,[string]$pagename) { $wikilibrary = $context.web.lists.getbytitle($wikilibrarytitle) $context.load($wikilibrary.rootfolder.files) $context.executequery() $wikipage = $wikilibrary.rootfolder.files | {$_.name -eq $pagename} $context.load($wikipage) $context.deleteobject() } $url = "hhtps://sharepoint.com" $context = new-objec

Update claims in asp.net claim based authentication -

i have asp.net application, authentication use claim based authentication. default asp stores user's claims in cookie(i think). i have admin panel, admin can change user's claims. example user has "crud" claims (for claimtype = "document"), admin decides change "crud" "cru" (d omitted). user has "crud" claims until cookie expired, because logged in before admin's decision. how can force user's cookie updated have "cru" claims.

javascript - How to determiner a controller is available on the global namesapce in angularJS -

in order instantiate controller mock scope object in following unit test, need make sure controller available on global namesapce. describe('testctrl', function(){ it('should create "phones" model 3 phones', function() { var scope = {}, ctrl = new testctrl(scope); expect(scope.phones.length).tobe(3); }); }); however, how determine controller available on global namesapce in angularjs ? a simple example, controller in root module app should on global namespace, , controller in dependency module products should ne non-global controller. angular.module( 'app', [ 'products', ... ]);

php - user_login_submit() is not working in Drupal 8 with AngularJS -

i working angularjs, rest api & drupal 8. able pass values between angularjs , php, drupal user authentication working, user_login_submit() not working. in console, shows 500 internal server error please take of code if(isset($_post)){ // getting posted data , decodeing json $_post = json_decode(file_get_contents('php://input'), true); $username = $_post['username']; $password = $_post['password']; $form_state['uid'] = \drupal::service('user.auth')->authenticate($username, $password); $uid = $form_state['uid']; if($uid != '' || $uid != null){ $user = user_load($uid); user_login_submit($form, &$form_state); return 'successfully logged in'; } else{ return false; } } $username = $_post['username']; $password = $_post['password']; must be $username =

javascript - Reactjs: Is it necessary to copy object in component state before modifying it? -

suppose my reactjs component has 2 states: a: { a: 1 }, b: [1, 2, 3] now want them become: a: { a: 1, b: true }, b: [1, 2, 3, 4] is correct by: this.state.a.b = true; b = this.state.b.push(4); this.setstate({ a: this.state.a, b: b }); if not, appropriate way it. best way it. this.setstate({ a: object.assign({}, this.state.a, { b: true }), b: [...this.state.b, 4] });

How to create Slack Slash Command automatically when user install Slack App in his team? -

Image
i developing slack bot, , want provide users ability use slash commands eg /command1. user deploys slack bot via slack button. options have make possible? i attach screenshot of different other bots slash commands installed in slack command , did no additional tweaking. how same? https://api.slack.com/docs/slack-button see: attach slash command app (optional)

logstash - _grokparsefailure on varnish log -

message looks like 1.2.3.4 "-" - - [19/apr/2016:11:42:18 +0200] "get http://monsite.vpù/api/opa/status http/1.1" 200 92 "-" "curl - api-player - preprod" hit opa-preprod-api - 0.000144958 my grok pattern is grok { match => { "message" => "%{ip:clientip} \"%{data:x_forwarded_for}\" %{user:ident} %{user:auth} \[%{httpdate:timestamp}\] \"(?:%{word:verb} %{notspace:request}(?: http/%{number:httpversion})?|%{data:rawrequest})\" %{number:response} (?:%{number:bytes}|-) %{qs:referrer} %{qs:agent} (%{notspace:hitmiss}|-) (%{notspace:varnish_conf}|-) (%{notspace:varnish_backend}|-) %{number:time_firstbyte}"} } i have grokparsefailure tag whereas fields fulfilled correctly except last one, 0 instead of 0.000144958 the full message in es is { "_index": "logstash-2016.04.19", "_type": "syslog", "_id": "avqt7wscn-2lsqj9ziiq"

Rails Kaminari pagination error with Ransack -

i using ransack kaminari - controller is: def index @q = household.search(params[:q]) @households = @q.result end the relevant part of view: - @households.each |household| %tr %td= link_to household.household_name, edit_household_path(household) %td= household.box %td= household.thumbs.html_safe %td= household.neighbors.count %td= household.visits.count %td= household.last_visit %td = link_to 'edit', edit_household_path(household), class: 'btn' = link_to 'destroy', household, confirm: 'are sure?', method: :delete, class: 'btn btn-mini btn-danger' = paginate @households this give me error: undefined method `current_page' #<activerecord::relation:0x007fd4cd3a0b98> if change = paginate @households to = paginate households i ok pagination when execute search, when have blank don't pagination - using decent exposure allowing household ins

node.js - Can't send error params to error middleware on an async way in Express -

currently have middleware using express can't launch error same format express uses because it's sync function things next(err) doesn't work. i send error throw , application not crash it's fine, cant set params such err.message or err.statuscode . code working: function getscope(req, res, next){ //req.scopesarray array of arrays: [ ['resource','.action'] , ['patient','.create'] ] req.scopesarray.foreach(function(current,index,array){ switch(req.scopesarray){ case 'user': var haspermissions = checkuserpermissions(permissionid,action); break; } if(!haspermissions) throw new error('error permissions'); }); next(); } i've realized that, event not calling next(err) , error middleware execute. i've tried thinks like: var err = {}; err.message = 'test'; err.statuscode=404; throw new error(err); but has not worked. how sen

css - Flexbox overlapping absoluted positioned childrens -

Image
i got problem flexbox containers absolute positioned childrens. fiddle ; if window getting smaller (in width) titles getting smaller, absolutly correct, problem in digits overlapping on other watches. tested bit around z-index , background-color doesn't work. html: <div class="stopwatch"> <div class="stopwatch__panel"> <div class="stopwatch__header"> <div class="stopwatch__title">random title 404531</div> </div> <div class="stopwatch__body"> <div class="stopwatch__counter"> <div class="stopwatch__segment stopwatch__segment--five"> <div class="stopwatch__segmenttopleft"></div> <div class="stopwatch__segmenttop"></div> <div class="stopwatch__segmenttopright"></d

ios - How to scan through a string, identify and convert to NSURL -

i go through string , identify if in string there url. if there is, format in such way user can tap on url. please note strings not static or same. strings json data belong comments , post in app's feed. my first idea use regex expression , create function scans through string, identifies if there match http:// or https:// etc. , turn range of string nsurl . any other ideas, advices, solutions? thank in advance! use nsdatadetector . nice article it: http://nshipster.com/nsdatadetector/

java - Split String not working properly with (|) operator -

this question has answer here: splitting java string pipe symbol using split(“|”) 6 answers i trying split string using '|' operator unable complete operation. i getting wrong output. i using below code : public static void main(string[] args) { string str = "c|9374052566|tfname|tlname|01-10-1988|test@gmail.com|234897238794"; string array[] = str.split("|"); (string str_ : array) { system.out.println(str_); } } } //produce output c | 9 3 7 4 0 5 2 5 6 6 | t f n m e | t l n m e | 0 1 - 1 0 - 1 9 8

join - SQL table joining different people -

Image
i join 2 tables showing different information population in table zp there people not shown in wg. add these people zp final table, in columns there no information, have zeros. select * mobility.mzmv2010.wegeinland wg join mobility.mzmv2010.zielpersonen zp using ("hhnr","zielpnr") an example can seen in picture: presumably, want left join . . . person table first: select coalesce(sum(zp."wp" * "w_rdist")/(62868 * avg(zp."wp")), 0) mobility.mzmv2010.zielpersonen zp left join mobility.mzmv2010.wegeinland wg using ("hhnr", "zielpnr") ; note: should qualify w_rdist column specify table coming from.

Apache Storm Flux change topology -

is possible change topology layout while running? change stream groupings , bolts while active. submitting yaml file new topology layout says cannot deploy since running. i'm using apache storm 0.10.0 thanks it not possible change structure of topology while running. need kill topology , redeploy new version afterwards. the parameter can change while topology running parallelism. see here more details: https://storm.apache.org/releases/1.0.0/understanding-the-parallelism-of-a-storm-topology.html

c# - Iterate through the properties of a lambda expression? -

how can iterate through expression , change property names based on custom attribute decorated them with? i use following code custom attribute of property, works simple expression 1 property: var comparison = predicate.body binaryexpression; var member = (comparison.left.nodetype == expressiontype.convert ? ((unaryexpression)comparison.left).operand : comparison.left) memberexpression; var value = comparison.right constantexpression; var attribute = attribute.getcustomattribute(member.member, typeof(myattribute)) myattribute; var columnname = attribute.name ?? member.member.name; var columnvalue = value.value; edit deriving expressionvisitor , can change property name overriding method visitmember . is place property name used build expression? you can implement system.linq.expressions.expressionvisitor rewrite memberexpression new mapped property. , yes visitmember place have implement remapping, 1 of advantages expression trees ,

java 8 - Can I use lambda expressions in Jaspersoft Studio 6.2.0? -

i use jaspersoft studio 6.2.0, , compile report in maven project dependencies: <dependency> <groupid>net.sf.jasperreports</groupid> <artifactid>jasperreports</artifactid> <version>6.2.0</version> </dependency> <dependency> <groupid>net.sf.jasperreports</groupid> <artifactid>jasperreports-fonts</artifactid> <version>6.0.0</version> </dependency> the report fed jrbeanarraydatasource beands = new jrbeanarraydatasource(new incident[]{incident}, false); i have tried use labmda expression in print when expression of band. seems not recognise it. expression is: $f{actionlist} == null || $f{actionlist}.stream().allmatch(a -> actionstatus.completed.equals(a.getstatus())) actionstatus enum. , syntax errors like: net.sf.jasperreports.engine.jrexception: errors encountered when compiling report expressions class file: 1. cannot resolved variable (((ja

I want the data to be permanent store in my Android app -

i want store data in shared preference or sqlite in app . data doesn't deleted when clear app data . infact when clear data of whatsapp have register again,it's registration data deleted.but want store permanently first registration data.is there way that? no. of app gets cleared when user either clicks "clear data" or uninstalls-and-reinstalls app.

scala - Is it possible to define a macro with variadic parameters, and get a type for each parameter? -

the following obvious variadic function: def fun(xs: any*) = ??? we can define macro in similar way: def funimpl(c: context)(xs: c.expr[any]*) = ??? fun(1,"1",1.0) but in case, arguments typed any . in fact, compiler knows types @ compile-time, hides us. possible list of arguments and types in macro? sure—for example: import scala.language.experimental.macros import scala.reflect.macros.context object demo { def at(xs: any*)(i: int) = macro at_impl def at_impl(c: context)(xs: c.expr[any]*)(i: c.expr[int]) = { import c.universe._ // first let's show can recover types: println(xs.map(_.actualtype)) i.tree match { case literal(constant(index: int)) => xs.lift(index).getorelse( c.abort(c.enclosingposition, "invalid index!") ) case _ => c.abort(c.enclosingposition, "need literal index!") } } } and then: scala> demo.at(1, 'b, "c", 'd')(1) list(

ios - How to configure embedded view controllers using iOS6 style embed seque -

i trying use embed segue in storyboard embed couple of collectionviewcontrollers in main view. however, when trying set embedded views using prepareforsegue (as familiar doing modal type seques), prepareforseque called, segue.identifier returns null. - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { nslog(@"segue.identifier %@", segue.identifier); } segue.identifier (null) i've been searching information on using embed segue in storyboards, have been unable find much. is prepareforsegue not correct way access embedded view controllers? if not, how set embedded controllers (such set initial state , set delegate)? if you've correctly set identifier segue, segue.identifier shouldn't null. using prepareforsegue:sender: 1 of ways access embedded controllers. other way use self.childviewcontrollers controller view has container views in -- give array of child view controllers.

javascript - Why hover() does not working on added class using jquery? -

this question has answer here: jquery click event not working after adding class 6 answers i'm trying delay animation, task i'm adding .startanimation class after 500 milliseconds animation. html <div class="layout">hover it</div> <div class="hoverdiv"></div> js settimeout(function(){ $(".layout").addclass('startanimation'); }, 500); $('.hoverdiv').hide(); $('.startanimation').hover(function(){ $('.hoverdiv').show(); }); but problem hover() not working added class .startanimation working .layout class located on same div . checked .startanimation class adding after 500 milliseconds. can 1 guide me regarding issue can fix it. appreciate. here reference demo use event delegation mouseenter , mouseleave events. $(document).o

jmeter - How to execute an Http Request Sampler with each of other samplers -

Image
i execute http request sampler each request defined in request group (simple controller) not find appropriate construct achieve this. more concrete description: i'd execute logrequest each of req1, req2, req3 ... , dont want duplicate logrequest. any idea on how this? using samplers: a sampler not executed each sampler in group/controller. there seems workaround using interleave controller. as picture shows, each request in interleave controller, log request gets executed. loopcontroller here required execute interleave controller again , again samplers inside controller. using post processor: if you, try use pre processor / post processor. need log something, can use beanshell post processor. shown below.

python - Regular Expressions: Special Characters and Tab Spaces -

i testing out function wrote. supposed give me count of full stops (.) in line or string. full stop (.) interested in counting has tab space before , after it. here have written. def seek(): = '1 . . 3 .' b = a.count(r'\t\.\t') return b seek() however, when test it, returns 0. a, there 2 full stops (.) both tab space before , after it. using regular expressions improperly? represented incorrectly? appreciated. thanks. it doesn't a has tabs in it. although may have hit tab key on keyboard, character have been interpreted text editor "insert number of spaces align next tab character". need line this: a = '1\t.\t.\t3\t.' that should it. a more complete example: from re import * def seek(): = '1\t.\t.\t3\t\.' re = compile(r'(?<=\t)\.(?=\t)'); return len(re.findall(a)) print seek() this uses "lookahead" , "lookbehind" match tab character without consuming

ios - UIDocumentInteractionController Disable Options Menu -

i have pdf showing in uidocumentinteractioncontroller , great. problem is, point of app protect pdf being shared etc. hence want rid of options button appears. there 1000 similar q's on stack, before go linking me have read please keep in mind need ios6 solution. i have tried implementing willshowmenu related functions, , bunch of other stuff. end of day, needs onto store, , know how rigid apple are, if has solid store-aproved ios6 solution great. if not, point me in right direction , work out. there alternative uidocumentinteractioncontroller display (but copy protecting) pdfs? thanks. you can use uiwebview display pdf file. to disable copy menu, add following code in webviewdidfinishload delegate of uiwebview [webview stringbyevaluatingjavascriptfromstring:@"document.documentelement.style.webkituserselect='none';"]; [webview stringbyevaluatingjavascriptfromstring:@"document.documentelement.style.webkittouchcallout='none'

java - Docmosis pdf conversion returns a converted but empty template -

i using docmosis generate pdf reports. new report returning pdf version of template supplied, blank. have confirmed data being sent docmosis. xml being sent in same form other reports, rendered. xml contains correct elements in correct order render correctly. else can check? have else run problem? just in case finds , wonders solution : in short - spelling mistake. there miscommunication in team , template submitted not same 1 testing against. casing of fields different ans resulting in blank document.

javascript - My function is only working inside of the else in an if statement? -

if need edit function, please let me know. anyhow, i'm going through json table , getting id of item on roblox. in case don't work roblox, we'll use letters. if a's name b's asset id, change a's name b's name. that's want do, it's not working. here's if statement. function loop(page) { $.get("https://search.roblox.com/catalog/json?subcategory=1&creatorid=62277089&currencytype=0&pxmin=0&pxmax=0&sorttype=3&sortaggregation=5&sortcurrency=0&includenotforsale=true&legendexpanded=false&category=1&pagenumber=" + page).success(function(data) { console.log("on page: " + page); (var = 0; < data.length; i++) { var prevname = data[i].name; if (!isnan(prevname)) { console.log("name number, changing...") $.get("https://www.roblox.com/item.aspx?id=" + number(prevname)).success(function(data) {

c# - How to compare decimal values of two properties of a document in an Elasticsearch query with Nest? -

i have documents typed product indexed in elasticsearch index. these product documents have 2 decimal values: normalprice , discountprice . i want search documents have normalprice > discountprice . i tried construct query this: q &= query<productmodel>.range(u => u.field(f => f.normalprice).greaterthan(u.field(f => f.discountprice))); first of i'm not sure if query correct if is, greaterthan function requires double values see. what should do? there alternative way of doing comparison decimal values? btw changing property types double not option. have use decimal. elasticsearch supports long , integer , short , byte , double , float numeric data types , nest maps decimal types double default. to perform comparison across document fields can achieved script query client.search<productmodel>(s => s .query(q => q .script(sn => sn .inline("doc['normalprice'].value > doc[&#