Posts

Showing posts from September, 2010

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 |...

angularjs - Type ahead feature in Angular UI Grid -

has implemented type ahead feature in angular's ui grid? want auto suggestion in grid cells user types name (suggestions should based on json data). http://plnkr.co/edit/pbktcqgswr5kxjiqg3bp?p=preview var app = angular.module('app', ['nganimate', 'ngtouch', 'ui.grid','ui.grid.edit', 'ui.grid.savestate', 'ui.grid.selection', 'ui.grid.cellnav', 'ui.grid.resizecolumns', 'ui.grid.movecolumns', 'ui.grid.pinning', 'ui.grid.grouping' ]); app.controller('mainctrl', ['$scope', '$http', '$interval', function ($scope, $http, $interval) { $scope.gridoptions = { savefocus: false, savescroll: true, savegroupingexpandedstates: true, enablefiltering: true, columndefs: [ { name: 'name' }, { name: 'gender' }, { name: 'company' } ], onregisterapi: function(gridapi){ $scope.gridapi = gridapi; } }; $http.get('https://cdn.rawgit.com...

wpf - ResourceDictionary in Generic.xaml of CustomControlLibrary produces errors -

i'm making wpf-customcontrollibrary-project customcontrols. 1 of these label nested textblock textwrapping. when set dependencyproperty horizontalcontentalignement p.e. left, want textalignment of textblock set left too. implememented converter class in article here: convert horizontalalignment textalignment then wanted use converter-class in generic.xaml. created resourcedictionary called resources.xaml, lies in rootdirectory of library. <resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:wpfdesignercustomcontrollibrary"> <local:horizontaltotextalignmentconverter x:key="h2talignmentconverter"/> </resourcedictionary> then added reference dictionary in generic.xaml , binded textalignment-property of textblock. <resourcedictionary xmlns="http:/...

php - RabbitMq connection reset by peer -

i have stainger error rabbitmq. send information of product threw rabbitmq , php, went wrong. can send message near 1 minute after had exception "errno=104 connection reset peer" . see below: 2016-05-09 08:13:14 daemon start 2016-05-09 08:13:17 send shop-id-1-price 2016-05-09 08:13:21 send shop-id-1-price 2016-05-09 08:13:24 send shop-id-1-price 2016-05-09 08:13:28 send shop-id-1-price 2016-05-09 08:13:32 send shop-id-1-price 2016-05-09 08:13:36 send shop-id-1-price 2016-05-09 08:13:39 send shop-id-1-price 2016-05-09 08:13:43 send shop-id-1-price 2016-05-09 08:13:47 send shop-id-1-price [errorexception] fwrite(): send of 21 bytes failed errno=104 connection reset peer rabbitmq:consumer [-m|--messages [messages]] [-r|--route [route]] [-l|--memory-limi t [memory-limit]] [-d|--debug] [--] <name> php fatal error: uncaught errorexception: fwrite(): send of 19 bytes failed e rrno=32 broken pipe in /c...

neo4j - py2neo - Functions like COUNT(),MIN(),MAX() in py2neo Api.(without using cypher.execute) -

hi, new py2neo api. have knowledge using cypher requirement run python api (instead of cypher.execute("****")), because of performing analytics operation on graph. i want way find no of nodes in graph, equivalent match n return count(n) . the graph object has order attribute ( http://py2neo.org/2.0/essentials.html#py2neo.path.order ) from py2neo import graph graph = graph() print(graph.order)

r - Plotting a SOM: how to change the colours? -

Image
i have following dataset. > ds dataset_clustering.codice_domanda fat_azi_mln importo_progetto num_addetti modelli formazione 22870 22870 4.855849e-03 0.25386313 0.001403368 0 0 22893 22893 3.606493e-04 0.40618102 0.115209837 0 0 16258 16258 4.433197e-04 0.58254746 0.140670944 0 0 14684 14684 6.189941e-04 0.35717439 0.304330393 0 0 12873 12873 2.480110e-05 0.65121413 0.022654370 0 0 12933 12933 2.603806e-02 0.02551876 0.017107725 0 1 12047 12047 7.130316e-05 0.20094923 0.005012029 0 0 22880 22880 1.963420e-05 0.16556291 0.015503876 0 0 11479 ...

ios - execute function inside enum -

i'm trying execute function inside enum, when execute code contenttype.savecontent("news") keep getting following error: use of instance member on type 'contenttype'; did mean use value of type 'contenttype' instead? . why wont run when i've set type string? enum contenttype: string { case news = "news" case card = "cardstack" func savecontent(type: string) { switch type { case contenttype.news.rawvalue: print("news") case contenttype.card.rawvalue: print("card") default: break } } } i instead of trying : in contenttype enum func : func savecontent() { switch self { case .news: print("news") case .card: print("cards") } } in other part of code use enum : func savecontentinclass(type: string) { guard let contenttype = contenttype(rawvalue: type...

php - How to get all post from a page with count ALL likes and comments? -

attached got question ... try feeds likes , comments retrieve page during period. or .. need total number of likes , comments overall. so far ... $user_pages = $facebook-> api ('/ me / accounts'); ... $page_feeds = $facebook-> api ("/". $ page_name ['id']. '/ feed', 'get', array ('limit' => 10000, 'since' => mktime (0,0, 0, date ("m"), 1, date ("y")))); ... foreach ($page_feeds ['data'] $ page) { $c = $facebook-> api ("/" $ page ['id'] "/ likes", "get", array ('limit' => 10000)..); $temp ['likes'] = count ($ c ['data']); $c = $ facebook-> api ("/" $ page ['id'] "/ comments", "get", array ('limit' => 10000)..); $temp ['comments'] = count ($ c ['data']); } ..... so pages in admin, feeds page since first of month. has...

asp classic - Redirect from a .asp page / Access databse -

i need page: http://address.com/research/staff/profile.asp?id=p0026510 to redirect basic html page. is there anyway can this? have seen on here answers making 301 redirect not sure how set 1 of these files up. i have tried typing: redirect 301 /research/staff/profile.asp?id=p0026510 /about/staff/p0026510/p0026510.asp into .htaccess file doesn't seem work. thanks steve

R shiny: How can I use textOutput for a title in a sidebarPanel? -

i have rendertext expression, produces value (between 1 , 10) , use title in sidebar panel. tried use textoutput() in main panel. however, didn't work. goal have following: h3(paste("the number should be", textoutput()))

javascript - Angular: how do I call a scope method on state change? -

the angular ui-router events statechangesuccess etc fired @ rootscope level , code related these events reside in rootctrl i have 2 states home , about, homectrl , aboutctrl on statechange 'about' want call method in aboutctrl ... how can achieve this? note: can call $scope.rootctrlmethod statechangesuccess code written in rootctrl , can't same aboutctrl . example: rootctrl : function($rootscope, $scope){ $scope.somefun = function(){ console.log("called"); } $rootscope.$on('routechangesuccess', function(event, tostate, fromstate,...){ if(tostate.name == '/'){ $scope.somefun(); } } } a trick here hook event on $scope , not on *$rootscope* : //$rootscope.$on('routechangesuccess', $scope.$on('routechangesuccess', function(event, tostate, fromstate,...){ if(tostate.name == '/'){ $scope.somefun(); } } and have access me...

Correct way to split nested brackets in PHP, e.g. "root[one[a,b,c],two[d,e,f]]" into array? -

like title says i'm looking robust way parse expression array (example in code). <?php $str = 'root[one[a,b,c],two[d,e,f]]' $decoded = decode($str); output: $decoded = ['root' => ['one' => ['a', 'b', 'c'], 'two' => ['d', 'e', 'f']] i'm trying via regex since brackets , commas nested it's not yielding correct results. how can this? a simple parser below should job. did not test - successful route, , few obvious edge cases based on fair assumptions. var_dump(parse('root[one[a,b,c],two[d,e,f]]')); function parse($str, $level = 0) { if ($level === 0) { // strip spaces once simplicity $str = str_replace([" ", "\t"], '', $str); } $result = []; while(true) { $rest = strpbrk($str, '[],'); if (!$rest) { if (strlen($str) > 0) { throw new expecteden...

java - Does argument (collection) to invokeAll depend on queue size? -

as far know can submit collection of callable threads invokeall , threadpool execute tasks (running tasks equal thread pool size in parallel @ given point). but need take care of queue overflow while use invokeall? it depends on code , business requirements. javadoc threadpoolexecutor states following use cases regards queue: there 3 general strategies queuing: direct handoffs . default choice work queue synchronousqueue hands off tasks threads without otherwise holding them. here, attempt queue task fail if no threads available run it, new thread constructed. policy avoids lockups when handling sets of requests might have internal dependencies. direct handoffs require unbounded maximumpoolsizes avoid rejection of new submitted tasks. in turn admits possibility of unbounded thread growth when commands continue arrive on average faster can processed. unbounded queues . using unbounded queue (for example linkedblockingqueue without pre...

python 2.7 - How to get JSON data in an Odoo controller using type='json'? -

a few days ago did similar question here: how json data in odoo controller? but now, need create controller receives json data. so, doing request python console, way: import requests import json url = 'http://localhost:8069/odoo/test' headers = {'content-type': 'application/json'} data = { 'name': 'jane', 'email': 'jane.doe@gmail.com', } data_json = json.dumps(data) r = requests.post(url=url, data=data_json, headers=headers) i have created controller listens http://localhost:8069/odoo/test , way: import openerp.http http openerp.http import response import logging _logger = logging.getlogger(__name__) class webformcontroller(http.controller): @http.route('/odoo/test', type='json', auth='public', methods=['post'], website=true) def index(self, **args): _logger.info('connection successful') _logger.info(args) name = args.g...

How can i pass the value to the field from excel sheet after clearing the field using clear method in selenium -

i have field called time default value 0.00. need pass value 8.00 excel sheet, in order perform first cleared field contains default value 0.00 using clear method. issue after clearing not able pass value excel. how can achieve ? can 1 me please ? thanks in advance..! regards sharath bandi

python - Should I use Pickle or cPickle? -

python has both pickle , cpickle modules serialization. cpickle has obvious advantage on pickle : speed. what, if any, advantage pickle have on cpickle ? the pickle module implements algorithm turning arbitrary python object series of bytes. process called serializing” object. byte stream representing object can transmitted or stored, , later reconstructed create new object same characteristics. the cpickle module implements same algorithm, in c instead of python. many times faster python implementation, not allow user subclass pickle. if subclassing not important use, want use cpickle. source of above information.

bind array data to view model- knockout.js -

the view model has observable array simplesearchresultsarray gets filled on click of bind data 1 button. applying binding @ document load. when click on button, view model gets updated, not view. here view code: <table> <thead id="resulttableheader"> <tr style="text-align: center" data-bind="foreach: columns"> <th style="text-align: center; height: 23px;" data-bind="visible: checked, text: header"> </th> </tr> </thead> <tbody id="resulttablebody" data-bind="foreach: simplesearchresultsarray"> <tr> <td style="text-align: center; vertical-align: middle;"> <span data-bind="text: $index()+1"></span> </td> <td style="text-align: center; vertical-align: middle;"> <span d...

jquery - JQueryUI - droppable only one at a time -

Image
i'm using jqueryui draggable , droppable . if drop 1 element in droppable area , again if try drop 2nd object. first dropped element should automatically remove , moved draggable area. basically, 1 element should in droppable area. here fiddle demo as droppable area has more 1 element. should remove last element. if added 1 more element. droppable area can't have more 1 object. code: $("#dvsource img").draggable({ revert: "invalid", //refreshpositions: true, drag: function (event, ui) { ui.helper.addclass("draggable"); }, stop: function (event, ui) { ui.helper.removeclass("draggable"); if ($.ui.ddmanager.drop(ui.helper.data("draggable"), event)) { console.log($("#dvdest img").length); } else { //alert(image + " not dropped."); } } }); $("#dvdest").droppable({ drop: funct...

See if an item in a list is in another item in Python -

i'm new programming, , have started learning python. wanted create small program detects if enter in "bad word" in entry. name = input ('please enter name. ') badword=['foo', 'bar'] if name in badword: print ('no.') else: print ('yes') this way doesn't work it's taking entirety of entered , searching list entry. , if try us: if badword in name: then error. call each part of list, that's lot of code if you're entering in different types of bad words, , lengthy know can in less code. little lost here, , google searches have come dry. you need loop on badword list test each word : for word in badword: if word in name: print('no.') break else: print('yes.') the else clause part of for statement; executed when loop not interrupted break statement, in case if none of values badword matched. this can shortened any() function , generator expre...

jmeter - Liferay p_auth correlation -

Image
in application value of p_auth dynamically changes tried handle correlation , seems fine me not getting succeed. i attaching screenshots , please me identify wrong enter image description here enter image description here p_auth liferay authentication token used csrf protection, can handled in 3 easy steps: design test scenario follows: open login page extract p_auth pass extracted values step 2 login request step 2 in details: if response text step 1 see p_auth in response body: in order extract jmeter variable add regular expression extractor child of 1st request , configure follows: reference name: meaningful, i.e. p_auth regular expression: p_auth=(.+?)" template: $1$ usually not required extract formdate parameter, substitute ${__time(,)} function so request looks like: to double check have logged in - check out response data tab of last request opens user dashboard: see how load test csrf-protected web sites article...

reverse engineering - Java decompilers that support renaming and other IDE features -

i've been trying hand @ decompiling dex , jar files few decompilers. far best 1 i've used jadx, , comes gui. however, seems read only. there decompiler allows me rename variables/methods/classes obfuscated code, other more advanced ide features such find when class/method/variable called/accessed? in opinion best way decompile jar , import code in ide of choice. if use intellij idea can create new project, import jar external lib, , use built-in decompiler. can set breakpoints etc.

Regex Expression for Specific string in Java -

i new regex expression not able validate string can have number 0-9 fghc,and fghc *#. i trying [0-9fghcfghc*#] its working regex tool in java not working.i using java 1.7 e.g.for pattern required 2314f*ghc 12fgh# etc. public static void main(string[] args){ string money = "23fghc*#"; pattern p = pattern.compile("[0-9fghcfghc*#]",pattern.case_insensitive); matcher m = p.matcher(money); if (m.matches()) system.out.println("valid:-"+ m); else system.out.println("unvalid:- "+m); } thank in advance , more explain soultion can have more knowledge in regex (?i)[0-9fghc*#]+ you need add quantifier @ end well. in case + match these characters 1 or more times. use can add (?i) make case insensitive.

javascript - dependent cascading drop down box list in AngularJS or jquery? -

i trying implement dependent cascading drop down list in angularjs. coming fine for: if select country(say: country1 ), it's states(say: state1 , state2 , state3 ) displaying in second drop down box(it's fine). but requirement that: after displaying above relevant states country, need display respective selected country given states in first drop down box(say if select either state1 or state2 or state3 of country1 country1 should displayed in first drop down box(since country1 having states), , other countries(country2, country3) should disabled or disappeared or not visible in first drop down box). created fiddle . please me how can implement eihter in jquery or angularjs ? in advance. if write ng-diabled="cities" in first drop down box, working fine per requirement.

swift - Limiting fractional digits with NSNumberFormatter SpellOutStyle -

i'm trying create meaningful accessibility labels ios app , hitting think strange problem/limitation of nsnumberformatter. import uikit let decimal = 171.8926 let formatter = nsnumberformatter() formatter.numberstyle = .decimalstyle formatter.maximumfractiondigits = 2 print(formatter.stringfromnumber(decimal)!) // "171.89" formatter.numberstyle = .spelloutstyle print(formatter.stringfromnumber(decimal)!) // "one hundred seventy-one point 8 9 2 six\n" it seems .spelloutstyle not honour maximumfractiondigits reason. am missing or have truncate them myself animal? let truncdecimal = double(int(decimal * 100)) / 100.0 print(formatter.stringfromnumber(truncdecimal)!) // "one hundred seventy-one point 8 nine\n" it seems crazy can use formatter strip digits numerics not words. swift nsnumberformatter numberstyle spelloutstyle prints number out in full current locale. to want recommend creating double extension: extension double ...

ionic framework - Angular 2 ES6 - Sending event from component -

i want send custom event component in es6, can listen in template <component (someevent)="somefunction()"> , cannot make happen. @component's properties ouputs or events breaking application. missing something? this component declaration: import {component, output} 'angular2/core'; @component({ selector: 'section-navigator-component', templateurl: 'build/components/section_navigator/section_navigator.html', inputs: [ 'resources', 'attr' ], outputs: [ 'someevent' ] }) export class sectionnavigatorcomponent { constructor() { } resourceclickhandler($event, resource) { } } this should work in case: import {component, output, eventemitter} 'angular2/core'; @component({ selector: 'section-navigator-component', templateurl: 'build/components/section_navigator/section_navigator.html', inputs: [ 'resources', 'attr'...

Apply multiple "Where" clauses in one Query SQL SERVER -

i want i have query : select sum(fact.cheques) totalchequeamount, sum(fact.revenusintermediationtodate + fact.cheques ) ytd , sum(fact.revenusintermediationtodate + fact.cheques ) ytdn1, sum(revenusintermediationtodate) totalrevenuintermediationtodate, acc.becompanycode codecompany, acc.country pays, acc.name name, acc.accounttypesec accounttype, acc.segmentation segmentation, acc.city city, acc.officialgroup officialgroup , acc.actualyearbudget budget2016, acc.segmentationressec segmentsecurities dbo.fact_profit_and_loss fact left outer join dbo.dim_accounts acc on ( acc.accounts_techkey = fact.fk_account) left outer join dbo.dimtemps time1 on (time1.temps_pk = fact.fk_time) year(time1.date) = 2016 group acc.becompanycode, acc.country , acc.name , acc.accounttypesec , acc.segmentation , acc.city , acc.officialgroup , acc.actualyearbudget, acc.segmentationressec the problem want apply filter year = 2016 column ytd , 1 other filter year = 2015 column ytdn1. is there ...

jquery - Setting CSS classes as a variable in Javascript for later use? -

i want know if it's possible set css class e.g. ".duck" variable in javascript using jquery e.g. var duck = $(".duck"); i've done "body" tag , css id's doesn't seem work kind of class. i want set variable later use, have id "#frog" set "var frog = $("#frog");" in javascript can type frog.moveto(0); frog.speed(0.3); frog.autobounceoff(true); but duck class still have use $(".duck").moveto(270); $(".duck").speed(0.65); $(".duck").oncollision(function(otherobj){ is possible set classes variable? there nothing related css here. duck html class. .duck class selector. $(".duck") function call returns jquery object (containing dom elements, in document, members of class @ time function called). you can store return value of function call in variable. a common convention store jquery objects in variables names starting $ . var $duck = $(...

ssl - Disabling authentication using Websphere MQ Explorer -

we have .net application reads websphere mq. queue local, , managed using mq explorer. queue authenticated using ssl certificates. we read same queue application being written in java. understand in order access queue using jms, need regenerate certificates use java. however, have not yet been able this. in order continue development , testing, there way, using mq explorer, disable authentication on queue or queue manager? i assuming can access existing queue using jms, , not have setup new queue under 'jms administered objects'. thanks well it's not queue tls/ssl enabled. it's connection (i.e. channel) queue manager tls/ssl enabled. can create channel not tls/ssl enabled , connect queue manager messages queue.

debugging - Pycharm unit test interactive debug command line doesn't work -

when debugging unit tests (through pycharm test runner), 1 can turn on interactive command line, (unlike when debugging regular scripts) commands entered don't produce output. matter of fact, appears stdout being captured somewhere, because stderr works expected: >>> print "a" >>> import sys >>> sys.stderr.write("moof") moof >>> sys.stdout.write("moof") >>> sys.stderr.write("test") test is expected behavior? interactive debug console , awesome if behaved nice when debugging unit tests well. this because test runner capturing stdout not stderr. i use py.test captures both stdout , stderr see no output @ all. if want see output have pass -s flag py.test runner can done modifying run/debug configuration , adding flag options field. (run > edit configurations > defaults > python tests > py.test > add -s options field.) >>> print 'a' >>> ...

html - Divs not centered on different media queries -

i quite new in web development. have built website , problem in portfolio section. cannot manage center on devices images , text. website url: alextodea.net thanks lot! relevant code. css used media queries : alextodea.net/css/style.css add css, center image , text in devices below 980px. @media screen , (max-width:990px) { #workd .thumb, #workd .description { float: none; margin: 0 auto; text-align: center; } .col-xs-12.col-md-8.description.block.more { padding-left:0; } }

angularjs - $watch inside a service? -

is possible set $watch on array of objects inside service (i'd $watch declaration inside service)? you can add expression set of watches injecting $rootscope , using function first argument $watch method. pseudo-code: $rootscope.$watch(function() { return //value watched; }, function watchcallback(newvalue, oldvalue) { //react on value change here }); don't forget third, boolean argument $watch method. need specify true if want deep-watch entire object changes.

jsf - How to add a String to ValueExpresion programatically -

hi i'm trying add string value value expresion. in xhtml code used things this: <h:outputtext value="#{mybean.value} %" /> it easy way add '%' symbol outputtext. how can accomplish programatically. i'm able add value expresion: final htmloutputtext outputtext = jsfutils.createcomponent(htmloutputtext.component_type); final valueexpression exp = jsfutils.valueexpresion("gasto.porcentajetotal"); outputtext.setvalueexpresion("value", exp); but don't know how add '%' symbol thank you. it looks problem in utility method, not allow specifying #{ , } because "automatically" wraps it. if move responsibility caller, should able achieve task. below canonical way create value expression ( copied omnifaces components ): public static valueexpression createvalueexpression(string expression, class<?> type) { facescontext context = facescontext.getcurrentinstance(); return contex...

Is there a way to return multiple variables from a function in C? -

i coming c after long spell python. wondering if there way return information on more 1 variable in c. best method think of returning structure contained variables. best way? c doesn't support tuples or similar features allow this. so, answer unfortunately no . as said, closest can defining own custom struct can used store values want return.

postgresql - How to create index on json field in Postgres 9.3 -

in postgresql 9.3 beta 2 (?), how create index on json field? tried using -> operator used hstore got following error: create table publishers(id int, info json); create index on publishers((info->'name')); error: data type json has no default operator class access method "btree" hint: must specify operator class index or define default operator class data type. found: create table publishers(id int, info json); create index on publishers((info->>'name'));

javascript - Call onchange function from Document.Ready with pre selected item from update -

i have user form contains many option boxes, 1 of them has (onchange()) function hide/show text inputs based on value. in add form every thing works charm, when editing pre-added record, select option populated (selected), selected when adding form, question here, when select record update, can hide/show input boxes based on option box selected value using javascript. and example of want can found as many mentioned, it's hard without example code given. i'll still give try. html: <select id="select" onchange="toggleinputs()"> <option value="0">option 0</option> <option value="1">option 1</option> <option value="2">option 2</option> <option value="3">option 3</option> </select> <input type="text" class="toggleinputs" placeholder="input 0" id="inp0"/> <input type="text...

javascript - Sencha Touch over jquery Mobile -

what main feature of sencha touch on jquerymobile don't understand. per knowledge 2 technology: 1) jquerymobile have simple data attribute feature design app cross mobile platform compare sencha touch . 2) sencha touch have new concept , structure implement designing page difficult compare jquery mobile . then significance of sencha , jquerymobile , own area in both play role ? intro unlike jquery mobile sencha touch (just app framework ) made work on mobile platforms , highly optimized. jquery mobile made work equally on desktop , mobile devices , not optimized sencha touch . not bad jquery mobile means jquery mobile not best solution form mobile hybrid applications. good side of sencha touch it several times faster jquery mobile, can find several benchamark articles if google bit. experience sencha touch mobile applications works much smoother jquery mobile ones. again not attack on jquery mobile, sencha highly optimized not mention build run on ...

php - how to move to another page after displaying JavaScript alert -

how can move page after displaying javascript alert. thank you, :d what's next code go page? if(isset ($_post['reply'])){ echo "<script>alert('login continue.')</script>"; } hope looking this echo "<script>alert('update not successfully');document.location='pagename.php'</script>"; do not forget write script @ start , end point in echo.

Swift cocoapod install framewoek(Alamofire) occur Syntax error in xcode -

i have problem in installing external framework. therefore, try in blank project error same , not sure did wrong. error image it little uncommon. seems did install wrong version of framework in appear 40+ error in code syntax. also, error alamofire,amazons3requestmanager , on. podfile , put pod install in target file directory source 'https://github.com/cocoapods/specs.git' # uncomment line define global platform project platform :ios, '8.0' # uncomment line if you're using swift use_frameworks! target 'test' pod 'fbsdkcorekit' pod 'fbsdkloginkit' pod 'fbsdksharekit' pod 'alamofireimage', '~> 2.0' pod 'firebase', '>= 2.4.3' pod 'swiftvalidator', '3.0.1' pod 'amazons3requestmanager', '~> 0.8' pod 'mbprogresshud', '~> 0.9.2' end the code in screenshot swift 2.2, have update xcode latest version, xcode 7.3. version old.

php - when url is 'abc' ajax is working and when urs is 'abc/2' ajax is not working in laravel -

<script> $(document).ready(function(){ $(document).on('change','#compid',function () { var username = $(this).val(); /*var token = $("input[name=_token]").val(); var datastring = 'username='+username+'&token='+token; */ var data1={username} $.ajax({ type: "get", url : 'depttbranch', data : data1, success : function(data){ $('#branchid').html(data); alert(data); },error : function(){ alert('out'); } }); }); });//end of document ready function </script> it's because using relative url , depttbranch . this means on http://example.com/abc relative url...

cross domain - Access-Control-Allow-Origin not working for image extensions in Nginx -

i have configuration in nginx add cross-origin , its working fine , header allow-origin present in response headers: location ~* \.(woff|woff2|oft|eot|ttf)$ { add_header cache-control "max-age=1604800"; add_header access-control-allow-origin '*'; log_not_found off; } but when try same image extensions not working, no allow-origin header in response headers: location \.(ico|gif|jpg|jpeg|png|flv|pdf|thumb)$ { add_header cache-control "max-age=29030400"; add_header access-control-allow-origin '*'; log_not_found off; } why not working images? i using regular expression "." without regular expression prefix "~" or "~*".

r - RODBC connectivity to Oracle without tnsnames.ora -

i trying connect oracle r using rodbc without using tnsnanes.ora. i have tried following strings, none of them working. > con.text <- paste0("driver={oracleodbc-11g};dbq=//oracle.server:1527/database.pdw.prod;uid=user;pwd=pswd;") > con.text <- paste0("driver={oracleodbc-11g}; ", "connectstring=(description=(address= (protocol = tcp)(host = oracle.server)(port = 1527))(connect_data=(service_name = database.pdw.prod))); uid=user;pwd=pswd;") > con.text <- paste0("driver=", "oracleodbc-11g" , ";server=", "oracle.server" , ";database=", "database.pdw.prod" , ";uid=", "user" , ";pwd=", "pwd", ";") > con.text <- paste0("driver=", "oracleodbc-11g" , ";server=", "oracle.serve...

angularjs - Angular compare time via variables -

i storing time in variable compare 1 , so, have response ifi variable >14:00 or <14:00 not know (and documenation not support), how store "14:00" in second variable.. var time = ed.datetimeto; var checktime=(??); if (time > checktime) { console.log("time >14:00"); } else console.log("time <14:00!"); any welcome! you can use following mechanism compare 2 time strings: function datecompare(time1,time2) { var t1 = new date(); var parts = time1.split(":"); t1.sethours(parts[0],parts[1],parts[2],0); var t2 = new date(); parts = time2.split(":"); t2.sethours(parts[0],parts[1],parts[2],0); // returns 1 if greater, -1 if less , 0 if same if (t1.gettime()>t2.gettime()) return 1; if (t1.gettime()<t2.gettime()) return -1; return 0; } if have complete date in ed.datetimeto , can use: var time = new date(ed.datetimeto); var checktime = new date(ed.datetimeto).sethours('14',...

printing - Crystal Reports - Printed field alignment issue -

we have created couple reports in vs2008 , since we've converted 2012 we've run issue fields perfect in designer , in viewer, when print fields moved. isn't same movement either, items moved down inch, others moved half inch, left/right/etc. resolve issue i've opened designer , manually moved fields wrong on designer print properly. issue i'm running when put field @ top of page, still pushes down despite margins being set zero. now don't breaking designer make work, if there more permanent solution people aware of, ideal. if there anyway force field pushed top of page, acceptable temp fix. the nature of our need here prints on specific insurance form , fields have fit in proper boxes or declined. thanks in advance, dylan with use of guidelines in crystal report can resolve issue. you can enable guidelines file--> option --> in layout tab in design view panel can select guidelines. now can design crystal report , set fields in to...

python - Writing the filter() function using for/while loops -

i trying understand how filter() function works , know how write: test = filter(lambda x: x == y, lst) using for or while loops. filter() pretty making new list loop , conditional. in example, identical to: l = [] in lst: if == y: l.append(i) or list comprehension: [i in lst if == y]