Posts

Showing posts from March, 2013

twitter - How to create GenServer child process from spawn function? -

i'm using extwitter stream track tweets in realtime , broadcast them via channel endpoint. create 1 process per event , assign 1 twitter stream listener, when new subscriber join same event previous stream state , receive , broadcast new tweets. how create genserver process from: stream = extwitter.stream_filter(track: hashtags) pid = spawn(fn -> tweet <- stream io.puts tweet.text myapp.endpoint.broadcast! "stream", "tweet", %{tweet: tweet.text} end end) and assign event_id child in following module: defmodule myapp.twitterstream.monitor require iex @moduledoc """ store twitter stream per event_id """ use genserver def create(event_id, hashtags, coords) case genserver.whereis(ref(event_id)) nil -> supervisor.start_child(myapp.twitterstream.supervisor, [event_id, hashtags, coords]) _twitter_stream -> iex.pry # return previous extwitter stream st

Android Studio cannot detect installed update if updating SDK outside Android Studio -

Image
at office, make each programmer team doesn't have download new android sdk update 1 one, downloaded sdk in pc , let team copy , paste update pc. but after copy , paste, when return android studio, still saying update other pc still need download. but if standalone sdk launcher, update updated. what can refresh android studio sdk detection? update: to make question more clear, copy update pc , paste sdk folder in pc "c:\users\zemmy\appdata\local\android\sdk". destination sdk folder in android studio path. android studio can download it's own sdk studio directory. it's setting in switch between local sdk , sdk within as. see here: android studio - how change android sdk path

javascript - How to pause and resume a HTML5 animation? -

i using "smoothie charts" http://smoothiecharts.org/ . i'm trying make animation stop , restart, can freeze "viewing" image. animation doesn't stop. seems continue run in background? once restart it, entire chart jumps actual time. on "start" need animation resume, paused. how can achieve this? i'm new , have been trying figure out week, i'm stuck on problem. this code animation: smoothiechart.animatecompatibility = (function() { var requestanimationframe = function(callback, element) { var requestanimationframe = window.requestanimationframe || window.webkitrequestanimationframe || window.mozrequestanimationframe || window.orequestanimationframe || window.msrequestanimationframe || function(callback) { return window.settimeout(function() { callback(new date().gettime()); }

ios - TableView definition conflict with previous using CoreData in Mutable array -

i trying access coredata , putting tableview have data mutable array when try access tableview got error. my code follows: import uikit import coredata class tableview: uiviewcontroller, uitableviewdelegate { @iboutlet weak var tableview: uitableview! override func viewdidload() { var desc_arr: [string] = [] var amt_arr: [string] = [] let appdel: appdelegate = uiapplication.sharedapplication().delegate as! appdelegate let context: nsmanagedobjectcontext = appdel.managedobjectcontext let request = nsfetchrequest(entityname: "expense") request.returnsobjectsasfaults = false { let results = try context.executefetchrequest(request) if results.count > 0 { result in results as! [nsmanagedobject] { if let desc = result.valueforkey("desc") as? string { print(desc) desc_arr.append(desc)

mysql - When i am trying to insert data into table, getting error -

i created page using laravel fetching data database, table. in same page given option insert data database. when inserting data database, showing error "sqlstate[23000]: integrity constraint violation: 1062 duplicate entry '' key 'primary' (sql: insert device ( vehicleid ) values (avs))". working , able insert datas. view page giving below @extends('app') @section('content') <div class="templatemo-content-wrapper"> <div class="templatemo-content"> <ol class="breadcrumb"> <li><a href="{{ url("/") }}"><font color="green">home</font></a></li> <li class="active">vehicle information</li> </ol> <h1>view/edit vehicle information</h1> <p></p> <div class="row"

android - TextInputLayout: Different color for hint label when not focused -

Image
what want do: when using edittext embedded in textinputlayout want ... set color of label green when it's de-focused , floating above edittext because user has entered value set color of label red when it's de-focused , located inside edittext, because user has not yet entered value i not want change hint text color of edittexts red, when they're wrapped in textinputlayout (i don't need general approach - specific approach setting theme/style each textinputlayout in layout xml fine) preserve (i.e. don't change) accent color (yellow) used color floating label when user has focused field. what have tried: setting below theme/style on textinputlayout satisfy 1. not 2. <style name="floatinglabel" parent="widget.design.textinputlayout"> <item name="android:textcolorhint">@color/red</item> </style> setting specific color on embedded edittext changes hint text color: android:textcolorhint=&qu

c# - Cannot apply indexing with [] to an expression of type 'ISet<string>' -

i getting error 'cannot apply indexing [] expression of type 'iset'' for code snippet foreach (gridviewrow grv in customtabledatalist.unigrid.gridview.rows) { if (grv != null) { if (null != grv.findcontrol(itemcheckboxid) && ((checkbox)grv.findcontrol(itemcheckboxid)).checked) { //at line getting error. itemids += customtabledatalist.unigrid.actionsid[rowcounter] + ", "; } rowcounter++; } } can give more details resolve this. add new using: system.linq; and change foreach (gridviewrow grv in customtabledatalist.unigrid.gridview.rows) { if (grv != null) { if (null != grv.findcontrol(itemcheckboxid) && ((checkbox)grv.findcontrol(itemcheckboxid)).checked) { itemids += customtabledatalist.unigrid.actionsid.toarray()[rowcounter] + ", "; } rowcounter++; } }

plsql - Retrieving a resultset through an oracle procedure -

i have limited skill on pl-sql , have complicated situation. in mssql have procedure returns result set varying number of columns varying source tables depending on parameters provided. in oracle having difficulty create proc same. i need generate query inside, execute , return result. i searched lot , tried lot of things. best way execute query cursor can not manage do. can generate query , execute - , have no visible result. any ? thanks edit: being more specific: how can execute dynamically generated query cursor or reutn local temporary table ? something this? create or replace procedure dynamic_cursor_demo ( p_some_expression in varchar2 , p_results out sys_refcursor ) begin open p_results 'select ' || p_some_expression || ' demo dual'; end dynamic_cursor_demo; (if have oracle 12c can use implicit statement results . examples in docs.)

encryption - Laravel 5: Decryption error The Mac is invalid -

when try login following error produced: decryptexception in baseencrypter.php line 49: mac invalid. i using xampp php 7. the laravel version use 5.2. *i have change api key running php artisan key:generate . **i have trying following commands: php artisan cache:clear composer dump-autoload composer update no lucky. have clear history of browser. ** here values of variables: iv=a69g/grfycnwtakeuz2kkw== value=c7dfthbfwfzq0km633uxmx0zrd1fuzcffbgp0vtzj/d4c4z3btgeflmu2a1c9tduludof4mnoghdveeb/gl1tq== mac=c0460e4ea3d724631cf4a12b7b19a5e512ecec8f492b4754e183714cc9d0a05c any usefull. in advance. i know little late might useful future me or else. i had issue had encrypt in database, changed app_key , tried decrypt , error happened.

logic - C# Visible values of enum -

i beginner in programming , have problem enums. maybe impossible want. here code: public static class browser { public static webbrowser browser = webbrowser.ie; public static resolution resolution = getres(browser); public static resolution getres(webbrowser browser) { resolution res; if(browser == webbrowser.chrome) { // compilator_error: res = resolution._800x600; // not_error: res = resolution._1024x768; } return res; } } public enum webbrowser { chrome, firefox, ie, opera } public enum resolution { _800x600, _1024x768, _1280x800 } i have created method want magic. if browser webbrowser.chrome , res visible _1024x768, _1280x800 resolution . if not, compilator error. maybe bad solution enums, hope understand want do. there optimal way how this?

c++ - Shifting array elements by n positions -

i have basic knowledge in c, c++ , im trying insert n elements @ k positions in array , shift k+1 element in array. have used 2 loops this void insert(int n,int k) { int temp=arraya[k][4]; for(int u=k+1;u<=rowa;u++) { arraya[k+n][4]=arraya[k+1][4]; arraya[k+n][3]=bigradius; arraya[k+n][2]=arraya[k+1][2]; arraya[k+n][1]=arraya[k+1][1]; arraya[k+n][0]=arraya[k+1][0]; } for(int pos=k;pos<=k+n-1;pos++,) { arraya[pos][4]=temp; arraya[pos][3]=b arraya[pos][2]=s1; arraya[pos][1]=s2; arraya[pos][0]=s3; } } where n no of new elements,k position new elements inserted,s1,s2,s3..are values if initial file 0.74172455 0.03613250 0.82822931 0.03121938 0 0.45620244 0.33476580 0.92169053 0.03121938 1 0.13701758 0.74540644 0.56569663 0.03121938 2 0.94162524 0.13094005 0.62107182 0.03121938 3 but in output if im inserting 3 elements in position 0,then elements @ position 1,2 missing -0.0104065 0.0312194 0.072

java - Cannot resolve symbol (variables) -

i new android, great if me error "cannot resolve symbol ..." in variables: - value 1 - banner_id - full_id my code following: package com.example.sienstranslation.siensapp; import android.content.intent; import android.net.uri; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view; import android.widget.textview; import com.android.volley.request; import com.android.volley.response; import com.android.volley.volleyerror; import com.android.volley.toolbox.stringrequest; import com.android.volley.toolbox.volley; import com.google.android.gms.appdatasearch.getrecentcontextcall; import org.json.jsonexception; import org.json.jsonobject; import java.util.hashmap; import java.util.map; public class main3activity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main3); intent intent

java - ElasticSearch | Filter Query -

i using elasticsearch-1.7.1 , java dependency <groupid>org.elasticsearch</groupid> <artifactid>elasticsearch</artifactid> <version>1.7.1</version> problem : using in clause in es when query es filtered query giving me null response. contentquery = boolquery().must(querybuilders.matchquery(property_book_id, bookid).operator(operator.and)) .must(querybuilders.matchquery("contenttype", "enrichments").operator(operator.and)) .must(contentquery); filteredquerybuilder builder = querybuilders.filteredquery(contentquery, filterbuilders.termfilter("spineid","chapter04.html")); searchresponse = searchclientservice.getclient() .preparesearch(index_name).settypes(index_type) .setquery(builder) .execute().actionget(); without filter, working fine. can please suggest how apply filter query or let me know if going anywher

java - Getting Command aborted because of exception: Command timed-out after 150 seconds error while starting roles on one of cloudera hosts -

we trying add host existing cluster , while starting roles on host gives "command aborted because of exception: command timed-out after 150 seconds" error.(also couldnt find log of process). before adding host had started zookeeper in command line not in cloudera manager interface , in cloudera manager zookeper seems "stopped" tested in command line working. after restarted zookeper service on cloudera manager interface , error: nfo org.apache.zookeeper.server.zookeeperserver minsessiontimeout set 4000 jul 12, 10:21:40.637 info org.apache.zookeeper.server.zookeeperserver maxsessiontimeout set 60000 jul 12, 10:21:40.642 info org.apache.zookeeper.server.nioservercnxnfactory binding port /0.0.8.133:2181 jul 12, 10:21:40.643 error org.apache.zookeeper.server.zookeeperservermain unexpected exception, exiting abnormally java.net.bindexception: address in use @ sun.nio.ch.net.bind0(native method) @ su

java - How to pass polygon points in geo_polygon Query in Elasticsearch? -

polygon points 13.049901579550138,77.60384321849386 13.050271501523547,77.6000084075878 13.042883570605907,77.60009104570553 13.042505842873242,77.60865383263827 13.039972708604349,77.6169725155289 13.04006230763758,77.62306611131774 13.036301472612582,77.62675523932252 13.027836648748504,77.63111238425978 13.026664014408041,77.63260862851725 13.02476188706518,77.63997438672054 13.01580550477802,77.66057241738156 12.994606646225883,77.66614853601016 12.99922317402202,77.67626586171559 12.999248673711989,77.6806137299943 12.989982441225264,77.68721899668857 12.967414209806904,77.700928481046 12.965565353801034,77.70119657236678 12.956563533462424,77.70009555907806 12.948645461168596,77.69833987361152 12.943956894161838,77.69679408243776 12.939778114785996,77.69436134214627 12.931071740988296,77.68511223031385 12.921149580164533,77.66436305248996 12.917680671328007,77.66871057636764 12.920113294517337,77.66953194946153 12.920753105482662,77.66763705053846 12.921023128671994,77.6677

json - is there a way to read .dat files as in the storage format for bitcoin blocks? -

Image
i've generated "raw data" encoded .dat from bitcoin testnet, accordingly have file /blk00000.dat , data of blocks i've generated? i.e. transaction data etc.? it looks this: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 00ff ffff ff03 5301 01ff ffff ff01 00f2 052a 0100 0000 2321 02f6 89e4 8543 5d1a 78f9 d08c a612 7e36 2216 20e1 ad70 7576 dbae 41e7 c01d 406a b7ac 0000 0000 fabf b5da b300 0000 0000 0020 abb4 1583 7333 ff2b fcde f019 f2ad 4f4d 5c69 462f 277e 1c52 8564 53c2 ab2d 7674 1c8d de8d e0fa 11eb 9dfe 798d 4839 5a61 b9d3 439c f4e7 79a5 ebe3 dabe f15d 2930 d791 7357 ffff 7f20 0100 0000 0101 0000 0001 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 ffff ffff 0354 0101 ffff ffff 0100 f205 2a01 0000 0023 2102 f689 e485 435d 1a78 f9d0 8ca6 127e 3622 1620 e1ad 7075 76db ae41 e7c0 1d40 6ab7 ac00 0000 00fa bfb5 dab3 0000 0000 0000 2026 a3de 12ea 2f3a deb5 10bf d337 4390 7371 c2d6 is there way render human readable json

javascript - using 2 controllers on a page with angularjs -

i'm trying assign 2 controllers page i'm finding hard through angular js html <div data-ng-controller="useraccount" ng-repeat="item in userphotos"> <ul id="navlist"> <li> {{item.username}} </li> </ul> </div> <div data-ng-controller="userphotos_ctrl" ng-repeat="item in userphotos"> <ul id="navlist"> <li> <img class="thumbnail" ng-src="http://localhost/myapp/resize_image/image.php?image={{item.pic}}&new_width=400&new_height=400"> </li> </ul> </div> js .state('tabs.useraccount',{ url:'/useraccount', views:{ 'list-source':{ templateurl: 'templates/user/user_account.html', controller: 'useraccount_ctrl' }

How do I set a horizontal alignment with Navigation Drawer concept for an Android app in Android Studio like in this picture? -

this link contains image has android app sliding menu. within menu, under filter by section, can find list of items arranged horizontally, namely delivery , dine in , night life . how in android studio? answer suggests scrollable effect horizontal alignment helpful.

c++ - Proper way to implement Queue with MFC? -

what want is; store string values in text file in multi threaded environment. store each , every string values in queue , read queue step step , write values text file. i saw example in msdn queues . example made changes , created code segment store cstring values.but can't achieve code. class cqueue :public ctypedptrlist < coblist, cstring* > { public: void addtoend(cstring* newlog) { addtail(newlog); } cstring* getfromfront() { return isempty() ? null : removehead(); } }; then try call this: cqueue q; cstring str("data1"); q.addtoend(&str); it's give error: 'void coblist::addtail(coblist *)' : cannot convert argument 1 'atl::cstringt<wchar_t,strtraitmfc_dll<wchar_t,atl::chtraitscrt<wchar_t>>> ' 'cobject *' what best way implement queue in mfc ? cstring no object or better: isn't derived cobject. said the list should derived coblist. have use cptrlist

javascript - Bootstrap multiselect used in a Bootstrap dropdown-menu -

when use multiselect independently, works well. but when put in bootstrap dropdown-menu, know, if click on dropdown-menu, it's window closed. so use stoppropagation() stop click event progating dropdown-menu, however, doing this, multiselect failed working, while 'test' can call function test() correctly. my code follows: <ul class='dropdown-menu dropdown-menu-right'> <li> <div class='container-fluid'> <div class='row' id='filter-container'> <div class='col-md-12'> <h4><a onclick='test();'>test</a></h4> <select id='example-getting-started' multiple='multiple'> <option value='aaaaaa'>bbbbbb</option> <option value='cccccc'>cccccc</option> <option value='dddddd'>dddddd</option> <option value=&

javascript - Fill data into all of my spans -

i have 8 spans, 4 of spans values retrieved database visible when page loads. other spans in own popup box, when user clicks on button view popup, value spans visible needs inside spans within popup box. so used each() function 2 classes, '.heart' class has first 4 spans visible when page loads. '.likes-count' class has 4 spans within popup box. my aim assign whatever value in first 4 spans other spans within popup box. im stuck in code below. js $('.heart, .likes-count').each(function(i, element) { var thisid = "#" + $(this).attr('id'); // '#like1', '#like2' var getagain = "." + $(thisid + " span").attr('class'); // .likecount1 getagain = $(getagain).text(); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> you can iterate through spans of first div using jquery's each . callback functi

Android google map multiply markers from api -

i list of car workshops api , after clicking on 1 of options list offers google map , shows marker of workshop information , question how not closing map , see other places marked markers , not chosen. api if need: http://gdetut.com/api/firms?salt=63926e380bdc96ef990d57898daeb71c&category_id=1 map activity: public class mapactivity extends appcompatactivity implements onmapreadycallback { private static final string log_tag = "mylogs"; marker marker; string nameofplace; string categoryofplace; string ratingofplace; double lon; double lat; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_map); places places = (places) getintent().getextras().getserializable("key"); nameofplace = places.getname(); categoryofplace = places.getsubcategory_name(); ratingofplace = places.getrating(); lon = double.parsedouble(places.getlon()); lat = double.p

Insert variable within the array search php -

how insert variable within search array? something that <?php $imagename = ' forest '; ?> <?php $myimageslist = array ( 'city.png' 'forest.png' 'fruit.png ' 'color.png' ); shuffle ($myimageslist); if (($key = array_search ("$imagename.png" $myimageslist))! == false) { array_splice ($myimageslist, $ key, 1); ?> what best way this? apologies if misunderstood question, looks you're asking how have first parameter of array_search() variable in nature. php's string concatenation operator dot (.). such, should able following: [...] if(($key = array_search($imagename . '.png', $myimageslist)) !== false) { array_splice($myimageslist, $key, 1); [...]

Static keyword doesn't work inside PHP generator function -

it seems static keyword not work inside generator functions? in php 5.5: function static_fn () { static $p = 0; echo "\nstatic_fn: p = " . $p . "\n" ; $p++; } echo "calling static_fn()\n"; static_fn(); echo "calling static_fn()\n"; static_fn(); function static_gen() { static $p = 0; echo "\nstatic_gen: p = " . $p . "\n" ; yield $p; } echo "calling static_gen()\n"; foreach(static_gen() $stuff) { echo $stuff . "\n"; } echo "calling static_gen()\n"; foreach(static_gen() $stuff) { echo $stuff . "\n"; } i result calling static_fn() static_fn: p = 0 calling static_fn() static_fn: p = 1 calling static_gen() static_gen: p = 0 0 calling static_gen() static_gen: p = 0 0 that is, static keyword worked static_fn function returned 0 , 1 consecutive calls, did not work static_gen function reinitialised 0 in each call. does know why so, , how 1 m

deployment - Are huge node_modules and bower_components directories necessary on production? -

i'm deploying remote server local development environment ( vagrant / homestead ). in project have huge directories both node_modules , bower_components . want use rsync deploy project on remote server think it's ok skip mentioned giants. why? by writing question confirm 2 things: 1) since triggered gulp tasks on local, right not copy 2 vendor directories if assets copied, minified , versioned using laravel elixir? compiled styles , scripts synced. (that's non-laravel project) use elixir in gulpfile.js it's simplicity 2) or should deployment process include installing assets (like npm install ) on remote server , running tasks? think it's wrong in case. if example won't able install , run npm on remote? so in nutshell. can consider node_modules , bower_components essential resources during development , redundant once deployed? yes right in once javascript app has been transpiled, dependencies(node_modules, bower_componenets, etc)

android - Detect Other User Location -

Image
i want build android app detect other user position in real time (like uber app when driver went pickup customer). [capture of uber app - pick customer] i don't know right way build it, tried build trick. [store , select user location] this trick success. but...the problem are.. with trick, there no information estimated time arrival. if wanna force estimate time arrival info, have send direction request api google maps, , make limit request api running out faster. big appreciates help, links or examples. thank you. maulana for suggestion introduce server. if admin need location of particular user(use id identify), admin app inform server (by api call). server push particular device (hosting id ) update periodically device location. user app notification(push best way here) , start updating server current co-ordinates(again api call) , whenever server receive updated location inform admin(via push/long pulling/tcp socket). or you can use dev

connection string - Classic ASP connecting to localdb for SQL Server -

can explain why works conn.open "provider=sqloledb;server=tcp:myazurename.database.windows.net;database=people;uid=myuid;pwd=mypwd;encrypt=yes;" and doesn't conn.open "provider=sqloledb;server=(localdb)\v11.0;database=people;uid=myuid;pwd=mypwd;encrypt=yes;" i copied live azure database locally dev work in classic asp , error message microsoft ole db provider sql server error '80004005' [dbnetlib][connectionopen (connect()).] sql server not exist or access denied. azure sql server version: 11.0.9231 local sql server version: 11.0.2318 i can connect using same details on sql server management studio not user permissions thing... under security server, user has public server role, user mapping 'people' database except db_denydatareader , db_denydatawriter. i have tried (localdb)\\v11.0 doesn't make difference. any ideas? ok believe answer follows: doesn't (localdb)\v11.0 wants proper instance name sai

java - Error on opening ExcelFile in a scheduled task -

i've create jar file have throw vba excel macro. i've use jacob api code call : final activexcomponent excel = new activexcomponent("excel.application"); try { final dispatch workbooks = excel.getproperty("workbooks").todispatch(); final dispatch workbook = dispatch.call(workbooks, "open", file.getabsolutepath()).todispatch(); final variant result = dispatch.call(excel, "run", new variant("\'" + file.getname() + "\'" + macro)); com.jacob.com.variant f = new com.jacob.com.variant(true); dispatch.call(workbook, "close", f); } catch (exception e) { readexcel.errorlog(e.getmessage()); } { excel.invoke("quit", new variant[0]); comthread.release(); } this code work fine when launch jar manually, on scheduled task i've got error : error - invoke of: open source: microsoft office excel description

How to work with multidimensional data in Halide -

i started working halide. know explicitly image processing framework, there way handle multidimensional array ( > 3d ) in without doing complex steps dimensionality reduction or separating mathematical equations in lower dimensional spaces? thanks, karnajit currently, believe there absolute limitation of 4 dimensions buffer: https://github.com/halide/halide/blob/master/src/buffer.cpp#l149 then there seem further limitations depending on target backend: https://github.com/halide/halide#limitations

Why cant I change the session timeout for Patron when using Faraday in Ruby? -

i trying change connection timeouts http requests done faraday using patron adapter. i try change timeout using default_connections_options in program follows: faraday.default_connection_options.request.timeout = 10 the problem still experience 5000 ms (patron default) timeouts when making requests. /users/finihoge/.rvm/gems/ruby-1.9.3-p374/gems/patron-0.6.5/lib/patron/session.rb:321:in `handle_request': operation timed out after 5003 milliseconds 0 bytes received (faraday::timeouterror) /users/finihoge/.rvm/gems/ruby-1.9.3-p374/gems/patron-0.6.5/lib/patron/session.rb:321:in `request' /users/finihoge/.rvm/gems/ruby-1.9.3-p374/gems/faraday-0.9.2/lib/faraday/adapter/patron.rb:33:in `call' /users/finihoge/.rvm/gems/ruby-1.9.3-p374/gems/faraday-0.9.2/lib/faraday/request/url_encoded.rb:15:in `call' /users/finihoge/.rvm/gems/ruby-1.9.3-p374/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in `build_response' /users/finihoge/.rvm/gems/ruby-1.9.3-p374/gems/far

php - Extracting Number and Select DB using the extracted Number -

i have php class piping/reading email sent particular email id, , insert database table. code work fine. wanted extract list of number in body of mail start "1011" , use query database. body ($this->body) can have 1 or 10 number start 1011. want use "1011" select database necessary information, , insert same table. not working. if remove select query, i'm able insert "1011" directly table. want first select parameter before inserting "1011". pls me!!! $matches = array(); $pieces = explode(php_eol, $this->body); $matches = preg_grep("/1011/", $pieces); //$results = implode(" | ",array_values($matches)); //echo "terminal ids: ".$results." "; foreach ($matches $columns) { $select = $this->pdo->query("select * tbl_atm_data1 terminal_id = '$columns' "); $select = $select->fetchall(); if(count($select) > 0) { foreach($selec

node.js - How to resolve issue with handling csrf with multiple tabs in express/nodejs? -

i built csrf protection in nodejs/express application following config: var app = express(), cookieparser = require('cookie-parser'), session = require('express-session'), csrf = require('csurf'); app.use(cookieparser()); app.use(session({ , saveuninitialized: true , resave: true , store: new mongostore() })); app.use(flash()); and following login form: <form action="/process" method="post"> <input type="hidden" name="_csrf" value="{{csrftoken}}"> <button type="submit">submit</button> </form> the problem arives when user opens 2 browser tabs , end of story getting ebadcsrftoken error @ this line : let's see following case: user opens form above in 2 separate tabs. in first tab logout , signin again. then switches second tab, click submit , ebadcsrftoken error. i need point destroy session in logout route: app.rout

java - No connection configured -

how can configure connection fix bug? use mysql , jdbc. public static void savecalllink(string oktell_login, string link) throws sqlexception { connection conn = dbconnection.getdatasource().getconnection(); dsl.using(conn) .insertinto(calls) .columns(calls.user_id, calls.call_link) .values( dsl.select(users.id) .from(users) .where(users.oktell_login.equal(oktell_login)) .fetchone().value1() , link ).execute(); conn.close(); } sorry, log added. org.jooq.exception.detachedexception: cannot execute query. no connection configured org.jooq.impl.abstractquery.execute(abstractquery.java:316) org.jooq.impl.abstractresultquery.fetchlazy(abstractresultquery.java:365) org.jooq.impl.abstractresultquery.fetchlazy(abstractresultquery.java:352) org.jooq.impl.abstractresultquery.fetcho

Delphi 7 / Archive pdf files on server caused error -

i have problems delphi 7 , generating pdf file out of word , archive file on server. description: have word-doc (5-40 sites). generate pdf-file send doc pdf-docu-com-printer. after generating pdf-file, file archived on server. my problem is: archive function try archive pdf file, although file not rdy.... in cases got error. i have wait, till pdf-file finished, how? i can't install application or tools or else... thx.

android - how to set the view to last item in recyclerview -

i displaying list of messages in chat room , i'm using recycleview display. want view set recent message(last message, last item in list) instead of first item. used smoothscrolltoposition don't want list scrolled first last view recent message. want whatsapp when clicked on chat show view of last message. how can achieve this? package com.wipro.chat.activity; import android.content.broadcastreceiver; import android.content.context; import android.content.intent; import android.content.intentfilter; import android.os.bundle; import android.support.v4.content.localbroadcastmanager; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.defaultitemanimator; import android.support.v7.widget.linearlayoutmanager; import android.support.v7.widget.recyclerview; import android.support.v7.widget.toolbar; import android.text.textutils; import android.util.log; import android.view.view; import android.widget.button; import android.widget.edittext; imp