Posts

Showing posts from March, 2015

version control - Are Branches In TFS's Default Collection Root Problematic? -

Image
been using tfs think while. got new job & i'm wondering if use of tfs wrong. used seeing team projects listed in default collection root. however, work, seeing branches @ root (as well). i haven't said yet, means (further) branch given (branch) folder root of default collection. seems big issue me...but maybe not. so questions are... is having branches @ default collection root wrong? is legitimate practice? what problems can cause? should something? how possible create branches at-root? (i tried test , couldn't) i speculate branches @ root created in 1 of 2 ways. they created using "branch team project" in create team project dialog. the folders / projects created separately , baseless merge performed between folders creating branching relationship. as if it's idea or not. no. can't think of upsides this. downsides here small list. it's untidy, not best reason cause confusion if have many branches, example...

File comparison script not working Python -

i wrote custom file comparison script based on nature of files i'm checking. file read dictionary , script tries hash lines determine if line exists in other file. f = open('test.txt', 'r') f2 = open('test2.txt', 'r') m1 = {} m2 = {} line in f: m1[line] = line line2 in f2: m2[line2] = line2 k in m1: try: l = m2[k] except keyerror: print m1[k] f.close() f2.close() i put trash line in 1 of files , script did not print out. why didn't detect trash line? following @peterwood's suggestion, def get_line_set(fname): open(fname) inf: return set(line.rstrip() line in inf) f1 = get_line_set("test.txt") f2 = get_line_set("test2.txt") only_in_f1 = f1 - f2 if only_in_f1: print("\nthe following lines appear in f1 not in f2:") print("\n".join(sorted(only_in_f1))) only_in_f2 = f2 - f1 if only_in_f2: print("\nthe following lines appea...

python - matplotlib, add_axes full-figure size -

Image
i'd add_axes fits full figure size. did: axes = figure.add_axes([0., 0., 1., 1.]) ...but doesn't fit, spines missing. in following picture, spines red: ...but top , left-hand spines missing. know why , how fix ? full source code: from __future__ import print_function import matplotlib matplotlib.use("qt4agg") import matplotlib.pyplot plt pyqt4.qtcore import qt_version_str pyqt4.qt import pyqt_version_str sip import sip_version_str import sys print("matplotlib version:", matplotlib.__version__) # 1.1.1 print("matplotlib backend:", matplotlib.get_backend()) # qt4agg print("qt version:", qt_version_str) # 4.8.2 print("pyqt version:", pyqt_version_str) # 4.9.4 print("sip version:", sip_version_str) # 4.13.3 print("python version:", sys.version) # 2.7.3 (default, apr 10 2012, 23:31:26) [msc v.1500 32 bit (intel)] figure = plt.figure() axes = figure.add_axes([0., 0., 1., 1.]) axes.spines['left...

c++ - Returning and using a pointer to a multidimensional array of another class -

i'm trying access 'room' array via functions in room class itself, i.e: class ship{ room * rooms[3][4]; public: room ** getrooms(){ return *rooms; } } class room{ //variables... ship * ship_ptr; public: getshipptr(); //assume returns pointer class ship void function_x(){ this->getshipptr()->getrooms()->rooms[x][y]->dothat(); } } i'm doing wrong pointer-wise i'm not sure, correct code can access room array out of ship class? note: assume rooms initiated i'm doing wrong pointer-wise i'm not sure you making false assumption 2d array can decay pointer pointer 1d array can decay pointer. int arr1[10]; int* ptr1 = arr1; // ok. 1d array decays pointer. int arr2[10][20]; int** ptr2 = arr2; // not ok. 2d array not decay pointer pointer. int (*ptr2)[20] = arr2; // ok. ptr2 pointer "an array of 20" objects. my suggestion: simplify code , change interface to: ro...

ios - UIPickerView not showing the items -

i'm new in swift , i'm having troubles uipickerview . problem this: when put items in picker , can choose. perfect don't know why when have 1 or 2 items don't show up, , have drag down times see it, , selected problem can't see :( this code: class loginviewcontroller: uiviewcontroller,uipickerviewdatasource,uipickerviewdelegate{ @iboutlet var pickercol: uipickerview! @iboutlet var labelcol: uilabel! @iboutlet var textusuario: uitextfield! @iboutlet var textpassword: uitextfield! let defaults = nsuserdefaults.standarduserdefaults() var picker = uipickerview() var numberofrows = 0 var namesarray = [string]() var idarray = [string]() var numero = 0 var col : string = "" override func viewdidload() { pickercol.delegate = self pickercol.datasource = self parsejson() super.viewdidload() } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } func par...

nlp - Using Arabic WordNet for synonyms in python? -

i trying synonyms arabic words in sentence if word in english works perfectly, , results displayed in arabic language, wondering if possible synonym of arabic word right away without writing in english first. i tried didn't work & prefer without tashkeel انتظار instead of اِÙ†ْتِظار from nltk.corpus import wordnet omw jan = omw.synsets('انتظار ')[0] print(jan) print(jan.lemma_names(lang='arb')) wordnet used in nltk doesnt support arabic. if looking arabic wordnet totally different thing. for arabic wordnet, download: http://nlp.lsi.upc.edu/awn/get_bd.php http://nlp.lsi.upc.edu/awn/awndatabasemanagement.py.gz you run with: $ python awndatabasemanagement.py -i upc_db.xml now wn.synset('إنتظار') . arabic wordnet has function wn.get_synsets_from_word(word) , gives offsets. accepts words vocalized in database. example, should use جَÙ…ِيل جميل : >> wn.get_synsets_from_word(u"جَÙ…ِيل") [(u'a', u'30...

virus scanning - How long will my Mobile Analyzer scans be available in the database if I don’t delete them? -

when running scans using appscan mobile analyzer saas offering, how long scans stored in database if not delete them? scans held in database 1 year if user not manually delete them.

c++ - Using an intermediate result to initialise several attributes -

i have class constructor this: class b; class c; class d; class a{ private: b b; c c; public: a(istream& input){ d d(input) // build d based on input b = b(d); // use d build b c = c(d); // , c } } which should work fine long b , c have default constructors. my problem b doesn't, need initialise b in initialisation list. issue since need build d before can compute b , c . one way this: a(istream& input):b(d(input)),c(d(input)){} but building d (very) costly (*) what's clean way around problem? (*)another problem if b , c need built same instance (like if d 's constructor randomized or whatever). that's not case though. in c++11 use delegating constructors : class b; class c; class d; class { private: b b; c c; public: explicit a(istream& input) : a(d(input)) { } // if wish, make protected or private explicit a(d const& d) : ...

python - Adding a background image to a plot with known corner coordinates -

Image
say plotting set of points image background. i've used lena image in example: import numpy np import matplotlib.pyplot plt scipy.misc import imread np.random.seed(0) x = np.random.uniform(0.0,10.0,15) y = np.random.uniform(0.0,10.0,15) img = imread("lena.jpg") plt.scatter(x,y,zorder=1) plt.imshow(img,zorder=0) plt.show() this gives me . my question is: how can specify corner coordinates of image in plot? let's i'd bottom-left corner @ x, y = 0.5, 1.0 , top-right corner @ x, y = 8.0, 7.0 . use extent keyword of imshow . order of argument [left, right, bottom, top] import numpy np import matplotlib.pyplot plt scipy.misc import imread import matplotlib.cbook cbook np.random.seed(0) x = np.random.uniform(0.0,10.0,15) y = np.random.uniform(0.0,10.0,15) datafile = cbook.get_sample_data('lena.jpg') img = imread(datafile) plt.scatter(x,y,zorder=1) plt.imshow(img, zorder=0, extent=[0.5, 8.0, 1.0, 7.0]) plt.show()

javascript - Where to apply my moment() function in a react component? -

i trying clock component, give date , time in local format in webpage. imported momentjs using command line npm moment --save in webpack environment. next wrote in clock.jsx component (mostly based on react example on website). import react 'react'; import moment 'moment'; export default class clock extends react.component { constructor(props) { super(props); this.state = { datetimestamp : date.now() }; } tick = () => { this.setstate({datetimestamp: this.state.datetimestamp + 1}); console.log('tick'); } componentdidmount() { this.interval = setinterval(this.tick, 1000); } componentwillunmount() { clearinterval(this.interval); } render() { const date = this.state.datetimestamp; return( <div classname="clock"> heure locale : {date}</div> ); } } doing timestamp incremented correctly. however, when passing new state element in object, first value (based on date.n...

javascript - Phonegap Android with JSONP Not Working -

i'm making phonegap app android jsonp not working on apk. of code in spanish makes no difference. <!doctype html> <html> <head> <script type="text/javascript" charset="utf-8" src="phonegap.js"></script> <script src="jquery.min.js"></script> <script src="jquery.jsonp-2.4.0.min.js"></script> <script> $(document).ready(function(){ var output = $('#output'); $.ajax({ url: 'http://www.laprepie.com/form/sql/1.php', datatype: 'jsonp', jsonp: 'jsoncallback', timeout: 5000, success: function(data, status){ $.each(data, function(i,item){ var landmark = item.id_sucursal+item.numero+item.direccion; output.append(landmark); }); }, error: function(){ output.text('there error loading data.'); ...

java - Apache camel simple http example -

i pretty new camel. have been trying fetch data http source. here's code: from("timer://runonce?repeatcount=1") .to("http4://webservice.com/example.xml") .process(new structurexml()) .to("mock:resource") .stop(); and: class structurexml implements processor { public void process(exchange httpexchange) throws exception { string httpres = httpexchange.getin().getbody(string.class); string[] lines = httpres.split("\n"); pattern p = pattern.compile("<map key='(.+)' value='(.+)'/>"); hashmap<string, integer> mapdata = new hashmap<string, integer>(); for(string line : lines) { matcher m = p.matcher(line); if(m.find()) mapdata.put(m.group(1), integer.parseint(m.group(2))); } httpexchange.getin().setbody(mapdata); } } well example works right want know possible ways further...

GWT RPC, Spring, JPA/Hibernate - null on callback method -

this first app. have problem between gwt (rpc) , db (mysql). junit tests run great. here code: https://github.com/sutakjakub/game client package: userservice.util.getinstance().adduser("kuba","tajne", new asynccallback<long>() { @override public void onfailure(throwable arg0) { window.alert("get se nezdaril" + arg0); } @override public void onsuccess(long id) { if(id == null){ window.alert("null"); }else{ window.alert("zapsano db; id=" + id); } } }); this method must return id of new user return null (in method onsuccess(long id) ). i dont have error logs. tried everything. thank idea or solution. an updated entity isn't returned saveorupdate method (generichibernatejpadao): @override public <entity extends abstractbussinessobject> entity saveorupdate(entity o) { if(o.getid() == null){ getentitymanager().persist(o); }else{ getentitymanager().merge(o); } return o; } should beco...

php - Current page hightlight button -

i have 3 buttons in header php file of site. want change color of button when on page cannot working correctly trying use $thispage statement call if on 1 of pages adds id="currentpage." here code using <input type='button' value='available now' onclick='location="/category/upcoming/"' <?php if ($thispage) echo " id=\"currentpage\""; ?> class="header-image" /> <input type='button' value='coming soon' onclick='location="/category/soon/"' <?php if ($thispage) echo " id=\"currentpage\""; ?>class="header-image" /> <input type='button' value='vault archive' onclick='location="/category/previous/"' <?php if ($thispage) echo " id=\"currentpage\""; ?>class="header-image" /> php <?php $page_name = basename(__file__); ?> html <li ...

javascript - Magnific Popup and Bootstrap 3 Modal Call Stack Exceeded -

i'm having interesting issue when combining boostrap 3 modal magnific popup. have bootstrap modal contains list of videos, , each video has view link opens magnific popup iframe popup. everything worked fine until played magnific popup's z-index in order appear on top of bootstrap modal. problem is , if try , close magnific popup (or interact @ all) stackoverflow error occurs (maximum call stack exceeded). note: works fine if leave z-index of magnific popup alone. simplified example: http://codepen.io/craigh/pen/gowwok/ note: codepen suppresses errors, issue not obvious. on site, occurs locking browser up. i think has how clicking outside of bootstrap modal closes modal, changed modal backdrop static (forces user click x or close button) no change. ideas? someone posted answer question in github issue same problem. commenting out line of code seems messing trick , haven't found side effects of now. taken github user randomarray's response ...

iOS: App Home Button Shortcut -

having trouble finding api home screen shortcuts when home button clicked. app plays audio , want similar shortcuts pop ipod give me option stop playback. can point me reference? this place start: remote control events from apple documentation: test app receiving , handling remote control events playing controls. these controls available on recent ios devices running ios 4.0 or later. access these controls, press home button twice, flick right along bottom of screen until find audio playback controls. these controls send remote control events app or playing audio. icon right of playback controls represents app receiving remote control events.

sitecore8 - Sitecore WFFM: Issues Submitting form programmaticaly -

i have been trying submit own form wffm. form created identical 1 created wffm, way fields map correctly. i began following following steps: https://jermdavis.wordpress.com/2015/05/18/programmatic-wffm-submissions/ i had make minor changes code in order submitactionmanager work the members of sitecore.form.core.submit.submitactionmanager class have been moved iactionexecutor interface.to obtain instance of interface use (iactionexecutor)factory.createobject ("wffm/wffmactionexecutor", false) call. below code have far: public void submitdata(contactusformmodel data) { var results = new list<controlresult>(); results.add(makecontrolresult(models.constants._cuffirstnameid, "first name", data.firstname)); results.add(makecontrolresult(models.constants._cuflastnameid, "last name", data.lastname)); results.add(makecontrolresult(models.constants._cufemailid, "email", data.email)); ...

c - How to create an low-level object file? -

basically want create object file (maybe x64 elf one) assembly code linked other object files in order create 1 executable. export addresses object , import other object files link to. i'll happy if can target linux x64 (i'm using opensuse now) , can used default linker (like 'ld' maybe). i want make compiler using 'c' language. just generate assembly code, , use assembler convert object format.

ruby - Amazon AWS Images are not showing? -

i trying add images work in app. have installed amazon aws sdk gem , setup environments variables when create image tag image not showing in heroku. heres code [![enter image description here][1]][1] when open https://s3.amazonaws.com/skilllzy/134h.jpg in browser, get: <error> <code>accessdenied</code> <message>access denied</message> <requestid>ca4454aaca61f45e</requestid> <hostid> 5faq4ogdrjmud9b012vbi495tizgpsrkhqh3zfzydzcv2ljluy48f/ug1kzeqv5iarlt0dy1ixg= </hostid> </error> this indicates either a) have not configured bucket static website or b) not have correct permissions on bucket allow public accesss. please review hosting static website on amazon s3 , permissions required website access make sure have configured bucket public http access.

javascript - Why does using ng-repeat for my directive make a difference to my binding? -

if take code: <div data-ng-repeat="video in vm.videos"> <p>{{video.title}}</p> <video-item content="video"></video-item> </div> it appears render directive correctly (the video object bound correctly , accessible directive). however if want display single video (same object type, single object rather collection): <p>{{vm.currentvideo.title}}</p> <div data-video-item content="vm.currentvideo"></div> then why scope no longer have access binding? here directive: import models = rod.domain.models; export class videodirective implements ng.idirective { public restrict: string = "a"; public replace: boolean = true; public scope: = { content: "=" }; constructor( private $compile: ng.icompileservice, private templateselector: rod.features.video.templates.itemplateselector<models.ivideo...

javascript - Use one md-switch to toggle a group of other md-switchs in HTML/JS -

i wanting able toggle , untoggle entire group sections. when group section toggled off, want sections in group toggle off or disabled. if group section toggled on, want sections toggled on or enabled. added ng-change group toggle function togglelayergroup . have foreach inside function goes through feeds in group. not sure add turn off or on feeds in group. controller this feeds loaded up. // -- load feeds if (service.currentuser.feeds) { var feeds = service.currentuserorg.feeds; angular.foreach(feeds, function(feed, index) { var lg = $scope.layergroups[feed.category]; if(lg) { lg.feeds[feed.id] = feed; lg.feeds[feed.id].layerstate = service.currentuser.mapstate.visiblelayers.indexof(feed.id) >= 0; if (lg.feeds[feed.id].layerstate) { lg.state = true; } } }); } this switches hit. $scope.layerstate = false; $scope.layergroup = false; $scope.togglelayer = function (layerstate, feed) { if...

html5 - Spring 4 Switching from admin to admin/minor view causes resources not found -

the issue when switch admin admin/minor causes resources not found. here controller : package com.projc.spring.controllers; import javax.servlet.http.httpservletrequest; import org.apache.log4j.logmanager; import org.apache.log4j.logger; import org.springframework.beans.factory.annotation.autowired; import org.springframework.context.messagesource; import org.springframework.stereotype.controller; import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.bind.annotation.requestmethod; import org.springframework.web.servlet.modelandview; @controller public class admincontroller { private static final logger logger = logmanager.getlogger(admincontroller.class); @autowired private messagesource messagesource; @requestmapping(value = { "/admin" }, method = requestmethod.get) public modelandview index(httpservletrequest request) { logger.debug("admin index page"); modelandview model =...

ruby - Why is this Sidekiq fake test not increasing the size of the jobs array? -

i have following test setup sidekiq test using fake testing in https://github.com/mperham/sidekiq/wiki/testing . spec_helper.rb require 'sidekiq/testing' sidekiq::testing.fake! # see http://rubydoc.info/gems/rspec-core/rspec/core/configuration rspec.configure |config| config.before(:suite) factorygirl.reload factorygirl.define to_create { |instance| instance.save } end databasecleaner.strategy = :transaction databasecleaner.clean_with(:truncation) airbrake.configure |c| c.project_id = env['airbrake_project_id'] c.project_key = env['airbrake_project_key'] end end config.before(:each, job: true) sidekiq::worker.clear_all #make sure jobs don't linger between tests end config.around(:each) |example| databasecleaner.cleaning example.run end end config.include factorygirl::syntax::methods end notification_spec.rb require 'spec_helper' rspec.describe notificationw...

linux - NEO4J local server does not start -

i running linux in virtualbox , having issue did not encounter on machine linux primary os. when launching neo4j service through sudo ./neo4j start in /opt/neo4j-community-2.3.1/bin timeout message failed start within 120 seconds. neo4j server may have failed start, please check logs my log /opt/neo4j-community-2.3.1/data/graph.db/messages.log says: http://pastebin.com/wua715qq and data/log/console.log says: 2016-01-06 02:07:03.404+0100 info started database 2016-01-06 02:07:03.603+0100 info stopped database 2016-01-06 02:07:03.604+0100 info shutdown neo4j server 2016-01-06 02:07:03.608+0100 error failed start neo4j: starting neo4j failed: component 'org.neo4j.server.security.auth.fileuserrepository@9ab182' initialized, failed start. please see attached cause exception. starting neo4j failed: component 'org.neo4j.server.security.auth.fileuserrepository@9ab182' initialized, failed start. please see attached cause exception. org.neo4j.server.serve...

binary based xmpp server? -

helo, i'm working on mobile game needs realtime communication client server. usually i'll implement tcp socket server , use private binary protocol enable bidirectional communication, , looking xmpp server ejabberd based on standard. xml in way it's redundant , inefficient, mobile app means more traffic , memory consumption. is must xmpp use xml? is there xmpp implementation uses binary low level data format instead of using xml? (or shouldn't choose xmpp , start other standard or technology.) any strategy reduce overhead of sending complex data object (not big file object) using xmpp? xml required xmpp specification, there no binary implementations. indeed contain more overhead, have keep in mind problem xmpp designed solve - active chat connection can expected transmit maybe 1 message per second. as google talk api: use non-xml protocol client - google server connections. when send message in gmail client, request body contains bunch of post dat...

ruby on rails - Adding filter for has_many relationship in rails_admin -

i'm using rails_admin reporting tool , leveraging export csv feature pull out specific data. works fine, need filter results based on data being between 2 dates, dates on on model linked through has_many relationship. here example class patient < activerecord::base has_many :appointments end class appointment < activerecord::base belongs_to :patient # has field: 'date' end i can load patients in railsadmin , in list view show appointments, how can add filter show patients have appointment between date x , y? possible @ all? is there anyway use named scope , pass in parameters? or virtual model rails_admin load? sql pretty simple this, i'm not sure how pass in actual date parameters? i curious how solve this. one option add appointments filter dropdown not allow choose dates. rails_admin include_all_fields field :appointments filterable true end list filters [:appointments] # make show default end end another ch...

Python 2.7 if / elif statement with or -

i'm new python i'm sure i'm doing wrong. defining function accepts string variable. can not sure variable be, there 3 values want test , return string if values found. if values not found, want return 'unknown'. here code: def item_priority(cell_color): if cell_color == 'green' or 'yellow': return 'low' elif cell_color == 'red': return 'high' else: return 'unknown' so try execute: >> item_priority('orange') python returns: 'low' the result expected see 'unknown'. if test "item_priority('red')", still returns 'low'. explanations have found on site far involve code more complex mine. i have tried interchanging second 'if' 'elif' result still same. i'm not sure i'm doing wrong here. appreciated. thanks! 'yellow' evaluating true within if-conditional, therefore block of code being executed ...

python - Collocation output to a variable -

i trying put in collocation results variable. i able this print(corpus.collocations()) and output on console... but when my_results = corpus.collocations() print(type(corpus.collocations())) i output <class 'nonetype'>

visual studio 2015 - ReSharper 10: VS2015 Pro Throws OutOfMemoryException Using "Show Type Dependecy" -

i installed trial resharper 10 on visual studio 2015 pro with update 1 . i'm trying create type dependency diagram large c# project, after running while, vs2015 throws outofmemoryexception . i believe there similar bug on earlier versions of vs , r#. referenced this stackoverflow. solution mentioned involves enabling large memory allocation visual studio process executing editbin /largeaddressaware devenv.exe . don't know if there known solution in vs2015. here version information resharper: jetbrains resharper ultimate 10.0.2 build 104.0.20151218.120627 dotmemory 10.0.20151218.125655 dottrace 10.0.20151218.132452 resharper 10.0.20151218.130009 and vs: microsoft visual studio professional 2015 version 14.0.24720.00 update 1 microsoft .net framework version 4.6.01055 installed version: professional also, here system info well: os name : microsoft windows 7 professional version : 6.1.7601 service pack 1 build 7601 other os ...

linux - Apache Spark upgrade from 1.5.2 to 1.6.0 using homebrew leading to permission denied error during execution -

i upgraded spark 1.5.2 1.6.0 using homebrew , reset spark_home environment variable /usr/local/cellar/apache-spark/1.6.0 . while executing pyspark, gives permission denied error. if go earlier 1.5.2 installation directory , execute pyspark there, runs fine. running pyspark 1.6.0 installation directory fails permission denied error. /usr/local/cellar/apache-spark/1.6.0/bin/load-spark-env.sh: line 2: /usr/local/cellar/apache-spark/1.6.0/libexec/bin/load-spark-env.sh: permission denied /usr/local/cellar/apache-spark/1.6.0/bin/load-spark-env.sh: line 2: exec: /usr/local/cellar/apache-spark/1.6.0/libexec/bin/load-spark-env.sh: cannot execute: undefined error: 0 what causing this? i ran same issue , easiest fix set $spark_home /usr/local/cellar/apache-spark/<your_spark_version>/libexec/ instead. you can build source directly , can find instructions here . basically do git clone https://github.com/apache/spark/` cd spark git checkout origin/branch-x.y bui...

php - BadMethodCallException with message 'Call to undefined method Illuminate\Database\Query\Builder::belongToMany()' -

following instructions in laracast : https://laracasts.com/series/laravel-5-fundamentals/episodes/21 i created channel model class channel extends model { // protected $fillable = [ 'title', 'description', 'published_at', ]; public function scopepublished($query) { $query->where('published_at', '<=', carbon::now()); } public function setpublishedatattribute($date) { $this->attributes['published_at'] = carbon::createfromformat('y-m-d', $date); } /* * tags associated given channel * */ public function tags() { return $this->belongstomany('app\tag'); //tag_id } } and tag model class tag extends model { // protected $fillable = [ 'name', 'description', ]; /** * channels associated given tag */ public function channels() { return $this-...

Automatically sort all Arrays in controller when getting from database PHP -

so have controller passes associative array called $pagedata view. inside array 3 more associative arrays, , view renders 3 select elements array data options. want sort 3 arrays don't want write sort 3 times here or add order_by query methods, because there dozens of similar pages , don't want write hundreds of sort method calls. told solve in constructor. wondering if there's oop solution lets me automatically sort child arrays inside $pagedata. class sku extends ci_controller { protected $pagedata = array(); public function __construct() { parent::__construct(); $this->load->model('mc'); } public function inventory() { $this->pagedata['class_ids'] = $this->mc->get_class_ids(); $this->pagedata['retail_readys'] = $this->mc->get_all_retail_ready(); $this->pagedata['statuses'] = $this->mc->get_all_status(); } } edit: i'm exploring...

java - Print forward sequencing followed by backward sequencing till the beginning? -

i have interesting problem solve have given start , end integer values , need print start end , end start using recursion. for example - start = 2 , end = 5 method should print following, 2,3,4,5,4,3,2 i can first part using code, public static void countup(int start, int end) { system.out.println(start); if(start< end){ countup(start+1, end); } } but, start value increased within recursion , don't have way find decrease. how can improve code mentioning 1 method allowed use ? currently, it's printing 2,3,4,5 // don't care commas countup(start+1, end); doesn't increase start - computes start+1 , passes result new invocation of countup , have its own value of start . inside current invocation, start still has same value. after recursive call has completed, control return current invocation , continue after call. happens if print start @ end of method?

mySQL MAX() working from phpmyadmin but not from php script? -

edit: solved - usual, error code unrelated suspect code. using variable in place of table_name , getting switched wrong table prior running query. for interested, of proposed solutions, original code, posted below, working me. help! sorry idiocy. original post: have strange error occurring. i trying maximum value mysql database column php script using following code: $q = "select max(item_id) maxid table_name"; $q = mysql_query($q); while($row=mysql_fetch_assoc($q)){ $maxitemnum = $row['maxid']; } echo $maxitemnum; however, $maxitemnum gets echoed count of table rows rather maximum value 'item_id' column. the strange thing is, when run following command via phpmyadmin, proper result (225): select max(item_id) table_name any ideas issue? i'm stumped... echo $maxitemnum = mysql_result(mysql_query("select max(item_id) maxid table_name limit 1"),0); one line good! @ least (:

javascript - Tell if string is pixels or percent then divide by two -

so have function allow user define custom width either pixels or percents. the problem need half of number provide. here example of trying do: user enters----------expected result 50% 25% 300px 150px any appreciated! this works, although should validate input first. parseint(str) / 2 + str.match(/(%|px)$/)[0] without validation, throws error if input doesn't end in % or px (can't null[0] ). if instead want have missing or unrecognized units treated % default, this: parseint(str) / 2 + (str.match(/(%|px)$/)||["%"])[0]

actionscript 3 - AS3 - Flash CS6 - Loading three Interactive swf files from a single swf one by one. third one loads but doesn't play -

hi loading 3 swf's loader file. each 1 loaded on different scene. there's switchboard scene moves user relevant scene file loaded as3 code below. var swf3:movieclip; var sim3:loader = new loader(); this.addchild(sim3); sim3.load(new urlrequest("sim12.swf")) // add instance display list, adding stage @ 0,0 sim3.x = 0;// move loaded swf 0 pixels right (from left edge) sim3.y = 0; each swf closes calling function in loader file described distinctively each scene; removechild(sim3); sim3.unloadandstop(); sim3 = null; swf3=null; and move next scene following statement this.nextscene(); now problem is, files open correctly switchboard when user select first time, , same happen second time third time no matter whatever file user opt open, loads child swf file 1st page moves 2nd click button. click button doesn't work keep clicking on , doesn't work. can help??? switchboard code: var progressgrid:datagrid = new datagrid; progressgri...

c# - Master Detail MVVM with Prism and XAML binding view in data context -

i have following dummy application i'm trying build master detail 2 views. first collection view, can select element of , displays in content presenter data template textblock , textbox defined below. i have tried move textblock , textbox out view, have been unsuccessful @ getting display data. if remove tbs , uncomment view, display view tbs in view won't populate. of course, idea have more 1 type. mainwindow <window x:class="myapp.views.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:views="clr-namespace:myapp.views" mc:ignorable="d" xmlns:prism="http://prismlibrary.com/" xmlns:viewmodel="clr-namespace:myapp.viewmodels" ...

ide - "Copy files from source folder to another location" in PhpStorm -

in netbeans ide, project, have option check "copy files source folder location", copies files working directory directory every time make change in working copy. use feature, because have other directory synced google drive, updates testing server when make changes. now trying switch phpstorm netbeans, cannot find such option in phpstorm. can me, how can achieve same in phpstorm? it can done using deployment functionality. settings/preferences | build, execution, deployment | deployment create new entry of local or shared folder type configure (all tabs) mark default project enable automatic deployment in deployment | options (look upload changed files automatically setting) .. or use upload or synchronize with... actions manually more in these official manuals (with video , pictures).

C# OpenFileDialog not opening file -

i'm trying use openfiledialog open bitmap image , place on form. form construtor... public form1() { initializecomponent(); drawing = new bitmap(drawingpanel.width, drawingpanel.height, drawingpanel.creategraphics()); graphics.fromimage(drawing).clear(color.white); // set default value line thickness tbthickness.text = "5"; } ... opens new form blank screen, , can draw on using mouse , various color selector buttons. save file method: private void btnsave_click(object sender, eventargs e) { // save drawing if (file == null) // file fileinfo object want use // check see if file exists // haven't worked out yet { drawing.save("test.bmp"); //savebitmap saveform = new savebitmap(); //saveform.show(); } else { drawing.save(fi.fullname); }...

What is the preferred method of localization in Zend 2? -

i looking tutorial on preferred method of handling localization in zend 2, far haven't been able find any. best find this page , doesn't explain practical process of implementing localization (specifically, application messages) in detail, or this question , asked before release of zend 2 , outdated. if given choice presented on page, pick gnu gettext translation format. there tutorial on localizing zf2 application in case? or, store text of pages on site in database table, example create table `page` ( `id` int(11) not null auto_increment, `title` varchar(255) default null, `body` blob, `locale` int(11) not null, `creator` int(11) not null, `created` datetime not null, `modified` datetime not null, primary key (`id`), key `pagecreatorfk_idx` (`creator`), constraint `pagecreatorfk` foreign key (`creator`) references `user` (`id`) on delete no action on update no action ) engine=innodb auto_increment=5 default charset=utf8 how go providing localized mes...

php - Error while importing posts in wordpress from one host to another -

Image
i importing wordpress posts 1 host another.. while doing it,(i done few times in different projects) have error (image_attached) , 260 of 900 posts imported. while giving ok in assign author stated one, while contacting admin of host, states wordpress error, not host error, knows how solve error. relevant ideas welcome?

aggregation framework - Mongodb group and sort by date from subdocument -

i have following mongodb documents { "_id" : isodate("2016-01-04t23:00:11.000+0000"), "value" : { "hour" : isodate("2016-01-04t23:00:00.000+0000"), "day" : isodate("2016-01-04t00:00:00.000+0000"), "time" : isodate("2016-01-04t23:00:11.000+0000"), "day_chan1" : 90.162, "day_chan2" : 77.547, "day_chan3" : 79.32, "total_day_chan" : 247.029 } } { "_id" : isodate("2016-01-04t23:00:23.000+0000"), "value" : { "hour" : isodate("2016-01-04t23:00:00.000+0000"), "day" : isodate("2016-01-04t00:00:00.000+0000"), "time" : isodate("2016-01-04t23:00:23.000+0000"), "day_chan1" : 90.167, "day_chan2" : 77.549, "day_chan3...

How can I call a web applet method via JMeter -

i have java web applet tries connect hardware token through pkcs#11 , sign string. when web page loaded sign applet loaded either. when dialog comes in web form, user should insert hardware token's password , after clicking sign button, web form call applet's sign method , sign sending string via certificate on token. note these steps executing on dialog without sending request server, jmeter can not sense happening until signed text sending through request server save in db. (the signed string different each time , it's based on different id existed on field of web form) the problem how can call applet's sign method jmeter because signed string based on id, different in load test either. jmeter should not send static signed string in each load , should sign different string every thread. i tried copy applet's jar file in lib folder of jmeter , call sign method via bsf sampler pkcs#11 exception in line used doprivilaged in applet's code. is there ...

php - I keep having this error when i run my page. can someone help me with this.(sqlsrv_fetch_array() expects parameter 1 to be resource, boolean given ) -

i keep having error when run page. can me this. (sqlsrv_fetch_array() expects parameter 1 resource, boolean given $sql = "select * adminiptable (adminipaddress=? , adminname !=?) "; // run query $result = sqlsrv_query($conn, $sql); if($row = sqlsrv_fetch_array( $result, sqlsrv_fetch_assoc)) { ?> <div class="container"> <div class="row"> <div class=" col-md-12 col-lg-12 col-sm-12 col-lg-12"> <div class="form-horizontal"> <fieldset> <legend>edit ip address</legend> <p id="error"></p> <div class="form-group"> <label for="inputname" class="col-l...

How to get the app port when launching an app in Deis? -

i'm using dockerfile deploy app. have expose directive port 4432. when deploy using git push deis master or deis pull my-docker-image days returns success message showing domain name app ( deis logs shows service running fine). however, when use domain name , navigate valid path browser seems hang. i read here deis uses -p behind scenes, question is how port on app running? it turns out deis automagically maps port 80, wasn't working me unrelated reasons (bug somewhere else)

Error when attempting to integrate with eclipse after adding spock grails plugin to project -

after adding buildconfig grails 2.0.4 project: test ":spock:0.7" in plugins { } section per plugin documentation wanted update eclipse project include spock libraries create test ran grails integrate-with --eclipse but greeted | error error executing script integratewith: spock compiler plugin not run because spock 0.5.0-groovy-1.7 not compatible groovy 1.8.6. more information, see http://versioninfo.spockframework.org spock location: file:/c:/users/fgg/.grails/ivy-cache/org.spockframework/spock-core/jars/spock-core-0.5-groovy-1.7.jar groovy location: file:/c:/tools/grails-2.0.4/lib/org.codehaus.groovy/groovy-all/jars/groovy-all-1.8.6.jar (use --stacktrace see full trace) i ended running fix it: grails clean then ran this: grails --refresh-dependencies integrate-with --eclipse got result: | loading grails 2.0.4 | created eclipse project files..

django - Apache mod_wsgi uses different version of python than which mentioned in python-path and WSGIPythonHome -

there lot of similar questions, have gone through , none of fixed issue. have configured httpd in centos 6 run django mod_wsgi. since dist python version 2.6, compiled , installed python2.7 (ucs2, shared-lib). created virtulenv virtualenv -p /usr/local/bin/python2.7 under /var/www/uatenv <virtualhost *:8080> alias /static/ /var/www/uatenv/my_app/static/ wsgidaemonprocess rbuat python-path=/var/www/my_app/core:/var/www/uatenv/lib/python2.7/site-packages wsgiprocessgroup rbuat wsgiscriptalias / /var/www/uatenv/my_app/core/wsgi.py </virtualhost> but server thrown 500 error , using different version of python more details added couple of lines in wsgi.py below import sys print sys.version print sys.executable print sys.maxunicode print sys.prefix after restarting server got below details logs [notice] apache/2.2.15 (unix) dav/2 mod_wsgi/4.4.21 python/2.7.10 mod_perl/2.0.4 perl/v5.10.1 configured -- resuming normal operations [error] 2.7.10 (defau...