Posts

Showing posts from June, 2014

javascript - D3.js: Stop transitions being interrupted? -

i'm working d3.js. i've got transitions working nicely, have 1 problem: if second transition starts before first 1 ends, this jsfiddle demonstrating problem: http://jsfiddle.net/kqxhj/11/ it works fine of time - cdg , lax appended , removed data changes - if click button twice in rapid succession, you'll notice new elements don't appear. this meat of code: function update(data) { var g = vis.selectall("g.airport").data(data, function(d) { return d.name; }); var genter = g.enter().append("g") .attr("class", function(d) { return "airport " + d.name; }); // perform various updates , transitions... [...] // remove exited elements. g.exit().transition() .duration(1000) .attr("transform", "translate(0," + 1.5*h + ")"); g.exit().transition().delay(1000) .remove(); } d3.select('#clickme').on("click", function() { update(curr

ios - UIImageView touch handling -

i have image view background image. seeking in place on image view touches enabled. started this: - (id)initwithtouchpoint:(cgrect )point { self = [super init]; if (self) { touchframe = point; [self setaccessibilityframe:touchframe]; } return self; } /* // override drawrect: if perform custom drawing. // empty implementation adversely affects performance during animation. - (void)drawrect:(cgrect)rect { // drawing code } */ -(bool)canresignfirstresponder{ return yes; } -(void)touchesbegan:(nsset *)touches withevent:(uievent *)event{ uitouch *touch = [[event alltouches] anyobject]; cgpoint touchlocation = [touch locationinview:self]; if (cgrectcontainspoint(touchframe, touchlocation)) { //[self setuserinteractionenabled:no]; }else{ //[self setuserinteractionenabled:yes]; } dlog(@"touchesbegan @ x : %f y : %f",touchlocation.x,touchlocation.y); } -(void)touchesmoved:(nsset *)touches wit

delphi - ssl httpserver throwing 'Access violation at address 00000000. Read of address 00000000' error -

this code throwing 'access violation @ address 00000000. read of address 00000000' error in runtime. i'm trying server accept ssl requests having real trouble. i have ssleay32.dll & libeay32.dll saved in debug folder. appreciated: serveriohandler := tidserveriohandlersslopenssl.create; serveriohandler.ssloptions.method := sslvsslv23; serveriohandler.ssloptions.mode := sslmclient; serveriohandler.ssloptions.verifymode := []; serveriohandler.ssloptions.verifydepth := 0; server:=tidhttpserver.create; server.iohandler := serveriohandler; server.defaultport:=port; server.bindings.defaultport:=port; server.onquerysslport(8092, newbool); //this line throws error server.autostartsession:=true; server.oncommandget:=idhttpserver1commandget; server.sessiontimeout:=360; server.active:=true; the reason why error onquerysslport event , haven't assigned handler for. the point of onquerysslport you should write method , assign pro

could not find artifact while running maven build in jenkins -

while building maven application in jenkins following error [error] artifact: com.envoisolutions.sxc:sxc-runtime:jar:0.7.3-osgi has no file. org.apache.maven.artifact.resolver.artifactnotfoundexception: not find artifact com.envoisolutions.sxc:sxc-runtime:jar:0.7.3-osgi in central (http://repo.maven.apache.org/maven2) org.apache.maven.artifact.resolver.artifactnotfoundexception: not find artifact xpp3:xpp3_min:jar:1.1.3.4.o-osgi in central (http://repo.maven.apache.org/maven2) try downloading file manually project website. then, install using command: mvn install:install-file -dgroupid=xpp3 -dartifactid=xpp3_min -dversion=1.1.3.4.o-osgi -dpackaging=jar -dfile=/path/to/file alternatively, if host own repository can deploy file there: mvn deploy:deploy-file -dgroupid=xpp3 -dartifactid=xpp3_min -dversion=1.1.3.4.o-osgi -dpackaging=jar -dfile=/path/to/file -durl=[url] -drepositoryid=[id] xpp3:xpp3_min:jar:1.1.3.4.o-osgi specified remote repositories: central

LinkedIn API using asp.NET -

i'm making social platform university in asp.net. need integrate linkedin api in site fetch profiles, current work , other relevant information. profiles should of people associated university. don't know how use/integrate linkedin api. have read https://developer.linkedin.com/documents/profile-api , http://developer.linkedin.com/documents/linkedin-api-resource-map not understand how use it. please guide me how use/integrate it.

asp.net - How can I count number of data members at runtime in C#? -

this question has answer here: how list of properties of class? 9 answers i have following class in c#. how can count number of data members @ runtime? public static class abc { public static string a; public static string b; public static string c; } bascially, have iterate each datamember , pass function 1 one assign value. thats why need this. if not possible, there other way same here 1 way it: var count = typeof(abc).getfields().length; each element of array returned getfields corresponds data member. in addition getting count, can further examine each field - name, check type , on. can use fieldinfo objects and/or set fields of target class. demo on ideone.

audio - Android playing Music in Background -

i have activity code below: public class player extends activity implements oncompletionlistener, onpreparedlistener, onerrorlistener, onbufferingupdatelistener, musicfocusable { private boolean playstate = false; private string station = "http://38.101.19.5:9157"; public static final float duck_volume = 0.1f; private string artistname = null; private string trackname = null; private textview artist; private textview track; private textview status; private button play; enum audiofocus { nofocusnoduck, // don't have audio focus, , can't duck nofocuscanduck, // don't have focus, can play @ low volume // ("ducking") focused // have full audio focus } private audiofocus maudiofocus = audiofocus.nofocusnoduck; private mediaplayer mplayer = null; private androidshoutcastlib shoutcast; private audiomanager maudiomanager; audiofocushelper

InputSplit customization in Hadoop -

i understand in hadoop, large input file splits small files , gets processed in different nodes map functions. got know can customize inputsplit s. know if following type of customization possible inputsplit : i have large input file coming in hadoop, want subset of file, i.e. set of lines in file go along every input split. mean data chunks of large file should contain these set of lines, irrespective of whatever way file split. to make question more clear, if need compare part of input file (say a ) rest of file content, in case inputsplit s going map function need have a part comparison. kindly guide me on this. theoretically possible split big file (a, b, c, d, ...) splits (a, b), (a, c), (a, d), ... . you'd have write lot of custom classes purpose. filesplit , extends inputsplit , says split file begins @ position start , has fixed length . actual access file done recordreader , i.e. linerecordreader . have implement code, read not actual split, header (p

ios - Memory leaks with "weak" and "strong" attributes -

using lrresty api calls on 1 of project work on. have noticed project leaks memory lot, have been given work fix leakage , improve stability of current application. the following scenario: entire project under arc, lrresty non-arc. view controller initialises "customservice" object passes self delegate. customservice object calls lrresty client handles request , returns response. customservice has private property request attribute "weak". the problem is: when run instruments (either on iphone or simulator) leaks detected, in both cases property request attribute "weak" , "strong". request (lrrestyrequest) weak (in case customservice dealloc gets called) otherwise customservice gets caught in retain cycle , dealloc not called. attribute "weak" leak "malloc" , can't identify source, if change attribute "strong" "instruments" shows me leaks @ initwithdelegate:self , [customservice serviceschedul

c# - Do I have to fake a value object in my unit test -

i have written class using tdd containing method (method under test) takes simple value object parameter ( range ). code: the method under test looks this: public list<string> in(irange range) { var result = new list<string>(); (int = range.from; <= range.to; i++) { //... } return result; } furthermore have unit test verify method under test: [testmethod] public void in_simplenumbers_returnsnumbersaslist() { var range = createrange(1, 2); var expected = new list<string>() { "1", "2" }; var result = fizzbuzz.in(range); collectionassert.areequal(expected, result); } private irange createrange(int from, int to) { return new fakes.stubirange() { fromget = () => { return from; }, toget = () => { return to; } }; } question: i have read roy osherove's book on unit testing ("the art of unit testing"). in there says "externa

MySQL INSERT with two different UNIQUE constraints -

i have table created with: create table usersessions ( id integer not null auto_increment, userid varchar(50) not null, starttime timestamp null, endtime timestamp null, primary key (id), index(starttime), index(endtime), unique(userid, starttime), unique(userid, endtime) ); and want know, if inserting row has duplicate key, on constraint duplicate, on starttime or on endtime. know how it? name constraints: create table usersessions ( id integer not null auto_increment, userid varchar(50) not null, starttime timestamp null, endtime timestamp null, primary key (id), index(starttime), index(endtime), unique idxstarttime(userid, starttime), unique idxendtime(userid, endtime) ); when insert fails error state constraint violated: #1062 - duplicate entry 'value' key 'idxstarttime'

How to improve performance with many objects in game in HTML5? -

what things can when it's necessary show many objects , calculate position, collision detection, reaction, etc. , want smoothly? here's example i'm developing. want if have 100 balls on screen, can show them smoothly. don't have idea of how it. every suggestion appreciated. the basic steps improve performance in canvas can seen in html5 rock's canvas performance tutorial . and, if free handle collision detection without box2d, check quad-tree implementation . quad-tree doesn't deals collisions directly can improve performance reducing amount of comparisons needed detect collisions. articles suggestion further reading: broad phase collision detection using spatial partitioning collision detection , response making games box2dweb

html - margin property in a div of another div -

html: div id="wrapper"> <div id="itro"> <ul> <li> <h2> title</h2> <p>this dumy content.this dumy content.this dumy content.this dumy content.this dumy content.this dumy content.this dumy content.this dumy content.this dumy content.this dumy content.this dumy content.this dumy content.this dumy content.this dumy content.this dumy content.this dumy content. </p> </il> <ul> <div id="logo"> <img src="image/bottom_logo.png" alt="logo" width="45" height="50" align="right"> </div> </div> css: #wrapper { width:850px; margin: 0 auto; background: #b3b3b3; } #itro { width:550px; border: 6px solid #000; margin: 0 auto; position: relative; background:#e7e7e7; margin-top:70px; }

php - Need best solution to insert data to remote database -

i developing php application using sql database , both application , database hosted on same server(on client server) . we want keep track of tables of database , purpose had created same tables in our side @ different server(vendor server). what best way insert rows @ remote side tables rows inserted client database tables? note: rows inserted may 50000 or 50 @ time. options in front of me: 1) use 2 connections , insert rows in both database , take time have insert rows in large numbers. 2) using curl request remote database , insert data after rows inserted in local database use mysql built in master/slave setup keep databases in sync each other http://dev.mysql.com/doc/refman/5.0/en/replication.html

How to change removeUrl of Kendo UI upload async in onSuccess? -

i'm using upload async upload files via ajax, , need update removeurl based on idea of uploaded file returns server after insert in database, how can this? seems there no method changing in api documentations, thanks e.sender.options.async.removeurl removeurl is. change whatever suits needs. this function onsuccess(e) { if (e.operation == "upload") { //do stuff, server response in e.response e.sender.options.async.removeurl ="newurl"; } } if you're uploading many files @ once , want set removeurl each 1 different, simplest approach store server response success somewhere, tap remove event , change removeurl there.

javascript - jQuery detect select in radio button -

i want build form radio buttons, need detect if radio has bee selected. it's quite easy function .change. in situation: $('input:radio').change(function() { alert($('[name|="pyt10"]:checked').val() + " / " + $('[name|="pyt11"]:checked').val() + " / "+ }) but here small issue - have 3 groups of radios. when select first radio, alert shows me, fields udefined, after second select first radio has value, second still undefined, , on. it means, alert shows radio value before change, not after. what should write radio value after select ? for immediate problem, "where need detect if radio has bee selected.", can use this: var radios = $('input:radio').on("click", function () { alert(radios.length === radios.filter(":checked").length); }); demo: http://jsfiddle.net/vwrzn/1/

php - inserting csv file with different amount of columns into mysql table -

trying insert data csv file using php command fcsvget mysql table coming short can tell me im going wrong. im getting no data going in , errors when loading page. the csv file has different header names , amount of columns table going into. here code far. <?php // set local variables $connect = mysql_connect("localhost","db","password") or die('could not connect: ' . mysql_error()); $handle = fopen("test.csv", "r"); // connect mysql , select database or exit mysql_select_db("db", $connect); // loop content of csv file, using comma delimiter while (($data = fgetcsv($handle, 1000, ",")) !== false) { $product_id = $data[0]; $model = $data[1]; // entry insert $query = "insert products_test (products_id, products_model) values '$product_id', $model"; mysql_query($query); if (mysql_affected_rows() <= 0) { // no rows affected update query } } else { // entry doesn't ex

sql - Using comboboxes for choises VB -

i have created own database , want data appear in comboboxes. combobox selections shall guiding towards final value. so manage populate first combobox using click assignments in visual studios. however, need populate second combobox using choice of first combobox filter. i'm new in vb , guided visual studios, feel don't find population of first combobox takes place. there's piece of code saying me.table1bindingsource.datamember = "table1" me.table1bindingsource.datasource = me.databasdataset me.table1tableadapter.fill(me.databasdataset.table1) me.combobox1.datasource = me.table1bindingsource me.combobox1.displaymember = "production technology" me.combobox1.formattingenabled = true me.combobox1.location = new system.drawing.point(265, 67) me.combobox1.name = "combobox1" me.combobox1.size = new system.drawing.size(317, 21) me.combobox1.tabindex = 29 me.combobox1.valuemember = "production

Scala API design for Java compatibility -

suppose have following scala api, plan call both scala , java: sealed abstract class interpmethod case object interplinear extends interpmethod case object interpnearest extends interpmethod case object interpspline extends interpmethod class interpolator { def interp(method: interpmethod) = method match { case interplinear => { ... } case interpnearest => { ... } case interpspline => { ... } } } object interpolator { def apply() = new interpolator } // scala usage: import mypackage._ interpolator.interp(interpnearest) // java usage: import mypackage.* interpolator myinterp = new interpolator() myinterp.interp(interpnearest) works great in scala. java throws compile error: interpnearest cannot resolved variable is there easy fix? or better way of defining parameters more java friendly? better define parameters closures? any best practices or workarounds appreciated. intended part of larger fluent interface . key criteria needs usable , clean i

algorithm - Converting spectral data for given Observer/Illuminant to another Observer/Illuminant -

i'm working on simple measuring software hunterlab (color) instruments (ez line) (screenshot here) , hope can out here. they deliver spectral data 400nm...700nm 10nm using d65 light source , 10° observer. i have observer functions astm d65 work great , can reproduce value instrument 1:1, long measure in d65, 10° (converting xyz , cielab using tristimulus references perfect reflecting diffuser). that done using algorithms brucelindbloom.com , easyrgb.com, both have great information! now want add ability convert spectral data observer or illuminant (or both). cant wrap head around how that. i guess directions enough dont know if need more references (references illuminants wavelength?) or if done other means. ok, here answer :) spectral data spectrophotometers corrected in far hardware illuminant , angle dont matter. what use observer functions every single angle/illuminant, written in astm e308, convert spectral data xyz instead of using table correspond

jquery - passing var with quote from parent to child in javascript -

i try differents ways of passing variables parent child jquery , ve got issues text containing quote: in child popup create html element embedding javascript calling method parent, 1 of variable (label) string can contains quote, if try display content on parent page, string cut after first quote. .data( "ui-autocomplete" )._renderitem = function( ul, item ) { $('#grille_table').append( "<tr><td><img onclick=parent.updatefunction('"+ item.id +"',this.title,this.src); src=/uploads/media/source/"+ item.image +" width=100 height=100 title='"+ item.label +"' />"+ item.label +"" ); how can achieve ? thx i think mean .data( "ui-autocomplete" )._renderitem = function( ul, item ) { $('#grille_table').append( '<tr><td><img onclick="parent.updatefunction(\''+ item.id + '\',this.title,this.src);" sr

broadcastreceiver - Is there Pause action For Download Manager in Android? -

i'm using download manager class in android download files . class can add , remove request of downloading . is there way pause specific download resume ? or there way ? edit: found way, it's working: when pause downloading process, close file wrote on. when resume downloading, access file (not completed) , size add downloaded bytes info header of httprequest : mhttprequset.setheader("range", "bytes=" + mpreviouslydownloadedbytes + "-"); mhttpclient.execute(mhttprequset);

gorm - Grails - find where date ranges overlap -

i have grails domain object startdate , enddate property. what's best way find objects range [startdate, enddate] overlaps specified date range? know how in sql wonder if there's grails/gorm magic more succinctly. also, enddate optional property. the sql / jpql query from myobject obj obj.startdate <= ?1 , (obj.enddate null or obj.enddate >= ?2) two ways embrace grails/gorm in case: lazy:- def today = new date() def query = myobject.where { startdate <= (today - 10) && (enddate == null || enddate >= today + 10) } def listofmyobjects = query.list() eager:- def today = new date() def listofmyobjects = myobject.findall {//or find{} if need first occurance startdate <= (today - 10) && (enddate == null || enddate >= today + 10) }

How to properly truncate a float/decimal to a specific place after the decimal in python? -

in python 2.7.3, current behavior: >>> 8./9. 0.8888888888888888 >>> '%.1f' % (8./9.) '0.9' same appears true decimal s: >>> decimal import decimal >>> decimal(8) / decimal(9) decimal('0.8888888888888888888888888889') >>> '%.1f' % (decimal(8) / decimal(9)) '0.9' i have expected truncation, however, appears round. options truncating tenths place? fyi ask because current solution seems hacky (but maybe best practice?) make string of result, finds period , finds x digits after period want. so options truncating tenths place? the decimal.quantize() method rounds number fixed exponent , provides control on rounding mode: >>> decimal import decimal, round_floor >>> decimal('0.9876').quantize(decimal('0.1'), rounding=round_floor) decimal('0.9') don't use math.floor on decimal values because first coerces them binary float introd

Loading google maps asynchronously -

i trying load google map asynchronously , works loading map in twice. if remove " box.onload = initialize; " stops problem infobox doesn't show...how fix code loads map once , shows infobox. function loadscript() { var map = document.createelement('script'); map.type = 'text/javascript'; map.src = 'https://maps.googleapis.com/maps/api/js?key=key_goes_here&sensor=false&callback=initialize'; document.body.appendchild(map); map.onload = function() { var box = document.createelement('script'); box.type = 'text/javascript'; box.src = 'https://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/src/infobox_packed.js'; document.body.appendchild(box); box.onload = initialize; }; } window.onload = loadscript; the map appears twice because you're calling initialize twice. before fixing that, let's simplify code bit. never let re

ios - NSDateFormatter cant parse German date -

i try make nsdateformatter set locale german, fails. in code below, while datefrom parsed, dateto not. note: in german februar, not february. nslocale *germanlocale = [[nslocale alloc] initwithlocaleidentifier:@"de_de"]; nsstring *formatstring = [nsdateformatter dateformatfromtemplate:@"dd. mmmm" options:0 locale:germanlocale]; nsdateformatter *dateformat = [[nsdateformatter alloc] init]; [dateformat setdateformat:formatstring]; nsdate *datefrom = [dateformat datefromstring:@"20. september"]; nsdate *dateto = [dateformat datefromstring:@"20. februar"]; try setting locale of nsdateformatter: nsdateformatter *dateformat = [[nsdateformatter alloc] init]; dateformat.locale = germanlocale; [dateformat setdateformat:@"dd. mmmm"]; nsdate *datefrom = [dateformat datefromstring:@"20. september"]; nsdate *dateto = [dateformat datefromstring:@"20. f

c# - WPF change text property on TextBlock in ControlTemplate -

i have tabcontrol , have plan generate dynamicaly tabitems , fill controltemplate. controltemplate: <window.resources> <controltemplate x:key="qtemp" targettype="control"> <controltemplate.resources> <controltemplate x:key="yesbutton" targettype="{x:type button}"> <grid> <image visibility="visible" name="normal" source="/tabitemtemplate;component/images/yes.png" /> <image visibility="hidden" name="pressed" source="/tabitemtemplate;component/images/yes_p.png" /> </grid> <controltemplate.triggers> <trigger property="button.ispressed" value="true"> <setter targetname="normal" property="visibility" value="hidden"/>

WPF bind datagrid with xml returned in web response -

i getting xml of format in response web request, unable bind whit data drid in wpf. here xml : <population> <name>tram, joshua </name> <id>83804</id> <hcp>dr. krueger</hcp> <symptoms>4</symptoms> <range>1/17/13 - 4/13/13</range> <last7>5</last7> <connect>41380</connect> <engage>5</engage> <daysin>160</daysin> <education>0.67</education> <recco>encourage education</recco> <name>riess, chuck </name> <id>73403</id> <hcp>dr. vockell</hcp> <symptoms>4</symptoms> <range>2/1/13 - 2/14/13</range> <last7>5</last7> <connect>41332</connect> <engage>5</engage> <daysin>179</daysin> <education>0.74</education> <recco>encourage tracking</recco> <name>park, teruyuki </name&

autocomplete - Modify auto_match of quotes, adding an additional quoting character to Sublime Text 2 -

sublime text 2 helpfully closes of quotes. possible modify characters with? for example, if add `backticks` list. @skuroda's answer works great. on mac osx, go sublime text 2 > preferences > key bindings - user and paste in text there. make sure wrapped in [...] (square brackets). the auto pairing few specialized keybindings. should allow auto pair backticks. should serve guide if want create other auto paired symbols. { "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`$0`"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "oper

ruby on rails - How can you override the activerecord has_many assoication build method? -

i override build method of has_many assoication. class otherthings < activerecord::base belongs_to :my_model end class mymodel < activerecord::base has_many :other_things end such that m = mymodel.create m.other_things.build # i'd add additional logic within build method... i have gone updating new method of otherthings, getting little messy. i'd logic happen when being associated hence build... im unsure of trying build. if trying add more methods attach .whatever_method end. also, models associated.

ember.js - some help on Em.Route#send? -

i trying implement router events , using send function of router trigger events on router. couldn't documentation on this. trying implement raising event controller/view data server. , events asynchronously fetches data server , when data has been fetched wanted initialize child view of view called event i.e. need know when data has been fetched. don't think events on router returns such can know when call has been over. like: view: em.view.extend({ click: function(){ var recordspromise = this.get('controller.target').send('getrecords'); recordspromise.done(this.initiateprotocol); }, showchild: false, initiateprotocol: function(){ //this showchild used condition in template show/hide // childview. , being set after call completed // //here childoneview present other js file , fetched using requirejs require(['childoneview'], $.proxy(function(childoneview){ this.set('ch

javascript - Detecting if period exists in a string -

i apologize if seems dumb question, how go searching string see if contains period? i've tried searching: var p="this text without period, now?" alert(p.search(".")); i under impression should return -1 because there no period in sentence. however, returns 0. am missing something? there's many ways this, use indexof() see if character exists in string : alert( p.indexof(".") != -1 ); // true or false according mdn, search() "executes search match between regular expression , string object.", : alert( p.search(/\./) ); which give -1 , , period has special meaning in regex, , must escaped.

Detecting cycle maxima (peaks) in noisy time series (In R?) -

Image
this question algorithm determining number , location of maxima in sequence of numbers. thus, there statistical flavor question, more leaning towards programming, because not interested in specific statistical properties, , solution needs in r. use of statistics answer question ok, not requirement. i want extract maxima of cycles in time series data (i.e., ordered sequence of numbers). example of such data solar flare time series (~11 year cycle, between 9 & 14 years). cycles don't repeat @ perfect interval, , peaks aren't same height. i found recent paper describing algorithm this, , paper uses solar flares example (figure 5, scholkmann et al. 2012, algorithms). hoping algorithm, or equally effective algorithm, available r package. link scholkmann paper on "automatic multiscale-based peak detection" http://www.mdpi.com/1999-4893/5/4/588 i've tried "turningpoints" function in "pastecs" package seemed sensitive (i.e., detected m

How to set font of all fields in a crystal report file non-programatically? -

i have couple of crystal report files , fonts fields arial , want change them times new roman. tried selecting when can't set font. is there anyway set fields in report font ui? using crystal reports xi release 2 if select fields cr disable options font toolbar. can still change fields' fonts, though. select reports objects that have text (this not work if select, say, line object along them). right-click objects → "format objects" → "font" tab. all of font options should available there.

ruby on rails - Slash in branch name in Gemfile causing error -

i have in gemfile (using branch slash): gem 'ice_cube', github: 'seejohnrun/ice_cube', branch: 'issues/50-from_ical' which produces error: $ bundle updating git://github.com/seejohnrun/ice_cube.git fatal: ambiguous argument 'issues/50-from_ical': unknown revision or path not in working tree. use '--' separate paths revisions, this: 'git <command> [<revision>...] -- [<file>...]' git error: command `git rev-parse issues/50-from_ical` in directory /users/jp/.rvm/gems/ruby-2.0.0-p0@example/cache/bundler/git/ice_cube-63812451ddbe2391df352dbcaee4a6cf04a9f746 has failed. if error persists try removing cache directory '/users/jp/.rvm/gems/ruby-2.0.0-p0@example/cache/bundler/git/ice_cube-63812451ddbe2391df352dbcaee4a6cf04a9f746' other branches (without slashes) work. know how around this? thanks! are sure issue / ? checked referenced repo , there no public branch issues/50-from_ical . i believe pro

java - Selenium WebDriver -- How can I know a certain line has executed successfully? -

i testing web application , sample test case has 3 steps: enter username enter password click 'login' driver.findelement(by.id("username")).sendkeys(username); driver.findelement(by.id("password")).sendkeys(password); driver.findelement(by.id("loginbutton")).click(); i need generate report specifies steps passed , failed. there mechanism can know each of lines executed successfully? selenium have kind of inbuilt activity/event listener? if want log basic steps click, navigate, on find element, etc i recommend add event listener. can use class eventfiringwebdriver. an example: eventfiringwebdriver events = new eventfiringwebdriver(this._driver); events.navigated += new eventhandler<webdrivernavigationeventargs>(eventafternavigate); and can define event handler as private void eventafternavigate(object sender, webdrivernavigationeventargs e) { log("url visited: " + e.driver.url); // call favour

java - Using an @Autowired resource with "try with resource" -

given following: public class resourceone implements autocloseable {...} with instance of resourceone instantiated in (spring) xml config. how should object (when autowired) used "try-with-resources statement", since required instantiate resource in try block? one approach use reference (see below), isn't optimal. public class test { @autowired resourceone test; //... public void execute() { //... try (resourceone localtest = test) { localtest.init() localtest.readline(); //... } } afaik think approach have taken seems way. try (resourceone localtest = test) { localtest.init() localtest.readline(); //... } i assuming have autowired resource declared prototype scope though right. @bean @scope(value="prototype", proxymode=scopedproxymode.default) public resource1 resource1() { return new resource1(); }

Commands and MVVM principles - RelayCommands -

i'm new @ c#, wpf , mvvm pattern. sorry quite long post, trying set points of understanding (or non understanding). after studying lot of texts on commanding mechanism provided wpf , mvvm pattern, have few problems getting mind straight on how use these things. i understand commands provided wpf allows define multiple "calling points" command logic held in component of visual tree. when command called, call bubbles through visual tree (starting @ command target or focused element) until bumps element holding commandbinding defines command logic. what seems nice can define public commands without specifying either logic nor calling points @ first. i understand following mvvm pattern, viewmodel of view should handle logic whereas base wpf implemtentation of commands allows visual elements handle because call bubbles through visual tree. i found custom implementations such josh smith's relaycommand can used in case, bind command called element of view (but

java - HttpConnection failing on .connect() for image URL -

i'm trying retrieve tweet information search query android application. i'm able put username , subject in listview, have trouble grabbing photo. here getview method adapter @override public view getview(int position, view convertview, viewgroup parent) { view v = convertview; if (v == null) { layoutinflater vi = (layoutinflater)getsystemservice(context.layout_inflater_service); v = vi.inflate(r.layout.listitem, null); } userrecord user = users.get(position); if (user != null) { textview username = (textview) v.findviewbyid(r.id.username); textview subject = (textview) v.findviewbyid(r.id.subject); // bitmap bitmap = downloadimage(user.imageurl); imageview img = (imageview) v.findviewbyid(r.id.avatar); if (username != null) { username.settext(user.username); } if(subject != null) { subject.s

sql server - C# Nested transaction in a loop, but rolling back if any of them fail -

the issue i'm trying solve follows: i have process ingests data file , inserts things in multiple tables, done 1 transaction, large data sets rollback or commit time out , fail, no matter set time out (at least far attempts have shown me). decided need rewrite functionality "chop" task up. stands pseudo code current code looks (pseudo code used avoid unnecessary information) variable = functionthatreadsfromafile(); itransactionmanager transactionobject = new transactionmanager(); idbtransaction dbtransaction = transactionobject.get(); writetofirsttable(variable ,dbtransaction); writetosecondtable(variable ,dbtransaction); writetothirdtable(variable ,dbtransaction); if(!error) transactionobject.commit(dbtransaction); else transactionobject.rollback(dbtransaction); like said, works fine smaller data sets, when file has more particular amount of rows (dependent on time out) fails on commit or rollback. i can't change time out 10,000 seconds example, in fac

git - Recovering Lost Commits After Push -

i use recovery strategy. somehow ended in position 1 commit dropped 3 days worth of commits. and got pushed . committer isn't sure whether did forced push or what, we're in position. , 10 additional commits have been pushed since "bad" one. all of old commits there , piece together, i'm hoping git can me out. suppose cherry-pick range of commits between point , point b, there better? most, not all, of changes local 1 directory , i'd rather not manually inspect each one. what's right approach here remembering has been pushed upstream? git reset --hard <one commit before bad commit> git cherry-pick <the range of commits you've lost> git pull this way simulate on last commit (with reset ). create new commits locally ( cherry-pick ). pull in changes (and maybe merge conflicts).

html - Registration page. Printing out user errors in php -

i've created registration page whch checks errors , prints them out user. example if not have valid email address says invalid email address. @ top logic done lets webpage know if there errors later can register them without errors. in bottom html trying printout errors show next text field. have created errors reason print before user prints anything. code follows: <form action="" method="post"> <input type="hidden" name="action" value="register" /> <?php if(@$_post['action'] == 'register') { } <input type="text" name="firstname" maxlength = "16" class="text-bars" placeholder="firstname"/> <input type="text" name="lastname" maxlength = "16" class="text-bars" placeholder="lastname"/><b

ruby - How do I write my own loop_until? -

i'm practicing ruby meta-programming , trying write own loop method handle of ugliness in listening socket, give programmer chance specify loop break condition , block of things after each io.select/sleep cycle. what want able write this: x = 1 while_listening_until( x == 0 ) x = rand(10) puts x end what i've been able make work is: def while_listening_until( params, &block ) break_cond = params[ :condition ] || "false" loop { #other listening things happening here yield break if params[:binding].eval( break_cond ) } end x = 1 while_listening_until( :condition => "x==0", :binding => binding() ) x = rand(10) puts x end so, how make eval , binding ugliness go away? this lambdas handy: def while_listening_until( condition, &block ) loop { #other listening things happening here yield break if condition.call } end x = 1 while_listening(lambda{ x == 0 }) x = rand(10) puts x en

javascript - Zepto - Can't cancel link tap on iPad -

i think must missing obvious, can't use preventdefault cancel navigating link's href when link tapped on ipad (it works ok on android phone though). i have simple test page, has on: <a id="mn" href="http://www.google.com">some link</a> <script> document.write('<script src=js/' + ('__proto__' in {} ? 'zepto.min' : 'jquery-1.6.2.min') + '.js><\/script>'); if ('__proto__' in {}) { document.write('<script src=js/touch.js><\/script>'); } $(document).ready( function() { $('#mn').tap(function(e) { e.preventdefault(); e.stoppropagation(); }); } ); </script> the tap event called, if stick alert in there fires ok, action of clicking link never cancelled. missing?! thanks, toby

Regex: Retrieve values from one of the two HTML tags. -

i'm using outwit hub scrape company names website. in pages, html tag this: <p style="font-weight: bold;">company name</p> while in other pages: <span style="font-weight: bold;">company name</span> all pages use 1 of above 2 options, never both. if you're not familiar outwit hub, works asking marker before, , marker after piece of information want. i'm trying create regex retrieve company name, regardless of 1 of markers used whether before or after. so far have tried 'before' tag, doesn't work: /[<p style="font-weight: bold;">]|[<p>name of company: <span style="font-weight: bold;">]/ can help? lose square brackets ( [...] ), these used specify character class or character set , not sequence of characters. /<p style="font-weight: bold;">|<p>name of company: <span style="font-weight: bold;">/ for understandin