Posts

Showing posts from May, 2012

GNU Make shell function breaks when piped to cut -

hello have mve trying catenate 2 variables , pipe cut. all: @echo $(app_name) @echo $(current_branch) @echo $(call eb_safe_name,$(current_branch)) @echo $(shell echo "$(app_name)-$(call eb_safe_name,$(current_branch))" | cut -c 23) output: $ cicdtest $ issue#13-support-multi-branch $ issue-13-support-multi-branch $ o if remove | cut -c 23 output fine, need limit 23 char. doing wrong on 4th echo statement above? different behavior in test script in make, issue explicit use of cut, not make. following works expected: @echo $(shell echo $(app_name)-$(call eb_safe_name,$(current_branch)) | cut -c 1-23) cut has handling incomplete range, in make (even though using bash) complete range needed: bytes, characters, , fields are numbered starting @ 1 , separated commas. incomplete ranges can given: -m means 1-m ; n- means n through end of line or last field. options -b byte-list --bytes=byte-list print ...

osx - error in backend: 32-bit absolute addressing is not supported in 64-bit mode -

hi i'm working on asm intel_syntax noprefix on mac using gcc, reason keep getting error in backend: 32-bit absolute addressing not supported in 64-bit mode has variables, @ moment been use on asm inline? here's code: #include <stdio.h> char c, b; int main() { printf("give me letter: "); scanf(" %c", &c); _ _asm( ".intel_syntax noprefix;" "xor eax, eax;" // clear eax "mov al, byte ptr [c];" // save c in eax "cmp eax, 65;" // eax ? "a" "jl fin;" // eax < "a" -> fin "cmp eax, 90;" // eax ? "z" "jg upc;" // eax >= z -> case "add eax, 32;" // make low case "jmp fin;" // -> fin "upc: cmp eax, 97;" // eax ? "a" "jl fin;" // eax < "...

javascript - Callback Eventlistener -

i new node, , having bit of trouble wrapping mind around callbacks. i trying use single function either open component's connection, or close it, depending upon it's current state. if(state){ component.open(function(){ component.isopen(); //true }); } else{ component.isopen(); //always false component.close(); //results in error, due port not being open } basically trying wait unspecified amount of time before closing connection, , close using singular toggle function. have seen, way guarantee port open, inside callback. there way have callback listen kind of event take place? or there other common practice accepting input in callback? callbacks meant called once whereas events there invoke methods on demand 'so speak' multiple times, use case appears me want open , close connection on demand multiple times... for better use eventemitter part of nodejs , easy use. for example: var eventemitter = require('events').e...

How do I take a snapshot using cpanel -

i'd take restorable snapshot of data (so can revert if break anything). don't want download data (so have reupload it). snapshot i'm talking zfs snapshot. can cpanel ? if want restores full account backup have contact hosting provider this. restore you, cpanel access can not restore full account backups.

In bash, how do I use grep to find a certain function from the output of perldoc? -

so want find built in function perl. running ubuntu, run line in terminal: $ perldoc perlfunc | grep "map" but don't documentation function, using grep wrong? grep finds individual lines, won't much. use e.g. perldoc -f map to see doc given built-in. (and perldoc perldoc see doc perldoc.)

c# - How to link external Xaml page to a Grid in Universal Windows Platform? -

Image
i want link external .xaml file grid in universal windows platform app. this folder structure: i want link listview.xaml grid declared inside mainpage.xaml codes both file : mainpage.xaml: <page x:class="todogrocery.mainpage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:todogrocery" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d"> <grid background="{themeresource applicationpagebackgroundthemebrush}"> <grid.rowdefinitions> <rowdefinition height="40"/> <rowdefinition height="*"/> </grid.rowdefinitions> <grid x:name="gridview" grid.row="0" horizontalalignment="stretch" margin="0,0...

sql - How to select id's wich contains just special values? -

i need sql query. have table this: id booktype date ----------- ---------- ------ 1 85 01.01.2014 1 86 01.01.2014 1 88 01.01.2014 1 3005 01.01.2014 1 3028 01.01.2014 2 74 01.01.2016 2 85 01.01.2016 2 86 01.01.2016 3 88 01.01.2015 3 3005 01.01.2015 i need query, returns id's booktype 85, 86 , not id's booktype 88,3005,3028. other types not relevant, can included. example: i want id 2, because there no booktype of 88, 3005, 3028. have id 74, doesn't matter, can included. i tried this: select bookid id, count(bookid) number books date between '01.01.2014' , '01.01.2016' , booktype in (85,86) group bookid having count(bookid) >1 minus select bookid id, count(bookid) number books date between '01.01.2014' , '01.01.2016' , booktype in (88,3005,3028) group ...

ubuntu - JsonProvider Requires FSharp.Core 2.3.5 -

i'm trying run standard example csvprovider example on xubuntu. error says jsonprovider missing dependency fsharp.core 2.3.5 . so, try install locally paket (i'm using atom , ionide). says that package doesn't exist. not sure here. the code i'm trying run: #r "packages/fsharp.data/lib/portable-net40+sl5+wp8+win8/fsharp.data.dll" open fsharp.data type stocks = csvprovider<"./data/msft.csv"> let msft = stocks.load("http://ichart.finance.yahoo.com/table.csv?s=msft") // @ recent row. note 'date' property // of type 'datetime' , 'open' has type 'decimal' let firstrow = msft.rows |> seq.head let lastdate = firstrow.date let lastopen = firstrow.open // print prices in hloc format row in msft.rows printfn "hloc: (%a, %a, %a, %a)" row.high row.low row.open row.close the error i'm getting: the type provider 'providerimplementation.jsonprovider' reported error: type pr...

python - Why variable defined in a if else blocks can be used outside blocks? -

import numpy np import tensorflow tf class simpletest(tf.test.testcase): def setup(self): self.x = np.random.random_sample(size = (2, 3, 2)) def test(self): = 4 x = tf.constant(self.x, dtype=tf.float32) if % 2 == 0: y = 2*x else: y = 3*x z = 4*y self.test_session(): print y.eval() print z.eval() if __name__ == "__main__": tf.test.main() here y tensorflow variable , defined inside if else block, why can used outside block? this more general tensorflow , has python 's scope of variables. remember this: python does not have block scope! * consider trivial example: x = 2 = 5 if == 5: y = 2 * x else: y = 3 * x z = 4 * y print z # prints 16 what trying y not local variable defined in scope of body of if statement , it's ok use after if statement. for more: variables_and_scope . * block scope in python

caching - android - download audio to app cache directory and then play -

in nutshell, have button should either download audiofile direct url private app cache directory, or (if done) play file cache. how can solve it? provide examples, please? first of need download file , save path either in preference (recommended if have 1 or couple files) or in database (ideal if lot of files). here can find cool guide on how download file , save it. have @ this article official docs know better how save file properly. once save save path file in 1 of ways suggested before , play this: mediaplayer mp = new mediaplayer(); mp.setdatasource(path); mp.prepare(); mp.start(); take this article in docs further information.

java - Is there a way to run multiple Spring Boot applications with a single Running Configuration in IntelliJ IDEA? -

i have multiple spring boot applications in single intellij project. , want have single button run of them in order. i know there option run configuration before launching original one, in way configurations can chained. but when use it, runs configuration , doesn't run original one. so i'm wondering if met issue , how resolved? you create compound run type , add applications in it. way can run config , apps start.

win universal app - Windows Phone 10 UWP with AngularJS is randomly crashing -

i have written 2 apps windows phone 10 using winjs angularjs. versions used: angularjs 1.4.9 (i tried downgrading 1.3.20) winjs 4.4.0 angular.winjs 4.4.0 now apps work great on emulators keep crashing randomly on device itself. enabled dev mode on device view crash dump. here got: dump file: ring times - 32507dg-infotec.ringtimes exception c0000194 on 3-17-2016 07.36.dmp : ring times - 32507dg-infotec.ringtimes exception c0000194 on 3-17-2016 07.36.dmp last write time: 17.03.2016 07:36:26 process name: wwahost.exe : wwahost.exe process architecture: arm exception code: 0xc0000194 exception information: heap information: present sadly no exception information given. tried multiple times in every dump file exception information missing. i put additional exception handling application catching angularjs exceptions , writing them file, after global winjs error handling (winjs.application.onerror) catch there , write file in both cases no files written. open app on...

android - NullPointerException when referencing toolbar in fragment -

i have added toolbar in activity , trying access in fragment change title , icon navigation, keep getting error java.lang.nullpointerexception: attempt invoke virtual method 'void android.app.actionbar.setdisplayhomeasupenabled(boolean)' on null object reference when run app number of warnings possible object being null. know has getsupportactionbar cannot work out doing wrong here code declaring toolbar in activity toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); the code referencing , changing toolbar in fragment toolbar toolbar = (toolbar) getactivity().findviewbyid(r.id.toolbar); ((appcompatactivity)getactivity()).setsupportactionbar(toolbar); ((appcompatactivity)getactivity()).getsupportactionbar().setdisplayshowhomeenabled(true); and code declaring toolbar in xml <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height=...

jwt - Django API fronted by Azure API gateway -

i have django application stores user credentials , performs authorization , authentication. in process of breaking off front-end angular spa , converting backend rest api. django api live azure api app protected azure api gateway. remove authentication piece django , allow users sign in using openid connect through either google or microsoft account. happen this: when user visits site, assuming have never registered app, have option sign in google account or microsoft account. if user decides sign in using google or microsoft account, (this i'm confused , why i'm posting here ... ) think happens api gateway performs authentication, generates json web token (jwt), , sends token django api. django receives jwt, decrypts it, , checks see if there user account matching email address in jwt. if there not user account, django add user user accounts table (not storing password). if there user matching email address, django allows user in. all said, guess question(s) are: ...

node.js - Save/Update an array with Mongoose doesn't work -

i'm newbie mongoose... , i'm not able save/update array. when create user login email, use this: user.findone({ 'local.email' : email }, function(err, user) { var newuser = new user(); var name = req.body.name; newuser.local.name = name; newuser.local.array = [1, 2]; newuser.save(function(err) { if (err) throw err; return done(null, newuser); }); }); it works fine, user saved ! but when update user: app.post('/change', function(req, res) { var newuser = new user(); newuser.isnew = false; newuser._id = req.user._id; var newname = req.body.name; newuser.local.array = [3, 4]; newuser.save(function(err) { if (err) throw err; return done(null, newuser); }); }); it doesn't work, console log "versionerror: no matching document found". if comment line local.array invloved in update, works fine, user updated. what's wrong code? calling save on mongoose object make modification existing ...

c++ - Does iterator need to include any type information from the container by the standard? -

today came upon this question , started wonder inconsistencies between gcc/clang , visual studio. the question general, still i'd understand - standard impose rules on whether iterator type should or should not contain container specific type information. consider snippet: #include <unordered_map> #include <iostream> struct hash1 { size_t operator()(int key) const { return key; } }; struct hash2 { size_t operator()(int key) const { return key + 1; } }; int main(int argc, char** argv) { std::unordered_map<int, int, hash1> map1; map1[1] = 1; std::unordered_map<int, int, hash2> map2; map2[1] = 1; std::unordered_map<int, int, hash2>::iterator it1 = map1.find(1); std::unordered_map<int, int, hash2>::iterator it2 = map2.find(1); if (it1 == it2) // visual studio 2015 gives assertion on iterator type inequality { std::cout << "equal"; } el...

php - How to avoid double render when using jPList -

i'm using jplist jquery plugin add pagination , filtering hotel-listing page written in php. can see example here . at moment, use loop in php create list div, , list-item divs within it. it works ok, except that, initially, php page loads , displays hotels (not first page) before jplist kicks in , replaces paginated list of (in case) 50 hotels. i've looked @ various data-source options, i'm not sure which, if choose and, if do, if solve problem. what best way avoid double render? here's code: javascript: <script> $('document').ready(function(){ /** * user defined functions */ jquery.fn.jplist.settings = { /** * stars: jquery ui range slider */ starsslider: function ($slider, $prev, $next){ $slider.slider({ min: 0 , max: 5 , range: true , values: [0, 5] , slide: function (event, ui) { $p...

Ansible execute remote ssh task -

i have tried connecting remote "custom" linux vm, , copied ssh public ssh it, yet, i'm able ansible ping / connect it, keep getting remote host unreachable. " i think because running custom version of linux , ssh auth might behaving differently " the following remote ssh command works # ssh -t user@server_ip "show vd" password: mypassword i'm trying convert above command ansible playbook --- - hosts: server_ip gather_facts: no remote_user: root tasks: - name: check devise status shell: ssh -i server_ip "show vd" register: output - expect: command: sh "{{ output.stdout }}" responses: (?i)password: user i'm unable work, , i'm not sure if write way of doing it, input highly appreciated it. whenever have ssh connection problems should add -vvvv parameter ansible-playbook command line. way give detailed information ssh connection , errors.

javascript - What is 1 * new Date()? -

reading through jquery source code , have come across following line of code: 1 * new date() following google search, have seen included in google analytics snippet. can explain happening here, , purpose of line? generate random number not repeated again? new date() return date() object. when coerced string object returns iso formatted string interpretation of date: console.log(new date()); // = 'thu mar 17 2016 09:37:12 gmt+0000 (gmt)' when coerced integer return epoch timestamp of date: console.log(1* new date()); // = 1458207432249 working example note coercion int returns same value date.now() , that method not available in ie8 , older.

php - Best practice: Upload a picture for non existing Task -

i programming crm (customer relationship management) employees can add tasks , asign them other employees (in php). it's required employees should able upload images task (e.g. when having bug, make print screens , add them task) now question is, how make association between images , task in database? @ point employees enter "create task form" in gui there no "task" entry in database yet, therefore can't assign uploaded pictures "task_id". logic requires "task" entry in db made, before can upload picture. why? => because when have entry table "task" have "task_id" required make entry in "task_image" (for foreign key). i thought option create task_id via guid instead of using auto increment function, not possible due other requirements. if it's not possible make task entered task table before store picture's details in pictures table, use arbitrary value taskid , pass through form...

python - Pythonic way to check if two list of list of arrays are equal -

i have 2 lists of lists of numpy arrays called , b , want check each list inside a, there exists list in b same (contains same arrays). here's example. = [[np.array([5,2]), np.array([6,7,8])], [np.array([1,2,3])]] b = [[np.array([1,2,3])], [np.array([6,7,8]), np.array([5,2])]] basically, wondering if there pythonic/elegant way write function f(a, b) == true. why should true? a[0] = [np.array([5,2]), np.array([6,7,8])]. there matching list in b. b[1] = [np.array([6,7,8]), np.array([5,2])] a[0] , b[1] both contain same set of vectors: np.array([6,7,8]), np.array([5,2]). a[1] = [np.array([1,2,3])]. there matching list in b. b[0] = [np.array([1,2,3])]. therefor, return true. some context: a , b 2 clusterings of same data. a , b have same number of clusters , b same length. a[0] list of arrays representing vectors belong 0th cluster in clustering. basically, want check whether , b clustered data same clusters. i'm not sure whether can compare a[i] , b[i]...

sql - How do I list the names and addresses for those employees whose addresses has at least 3 digits? -

drop table if exists employee; create table employee ( fname varchar(15) not null, minit char(1) default null, lname varchar(20) not null, ssn varchar(11) not null, bdate date default null, address varchar(50) default null, sex char(1) default null, salary float(10,2) default null, super_ssn char(9) default null, dno int(11) not null, primary key (ssn) ) engine=innodb default charset=latin1; i'm guessing select fname, lname, address employee address address regexp '^[0-9]{3}[ ]'; except returns addresses 3 digits use {m,} . matches @ least m occurrences of preceding subexpression select fname, lname, address employee address address regexp '^[0-9]{3,}[ ]';

ionic2 - ionic 2 ion-refresher always fired when pulling up after the on-refresh function triggered once -

appearing error <ion-content class="orderformheader"> <ion-refresher (refresh)="dorefresh($event)"> <ion-refresher-content></ion-refresher-content> </ion-refresher> <ion-list *ngif="listdata!=null&&listdata.length>0"> <ion-item *ngfor="#obj of listdata"> <orderitem [item]="obj"></orderitem> </ion-item> </ion-list> </ion-content> my code above. at first,the listdata null, dorefresh give more 20 items listdata . can pulling down smoothly. but when pulling back, far top , the dorefresh triggered, list jumpped top. can't see item mid of list. chrome console warn: ignored attempt cancel touchmove event cancelable=false, example because scrolling in progress , cannot interrupted. ionic cli v2.0.0-beta.17 im update ionic-framework beta.2,the problem's gone~ "ionic-framework": ...

Sorting the WPF Listview -

iam having listview named "listlogindetails" in wpf. in displays 2 columns namely "user_name", "password" through dataset. haven sort listview on both ascending & descending order. based upon button clicked..... home.xaml: <listview name="listlogindetails" itemssource="{binding path=table}" margin="18,0,0,0" grid.rowspan="3" > <listview.view> <gridview x:name="gridview"> <gridviewcolumn width="100" header="user_name" displaymemberbinding="{binding path=id}" /> <gridviewcolumn width="140" header="password" displaymemberbinding="{binding path=password}" /> </gridview> </listview.view> </listview>

sed - Ruby file reading parallelisim -

i have file lot of lines (say 1 billion). script iterating through lines compare them against data set. since running on 1 thread/1 core @ moment, i'm wondering if start multiple forks, each processing part of file simultaneously. the solution came mind far sed unix command. sed it's possible read "slices" of file (line x line y). so, couple of forks process output of corresponding seds. problem ruby load whole sed output ram first. are there better solutions sed, or there way "stream" sed output ruby? what asking wont you. firstly, jump line n of file, firstly have read previous part of file, count number of line breaks there are. example: $ ruby -e '(1..10000000).each { |i| puts "this line number #{i}"}' > large_file.txt $ du -h large_file.txt 266m large_file.txt $ purge # mac os x command - clears in memory disk caches in use $ time sed -n -e "5000000p; 5000000q" large_file.txt line number 5000000 ...

ruby on rails - How to detect extension of image without extension? -

my situation: have application, based on rubyonrails. use carrierwave images uploading. i have many files saved without extensions mistakenly. so, of these have content_type empty value is there way restore extensions these images? thanks you might have infer file signatures: http://en.wikipedia.org/wiki/list_of_file_signatures

Unable to receive Google reports api push notifications -

we have application in need notify url whenever new user created in google apps domain. notifying url https://projectid.appspot.com/userwatcher . have verified domain in app engine console https://projectid.appspot.com unuable receive push notification messages notifying url. kindly me out to use push notification make sure things: register domain of receiving url. example, if plan use https://example.com/notifications receiving url, need register https://example.com . set receiving url, or "webhook" callback receiver. https server handles api notification messages triggered when resource changes. set notification channel each resource endpoint want watch. channel specifies routing information notification messages. part of channel setup, identify specific url want receive notifications. whenever channel's resource changes, reports api sends notification message post request url. for more information check page .

c# - Using Youtube ApiV3 locally as well as on server -

i beginner in c# helpful if explain issue in simple words. have issue regarding uploading video on youtube channel through server using youtube api v3 when run code locally have no issues uploading video.but hosting on iis/server gives object reference error. below code trying execute video uploading written on upload button. protected async void btnupload_click(object sender, eventargs e) { if (txtvideotitle.text != "" && txtfileupload.hasfile) { date = datetime.now; string client_id = configurationmanager.appsettings["clientid"]; string client_secret = configurationmanager.appsettings["clientsecret"]; var youtubeservice = authenticateoauth(client_id, client_secret,"singleuser"); if (youtubeservice == null) throw new argumentnullexception("youtubeservice"); var video = new video(); video.snippet = new videosnippet(); video.snippet.tit...

move the first word to the last position in Java -

how can make jave language is language java here code, think there problems here. public class lab042{ public static final string testsentence = "java language"; public static void main(string [] args) { string rephrased = rephrase( testsentence); system.out.println("the sentence:"+testsentence); system.out.println("was rephrased to:"+rephrased); } public static string rephrase(string testsentence) { int index = testsentence.indexof (' '); char c = testsentence.charat(index+1); string start = string.valueof(c).touppercase(); start += testsentence.substring(index+2); start += " "; string end = testsentence.substring(0,index); string rephrase = start + end; } } you not returning new phrase. @ bottom of method rephrase(), put this: return rephrase;

How to delete a particular sentence from a file using line number in Python -

Image
i want delete particular lines contain stopwords or matching string: import nltk nltk import * nltk.tokenize import word_tokenize import time mywords = 'hello', 'there', 'been' #stopwords matching in sentences. f = open('hello.txt','ru') raw = f.read() sent = word_tokenize(raw) #tokenize words. nltk.tokenize import wordpunct_tokenize punct = wordpunct_tokenize(raw) sent = sent_tokenize(raw) length = len(sent) print(length) = 0 while(i<length): = + 1 time.sleep(2) #print(sent[i]) if <length: #print(sent[i]) thisword = (word_tokenize(sent[i])) word in thisword: if word in mywords: #print(thisword, word) print("yes: ", sent[i]) else: print("no:", sent[i]) else: print("end of line") you cannot delete lines file, can write lines not contain of stop words file. the following ...

java - Creating Executable jar from CMD prompt -

i have following class files,jar , manifest in directory dot.class bridge.class jsch.jar manifest.md manifest file contains following 2 lines manifest-version: 1.0 main-class:dot command used creating jar file jar cfm dot.jar manifest.md * while executing generated jar throws error saying no main manifest attribute while seeing inside generated jar meta-inf folder contains auto generated manifest file, doesn't have content main class. i couldn't find successful steps ,please correct me. had same issue few days ago , couldn't resolve manifest file put main class build parameter this: jar cfe main.jar mainclass *.class

Firebase Security issue in creating user accounts using javascript -

i've been using javascript create users in firebase .this code given in firebase guide var ref = new firebase("https://<your-firebase-app>.firebaseio.com"); ref.createuser({ email : "bobtony@firebase.com", password : "correcthorsebatterystaple" } this data available browser console , can security threat (any 1 can create account themselves) there security measure can take prevent ? absolutely, the way firebase handles security bit different (by own admission). here basic concepts: authentication firebase provides tools allowing authentication, these include integrations facebook, github, google, , twitter authentication providers email & password login, , account management single-session anonymous login and custom login tokens authorization firebase allows specify rules live on firebase servers via account dashboard data validation firebase has set of rules in language includes . val...

bitmap - Android: Glide onStart/onResume bug -

i have weird bug glide , i'm not sure it. have function, loads images reddit.com/r/earthporn/ newsdata.data.children[position].data.url list of urls public void displayimage(final int position) { drawable d = view.getcontext().getresources().getdrawable(r.drawable.ic_collections_white_24dp); system.out.println(newsdata.data.children[position].data.url); glide.with(view.getcontext()) .load(newsdata.data.children[position].data.url) .asbitmap() .listener(new requestlistener<string, bitmap>() { @override public boolean onexception(exception e, string model, target<bitmap> target, boolean isfirstresource) { displayimage(position + 1); //todo: make sure don't run index out of bounds. return false; } @override public b...

Explanation of asynchronous data loading in AngularJS -

below example code in controller 2 console.log instructions. after accessing page in browser, list of users appears, displayed well. result of console.log : the first one: after loadall() function call = 0 the second one: end of loadall() function = 8 angular.module('tessicommunicationapp') .controller('usermanagementcontroller', ['$scope', '$filter', '$log', 'principal', 'user', 'parselinks', 'language', 'ngtableparams', function ($scope, $filter, $log, principal, user, parselinks, language, ngtableparams) { $scope.users = []; $scope.authorities = ["role_user", "role_admin", "role_tc_admin", "role_tc_ges_adm", "role_tc_sui_tra", "role_tc_cons"]; language.getall().then(function (languages) { $scope.languages = languages; }); principal.identity().then(function (ac...

tomcat - How to write shell script to restart tomcat7 automatically using cron? -

i new shell script,in company need restart application servers in production @ or before 12.30 pm everyday.can automate process shell script affect other application running on server. thanks in advance at last found answer restart tomcat automatically writing simple script , setting-up script on cron whatever time sequence need restart application server. script #! /bin/sh service=/etc/init.d/tomcat7 $service restart cron job 30 12 * * * /root/restarttomacat.sh it wont affect other applications.

Socket timeout exception with connection on Android -

i have code test connection https url: ctimertask = new timer(); ctimertask.scheduleatfixedrate(new timertask() { public void run() { try { url myurl = new url("https://www.google.it"); httpsurlconnection connection = (httpsurlconnection) myurl.openconnection(); connection.setconnecttimeout(15000); connection.connect(); log.d(tag, "!!! responsecode: " + connection.getresponsecode()); //log.d(tag, "connection ok"); } catch (malformedurlexception e) { log.d(tag, "!!! malformed url"); e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } } }, globalclass.delay_connection_check, globalclass.period_connection_check);...

How to grep a specific integer in R? -

how grep specific integer in r ? thought parameter fixed=true allowed apparently not case: namedatatable = "long_te_b.xpt" ndie = 1 datatable = read.xport(namedatatable) pos_datatable_die = grep(as.character(ndie), datatable[,"dieindex"], fixed=true) datatabledie = datatable[pos_datatable_die,] that takes lines dieindex equal 11. problem me : > datatabledie[947, "dieindex"] [1] 1 > datatabledie[949, "dieindex"] [1] 11 how settle it, please ? thank in advance. william we can paste ^ , $ more specific. or use word boundary ( \\b ) grep(paste0("^",ndie, "$"), datatable[,"dieindex"])

java - How to Diagnose ElasticSearch Search Queue Growth -

Image
i'm trying diagnose issue our elasticsearch search queue seemingly randomly fills up. the behavior observe in our monitor on 1 node of our cluster search queue growth (just one) , after search thread pool used start getting timeouts of course. there seems 1 query blocking while thing. way resolve problem @ moment restart node. you can see below relevant behavior in charts: first queue size, pending cluster tasks (to show no other operations blocking or queing up, e.g. index operations or so) , active threads search thread pool. spike @ 11 o'clock restart of node. the log files on nodes show no entries during hour before or after issue until restarted node. garbage collection events of around 200 -600ms , 1 on relevant node around 20 minutes before event. my questions: - how can debug there no information logged anywhere on failing or timing out query? - possible reasons this? don't have dynamic queries or similar - can set query timeout or clear / reset active...

javascript - Symfony and React router, no route found -

i using symfony3 , creating bundle using react.js using react-router. the issue when use routing in react, if reload page symfony routing module send 'no route found" my routes /admin index page , /admin/data next page. when load page /admin good, click on link go /admin/data, works, react send me dynamically on it, when refresh (f5) page /admin/data, symfony intercept , try find routing in code , redirect /404 "no route found". i know on angularjs, framework using ancors path "localhost://admin/#/data", seems easier manage react-router use "localhost://admin/data" my symfony routing: admin: path: /admin defaults: { _controller: bibundle:admin:default } my react routing: import { router, browserhistory } "react-router"; <router history={browserhistory}> <route path="/admin" component={app}> <indexroute components={{content: dashboardpage}} /> <route path="data/list...

java - Determine subclass when unmarshalling with JAXB -

i try provide sscce of problem. i have hierarchy of classes: class base: @xmlrootelement @xmlseealso({ a.class, b.class }) @xmlaccessortype(xmlaccesstype.field) public class base { @xmlattribute private string basedata; public string getbasedata() { return basedata; } public void setbasedata(string basedata) { this.basedata = basedata; } } class extends base @xmlaccessortype(xmlaccesstype.field) @xmltype(name="a", proporder = { "dataa1", "dataa2" }) @xmlrootelement(name = "base", namespace = "") public class extends base { private string dataa1; private string dataa2; public string getdataa1() { return dataa1; } public void setdataa1(string dataa1) { this.dataa1 = dataa1; } public string getdataa2() { return dataa2; } public void setdataa2(string dataa2) { this.dataa2 = dataa2; } } class b extends base ...

php - How to highlight a row of my table -

how can highlight background color of row of table print way when read it's contents database? 2 rows. condition highlight value of 3rd column. <?php echo "<table id='allocation' class='inlinetable'>"; //style='border: solid 1px black;' echo "<tr>"; echo "<th class=\"row-1 a_user\">user </th>"; echo "<th class=\"row-2 a_destination\">user </th>"; echo "<th class=\"row-3 a_tremaining\">time remaining </th>"; echo "<col = width: 3em />"; echo "</tr>"; echo "<col = width: 3em />"; class tablerows extends recursiveiteratoriterator { function __construct($it) { parent::__construct($it, self::leaves_only); } function current() { return "<td style='width: 100px; border: 1px solid black;'>" . parent::current(). "</...

Bash - build URL query string by parsing script command arguments -

i don't use bash need work on bit of bash has make curl request web service query string tail built command arguments contained in script command arguments variable $@ . if command argument string -e -v -s somethingelse , query string must produced e=something&v=blank&s=somethingelse . at moment test script looks this: #!/bin/bash set -e echo "${@}" query_string="" arg in "${@}" ; if [[ "${arg}" =~ "-" ]] ; query_string+="${arg}=" else if [ -z "${arg}" ] ; query_string+="blank&" else query_string+="${arg}&" fi fi done echo "${query_string}" | tr -d '-' and produces incorrect output e=something&v=s=somethingelse& i'm not sure i'm going wrong. suggestions appreciated. how about: #!/bin/bash set -e echo "${@}" option=true query_string="" arg in "${@}"...

sql - how to sum a column from one table and group the sum using data from column of another table -

i having problem trying sum column of 1 table , group according data table. common key have account number. here scenario table 1. account_no volume read_date 1 32 12016 2 22 12016 3 20 12016 4 21 12016 5 54 12016 3 65 12016 7 84 12016 8 21 12016 9 20 12016 10 30 12016 ========================================================= table 2 account_no zone 1 2 3 b 4 b 5 3 7 b 8 b 9 c 10 c result zone total 173 b 146 c 50 so far how query goes select sum(volume) total, read_date bdate group bdate order bdate it able sum volumes based on read_date appreciated... try this, sum based on read_dates , zones select a.read_date ,b.zone ,sum(a.volume) sumofvolume @table1 inner jo...

Hive on Accumulo recommended settings -

we use hive (v. 1.2.1) read "sql like" on accumulo (v. 1.7.1) tables. is there special settings can configure in hive or somewhere gain our performance or stability? if use hive way there point example trying out hive indexing or whatever settings "hive.auto.convert.join" or works different way , not affect in these case? thank you! obligatory: wrote (most of) accumulostoragehandler, no means hive expert. the biggest gain able find when can structure query in such way can either prune row-space (via statement in clause on :rowid-mapped column). knowledge, there isn't (any?) query optimization pushed down accumulo itself. depending on workload, use hive generate own "index tables" in accumulo. if can make custom table has column want actively query stored in accumulo row, queries should run faster.

xamarin.forms - OAuth2 Implemenation with Restsharp.Portable -

i'm doing application android, ios , windows phone using xamarin.forms. need implement login common social platforms , have found on web restsharp.portable. i'm having trouble understand how use library (it correctly imported) oauth2 request. have example or guide helpful? i struggled restsharp.portable due lack of documentation. instead used redirect url way of getting code generated after user gives permission needed request access token. i gave browser correct adddress login/permission screen , redirect set made address ( http://madeupaddress.com ) , on navigating event of browser checked if url started made address, if so, cancel navigation, closed browser , take token uri.query parameters found in navigating event parameters (or named differently depending on control/platform). thenapply access token using code via microsoft http client. windows phone 8.1. thanks go vittorio bertocci i ended using microsoft httpclient access token.

java - trying to make a diamond but cant understand how to finish it? -

hey guy iv been trying same exercises on own lately, , thought making diamond out of astricks cool , got stuck on last part. im getting , cant figure out how flip triangle, or make complete diamond * *** ***** public static string drawdiamond(int n) { string results = ""; int cols = 1; int spaces = n / 2; while (cols <= n) { results += drawchars(" ", spaces) + drawchars("*", cols) + "\n"; /*-------------------------------------------------------------------------------- while(cols>=n){ results += drawchars(" ", spaces) + drawchars("*", cols)+"\n";<--- test code. cols-=2; spaces++; } */-------------------------------------------------------------------------------- cols += 2; spaces--; } return results; } just extending logic , assuming n=5, after 3rd iteration cols value become 7 , hence coming out of loop. when col...