Posts

Showing posts from May, 2014

How to have Variable as Recursive Regex in Perl? -

i'm writing simple translator john tromp's binary lambda calculus on de bruijn notation lambda calculus can understand how lambda files working in 2012 "most functional" international obfuscated c code winner here example of language before translation primes.blc : 00010001100110010100011010000000010110000010010001010111110111101001000110100001110011010000000000101101110011100111111101111000000001111100110111000000101100000110110 i'm having trouble nested regex in commented line before primes.txt file save section of bruijn.pl: #!/usr/bin/env perl #use strict; use warnings; use io::file; use cwd; $originalcwd = getcwd()."/"; #primes.blc argument test conversion #______________________________________________________________________open file ($name) = @argv; $file = new io::file; $file->open("< ".$originalcwd."primes.blc") || die("could not open file!"); #$file->open("< ".$name) || die(...

spring - Handling MaxUploadSizeExceededException in servlet filter, how to set flash message in redirect? -

when implementing spring security , csrf protection, new problems arose multipart file uploading. reading several threads issue, encountered following solutions subsequent problems: first, cause of problems uploading file did not work anymore after enabling csrf (actually is enabled default in spring security). because when using multipart request csrf token not send, multipartfilter must specfied before spring security filter. according documentation of spring security ( http://docs.spring.io/spring-security/site/docs/4.0.4.release/reference/htmlsingle/#csrf-multipartfilter ) can done implementing beforespringsecurityfilterchain method in securitywebapplicationinitializer class: public class securitywebapplicationinitializer extends abstractsecuritywebapplicationinitializer { @override protected void beforespringsecurityfilterchain(servletcontext servletcontext) { // todo auto-generated method stub insertfilters(servletcontext, new multipartfilter())...

c++ - Delphi WideString in Visual Studio MFC -

i have trying receive information exe written in delphi. exe passes me pointer 1 of data structures: type recordtype = record st: widestring; next: pointer; end; var datarec: ^recordtype; so in visual studio mfc have declared data type should similar: struct recordrec { bstr st; void *next; }; recordrec *datarec; the delphi says widestring compatible bstr, however, not work. when @ st in debug mode says "0x0000000000000000 <bad ptr> wchar_t *" i don't know how declare equivalent of widestring in visual studio mfc. if shortstring declare: struct recordrec { byte stlen; char st[255]; void *next; }; but not work widestring , don't think should declare variable ~2^30 (1,073,741,824) characters in it. what missing? hope can help. a delphi widestring indeed wrapper bstr , however, not mean raw bstr pointer can passed as-is 1 process another. data has marshalled when passing across process boundaries...

envdte - How to get a programmable interface to the Visual Studio Call Stack window? -

i working on visual studio add-in (part of ilspy open source project) , want information selected stack frame in visual studio call stack window. i tried this: var callstackwindow = ((envdte80.dte2)getglobalservice(typeof(envdte.dte))).toolwindows.gettoolwindow("call stack"); however throws exception when not debugging (and call stack window not present) , returns null when call stack window present. there vswindowtypecallstack member in vswindowtype enumeration , can't find api uses it. i've searched envdte documentation without finding further information. i'm working in c# visual studio 2013 professional.

rest - Design of RESTful endpoint for querying based on aggregate data -

let's have 2 resources: person, movie. persons/123 {id: 123, firstname: "john", lastname:"travolta"} persons/124 {id: 124, firstname: "uma", lastname: "thurman"} persons/125 {id: 125, firstname: "bob", lastname: "saget"} persons/126 {id: 126, firstname: "christopher", lastname: "walken"} persons/127 {id: 127, firstname: "steve", lastname: "buscemi"} movies/1 {id: 1, name: "pulp fiction"} movies/2 {id:2, name: "reservoir dogs"} then, relate two, have resource: cast member get cast-members?movie.name=pulp%20fiction [ { id: 502, movie: {id: 1, name: "pulp fiction"} actor: {id: 123, firstname: "john", lastname:"travolta"}, character: "vincent vega" }, { id: 503, movie: {id: 1, name: "pulp fiction"} actor: {id: 124, firstname: "uma...

c# - Responsive Windows App Element -

is there xaml element automatically wrap new line sub elements don't have enough room on line? what mean on wide screen i'll get: box1 box2 box3 and on narrow one: box1 box2 box3 without having listen events , fix code. the comments mention variablesizedwrapgrid solution. can't figure out how make wrap. you can use simple gridview it. if don't set height , should work charm. <gridview name="xconcerts" itemssource="{x:bind artist.upcomingevents, mode=oneway}"> <gridview.itemtemplate> <datatemplate x:datatype="songkick:eventext"> <border cornerradius="8" background="{themeresource themegrayhighcolorbrush}" opacity="0.8"> <stackpanel margin="18,2"> <textblock text="{x:bind fulldisplaydate, converter={staticresource formatstringtodatedayconverter}}" style="{themeresour...

Logstash output conditional on elasticsearch connection -

i'm using logstash parse , output results of several similar commands elasticsearch, similar this: input { exec { type => 'hist' command => '/usr/bin/somecommand' interval => 900 codec => "json" } exec { type => 'hist' command => '/usr/bin/somecommand' interval => 900 codec => "json" } exec { type => 'hist' command => '/usr/bin/somecommand' interval => 900 codec => "json" } } output { if [type] == "hist" { elasticsearch { hosts => ["hostname.domain.com:9200"] index => "monitor-hist-%{+yyyy-mm-dd}" } } } what able output stdout or file if connection elasticsearch fails, like: if _connectionfails_ { stdout { codec => rubydebug } } is possible? or o...

Increase the wait time of Twilio messaging? -

let's assume server has lag in internet network. whenever, twilio attempting message it, messaging succceding 50% of time , while other 50% failing because of http: connection timed out. is there way tell twilio increase wait-time or retry messaging server? twilio developer evangelist here. you won't able increase timeout on twilio or have retry can check response twilio using callback url . providing twilio able make request server @ time. twilio make request server tell whether able send message or not. you add messages queue, , try resend them later on. what use api error logs application, , try resend messages message wasn't sent. have @ events monitor api this. let me know if helps you.

Python different behavour from comand line and php call -

i'm using small python 3.4 script works great when called comand line, throws exception when called php script. here's php code running python: $cmd = 'python3 ./realty_parser_frontend.py'; $outputfile = 'log'; $pidfile = 'pid'; exec(sprintf("%s > %s 2>&1 & echo $! >> %s", $cmd, $outputfile, $pidfile)); the exact error is: unicodeencodeerror: 'ascii' codec can't encode characters in position 5-12: ordinal not in range(128) the thing don't error when running script directly , have no idea problem be...

java - Enable Logging JBoss EAP 6.2 log4j -

i have web app trying migrate jboss eap 6.1. have tried every suggestion on accomplish log4j logging , can't seem traction. server logs don't logged nor eclipse console logged using log4j statements. have tried system.out statements , don't work. web app , running , logs startup of jboss. what have tried moving log4j.xml web-inf moving log4j.xml src/main/java gets bundled in classes folder creating jboss-deployment-structure.xml , placing in meta-inf folder changing logging library org.jboss.jboss.logging.logger adding java_opts="$java_opts -dorg.jboss.as.logging.per-deployment=false" standalone.conf file posts have referenced: link 1 link 2 link 3 link 4 this seems such simple thing, yet @ total loss. next step forget web app , make little test app , see if can logging. maybe conflict or somewhere. anyhow, appreciated. thanks. edit 1 log4j.xml contents james <?xml version="1.0" encoding="utf-8"?><!doctyp...

javascript - Mongodb updated but not showing in redirected page -

i using node/express web framework, here how structured delete action (it's nested in higher level route): .delete((req, res) => { db.collection('collection-name').findoneanddelete({ topic_title: req.body.topic_title}, (err, item) => { if(err) return console.log(err); console.log('item deleted'); res.redirect('/'); }); client-side request: $('.delete-button').click(function(){ $('.topic-title').text($('.topic-title').text()); if(confirm('are sure want delete ' + $('.topic-title').text() + '?')){ fetch('topics', { method: 'delete', headers: { "content-type" : 'application/json' }, body: json.stringify({ 'topic_title' : $('.topic-title').text() }) }); } when hit delete button, page redirect index of entries in db. the problem deleted entry still displays in redirected page, until page refreshed. i'...

javascript - Trying to store hashed username in database -

i trying hash username using javascript-md5 plugin, , store database use jdenticon. able hash password , log console using var hash = md5($scope.username); unable pass newuser variable. registration controller $scope.register = function(){ var hash = md5($scope.username); console.log(hash); var newuser = { email: $scope.email, password: $scope.password, username: $scope.username, userhash: hash }; $http.post('/users/register', newuser).then(function(){ $scope.email = ''; $scope.password = ''; $scope.username = ''; userhash = ''; }; registration route: app.post('/users/register', function(req, res) { bcrypt.gensalt(10, function(err, salt) { bcrypt.hash(req.body.password, salt, function(err, hash) { var user = new user({ email: req.body.email, password: hash, username: req.body.username, userhash: req.body.userhash }); console.log(user); user.sav...

java - How to free memory in 2-D array -

i have long code. logic follows: have 2-d array in java. so, have values inside locations: [0][0], [0][1], [0][2] , values in: [1][0], [1][1], [1][2] . @ point, made comparisons, , done first row. want free memory of: [0][0], [0][1], [0][2] , move next locations [2][0], [2][1], [2][2] . how can this. can not overwrite [0][0], [0][1], [0][2] ,my code programmed move next row [2][0], [2][1], [2][2] faced memory constraints , want free memory first row [0][0], [0][1], [0][2] not need more. need current row , previous make comparison. so, want delete first row whenever finish comparison. update: tried assign null unused array locations following: for (int f = 0; f <= capacity; f++) { table[f][i-2] = (integer) null; } my array of type int , need last 2 columns. first 1 not needed once move 1 more position forward. when applied above code assign null , got: java.lang.nullpointerexception ...

php - Socket.io Node Laravel Redis and saving chat messages to database -

i have laravel project uses node laravel , redis make real time chat. have followed many tuturials lost on how save data chat messages database(mysql). i've seen tuturial can use redis broadcast events laracasts, , youtube video uses mongodb https://www.youtube.com/watch?v=c01ohdupdmu.i havent been able find clear answer on saving methods socket. need send ajax request outside of socket?? here tried make test httprequest, maybe there someway send data on post request laravel route? can provide advice? var app = require('express')(); var server = require('http').server(app); var io = require('socket.io')(server); server.listen(3000, function(){ console.log('listening on *:3000'); }); console.log('chat has booted...'); io.on('connection', function(socket){ socket.on('join', function (data) { socket.userid = data.user_id; socket.username = data.user_name; socket.class_group = data.cla...

Javascript convert array -

i have array of google analytics data: [ ["2016-01-01","google","335"], ["2016-01-01","bing","135"], ["2016-01-01","yahoo","35"], ["2016-01-02","google","145"], ["2016-01-02","bing","115"], ........... ] it can large. simplest , fastest way following 2 arrays? an array of unique date values: ["2016-01-01","2016-01-02","2016-01-03","2016-01-04"] - uniqe sorting date an array of objects group data source: [{ source: 'google', data: [335, 145,.....] // lenght array=count unique date }, { source: 'bing', data: [135, 115,.....] }, ... ] a solution intermediate object. var array = [["2016-01-01", "google", "335"], ["2016-01-01", "bing", "135"], ["2016-01-01", "yahoo...

sql - Adjacent List Model Tree, preventing loop -

example table: create table adj_list_model ( id int not null auto increment, parent_id int, my_string varchar(255),//some random information primary key (id) ) the tree creating have multiple "root" users in same table (when parent_id = null). these "root" users may @ point acquire parent_id "leaf" user (user has no 1 under them). doubt have how make sure don't create "loop" similar following one: example tree design: a b c d e f g if user "a" acquires user "g" parent, loop created be: a -> c -> d -> f -> g -> -> c... , on forever question: what's way check if user "g" under user "a" when user "a" wants go under user "g" in tree? (so in specific cases action can prevented) key points consider: having 2 trees merging 1 happen often. if number of levels in tree hypothetically 80, amount of ti...

python - Sklearn preprocessing - PolynomialFeatures - How to keep column names/headers of the output array / dataframe -

tldr: how headers output numpy array sklearn.preprocessing.polynomialfeatures() function? let's have following code... import pandas pd import numpy np sklearn import preprocessing pp = np.ones(3) b = np.ones(3) * 2 c = np.ones(3) * 3 input_df = pd.dataframe([a,b,c]) input_df = input_df.t input_df.columns=['a', 'b', 'c'] input_df b c 0 1 2 3 1 1 2 3 2 1 2 3 poly = pp.polynomialfeatures(2) output_nparray = poly.fit_transform(input_df) print output_nparray [[ 1. 1. 2. 3. 1. 2. 3. 4. 6. 9.] [ 1. 1. 2. 3. 1. 2. 3. 4. 6. 9.] [ 1. 1. 2. 3. 1. 2. 3. 4. 6. 9.]] how can 3x10 matrix/ output_nparray carry on a,b,c labels how relate data above? working example, in 1 line (i assume "readability" not goal here): target_feature_names = ['x'.join(['{}^{}'.format(pair[0],pair[1]) pair in tuple if pair[1]!=0]) tuple in [zip(input_df.columns,p) p in poly.powers_]] out...

jquery - It is possible send other data together with files in ajax? -

i'm uploading files through ajax interaction. i'd send, together, information in order build path in server side. don't know if possible , how it. function uploadfd(){ var omyform = new formdata(); jquery.each(jquery('#file')[0].files, function(i, file) { omyform.append('file-'+i, file); }); $.ajax({ url: 'filecontroller', data: omyform, processdata: false, contenttype: false, type: 'post', success: function(data){ $('#result').html(data.msg); $.messager.show({ title : 'success', msg : data.msg, showtype : 'show' }); } }); } controller: @requestmapping(method = requestmethod.post, headers = "content-type=multipart/*") public void upload(multiparthttpservletrequest request, httpservletrespons...

javascript - FormData without submit button -

hi there have form upload file $("#form").on('submit',(function(e) { e .preventdefault(); $.ajax({ url: "index2.php", type: "post", data: new formdata(this), contenttype: false, cache: false, ... in form html: <form id="form" action="index2.php" method="post" enctype="multipart/form-data"> <input id="uploadimage" type="file" accept="image/*" name="image" /><br/> <input id="button" type="submit" value="upload"> </form> it works. butnow want remove button. want upload automaticly when select file. $.ajax({ url: "index2.php", type: "post", data: new formdata("#form"), contenttype: false, ...

java - Adding nodes to end of linked list -

having trouble adding nodes end of linked code pretty self explanatory, addtoend method adds single node end of linkedlist. public class ll5 { // private inner class node private class node{ int data; node link; public node(int x, node p){ data = x; link = p; } } // end of node class public node head; public ll5(){ head = null; } public void addtoend(int data) { node p = head; while (p.link != null) p=p.link; p.link=new node(data, null); } public static void main(string[] args) { scanner input = new scanner(system.in); ll5 list = new ll5(); list.printlist(); system.out.println("how many values want add list"); int toadd = input.nextint(); for(int = 0; < toadd; i++) { system.out.println("enter value " + (i + 1)); list.addtoend(input.nextint...

Include arrays with the same name from different files in PHP? -

this question has answer here: php variables same name 2 answers i trying figure out how can include arrays have same name php file 2 different files . i know it's simple, can't seem find right search me solution. i've been trying reference arrays such function_call(menu_config.$config) isn't working. assuming both files have $config array. if want 1 resulting array: include('file1.php'); $new = $config; include('file2.php'); $new = array_merge($new, $config); or 2 new arrays: include('file1.php'); $config_1 = $config; include('file2.php'); $config_2 = $config; another option function: function get_config($file) { include($file); return $config; } $config_1 = get_config('file1.php');

SQL Server 2008R2 from Table to edges for Graph -

i have stumbled upon interesting challenge. have data in sql server table following format/content. date | name ---------+--------- 1/1/2010 | john 1/1/2010 | mark 1/1/2010 | peter 1/1/2010 | mia 2/4/2010 | john 2/4/2010 | billy i trying convert table file containing edges of graph. i'll need edges file have columns , combinations table shows. john | mark john | peter john | mia mark | mia mark | peter peter | mia john | billy i suspect part of can achieved pivot/unpivot don't know how proceed limiting pivot 2 columns. also, don't know how make sure possible combinations of nodes, see first 4 'nodes' need become 6 'edges.' you use row_number , "triangle join": with cte ( select *, rn = row_number() over(partition date order name) tab ) select c.name, c2.name cte c join cte c2 on c.date = c2.date , c.rn < c2.rn; livedemo output: ╔═══════╦═══════╗ ║ name ║ name ║ ╠═══════╬═══════╣ ║ john ║ mark ║ ║...

Using Excel to SUM values from multiple sheets using a date value as a lookup -

i have following situation payroll spreadsheet working on i have multiple sheets exact same layout. 1 each employee each row of employee sheet has pay period end date , other values year date gross pay, net pay, taxes witheld , other values since more employees can added throughout year cannot list out each employee in formula on separate sheet, called quarterly report, trying sum values of employee sheet based on specific date listed in cell. how without declaring every sheet separately, in formula, lookup row defined date on quarterly report , sum year-to-date gross pay row on every sheet. i.e. sum('bob:susan'!c1) row determined vlookup or match or along lines. i have been trying vlookup, index/match, , sumif. not sure if doing wrong in these formulas or if using wrong formula. 1 of attempts =sumif('susan:employee template'!b13:b38,b3,'susan:employee template'!m13:m38) list sheet names in range on sheet , name range sheetnames yo...

php - Codeigniter Email Sending Issue -

this link: http://theartvalley.com/clients/theartvalley.com/ i using in email send code: <?php include_once (dirname(__file__) . "/load_pages.php"); class generalfunctions extends load_pages { function __construct() { parent::__construct(); } function send_mail(){ $smtp_host = "uscentral48.myserverhosts.com"; $smtp_port = 465; $smtp_user = "admin@theartvalley.com"; $smtp_pass = "sender33"; $send_email = "gnkafridi@gmail.com"; $config = array( "protocol" => "smtp", "smtp_host" => $smtp_host, "smtp_port" => $smtp_port, "smtp_user" => $smtp_user, "smtp_pass" => $smtp_pass, "smtp_crypto" => "ssl", "mailtype" => "html", "charset" => "iso-8859-1", "wordwrap" => true...

excel vba - Change Shape Colour when Cell is Clicked -

Image
i looking code change colour of shape when cell clicked on. example shape s_irl ireland , located in cell b22. what happen if cell b22 shape s_irl changes blue red. if cell country clicked corresponding shape changes red , previous returns previous colour. appreciated you can add new subroutine in worksheet's code fire when selection changes on sheet: private sub worksheet_selectionchange(byval target range) dim strshapename string 'variable hold shape name dim shp shape 'variable hold shape object 'detect if click in range a:c if not intersect(target, range("a:c")) nothing 'boom... set shapes blue each shp in me.shapes if left(shp.name, 2) = "s_" shp.fill.forecolor.rgb = rgb(0, 0, 255) next shp 'grab shape name column strshapename = cells(target.row, 1).value 'set color of shape red shapes(strshapename).fill.forecolor.rgb...

Does python garbage-collect at the end of an iteration in a loop? -

please observe simple code: import random while true: l = list( str(random.random())) question: if let run, python run out of memory? reason asking: first iteration of loop, list created, , 'l' assigned represent list. next iteration of loop, list created, 'l' yanked previous list , and assigned new list. previous list has lost reference. previous list going garbage collected? if not @ end of each iteration, hope? having said that, expand scenario bit further multiprocessing: import random while true: l1 = list( str(random.random())) pseudo: multiprocessing.queue.put(l1) # how l1 handled here? # l1 .copy()-ed queue or referenced queue? # l1 destoryed in process (this while loop) @ end of iteration? the primary means of garbage collection reference counting in cpython (the reference implementation of language). when there no longer references object, memory occupies freed...

arrays - Creating a Round Image in TableView -

Image
i getting list of images parse , trying display them circle though image in parse square. in cellforrowatindexpath , use code: cell1.imageview!.layer.cornerradius = cell1.imageview!.frame.size.height / 2 cell1.imageview!.clipstobounds = true here appears now: why images not round? make sure set maskstobounds true after manipulate corner radius.: cell.cellimage.layer.maskstobounds = true this last step you're missing.

c# - Cannot find Xamarin controls -

i installed visual studio 2015 xamarin in order develop mobile applications c#. when open main.xaml , cannot find controls in visual studio toolbox , xml editor not allow me write anything. how fix this? i had similar issue. resolved going on https://www.xamarin.com/download , downloading installer directly. once run it, detects missing components , updates / installs them you.

python - How to remove rows with specific missing tags from a Pandas dataframe? -

in pandas dataframe, '-999' (as integer) used tag indicate 'cells' missing data. cleaning data removing rows if row contains '-999' in it. tried method: flag = (dataframe != -999) dataframe = dataframe[flag] however, resulting dataframe still has same shape , cells -999 became empty. used line: dataframe.dropna(axis = 0, how = 'all', inplace = true) but did not remove rows expected. can help? thanks! you can use .any(axis=1) or .all(axis=1) that: in [92]: df out[92]: b c 0 8 7 6 1 8 0 -999 2 8 9 9 3 -999 8 9 4 4 7 6 5 5 9 9 6 6 4 8 7 5 -999 9 8 5 0 5 9 0 6 5 in [93]: df.loc[~(df == -999).any(axis=1)] out[93]: b c 0 8 7 6 2 8 9 9 4 4 7 6 5 5 9 9 6 6 4 8 8 5 0 5 9 0 6 5 or, alternatively, using .all(axis=1) : in [94]: df.loc[(df != -999).all(axis=1)] out[94]: b c 0 8 7 6 2 8 9 9 4 4 7 6 5 5 9 ...

excel - How do I grab the first element from this string that looks like an array? -

Image
in excel, have cell containing string looks this: [[1.234,3.21],[2.345,3.21]] i want average of 1.234 , 2.345 in 1 cell, , average of 3.21 , 3.21 in other. i've never worked string looks array other programming languages before. how can achieve want excel formula? you use following: =average(--trim(mid(substitute(substitute(substitute($a1,"[",""),"]",""),",",rept(" ",99)),((column(a:a)-1)*99)+1,99)),--trim(mid(substitute(substitute(substitute($a1,"[",""),"]",""),",",rept(" ",99)),((column(b:b))*99),99))) then drag across 1 , down far needed

sql server - Create Tree Query From Numeric Mapping Table in SQL (Specific Format) -

i have exported table accounting software below. accountid accountname --------- ----------- 11 acc11 12 acc12 13 acc13 11/11 acc11/11 11/12 acc11/12 11/111 acc11/111 11/11/001 acc11/11/001 11/11/002 acc11/11/002 12/111 acc12/111 12/112 acc12/112 i want convert tree query in ms-sql server 2008 use treelist datasource in win aaplication. i raised question before , it's answered way very slow big table more 5000 records ( create tree query numeric mapping table in sql ). think counting "/" , separating accountid field "/" can solve problem easier , faster. anyway, expected result must below: accountid accountname id parentid level haschild --------- ----------- --- --------- ------ -------- 11 acc11 1 null 1 1 12 acc12 2 null 1 1 13 ...

html - Rendering Angularjs specfic view without header and footer -

so of pages use index.html render pages , in index.html, code structured views render in div ng-view="" tag as: <body> <div class="navbar navbar-inverse" role="navigation" ng-controller="indexcontroller" style="border-bottom: #ab2328 3px solid;"> <div class="container"> <div class="navbar-header"> <button class="btn btn-success navbar-toggle" ng-click="navbarexpanded = !navbarexpanded"> <span class="glyphicon glyphicon-chevron-down"></span> </button> <a ng-show="!isswa" class="navbar-brand" href="http://www.naviabenefits.com" target="_blank"><img style="height: 37px;" src="ppt/assets/navia.png"></a> <a ng-show="isswa" class="navbar-br...

regex - Regular Expression not returning expected result in Swift -

i hav following, gets matches of string in string: let : string = "https://www.example.com" let b = nsstring let regex : nsregularexpression = try! nsregularexpression(pattern: "(\\.(.*)\\. || /(.*)\\.)", options: .caseinsensitive) let text = regex.matchesinstring(a, options: [], range: nsmakerange(0, b.length)) return text.map {b.substringwithrange($0.range)}[0].stringbyreplacingoccurrencesofstring(".", withstring: "") the goal create more readable version of domain name. instance - https://www.example.com should become: example but returns empty string. is there wrong regular expression? you have spaces in regex pattern. you using ||. not mean or in regex pattern. you nesting parens. i modified regex , it's doing expect. let : string = "https://www.example.com" let b = nsstring let regex : nsregularexpression = try! nsregularexpression(pattern: "\\.(.*)\\.", options: .caseinsensitive) let te...

Android Facebook Log In with AWS Cognito -

i'm having trouble authenticating users facebook , creating single new identity aws cognito. if user deletes app , re-downloads want cognito return same identity. facebook login works credentialsprovider.setlogins(logins); creates 4 new unauthenticated identities every time. final cognitocachingcredentialsprovider credentialsprovider = new cognitocachingcredentialsprovider(getapplicationcontext(), "xxxxxxxx", regions.us_east_1); loginbutton = (loginbutton) findviewbyid(r.id.login_button); loginbutton.setreadpermissions(arrays.aslist("email", "user_friends")); callbackmanager = callbackmanager.factory.create(); accesstokentracker = new accesstokentracker() { @override protected void oncurrentaccesstokenchanged( accesstoken oldaccesstoken, accesstoken currentaccesstoken) { updatewithtoken(currentaccesstoken); } }; loginbutton.registercallback(call...

asp.net - SqlDataSource Multiple Word Search -

i have following code: <asp:sqldatasource id="sqlinvent" runat="server" connectionstring="<%$ connectionstrings:inventconnectionstring %>" filterexpression="(descripcion '%{0}%') , model '%{4}%' , code_item '%{1}%' , desc_grupo '%{2}%' , desc_brand2 '%{3}%'" selectcommand="select brand.code_item, item_unidad.desc_unidad, brand.descripcion, item_grupo.desc_grupo, item_tipo.desc_tipo, item_brand2.desc_brand2, brand.model brand inner join item_grupo on brand.grupo_art_id = item_grupo.grupo_art_id inner join item_brand2 on brand.brand2_id = item_brand2.brand2_id inner join item_tipo on brand.tipo_art_id = item_tipo.tipo_art_id inner join item_unidad on brand.unidad_id = item_unidad.unidad_id"> <filterparameters> <asp:controlparameter controlid="txtsearch" convertemptystringtonull="false" name="descripcion" pr...

c# - How to track the progress of HttpClient post -

i'm building android app sends binary data server using httpclient postasjsonasync method. is possible track progress of data being sent? i'm using code below send data server: var client = new httpclient(); client.baseaddress = uri; client.defaultrequestheaders.accept.clear(); client.defaultrequestheaders.accept.add( new mediatypewithqualityheadervalue("application/bson")); var result = client.postasjsonasync(uri, filebytes); implement http post using asynctask. using task can track progress of task.

join - Octave Conditional Merging of matrices -

i have searched octave function facilitates conditional merging of matrices haven't 1 far. goal using vectors without looping. here example of trying do. a= [1 1 2 2 3 1 5 2]; b= [1 9 2 10]; i c as c= [1 1 9 2 2 10 3 1 9 5 2 10]; is there function takes a , b , list of column(s) join on , produce c ? you can use second output of ismember find occurrences of second column of a in first column of b , use grab specific entries second column of b construct c . [~, inds] = ismember(a(:,2), b(:,1)); c = [a, b(inds,2)]; %// 1 1 9 %// 2 2 10 %// 3 1 9 %// 5 2 10

ios - in-app purchase is not supported -

one of users getting error message: in-app purchase not supported device licensed app not support in-app purchase on non-consumable in-app purchase. idea causes this? screen shot maybe reason that: in-app purchases aren't shared family members in family sharing. https://support.apple.com/en-us/ht202023

Python Reading a file and printing -

hi reading file data.txt in below format. last table change time : 6:55:12 ago number of table inserts : 3 number of table deletes : 0 number of table drops : 0 number of table age-outs : 0 port neighbor device id neighbor port id ttl et1 arista2 ethernet1 120 et2 arista2 ethernet2 120 ma1 arista2 management1 120 i need extract data , print et1, arista2, ethernet1 et2, arista2, ethernet2 ma1, arista2, management1 i using below code, able print ('et1', 'et2', 'ma1') open('data.txt') f: x in xrange(6): next(f) line in f: print zip(*[line.split() line in f])[0] f.close() you can extract desired content of little bit regex. try following code snippet: import re open(...

sql - Create writeable multi table select query in Access -

i have 2 tables below schema table 1 - id, serial code, hours xxxx-aa, 1 xxxx-bb, 2 yyyy-aa, 1 table 2 - stage , description aa, foo bb, bar right joins this. select x.*, y.description table1 x left join table2 y on mid(serial, 6, 2) = y.stage this gave me desire result. however, readable only. know can create writeable query if separate out foreign key in table 1 joining condition is select x.*, y.description table1 x left join table2 y on x.stage = y.stage but there better way create writeable query without .. un-normalize.. table 1? thanks. one approach create calculated column called [stage] in table 1 , define mid(serial,6,2). fill table, column automatically populated , allows query if "un-normalized" table 1.

adt - IBM Worklight 5.x - Android app stops and terminates unexpectedly -

i have tried develop test application using worklight android environment. when run app using avd throws error message like: "sorry application test (process com.accorfintech) has stopped unexpectedly. please try again." and application terminates. using eclipse 4.2 , android version avd android 2.2. here logcat: 07-01 16:19:33.510: w/dalvikvm(403): unable resolve superclass of lcom/accordfintech/accordfintech; (12) 07-01 16:19:33.510: w/dalvikvm(403): link of class 'lcom/accordfintech/accordfintech;' failed 07-01 16:19:33.540: d/androidruntime(403): shutting down vm 07-01 16:19:33.540: w/dalvikvm(403): threadid=1: thread exiting uncaught exception (group=0x4001d800) 07-01 16:19:33.570: e/androidruntime(403): fatal exception: main 07-01 16:19:33.570: e/androidruntime(403): java.lang.runtimeexception: unable instantiate activity componentinfo{com.accordfintech/com.accordfintech.accordfintech}: java.lang.classnotfoundexception: com.accordfintech.accor...

java - ffmpeg process saying it is erroring -

i using ffmpeg convert audio file. call command line , in turn ffmpeg java. using runtime , process runtime.exec() . process have inputstream , errorstream . reason, though ffmpeg commands works fine, prints out error stream giving impression has failed. know why might happening? it's not major issue work fine, if reason error, or new project not realise how works confusing. ideas? here relevant code: runtime rt = runtime.getruntime(); system.out.println("execing " + cmd); process proc = rt.exec(cmd); streamgobbler errorgobbler = new streamgobbler(proc.geterrorstream(), "error"); // output? streamgobbler outputgobbler = new streamgobbler(proc.getinputstream(), "output"); // kick them off errorgobbler.start(); outputgobbler.start(); // error??? int exitval = proc.waitfor(); system.out.println("exitvalue: " + exitval); and streamgobbler...

html - CSS box-shadow inset gap between border when collapsed border -

i have table border-collapse: collapse set, , result odd gap between the box-shadow inset , border, gets bigger bigger border widths. how avoid weirdness? on chrome, way. html: <table class="thetable"> <tr> <td class="weirdgap"> unexpected gap <br> unexpected gap </td> </tr> </table> css: .thetable { border-collapse: collapse; } .weirdgap { box-shadow: inset 0 0 6px red; border: 5px solid blue; } here's jsfiddle http://jsfiddle.net/ukhgk/11/ the border-collapse property sets table borders collapsed single border or detached in standard html. can find more developer.mozilla.org/.../border-collapse how use examples.

postgresql - Restoring database according to Postgres Guide -

i trying follow postgres guide , think there issues following restore command. pg_restore --verbose --clean --no-acl --no-owner -h localhost example.dump it's missing target database isn't it? however running following command introduces lot of errors, pg_restore --verbose --clean --no-acl --no-owner -h localhost -d pgguide example.dump even though command above works, think data restored incomplete. realised in user schema, can't see first_name or last_name shown in postgres guide .

c# - ASP.NET Code blocks are not supported in this context Site.master -

im trying write code in master page check if user logged in. here block of code <div class="navbar-collapse collapse"> <asp:loginview runat="server" viewstatemode="disabled"> <% if (session["userid"] == null) { %> <anonymoustemplate> <ul class="nav navbar-nav navbar-right"> <li><a runat="server" href="~/account/register">register</a></li> <li><a runat="server" href="~/account/login">log in</a></li> </ul> </anonymoustemplate> <% } else { %> <loggedintemplate> ...

c# - Generic covariance with interfaces - Weird behavioural contradiction between "is" and "=" operators -

i had complete wtf moment when dealing covariant interfaces. consider following: class fruit { } class apple : fruit { } interface ibasket<out t> { } class fruitbasket : ibasket<fruit> { } class applebasket : ibasket<apple> { } note: applebasket does not inherit from fruitbasket . ibasket covariant . later on in script, write: fruitbasket fruitbasket = new fruitbasket(); applebasket applebasket = new applebasket(); log(fruitbasket ibasket<fruit>); log(applebasket ibasket<apple>); ...and you'd expect, output is: true true however , consider following code: applebasket applebasket = new applebasket(); log(applebasket ibasket<fruit>); you'd expect output true , right? well, wrong -- @ least compiler anyway: false that's strange, perhaps it's performing implicit conversion , similar converting int long . int not kind of long , long can assigned value of int implicitly. however , c...