Posts

android - how to set the value in custom notification textview -

please me set text in textview in custom notification private void startnotification() { string ns = context.notification_service; notificationmanager notificationmanager = (notificationmanager) getsystemservice(ns); notification notification = new notification(r.drawable.ic_launcher, null, system.currenttimemillis()); remoteviews notificationview = new remoteviews(getpackagename(),r.layout.mynotification); mremoteviews.settextviewtext(r.id.appname, getresources().gettext(0,"gfhf")); mbuilder.setcontent(mremoteviews); intent notificationintent = new intent(this, flashlight.class); pendingintent pendingnotificationintent = pendingintent.getactivity(this, 0, notificationintent, 0); notification.contentview = notificationview; notification.contentintent = pendingnotificationintent; notification.flags |= notification.flag_no_clear; intent switchintent = new intent(this, switchbuttonlistener.class); pendingintent pend...

ruby on rails - Getting Connection reset by peer - SSL_connect error while uploding file to another app -

currently have rails application. have implement functionality upload file application. the given application uses 3-legged oauth security. have following architecture first create file id using post call ( https://www.example.com/org/files ) then of above file id, upload file using put call ( https://www.example.com/files ) i have able create fileid. while making put call (uploading file) getting errno::econnreset: connection reset peer - ssl_connect error. so how can upload file in chunk. here sample code uploading file. file_data = file.open("/home/test/downloads/rechargereceipt.pdf") {|io| io.read} file_data_64 = base64.encode64(file_data) access_token.put("/org/files/3156906966", { 'content' => file_data_64 }.to_json, { 'accept' => 'application/vnd.axiom.v3+json', 'content-type' => 'application/octet-stream' } ) i using rails 4. there issue while passing body paramete...

hibernate - Populate the domain model from data layer, or query database direct? -

say have domain model 3 objects interact, reservation , vehicle , fleet . fleet has many vehicles, , each vehicle can have many reservations. e.g. fleet -1--*- vehicle -1--*- reservation if want fleet have method getmostpopularvehicle() , have iterate each vehicle , count number of reservations. if want introduce orm persistence, should (1) have getmostpopularvehicle() call data layer method populate fleet, vehicles , reservations before iterating before? or should (2) query database directly popular vehicle in data layer method? my thinking (1) correct, database query can efficient. perhaps approaching wrong? both approaches valid. depends on want achieve; if can performance issueing (hql or jpql or whatever orm supports) query, uses domain model well, quite legal this.

uicollectionview - How can I create Instagram like profile page in Swift -

i'm creating ios app , having problem usage of uicollectionview. when create instagram-like profile page, simple way of doing is, guess, having uiview on top of vc contains user data , having collectionview below that. in case, problem comes when scroll down collectionview. doesn't scroll of vc collectionview area scrolls down. , have no idea how can implement scroll action correctly. help!! it simple. had create upper view uicollectionreusableview , add collectionview uicollectionelementkindsectionheader.

intellij idea - Getting error java.lang.AbstractMethodError on ReportClientDocument.open() call -

i trying autopost crystal report in pdf formate. using ide: intellij gradle public void runapprovedsuppliersitereport(){ // final config config = configfactory.instance(config.class); //crystalutil.setupjdbcjndi(config.getdatabaseserver(), config.getdatabaseusername(), config.getdatabasepassword(), config.getdatabasejdbcdriver(), config.getdatabasejdbcurl()); final list<string> paramnames = config.getmatches(approved_supplier_site_param_regex); final map<string, string> params = new hashmap<>(); (final string name : paramnames) { final string value = config.getpqp_report_approvedsuppliersite_param_$0_value(name); params.put(name, value); } final reportclientdocument reportdoc = new reportclientdocument(); try { // export pdf final string report = config.getpqp_report_approvedsuppliersite_rpt(); reportdoc.open(report, openreportoptions._openasreadonly); crystalutil.setparamfields...

go - Is it possible to issue a failure to an AngularJS post request, with a Golang server? -

i have http server written in golang , client written in angularjs. client send post request server username/password attempt register new account. want client depending on answer of server. if user requested username exists want stay @ registration site, else want client change view else. i have follow code post server, how tell client request failed? $scope.register = function(){ var postbody = json.stringify({username:$scope.vm.user.username, password:$scope.vm.user.password}) registration.save(postbody, function(data){ //on success console.log(data) //$location.path('/bookingsystem') }); }; assuming using $resource create registration can do registration.save(postbody, function(data, responseheaders){ //on success console.log(data) console.log(responseheaders) //$location.path('/bookingsystem') }, function(httpresponse){ // handle error console.log(httpresponse) }); see document...

javascript - Ruby/JS how to reload page after submit button? -

i'm writing web app using ruby on rails. in controller: def create @category = category.new(category_params) respond_to |format| if @category.save format.html { redirect_to @category, notice: 'category created.' } format.json { render :show, status: :created, location: @category } format.js { render js: 'window.top.location.href = "/categories";' } else format.html { render :new } format.json { render json: @category.errors, status: :unprocessable_entity } end end in new.html.erb: <h1>new category</h1> <%= render 'form' %> <%= link_to 'back', categories_path %> in _form.html.erb: <%= form_for(@category) |f| %> <% if @category.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@category.errors.count, "error") %> prohibited category being saved:</h2> <ul> <% @category.errors.full_messages.each |...