Posts

Showing posts from May, 2012

How to download a file after clicking a button (Android Studio) -

i created activity in app. wanted user download .pdf file when he/she wants view guidelines. wanted implement on button. idea how properly? heres code below: public class exhibitor_registration_activity extends appcompatactivity { button buttondownload; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_exhibitor_registration_); this.settitle("buyer registration"); toolbar mytoolbar = (toolbar) findviewbyid(r.id.my_toolbar); setsupportactionbar(mytoolbar); getsupportactionbar().setdisplayhomeasupenabled(true); mytoolbar.setnavigationicon(r.drawable.ic_arrow_back_white_24dp); final button buttondownload = (button) findviewbyid(r.id.buttondownload); buttondownload.setonclicklistener(new view.onclicklistener(){ @override public void onclick(view view) { try {

mongodb - Azure DocumentDB | Connection Strings missing on Settings -

Image
i've noticed connection strings link missing on settings section in azure portal. i following this tutorial in order use .net mongodb driver work azure documentdb. look @ image below(from tutorial) and in azure portal not show connection strings. the connection strings option appears when configure database mongodb compatibility (which must choose when creating new database: once this, you'll have connection string option: with databases have not enabled mongodb compatibility, you're correct connection info appears under keys :

using Instamojo rest api with Spring RestTemplate class -

unable make payment request on instamojo using instamojo rest api getting bad request(400), unable identify why getting 400 error. using spring resttemplate class make post request on instamojo. below display code using: resttemplate resttemplate = new resttemplate(); map<string,object> requestbody = new hashmap<string, object>(); requestbody.put("amount", "10000.00"); requestbody.put("purpose", "just_testing_purpose"); requestbody.put("buyer_name", "adityapandey"); requestbody.put("email", "robust_aditya95@xyz.com"); requestbody.put("phone", "+919634222331"); requestbody.put("redirect_url", "www.imthebest.in"); requestbody.put("webhook", ""); requestbody.put("allow_repeated_payments", false); requestbody.put("send_email", false); requestbody.put("send_sms&qu

python - Formatting columns when writing to csv -

i'm trying write following list of lists columns in .csv file, using python. writelist = [['met ', '===============', 'et_miss_inv', 'et_miss_lep', 'et_miss_seed', 'met_avpt_seed'], ['photon ', '===============', 'pass1phtriggers', 'nph', 'topoetcone40_1ph', 'ptvarcone20_1ph', 'pt_1ph', 'eta_1ph', 'phi_1ph', 'dphi_1ph', 'dphi_1ph1jet', 'phi_v', 'nbaselineph', 'dphimin4_lep'], ['weight ', '===============', 'j1_bweight', 'j1_bweight', 'j1_bweight', 'j2_bweight', 'j2_bweight', 'j2_bweight', 'leptonweight', 'triggerweight'], ['hlt ', '===============', 'hlt_g120_loose', 'hlt_g140_loose', 'hlt_e20_medium', 'hlt_2e17_loose', 'hlt_mu20_iloose_l1mu15', &#

Excel hide/show rows worksheet_change not working when cell value deleted -

firstly apologies i'm complete novice this. i'm helping our hr department develop training spreadsheet , wanted include code hides rows when no training needs flagged done numerical value i.e. 9 or 10. i've got functionality work when 'delete' cell value doesn't trigger change event i.e. hiding row. i'm sure simple solution not 1 i've been able conclude based on existing posts. would appreciate anyone's on this thank-you matt private sub worksheet_change(byval target range) on error goto reset_enableevents application.enableevents = false if target.address = "$o$4" if isnumeric(target.value) if target.value >= 1 , target.value <= 8 sheets("training plan").rows("5:21").entirerow.hidden = false else if target.value < 11 , target.value >= 9 sheets("training plan").rows("5:21").entirerow.hidden = true end if end if end if end if if target.address = "$o$5" if isnumeri

sabre - IMAP_AirSeatMapService details -

we want retrieve seat availability sabre. can not use enhancedseatmaprq not activated. documentation of few services refer imap_airseatmapservice . sabre dev studio not reflect documentation service. questions have - 1. imap_airseatmapservice available use? if yes, know related resources (wsdl/xsds) 2. alternative enhancedseatmaprq seat availability during booking process? appreciate on this. enhancedseatmaprq came replacement imap service. if not have access it, should contact sabre account manager , request it.

MongoDB driver not accessible from PHP on same server -

i'm experiencing problem mongodb php driver , it's connection actual mongodb on ubuntu 14.04 server. i've installed per instructions (through pecl, added 'extension=mongodb.so' etc), , extension installed , loaded in phpinfo latest 1.2.8 version , extension_loaded('mongodb') returns true. i'm running php 5.6.30 , mongodb version on server 3.4.2 i'm trying connect port 27020 on server (found out it's listening 0.0.0.0 address instead of 127.0.0.1 mysql). after have started mongod this mongod --port 27020 --dbpath /db/path --logpath /log/path/mongo.log.log --fork --bind_ip 0.0.0.0 and changed /etc/mongod.conf 's network interfaces to # network interfaces net: port: 27017 bindip: 0.0.0.0 but still running mongo shell mongo --port 27020 gets me this connecting to: mongodb://127.0.0.1:27020/ the problem empty object after running $client = new mongodb\driver\manager("mongodb://0.0.0.0:27020/"); and, of course,

elasticsearch - Children are not mapping properly in elastic to parents -

"chods": { "mappings": { "chod": { "properties": { "state": { "type": "text" } } }, "chods": {}, "variant": { "_parent": { "type": "chod" }, "_routing": { "required": true }, "properties": { "percentage": { "type": "double" } } } } }, when execute: put /chods/variant/565?parent=36442 { // data } it returns: { "_index":"chods", "_type":"variant", "_id":"565", "_version":6, "result":"updated", "_shards":{ "total":2, "successful":1, "failed":0 }, "create

datastax - dse graph connection timeout from nodejs driver when trying to execute graph queries -

i'm playing last version of dse enterprise. i'm interested in graph features. have 1 project running on titan open source graph database inspired dse graph, , i'm trying evaluate dse graph replacement database, since titan missing many administration , operation features. my problem following: i have strange behavior while trying execute graph queries on datastax cluster using nodejs driver. query working (i can add or delete vertices), on client side (nodejs driver) connection timeout error, after 5 7 seconds, this: { "statuscode": 200, "body": { "info": { "queriedhost": "xx.xx.xx.xx:9042", "triedhosts": { "xx.xx.xx.xx:9042": { "message": "connection timeout", "info": "cassandra driver error" } }, "achievedconsisten

Javascript/jQuery working perfectly in Chrome but not in Firefox -

i've been using code allows people pay paypal express checkout when using our site in gbp currency, don't want option there when using euro's, dollars, or other currency. in custom css i've used .paypalbutton {display: none !important;} then in javascript/jquery i've used window.setinterval(function(){ if (jquery(".currency-selector:contains('gbp')").length) { jquery(".paypalbutton").attr('style', 'display: inline-block !important'); } 1000}); the reason i've done way because paypal button loaded in dynamically php. , reason .on , .live don't seem work. now works in google chrome, i've been testing in. reason wont work in firefox (haven't tested other browsers yet). question is, why wont work in firefox? thanks help. some more info: the code doesn't seem having problems in firefox when typed console, paypal button should showing when on 'gbp' not showing in firefox in

multithreading - Many threads are blocked and memory from old gen not releasing -

i using tomcat server , when took thread dump can see many threads blocked (172) , other threads in_native (27). many blocked threads smiler below. can 1 may reason. 8gb oldgen space full. after performing gc not releasing. blocked threads : thread 22614 - threadid:thread 22614 - state:blocked stacktrace: - java.net.socketinputstream.socketread0(java.io.filedescriptor, byte[], int, int, int) @bci=0 (compiled frame; information may imprecise) - java.net.socketinputstream.read(byte[], int, int, int) @bci=87, line=152 (compiled frame) - java.net.socketinputstream.read(byte[], int, int) @bci=11, line=122 (compiled frame) - org.apache.coyote.http11.internalinputbuffer.fill(boolean) @bci=59, line=512 (compiled frame) - org.apache.coyote.http11.internalinputbuffer.fill() @bci=2, line=497 (compiled frame) - org.apache.coyote.http11.http11processor.process(org.apache.tomcat.util.net.socketwrapper) @bci=263, line=203 (compiled frame) - org.apache.coyote.abstractprotocol$abstractconn

ios - Want to transfer or copy data from one cell button to another cell label of same tableview -

cell vc ----> @ibaction func datepickertapped(_ sender: any) { datepickerdialog().show("datepickerdialog", donebuttontitle: "done", cancelbuttontitle: "cancel", datepickermode: .date) { (date) in if let dt = date { let formatter = dateformatter() formatter.dateformat = "dd-mm-yyyy" let result = formatter.string(from: dt) self.buttondate.settitle("\(result)",for: .normal) } } } parent vc ----> let cell = tableview.dequeuereusablecell(withidentifier: "cell2", for: indexpath)as! twoprofittableviewcell let date = date() let formatter = dateformatter() formatter.dateformat = "dd.mm.yyyy" let result = formatter.string(from: date) if self.responseapi.count > 0 { cell.chart_view.chartdescription?.text = self.responseapi["graph_data"]["axis_data"]["axisname"].str

sql server - The underlying provider failed on Open? -

i created application using entity framework 6 sql. working fine. yesterday got error twice entity framework shown below, after issue not raised yet now. system.data.entity.core.entityexception: underlying provider failed on open. ---> system.transactions.transactionmanagercommunicationexception: network access distributed transaction manager (msdtc) has been disabled. please enable dtc network access in security configuration msdtc using component services administrative tool. ---> system.runtime.interopservices.comexception: transaction manager has disabled support remote/network transactions. (exception hresult: 0x8004d024) @ system.transactions.oletx.idtcproxyshimfactory.receivetransaction(uint32 propgationtokensize, byte[] propgationtoken, intptr managedidentifier, guid& transactionidentifier, oletxtransactionisolationlevel& isolationlevel, itransactionshim& transactionshim) @ system.transactions.transactioninterop.getoletxtransactionfromtransmitterpr

angularjs - Ng-table-to-csv -> Asian characters export -

in angularjs application, using following directive export ng-table csv file. the directive works charm , exports ng-table perfectly. if ng-table contains asian characters, not exported correctly , appear 'ã²Ã£‹Ã£‚Šä¼Å¡Ã§¤¾' when open exported csv file using microsoft excel. note : if open exported csv file notepadd ++ asian characters correctly displayed. question : how can modify directive let microsoft excel open csv , see asian characters correctly? thank in advance.

.net - How to properly implement/inherit a ComboBox.ObjectCollection class for design-time usage? -

Image
scenario i subclassed combobox class design kind of combobox control on can supply custom type ( myitem ) combobox.items collection... this subclassed combobox class: <designercategory("usercontrol")> public class mycombobox : inherits combobox <editor(gettype(collectioneditor), gettype(uitypeeditor))> <designerserializationvisibility(designerserializationvisibility.content)> public shadows readonly property items myitemcollection <debuggerstepthrough> public sub new() mybase.drawmode = drawmode.ownerdrawfixed me.items = new myitemcollection(owner:=me) end sub protected overrides sub ondrawitem(byval e drawitemeventargs) e.drawbackground() e.drawfocusrectangle() ' check if item items collection. if (e.index < 0) ' not item, draw text. using brush new solidbrush(e.forecolor) e.graphics.drawstring(me.text, e.fo

forecasting - ETS function in package 'Forecast" in R, minimum data points -

for ets function in r, looking minimal number of data points forecast. read both of hyndman papers (2002 & 2008) mentioned in documentation, not find quantifiable value. in: http://robjhyndman.com/hyndsight/short-time-series/ mentioned depends on number of parameters . @ point looking source can clarify amount of data points needed in ets function. can me this? why don't try , see happens. find ets function work single observation: > 1 %>% ets %>% forecast point forecast lo 80 hi 80 lo 95 hi 95 2 1 1 1 1 1 3 1 1 1 1 1 4 1 1 1 1 1 5 1 1 1 1 1 6 1 1 1 1 1 7 1 1 1 1 1 8 1 1 1 1 1 9 1 1 1 1 1 10 1 1 1 1 1 11 1 1 1 1 1 of course, not fitting 2 parameters, doi

wpf - Task cancellation: while loop not exited properly when ThrowIfCancellationRequested() is called -

i've developed small project (using mvvm) functionality upload file ftp-server. the user can view uploading progress: percentage completed shown user vm.busycontent, property in viewmodel bound ui element in view. here code reading file , uploading via ftp (which part of task vm.ftpuploadtask) using (filestream inputstream = file.openread(file)) { using (outputstream = request.getrequeststream()) { var buffer = new byte[1024 * 1024]; int totalreadbytescount = 0; int readbytescount; while ((readbytescount = inputstream.read(buffer, 0, buffer.length)) > 0 && (!vm.token.iscancellationrequested)) { vm.token.throwifcancellationrequested(); outputstream.write(buffer, 0, readbytescount); totalreadbytescount += readbytescount; var progress = totalreadbytescount * 100.0 / inpu

android - Delay onComplete() in Observable -

i doing this: return observable.zip( observable.interval(0, move_length_in_millis, timeunit.milliseconds), observable.fromiterable(mysupernicearraylist), new bifunction<long, itemtest, itemtest>() { @override public itemtest apply(@nonnull long along, @nonnull itemtest itemtest) throws exception { return itemtest; } } ) the problem have after last item emitted, oncomplete called. there way postpone/delay call of oncomplete method? hacky solution add 1 more element arraylist , ignore in onnext(). concat entire zip empty observable delayed: return observable.zip( observable.interval(0, move_length_in_millis, timeunit.milliseconds), observable.fromiterable(mysupernicearraylist), new bifunction<long, itemtest, itemtest>() { @override public itemtest apply(@nonnull long along, @nonnull itemtest itemtest) throws exceptio

c# - How do I add another subitem in a listview item after its done downloading? -

i have application listview control , button. when press button want add time , name of file listview , add control, once done downloading file want add subitem same listview reason not adding , cant figure out why, calling wrong? using system; using system.componentmodel; using system.net; using system.windows.forms; namespace listviews { public partial class form1 : form { public form1() { initializecomponent(); } listviewitem lvi = new listviewitem(); webclient webclient; public void downloadfile(string urladdress, string location) { using (webclient = new webclient()) { webclient.downloadfilecompleted += new asynccompletedeventhandler(completed); try { // start downloading file webclient.downloadfileasync(new system.uri(urladdress), location); } catch (exc

Orchestrated vs Choreographed Service-Oriented Architecture in large scale? -

i'm architect in large scale financial company , in beginning of implementing new business oriented infosystem across our different countries. from on core idea has been follow microservice oriented principles as possible (and making sure engineers have read building microservices book sam newman) . by i've come crossroads. our services json rest services using swagger automated documentation, in order use these services in our business processes , making sure not write business logic services outside domain of services, we've been using camunda orchestration tool. , camunda fine (though have considered corezoid alternative) , clumsy in otherwise elegant set of services. now service orchestration concept pretty familiar engineers. 1 not entirely happy due still having central engine drives everything. incredibly expensive replace later down road (though still cheaper replace monolith) . , if central engine split multiple engines (which case today) , not make bette

php - select results from clumon "" and join another table -

client clientid userid customerid 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 client service: clientserviceid clientid serviceid description 28 10 6 premium master "multaps1.com" 48 134 6 premium master "multaps3.com" 58 135 6 premium master "multaps4.com" 68 137 6 premium master "multaps5.com" 366 273 1 webhosting master "multaps10.com" hostingaccount: hostingaccountid domain domainip username email 2 multaps1.com 7 bert bert@in.com 3 multaps2.com 9 bernard nard.@sedn.ca 4 multaps3.com 3 bree aenean@cum.org 5 explts.com 1 exploi ante@cursusluctus.edu 6 multaps5.com 10 rama quis@tempusrisusuk service serviceid servicetype 1 1 2 1 3 1 4 2 i have folowing tables need resu

accessibility - Is there a way to add alt attributes to ZingChart? -

Image
for general accessibility , section 508 compliance, need ability add alt attributes rendered charts. empty alt sufficient. for outside reference. zingchart image map not contain alt tag. has been updated , pushed out in newest release v2.6.1. release may 2-3 weeks time answer published. note problem easier solve direct contact through support@zingchart.com. while don't want discourage public outreach, fastest way reach through support@zingchart.com. goes directly our ticketing system. the (alt=””) pass test , tell screen readers decorative , not informational.

fpga - How can write code in verilog shorter using case sentence -

i new in verilog , still have problems basics. following code 1 of modules , works way want, wonder if can written more efficient , shorter , how done. thank help! `timescale 1ns / 1ps module counter ( input a_i, input b_i, input enable_i, input clk, input reset, input r_i, input up_down_i, // za realno stanje se up_down_o prepisuje v up_down_i output reg signed [7:0] value_o, output reg up_down_o ); reg a; reg b; reg signed [7:0] value_cmp; wire [1:0] a_b={a,b}; initial value_o = 8'b00000000; initial value_cmp = 8'b00000000; initial = 1'b0; initial b = 1'b0; initial up_down_o = 1'b1; always@ (posedge clk or posedge reset) begin <= a_i; b <= b_i; value_cmp <= value_o; if (reset || r_i) begin value_o<= 8'b0; value_cmp <=8'b0; end else if (enable_i) begin //up or down if (up_down_i) begin //up if ((

I have unknown script injects in google chrome -

Image
i confused because have script injects in google chrome on every website. there "var pb_blacklist" array of (porn) urls. , whitelist google urls. normal google chrome filter oder have on computer? in chrome not on other brothers opera. maybe have same , idea.. here screenshot of webdev console it because extension poperblocker

ssl - NexGen Gallery Wordpress HTTPS Update -

i wanting serve me website via https only. means updating inks https. unable update links using nextgen gallery plugin. does know fix update links using plugin? i have tried updating standard wordpress url via database. i had same problem. turns out have clear cache in nextgen gallery. go dashboard > gallery > other options > miscellaneous , click button "clear image cache". i cleared out w3 total cache -- in case -- , made sure cdn on development. when checked it, https: worked , gallery images served securely.

rust - Is there a way to use the cfg(feature) check on multiple statements? -

is there way minimize following feature check? #[cfg(feature = "eugene")] pub mod eugene_set_steam_id; #[cfg(feature = "eugene")] pub mod eugene_balance; #[cfg(feature = "eugene")] pub mod eugene_force_map; #[cfg(feature = "eugene")] pub mod eugene_rating; #[cfg(feature = "eugene")] pub mod eugene_stat; #[cfg(feature = "eugene")] pub mod eugene_steam_id; #[cfg(feature = "eugene")] pub mod eugene_top; to like: #[cfg(feature = "eugene")] { pub mod eugene_set_steam_id; pub mod eugene_balance; pub mod eugene_force_map; pub mod eugene_rating; pub mod eugene_stat; pub mod eugene_steam_id; pub mod eugene_top; } this better convey meaning , more ergonomic. the cfg-if crate provides cfg-if! macro should want: #[macro_use] extern crate cfg_if; cfg_if! { if #[cfg(feature = "eugene")] { pub mod eugene_set_steam_id; pub mod eugene_balanc

asp.net - Time picker always using the 12 hours format in browser -

i working on asp.net web application. have published using vs 2015 , deployed under iis6.1. website hosted in server system time format 24 hours. when start website iis on browser on server, each time change time format (from 24 12), input time picker input box displayed on web page follows system format. <input type="time" id="totime" class="form-control"> however when open website on chrome browser on machine (which system time format 24 hours well), time picker display 12 hours format. i not talking returned value timepicker in 24 hours format, rather how input time picker displayed on browser. i'm suspecting iis overrides system format can't find out how , might doing so??

node.js - update schema in mongoose to add new property -

i trying update schema add new property field. hoping simple adding property schema updated field being accessible. i have existing schema let userdrinkschema = new mongoose.schema({ new schema creator : { type: mongoose.schema.types.objectid, ref: 'user' // name of user file }, caffeine: number, mgfloz: number, name: string, size: number, updated_at: { type: date, default: date.now() } }); i need add id schema const userschema = mongoose.schema({ const user = module.exports = mongoose.model('user', userschema); i not sure how add property each user. followed example dealing schema changes in mongoose the schema now: let drinkschema = new mongoose.schema({ user: { type: mongoose.schema.types.objectid, ref: 'user', required: true, default: null }, caffeine: number, mgfloz: number, name: string, size: number, i

html - Python Flask images doesn't update in Google Chrome -

i have image (from static folder, pretty straightforward)in simple html template button, clicking button perform background processes, getting new image , replacing old 1 in static folder. after getting new image , refreshing page, page still display old one, happen in google chrome, works expected in ie , edge. looking @ terminal output, refreshing page in chrome doesn't send request image, while refreshing in edge or ie request image again. this looks more chrome problem, on how handle image, there anyway around varying code, since people using chrome, , don't want force them change browser application?

javascript - Prestshop Create Discount for total items into shopping cart -

i shopping-cart.tpl discount rules. but have 2 problems: 1.- when use buttom +/- value don't change. 2.- change happen if refresh page. how can that, without refresh page?, if other field how total products ($productnumber) , price change automatically. code tfoot> <tfoot> {assign var='totalqty' value=0} {assign var='totalreductonpercent' value=0} {assign var='totalreductonvalue' value=0} {assign var='totalweight' value=0} <!-- value variables assignation --> {foreach $products $product} {assign var='totalreductonvalue' value=$totalreductonvalue + $product.price_without_specific_price} {assign var='totalqty' value=$totalqty + $product.quantity} {/foreach} <!-- discount rules according qty --> {if $productnumber>=16} {assign var='totalreductonpercent' value=20} {else} {if $productnumber>=11} {assign var='totalreductonpercent' value=15} {else} {if $productnumber>=6} {assign va

python - Turn a pylint warning as an error under Eclipse/pydev -

i'm working pylint under eclipse python code. have warnings given pylint want marked errors. graphically consists in red cross instead of yellow warning panel. any idea ? ps : warning want more severe w0102, ie dangerous-default-value in pydev can choose severity of each of message types in pylint (i.e.: fatal, errors, warnings, conventions, refactor) -- can in pylint preferences page inside pydev, there's nothing related changing message type of single item error. i.e.: if need change message type of message warning message type error message type, pylint should support (and if/when does, should configure parameters pass pylint in preferences page).

ios - Facing error as invalid literal for int () with base 10: in swift 2 -

Image
as per screenshot while submitting feedback facing issue. appreciated. i have enter comments smile or sad after typing text ride. working fine. while clicking on submit button getting journeyid nil other in self.journeyapidetails getting whole data json. in advance. func submitbuttontapped() { if self.smileactive! == true || self.frownactive! == true { let comment = (self.mainview.textfield.text! == "tap type" || self.mainview.textfield.text! == "leave additional comments here") ? "": self.mainview.textfield.text! let rating = self.smileactive! == true ? "true":"false" let journeyid = self.journeyapidetails!["data"]["journey_id"].stringvalue let userid = accountservice.sharedinstance.typeofuser() == .customer ? self.journeydetails?.driver.id : self.journeydetails?.customer.id let details = ["rating&qu

mongodb - Is my implementation of a simple CRUD service with Spring WebFlux correct? -

i implementing simple movie based crud api using spring webflux , reactive spring data mongodb. want make sure implementation correct , using flux , mono implement crud operations. want make sure handling errors or null values. new programming paradigm , spring webflux, not sure correctness of implementation of controller , service layer, want make sure adhering spring webflux , project reactor best practices. @repository public interface movierepository extends reactivemongorepository<movie, string> { flux<movie> findbyrating(string rating); } public interface movieservice { flux<movie> list(); flux<movie> findbyrating(string rating); mono<movie> update(string id, movierequest movierequest); mono<movie> create(mono<movierequest> movierequest); mono<movie> read(string id); mono<movie> delete(string id); } @service public class movieserviceimpl implements movieservice { @autowired pr

sql - sanitize a foreign entity when called in Java -

i have table generated database table. in database table has foreign key linking database table. when print out field prints out full path such entity."" [""=""]. there way sanitize return result? trying link pages , things using results number. below in tickets jsp page see created link on sheetnum directs viewbuyer?"buyernum" when click link instead of going viewbuyer?1 goes viewbuyer?entity.buyerinfo[ buyernum=1 ]. want scrub out entity stuff , left value grabbing. servlet case "/tickets": try{ ticket = ticketdb.gettickets(); request.setattribute("ticket", ticket); } catch (numberformatexception ex) { ex.printstacktrace(); } break; tickets.jsp <div id="body"> <table id="buyertable"> <c:foreach var="ticket" items="${ticket}" varstatus="