Posts

Showing posts from April, 2014

image - Rotating Animation on an Angle -

i wanting have gear image rotate using css3 webkit rotate. have tried multiple avenues of x, y , z individually , collectively, 2d , 3d. assistance appreciated. can see, rotating, not @ angle produce realistic rotation of gear. http://jsfiddle.net/carincamen/3z90g2yr/ #gear07 { position: absolute; left: 40%; margin-top: 30%; width: 100px; height: 100px; background-image: url(http://s18.postimg.org/3uqlngkph/gear_lg.png); transform: rotate(35deg); z-index: 3; -webkit-animation: gear07 2s infinite linear; -moz-animation: gear07 2s infinite linear; -o-animation: gear07 2s infinite linear; -ms-animation: gear07 2s infinite linear; animation: gear07 2s infinite linear; -webkit-transform-origin: 50% 50%; -moz-transform-origin: 50% 50%; -o-transform-origin: 50% 50%; transform-origin: 50% 50%; } @-webkit-keyframes gear07 { 0% { -webkit-transform: rotate3d(0, 0, 1, 0deg); } 100% { -webkit-transform: rotate3d(0,

java - Extraction of subsequences that end with point and space by regular expression -

hy want extract sub sentences of sentence regular expression: it learn od fg network layout. kdsjhuu ddkm networ.12kfdf. learndfefe layout. learn sdffsfsfs. sddsd learn fefe. i couldn't write correct regular expression pattern.compile . this expression: ([^(\\.\\s)]*)([^.]*\\.) actually, need way writing "read everthing except \\.\\s sub sentences: it learn od fg network layout. kdsjhuu ddkm networ.12kfdf. learndfefe layout. learn sdffsfsfs. sddsd learn fefe. just split string regex "\\. " string[] arr= str.split("\\. ");

javascript - Gallery View of Images taken from DB in html -

i have 200 images in list. $rings = $db->query("select * rings id > ". $ringid ." limit 100"); i want display them in gallery form checkbox each. each row must contains atleast 4 images checkboxes. i have tried, making loop adding div adds vertically on ring @ time. how can give sort of gallery look. <div> <?php echo "<table><tr>"; $i =0; foreach( $rings $ring ) { $i++; echo '<td><input type="image" src="http://thevowapp.com/iphoneapp/vowstore/rings/'. $ring['imagepath'] .'" name="checked" value="' . $ring['id'].'" data-my-info=&qu

ruby on rails - How can an engine provide routes to the main app without using the engine's name? -

devise allows app use routes methods new_user_session_path but if create own mountable engine authentication, have use myengine.new_user_session_path when calling in main app. how can use routes urls devise does? could due using normal rails engine vs mountable one? i think there out of box way so. devise uses special stuff that. ' devise_for ' method generates needed routes. path helpers routes (such 'new_user_session_path') defined in devise::controllers::urlhelpers , included actioncontroller::base.

css - Boostrap 3 input with addon and help block -

using bootstrap css 3.3.1, got little problem input addon , block. just see fiddle : https://jsfiddle.net/l8cyqol1/1/ tested on firefox / chrome. markup wrong ? tried "input-group" ... class without success here markup : <div class="form-group"> <label for="title" class="control-label col-md-3">titre de la page</label> <div class="col-md-9 input-group"> <div class="input-group-addon"> @ </div> <input type="text" value="value test" class="form-control input-xxlarge" id="title" name="title" size="46" /> <span class="help-block">help lorem ipsum</span> </div> </div> try this: <div class="form-horizontal"> <div class="form-group"> <label for="title" class=&quo

excel - Array formula to sum the value of each element -

this formula have apply cell in several rows in excel sheet: (this 1 row 20, there 200+ rows) =( z20*z$11*z$9*vlookup(v20,r5:t8,3,false)*x20+ aa20*aa$11*aa$9*vlookup(v20,r5:t8,3,false)*x20+ ab20*ab$11*ab$9*vlookup(v20,r5:t8,3,false)*x20+ ac20*ac$11*ac$9*vlookup(v20,r5:t8,3,false)*x20+ ad20*ad$11*ad$9*vlookup(v20,r5:t8,3,false)*x20+ ae20*ae$11*ae$9*vlookup(v20,r5:t8,3,false)*x20+ af20*af$11*af$9*vlookup(v20,r5:t8,3,false)*x20+ ag20*ag$11*ag$9*vlookup(v20,r5:t8,3,false)*x20+ ah20*ah$11*ah$9*vlookup(v20,r5:t8,3,false)*x20+ ai20*ai$11*ai$9*vlookup(v20,r5:t8,3,false)*x20+ aj20*aj$11*aj$9*vlookup(v20,r5:t8,3,false)*x20+ ak20*ak$11*ak$9*vlookup(v20,r5:t8,3,false)*x20+ al20*al$11*al$9*vlookup(v20,r5:t8,3,false)*x20+ am20*am$11*am$9*vlookup(v20,r5:t8,3,false)*x20+ an20*an$11*an$9*vlookup(v20,r5:t8,3,false)*x20+ ao20*ao$11*ao$9*vlookup(v20,r5:t8,3,false)*x20 )/1000 i tried use array formula make bit neater, e.g. =(z20:ao

c# - The property 'name' is part of the object's key information and cannot be modified. Entity Framework -

i trying update record , error message after context.savechanges(); the property 'name' part of object's key information , cannot modified. here code update function: if (context.eat_sourcenames.any(e => e.name == newsourcename)) { messagebox.show("name exists in database"); } else { var nametoupdate = context.eat_sourcenames.singleordefault(e => e.name == sourcename.name); if (nametoupdate != null) { nametoupdate.name = newsourcename; context.savechanges(); refreshdgvs(); } } my sourcenames class looks following: public eat_sourcenames() { this.eat_sources = new observablelistsource<eat_sources>(); } public string name { get; set; } public string version_id { get; set; } public string allocation_name { get; set; } i searched similar questions, not find working solution. see answer yildizm85 question: entity framework not working on table with

php - Update-ing in to the Database -

this question has answer here: php parse/syntax errors; , how solve them? 12 answers so @ first made formular users enter data in database worked,after have tried make option them able modify data. , have error , several more parse error: syntax error, unexpected '}' in c:\xampp\htdocs\atestat\addate.php on line 131 problem somewhere on else statement(131) <?php include 'ch20_include.php'; dodb(); if (!$_post) { //haven’t seen form, show $display_block = <<<end_of_text <form method=”post” action=”$_server[php_self]”> <fieldset> <legend>first/last names:</legend><br/> <input type=”text” name=”f_name” size=”30” maxlength=”75” required=”required” /> <input type=”text” name=”l_name” size=”30” maxlength=”75” required=”required” /> </fieldset> <p><label for=&

Linux: load module based on another module -

is possible dynamically load (via mod_alias() maybe?) module requires module first loaded? background: have usb->i2c bridge on system, , attached i2c end touchscreen. kernel module brings i2c automatically loads/unloads whenever usb cable connected/disconnected. i'm looking way load/unload touchscreen driver on same events. you're talking module dependencies, generated depmod -a. actual dependency information stored in /lib/modules/version/modules.dep. if /lib/modules/2.6.29/kernel/a.ko depends on b.ko (in same directory) add line: /lib/modules/2.6.29/kernel/a.ko: /lib/modules/2.6.29/kernel/b.ko to create dependency.

eclipse - Can't deploy a jar on Jboss EAP6 with error java.lang.NoClassDefFoundError -

i try deploy maven projet (jar) on jboss eap6 @ every time gives me errors bellow: `17:55:58,212 error [org.jboss.msc.service.fail] (msc service thread 1-2) msc000001: failed start service jboss.deployment.subunit."services-1.0.0.ear"."services-trans-1.0.1.jar".post_module: org.jboss.msc.service.startexception in service jboss.deployment.subunit."services-1.0.0.ear"."services-tran-1.0.1.jar".post_module: jbas018733: n'a pas pu traiter la phase post_module de subdeployment "services-tran-1.0.1.jar" of deployment "services-1.0.0.ear" @ org.jboss.as.server.deployment.deploymentunitphaseservice.start(deploymentunitphaseservice.java:166) [jboss-as-server-7.4.0.final-redhat-19.jar:7.4.0.final-redhat-19] @ org.jboss.msc.service.servicecontrollerimpl$starttask.startservice(servicecontrollerimpl.java:1980) [jboss-msc-1.1.5.final-redhat-1.jar:1.1.5.final-redhat-1] @ org.jboss.msc.service.servicecontrollerimpl$starttask.run(ser

xslt - Use buttons to update XML element styled with XSL -

as newbie xsl, minimal exposure xml, i'm having trouble figuring out how integrate 2 html. i'd use 2 buttons update 2 elements captured in xml document , have update elements displayed using xsl stylesheet. i've provided snippets of code below. xml <best_answer> <head> <title>title text goes here </title> <objective> <goal>goal text goes here</goal> </objective> <settings> <setting type="application">app name</setting> </settings> <verifications> <verification type="helpful">10</verification> <verification type="unhelpful">5</verification> </verifications> </head> </best_answer> xsl <xsl:template match="verifications"> <br></br> <table style="border:1px dashed; align: center; border-spacing: 5px; width: 100%"> <tr colspan="2&

Is it possible to discover which classes are not used in a Ruby on Rails application? -

in our project had "forgotten" classes lying around quite time. those classes substituted other ones forgot delete them. there automated way/tool discover classes not being used in ruby {on rails,} application? thanks ! this question has been made lot of times, best answers compiled in here: find unused code in rails app i, personally, liked log parsing: https://stackoverflow.com/a/14161807 but in case can create own logger extending activerecord::base create observer stores in database used modules. after prudential time, able reverse find models not called once. there other profesional tools (paid) measures app behaviour: http://newrelic.com/ i've used 1 in project , did great working measuring controller usage. might find useful.

Find the median from a CSV File using Python -

i have csv file named 'salaries.csv' content of files follows: city,job,salary delhi,doctors,500 delhi,lawyers,400 delhi,plumbers,100 london,doctors,800 london,lawyers,700 london,plumbers,300 tokyo,doctors,900 tokyo,lawyers,800 tokyo,plumbers,400 lawyers,doctors,300 lawyers,lawyers,400 lawyers,plumbers,500 hong kong,doctors,1800 hong kong,lawyers,1100 hong kong,plumbers,1000 moscow,doctors,300 moscow,lawyers,200 moscow,plumbers,100 berlin,doctors,800 berlin,plumbers,900 paris,doctors,900 paris,lawyers,800 paris,plumbers,500 paris,dog catchers,400 i need print median salary of each profession. tried code, shows error. my code : from stringio import stringio import sqlite3 import csv import operator #from operator import itemgetter, attrgetter data = open('sal.csv', 'r').read() string = ''.join(data) f = stringio(string) reader = csv.reader(f) conn = sqlite3.connect(&#

tomcat - Where are compiled JSP Java (*__jsp.java) files? -

i getting javax.servlet.jsp.jspexception in 1 of jsp files website trying render ( survey.jsp ). however, stack trace not give me the specific line in jsp fails rather line number fails in ( survey_jsp.java:787 ), seems compiled jsp file. find such files, know line throwing exception? thanks edit: these files live in /work directory if using tomcat suggested in comment below. the compiled jsp files default available in /work folder of tomcat environment. there should subfolder catalina in turn has subfolder representing domain name defaults localhost . there in turn should project folder in turn contains package hierarchy org.apache.jsp therein compiled jsp files. tomcat |-- backup |-- bin |-- conf |-- lib |-- logs |-- temp |-- webapps `-- work `-- catalina `-- localhost `-- projectname `-- org `-- apache `-- jsp

node.js - Add a Timestamp to the End of Filenames with Grunt -

during grunt tasks, add unique string end of filenames. have tried grunt-contrib-copy , grunt-filerev . neither have been able need them to... currently less files automatically compiled on 'save' in sublime text 3 (so not yet occur in grunt tasks). then, open terminal , run ' grunt ', concatenates (combines) js files. after done, grunt should rename ' dist/css/main.css ' , ' dist/js/main.js ' "version" @ end of filename. i have tried: grunt-contrib-copy (' clean:expired ' deletes concatenated js before grunt-contrib-copy ' can rename file) grunt-filerev ('this worked on css files reason, , inserted version number before '.css'. not sure why didn't work on js files.') here's gruntfile.js so, clear, not asking "code review" need know how can incorporate "rename" process when tasks complete, have 'dist/css/main.css12345 & dist/js/main.js12345' no 'dist/css

javascript - Get a ID from URL in another Function -

my question simple... see code: my autocomplete: $("#produto").autocomplete({ source: '/pedidoonline/index.php/pedidos/search/' + $('#codigo_fabricante').val(), minlength: 2, focus: function(event, ui) { $("#produto").val(ui.item.label); return false; }, select: function(event, ui) { $('#procura_produto').val(ui.item.id); preencherlinhaproduto(ui.item.id); } }); other function recieves codigo_fabricante: function in controller: public function search() { $this->autorender = false; // consultando pelo que o usuário está digitando $term = $this->request->query ['term']; //this way isn't working, tried ['pass'][0] either. $fabricante = $this->request->params['pass']; echo($fabricante); $this->loadmodel ( 'procuraprodutopedonline' ); $produtos = $this->procuraprodutopedonline->find ( &#

database - Alternative method to save data than my.settings for VB.Net -

i need save approximately 1600 different pieces of information windows forms application. what best way go this? example of user settings measuringitem1name , measuringitem1equation , measuringitem1enabled , measuringitem1offset , measuringitem2name ... i have looked my.settings, however, found tedious , error prone type out every user setting. it seems best solution have type of table can access each individual cell , edit information. does exist? if so, how implemented vb.net ? i'd recommend creating class properties hold settings. mark class serializable. serialize , deserialize instance of class application startup / shutdown user's profile directory. allow have typed settings save separately per user if ever need option. allow set default values settings. you can make "settings" class deep want, properties made of other sub setting classes or lists of settings index. it's powerful pattern. for example: settings.measuringitem(1

ios - Passing a variable with prepareForSegue that exists in another function -

i have function: - (void)requestmewithtoken:(nsstring *)accesstoken { [self.client get:[nsstring stringwithformat:@"https://api.linkedin.com/v1/people/~?oauth2_access_token=%@&format=json", accesstoken] parameters:nil success:^(afhttprequestoperation *operation, nsdictionary *result) { nslog(@"the current user is:%@", result); nsmutabledictionary *newresult = [result mutablecopy]; //copies nsdictionary 'result' nsmutabledictionary called 'newresult' [newresult setobject: [newresult objectforkey: @"id"] forkey: @"appuserid"]; //copies value assigned key 'id', 'appuserid' database can recognize [newresult removeobjectforkey: @"id"]; //removes 'id' key , value nsstring *userid = [newresult objectforkey: @"appuserid"]; //pulls appuserid out nsstring called 'userid' linkedinloginjson *instance=

removeclass - Jquery remove class not working on a bc website -

i trying removeclass.addclass jquery <input class="cat_button botao-verde formulario-rodape" type="submit" value="subscrever" id="catlistbutton" /> <script type="text/javascript"> $("catalistbutton").click(function(){ $(this).removeclass("formulario-rodape").addclass("botaoclique"); }); </script> it not working. adds new class(no shadows) , class removed shadow effect remains in code. see here @ bottom of page on newsletter signup form, green button http://ocozinheiroperfeito.businesscatalyst.com/ your jquery selector incorrect. use $("#catalistbutton") adress id. suggest putting dom manipulating code inside $(document).ready();

javascript - Meteor Router.go not passing params -

snippet of code client-side: template.projecteditbutton.events({ "click .edit": function() { router.go('projectform', {prjid: this._id}); } }); at point, this._id correct. in router file: router.route('/projects/form', { name: 'projectform', data: function() { return projects.findone(this.params.prjid); } }); this.params empty. missing? you need add parameter route definition in order mapping work: router.route('/projects/form/:prjid', { name: 'projectform', data: function() { return projects.findone(this.params.prjid); } });

java - Append text to a TextView datatype -

i'm beginner android/java programmer , background in c++ , c#. in c# if have string variable called myword , has value of "hello" can append additional information using + operator. i tried method few times in java , apparently can't use tatic because textview datatype void. android studio gives me following error: operator '+' cannot applied 'void', 'java.lang.string' /*c # */ public string bob () { return "bob!"; } string myword = "hello "; myword = myword + "bob!"; //myword equal "hello bob!" or myword = "hello " + bob(); //myword equal "hello bob!" */ java */ textview displaytextview = null; displaytextview.settext("hello"); i'd find way append additional text original value of "hello" value of displaytextview "hello bob!" any ideas? edit: i'm using capital "s" , app can access , retrieve information class. app fc

php - Laravel eloquent relationships with foreign keys -

stuck on 1 tonight...so i'm building messaging system comprised of tables seen in schema: http://www.laravelsd.com/share/8nbzmc so user may post job user can send user message regarding job. triggers conversation created, message posted (containing id of user sent it) , 2 user_id's added conversation_user pivot table participants. in terms of relationships job hasmany conversations belongsto user, conversation hasmany messages , belongsto job, messages belongto conversation etc etc etc. my question based on schema, how show total number of messages relate job? i.e. how job id , filter conversations match id , count number of messages against each conversation? straying query builder land opposed eloquent? obvious solution add job_id messages table that's duplication , i'm stubborn :) this should work: $jobid = 1; $count = message::wherehas('conversation.job', function($q) use ($jobid){ $q->where('id', $jobid); })->count();

vlc - Transport stream extract ES video/audio data and play it -

i working on , came point cannot find useful searching on internet further. i wrote descrambler dvbs2 csa, want try real data. have .ts file , have key. want check if code can descramble single frame sufficient me. can es bits following pid software when copy-paste straight forward on file bit after bit, vlc or other player won't play it. what should do?, how can visualize es data? i appreciate if me. i have found out copying , pasting bits straight forward notepad won't work. need write code write file bytes. wrote c code , works. had descramble @ least 2000 packages make playable on ts software.

Protractor/Selenium: run browser in the background -

i'm using protractor testing. 99% of times there's no need see browser, tests take long time, , we're interested in final outcome. there way hide browser opened testing (e.g. run in background)? as stated before, docker-selenium works wonders. browser not supported docker-selenium internet explorer, obvious reasons.

python - ROS frame transformation (camera to base) -

i working baxter robot , trying position of object using augmented reality markers , move hand position in order grasp it. i using ar_tools package position/orientation of object, respect head_camera using. last couple of days i've been experimenting how change reference frame ( head_camera ) base frame frame used moveit make plans. have tried set frame_id of header of message receive ar_tools manually 'base' : pose_target.header.frame_id = 'base' but position , orientation getting still wrt head_camera . tried do: self.tl.lookuptransform("/base", "/head_camera", self.t) where self.t = self.tl.getlatestcommontime("/head_camera", "/base") , getting extrapolation error. the transformation requires extrapolate in past (i can't remember , i'm not in lab.) thought might need run lookuptransform head_cam head , head torso , torso baxter's base . could guide me on how change frame of ma

Confused by ASP.NET Identity and IdentityDbContext -

it's been while since i've done serious work using asp.net authentication , i'm bit rusty. asp.net identity in thing. i'm hoping can explain i'm doing , have tell me why , assumptions wrong or if they're not wrong. the application i'm building going hipaa compliant, , such cannot store identifiable information in database. spent time looking @ how asp.net identity works, noting things applicationuser (which inherits identityuser ), applicationdbcontext (inheriting identitydbcontext ). read couple msdn articles , forth. i noticed identitydbcontext seems tied aspnetusers table in database. noticed concerning me in aspnetusers table since i'm writing application cannot store identifiable: email , phonenumber columns. so wanted remove those. looked under hood bit , saw aspnetusers table mapped dbset property of identitydbcontext (see here ). tuser applicationuser , inherits identityuser . , identityuser has email (see here ). so...after

javascript - Reload page on browser back/forward button in AngularJS with ui router -

i have following config ui router state in angularjs app. $locationprovider.html5mode(true); $stateprovider .state('index', { url: '/index?zoom&center', views: { 'map': { controller: 'mapctrl', templateurl: 'map.html' } }, reloadonsearch:false }); however, forward button in browser go different url, need reload page urls stateparams. for example: user1 go page http://www.example.com/index?zoom=2&center=1,2 . bunch operation in page, url becomes http://www.example.com/index?zoom=12&center=3,4 then presses button, url changes previous one, need reload page let controller read query parameters right thing... any way let work browser back/forward? have tried setting reloadonsearch true? if doesn't suite needs, perhaps check out question: force angularjs reload route altho

Magento: How to Use for Newbs -

i new software. wondering how create/edit/check header, side, , footer link. have noticed far numerous searches requires type of actual manual programming. , if not template, have add through static blocks or edit through .phtml/.php/.xml file have no idea do. assume have latest software. appreciated. you can create shop in english without manual coding @ all. result asked for. hard application without customisations not valid irs-wise(for example, invoices in greece have contain specific things. if not not valid , fined.). header , footer customised static blocks backend of magento without trouble. have search documentation of template ofcourse. there many information , cannot give 1 post. have study , ask right questions!

xamarin.ios - Xamarin - Using Portable Class Libraries a mandatory way to go? -

recently requested setup design new app, needs build using xamarin. team created demo app android, ios , windows phone. demo version needs transformed/refactored proper maintainable product. when looking code implemented in demo app, found out third party libraries used not available pcl. means cannot build app using pcl's unless can port third party library pcl. my findings are: the functionality use third party library works fine on 3 platforms i cannot find blocking reason why should not use normal class libraries questions: are there blocking reasons why cannot make use of normal class libraries? will public apps stores accept these apps or not issue @ all? if not.. can give recommendations take care of going normal class library's if there are.. how can port third party libraries pcl or there other way work around? first: public app stores don't care internals of app, long follows guidelines. , that's xamarin takes care of, droppin

aggregate - Find value relative to mean for particular Day of Year in R -

i'm working meteorology data in r, , conceptually, i'm trying find out how day above/below average. this, want separate day of year, find average doy (e.g. average january 1 temperature?), , compare every date (e.g january 1, 2014 anomalously warm, how much?) i can find 'mean' table every day of year using aggregate: head(data) x date 1 5.072241 1970-01-01 2 6.517069 1970-01-02 3 4.413654 1970-01-03 4 11.129351 1970-01-04 5 9.331630 1970-01-05 library(lubridate) temp = aggregate(data$x, list(yday(data$date)), mean) but i'm stuck how use aggregated table compare original data.frame, see how x @ 1970 jan 1 relates average jan 1 x. we can remove 'year' part sub ('monthday'). use ave if mean variable needs created grouped 'monthday'. data$monthday <- sub('\\d+-', '', data$date) data$mean <- with(data, ave(x, monthday)) then, can compare 'x' variable, example data$rel

angularjs - django webserver on travis for e2e testing -

a quick question django / travis pros. i run e2e tests on travis django/angular app, , connect saucelabs through sauceconnect tunnel. //travis.yml addons: sauce_connect: true postgresql: "9.3" branches: only: - master - integration_env language: python python: - '2.7.9' cache: directories: - $home/virtualenv/python2.7.9/lib/python2.7/site-packages - node_modules - bower_components install: - npm install - pip install -r requirements.txt - pip install coverage -u --force-reinstall - pip install coveralls -u --force-reinstall - node_modules/protractor/bin/webdriver-manager update before_script: - psql -c 'create database travisci;' -u postgres - pg_restore --no-acl --no-owner -h localhost -u postgres -d travisci demodb.dump - python manage.py runserver & script: # - grunt karma:saucetravis - grunt protractor:saucelabs - coverage run --source='.' manage.py test after_success: - grunt coveralls:run - cove

java - Parsing date times in "X minutes/hours/days/weeks/months/years ago" format -

how can parse dates in format x minutes/hours/days/weeks/months/years ago. here examples show i'm referring to: 3 days ago 1 minute ago 2 years ago i don't think is possible default java libraries. right? a little snippet based on calendar api. pattern p = pattern.compile("(\\d+)\\s+(.*?)s? ago"); map<string, integer> fields = new hashmap<string, integer>() {{ put("second", calendar.second); put("minute", calendar.minute); put("hour", calendar.hour); put("day", calendar.date); put("week", calendar.week_of_year); put("month", calendar.month); put("year", calendar.year); }}; string[] tests = { "3 days ago", "1 minute ago", "2 years ago" }; (string test : tests) { matcher m = p.matcher(test); if (m.matches()) { int amount = integer.parseint(m.group(1));

multithreading - ReCreating threads in python -

Image
i'm using following template recreate threads need run infinity. want know if template scalable in terms of memory. threaded destroyed properly? import threading import time class alazythread(threading.thread): def __init__(self): threading.thread.__init__(self) def run(self): time.sleep(10) print "i don not want work :(" class aworkerthread(threading.thread): def __init__(self): threading.thread.__init__(self) def run(self): time.sleep(1) print "i want work!!!!!!!" threada = alazythread() threada.start() threadb = aworkerthread() threadb.start() while true: if not (threada.isalive()): threada = alazythread() threada.start() if not (threadb.isalive()): threadb = aworkerthread() threadb.start() the thing bother me following picture taking in eclipse show debug info, , seems thread stacking it. i see nothing wrong image. there's

I need help for Matlab vectorization of this code -

i new on matlab, don't know proper basics of vectorization.. trying vectorize function. function indc = patchsearch(x, row, col, off, nv, s, i) [n m] = size(i); f2 = size(x,2); rmin = max( row-s, 1 ); rmax = min( row+s, n ); cmin = max( col-s, 1 ); cmax = min( col+s, m ); idx = i(rmin:rmax, cmin:cmax); idx = idx(:); b = x(idx, :); v = x(off, :); dis = (b(:,1) - v(1)).^2; k = 2:f2 dis = dis + (b(:,k) - v(k)).^2; end dis = dis./f2; [val,ind] = sort(dis); indc = idx( ind(1:nv) ); %indc = idx(dis<250); i need experts vectorizating function thanks you can replace following loopy portion of code - dis = (b(:,1) - v(1)).^2; k = 2:f2 dis = dis + (b(:,k) - v(k)).^2; end with bsxfun implementation - dis = sum(bsxfun(@minus,b,v).^2,2); the assumption here f2 number of columns in b , same number of elements in v , looking @ code way b , v initial

git - Keeping github in sync with a different server -

i want use github (enterprise) managing code, issue tracking , on. have requirement need repository on server. there's bunch of posts on mirroring, seem work 1 way (github -> server sync). i'd able push both github and server, , want things in sync. there clean way achieve this?

Python Unittest for method returning json string -

i ma new writing python unit tests. have method in class returning json response api. json response contains attributes such data, token, object name , status. method hits api , returns response different values each time, can't hard code response , test it. how can write unit test type of method. one thing, thought of check whether response not null. there other type of checks can here. each time returns different token, date(timestamp). status same. def json_get_status(self): get_url = "xxxx" #url hit api r = requests.get(get_url) self.get_json = json.loads(r.text) self.get_token=self.get_json["token"] self.get_date=self.get_json["date"] self.get_status=self.get_json["status"] return self.get_json if method under test supposed "read status correctly", might want test that. so assuming app like def read_status(response): parsed = json.loads(response) # other stuff retur

arduino - Stop timer set new value and start again AVR (Interrupt) -

i have avr mcu. playing timer now. need ? have timer counting frequency. in each interrupt incrementing variable, , somewhere need check value of variable , if equals 100, need stop timer count, set new value frequency , continue counting down. cannot how stop timer , set new value compare. have tried select no clock source using mux selector register, continue count up. correct way this. here code // arduino timer ctc interrupt example // www.engblaze.com // avr-libc library includes #include <avr/io.h> #include <avr/interrupt.h> #define ledpin_up 9 #define ledpin_down 8 int current_value = 0; void setup() { serial.begin(9600); // pinmode(ledpin_up, output); // initialize timer1 cli(); // disable global interrupts tccr1a = 0; // set entire tccr1a register 0 tccr1b = 0; // same tccr1b // set compare match register desired timer count: // ocr1a = 3123; ocr1a = 1562; // turn on ctc mode: tccr1b |= (1

javascript - Create HTML and CSS for WPF WebBrowser -

ok, i'm building application similar battle.net's launcher :) tabs multiple applications , have liked add "dynamic content area" post news , stuff. therefore placed webbrowser there, set width , height , proceeded create static html file. i aware wpf's measure unit is not pixel. therefore, when creating css html, multiplied webbrowser's dimensions 1.33 , used html's body width , height. , looked on work monitor. when got home, surprise! apparently monitor works @ higher dpi value, therefore image had there larger browser window, text way big, etc. did try switching em unit, still no luck. so, how can create webpage fit kinds of dpi settings? seeing can't monitor dpi values (not reliably, far have been able read). possible? the other possibility have considered create placeholder image , text (wpf controls is) , populate them server, may want change layout @ point, etc, therefore doesn't me in long run.

nosql - HBase RowKey for Hierarchical data -

i have recommendation on designing hbase table/rowkey efficient search here, sample data set: | column families | column qualifiers | row 1 | row 2 | row 3 | --------------------------------------------------------------------------------------------------------- | country | code | | | uk | | | | full name |united states of america| |united kingdom | | | capital |washington, dc | |london | | | leader | president | president |prime minister | |state | | texas | | | |district | |houston |la | | |county | |harri

VBScript OpenTextFile Invalid Proedure call or argument -

so have read kinds of answers question , have implemented them best of understanding. after defining constants , checking ensure target file exists, still receiving error. has passing of optional parameters opentextfile - code run if pass file path , name. because target file in unicode, however, not work uses. more importantly, understand happening here after spending more few hours trying decipher issue. appreciate offered. thank you. for reference, error receiving is: unhandled exception @ line 17, column 3 in getnewversion.vbs 0x800a0005 - microsoft vbscript runtime error: invalid procedure call or argument option explicit const forreading = 1 const tristatetrue = 1 dim strcomputer, objwmiservice, fso, ts, objshell, stempdir, spid, sfilepath, sfilename, colprocesslist, objprocess,listinfo, lineinfo 'create file system object set fso = createobject("scripting.filesystemobject") 'locate temp directory stempdir = fso.ge

android - How to change the background of the ActionBar? -

already followed several tutorials on subject , beginner'm still problem. manifest: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.universo91.towersrock" > <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:logo="@drawable/ic_launcher" android:largeheap="true" android:label="@string/app_name" android:name=".utils.applicationclass" android:theme="@style/themeoverlay.appcompat.actionbar"> <activity android:name=".pages.mainactivity" android:label="@strin

java - How to run concurrent job with dependent tasks? -

i have situation need work on i have class has send method, example @singleton class sendreport { public void send() {} } the send method called user click on web page, , must return immediately, must start sequence of tasks take time send ->| | |-> task1 <-| | <-| | |-> task2 (can start when task1 completes/throws exception) <-| | |-> task3 (can start when task2 completes/throws exception) <-| i new java concurrent world , reading it. per understanding, need executor service , submit() job( task1 ) process , future continue. am correct? the difficult part me understand , design is - how , handle exceptions such task? - far see, have like? executorservice executorservice = executors.newfixedthreadpool(1); future futuretask1 = executorservice.submit(new callable(){ public object call() throws exception { system.out.println("doing task1"