Posts

Showing posts from February, 2011

Python converting ndarrays into graph -

Image
so i'm working on python program, computes displacement of nodes in given undirected graph via algorithm. output consists of adjacency matrix in form of numpy ndarray , numpy ndarray holding coordinates(2d) of each node. ive been looking ways of plotting resulting graph , stumbled across igraph , networkx. did not use them yet, know can convert adjacency matrix graph, in case not using coordinates though. wonder, how can use both graphical representation of graph? i imagine have use both arrays create different kind of object, can converted networkx/igraph. networkx solution: the draw nx.function : takes in optional second argument of positions: import numpy np import networkx nx import pylab plt = np.array([[0,0,1,0],[1,0,0,0],[1,0,0,1],[1,0,0,0]]) g = nx.digraph(a) pos = [[0,0], [0,1], [1,0], [1,1]] nx.draw(g,pos) plt.show()

python - Database Error at /myapp/ -

i include choice field in model quote_template = models.charfield(_('template'), choices=template, max_length=20) and error coming databaseerror @ /quote/ current transaction aborted, commands ignored until end of transaction block any idea??? how resolve this?? adding fields model not magically update existing database schema - either have , or use schema-migration tool south.

Continuous Integration - how to add a bugfix to a live build? -

we in process of implementing continuous integration in our organisation, , 1 of questions arose how fix bug in live build. do add fix continuous integration branch , release? maintain/create release branch live version , add bugfix that? option 1 seems advocated continuous integration, seems high risk. option 2 has been done historically, , low risk. it depends ! if think bugfix envolving deep changes should create branch on you work, otherwise (and normaly) bugfixes not risky, assumption 1 fixing bug knows doing, can done on head. ps. making branch force merge later can annoying if head gets lot of changes in while implementing bugfix.

javascript - Resizing of iframe with js stops working when https -

what i'm trying resize fancybox iframe , thought succeeded calling: parent.jquery('#fancybox-inner').css({'height': '450px'}); parent.jquery('#fancybox-wrap').css({'height': '550px'}); but when deploying stage area works in https solution doesn't work , guess has https part. tried google didn't find suitable solution. please me , remember i'm js newbie. code: jquery().ready(function() { jquery('#no_user').click(function () { if (jquery(".temp_expand").css("display") == "none") { jquery(".temp_expand").slidedown(); parent.jquery('#fancybox-inner').css({'height': '450px'}); parent.jquery('#fancybox-wrap').css({'height': '550px'}); } else { jquery(".temp_expand").slideup(); jquery(".temp_expand...

raytracing - Ray Tracing vs Radiosity in Graphic -

i had exam , there question couldn't answer..what kind of illumination phenomenon can not implemented using ray tracing(than radiosity used in case) technically, path tracing (which kind of raytracing) implements complete lighting equation. meant indirect lighting, iow. global illumination.

sql - Procedure stops when legacy, new error traps are next to each other -

we have bunch of old stored procedures legacy style error trapping. changed 1 other day , included newer try...catch block. stored procedure stopped after try/catch , returned though there error in legacy block. if put a select null in between 2 works fine. know why happening? --begin new error trap-- begin try stuff... end try begin catch end catch --end new error trap--- ----------------- old school trap begin ----------------- select @sperror = @@error , @sprowcount = @@rowcount set @spreturn = @spreturn + 1 if ( @sprowcount <= 0 or @sperror <> 0 ) set @spreturn = 0 - @spreturn if ( @sprowcount <= 0 or @sperror <> 0 ) return @spreturn select @sprowcount = -1 , @sperror = -1 ------------------ old school error trap end ------------------ in try catch block, last statement doing sets row count 0. "select null" setting row count 1, since returns 1 row, no error detected. you can fix chang...

ruby - GzipReader each_line method missing in Rubinius -

i trying read gzipped file using zlib:gzipreader. works expected using ruby 1.9.3 getting method_missing error each_line when using rubinius. is there way read gzipped file using rubinius? require 'zlib' zlib::gzipreader.open("lines.txt.gz").each_line { |line| puts "#{line}" } kernel(zlib::gzipreader)#each_line (method_missing) @ kernel/delta/kernel.rb:81 i believe bug in rubinius, should consider opening issue project. however, workaround should going: require 'zlib' require 'stringio' file = file.read("lines.txt.gz") lines = zlib::gzipreader.new(stringio.new(file)).read

Rails i18n in one table (CakePHP-like)? -

is there gem stores translations in 1 table cakephp does? the polymorphic cakephp i18n-table has following structure: id locale model foreign_key field content globalize3 i.e. uses new table each model translation find redundant. you can add various backends i18n gem provides internationalization ruby. globalize3 1 option. more lightweight alternative i18n-active_record uses single table similar cakephp example.

Facebook Page Tab App OAuth - test if fresh app install -

i have page tab app. authorization works fine - user clicks authorize button on app, oauth dialog pops up, authorize app, redirects page tab , user goes merry way, using app. i need know 1 thing, , life of me cannot find real answer - possible identify 1 http request occurs after user authorizes app? want log user's data when user authorizes app, without having hit database , test if facebook user id has been logged. you'd think easy... thank time. yes, can of signed_request read here how handle authroization in page tab. simply, when user comes app - check user_id exits in signed request, if not exist, has not authorized. - store variable in session - when user logs in, check whether session variable exists or not. if exists, fresh install.

wine - Program error on source insight using ubuntu -

i using source insight 3.5 on ubuntu 10.10 32bit. reason, while working, program got stuck. closed it, , ever since, when try open it, following error message: program error the program insight3.exe has encountered serious problem , needs close. sorry inconvenience. restarting computer didn't help. uninstalling program , wine , reinstalling them didn't well. still same error message. anyone rescue? thank you. in ubuntu go ~/source insight/ , remove project directory content , setting directory content , open source insight , load existing .pr file.

asp.net mvc 3 - Bind radio button to single model preoperty in MVC3 -

how bind 2 radio buttons single model property in mvc using @html.radiobuttonfor() in model: public class mymodel { public bool? doyouagree { get; set; } } in view: <label> @html.radiobuttonfor(m => m.doyouagree, false, new { id = "doyouagree_false" }) no </label> <label> @html.radiobuttonfor(m => m.doyouagree, true, new { id = "doyouagree_true" }) yes </label>

java - HttpEntity content already consumed -

i searched error , found happen when try getcontent twice or more times, thing is, not, have 2 identical methods, 1 works, other don't.. method parsehor() -doesn't work public arraylist<hor> parsehor() throws exception{ arraylist<horario> listhorario = new arraylist<horario>(); httpget = new httpget( url1); httpresponse response = httpclient.execute(get); httpentity entity = response.getentity(); inputstream = entity.getcontent(); // create inputstream bufferedreader reader = new bufferedreader(new inputstreamreader(is, "iso-8859-1")); stringbuilder sb = new stringbuilder(); ... } parsegrades() - works public arraylist<grade> parsegrades() throws exception { httpget = new httpget( url2); httpresponse response = httpclient.execute(get); httpentity entity = response.getentity(); inputstream = entity.getcontent(); // create inputstre...

hibernate - Can EntityManager not assign an id? -

are there specified cases in jpa2 when merge not assign @id variable ? , yet return new instance of entity without firing exception ? say i'm having hierarchy: @mappedsuperclass abstract class bar { @id @generatedvalue(strategy = generationtype.auto) private long id; ... } @entity @table(name = "bar_1s") @access(accesstype.property) class bar1 extends bar { ... } @entity @table(name = "bar_2s") @access(accesstype.property) class bar2 extends bar { ... } for yet found reason instances of bar1 id after merge() while instances of bar2 don't. @ least that's looks like. i've been trying various approaches @ no prevail. it looks hibernate (4.1.4.final) doesn't want assign id instances of particular class. :-) the questions have: did ever had ? can tell me in hibernate id's set ? can debug part of code , find out why skips assignment. intellij doesn't seem break on modification of fields in entities. edit - e...

oracle - Is it possible to go back to line after error in PL/SQL? -

i have tons of insert statements. i want ignore errors during execution of these lines, , prefer not wrap each line seperately. example: try insert 1 insert 2 insert 3 exception ... i want if exception thrown in insert 1, ignore , go perform insert 2, , etc. how can it? i'm looking "resume next" in vb. if can move inserts sql script , run them in sql*plus, every insert run own , script continue run. if using plsqldeveloper (you taged it), open new command window (wich sql script run sql*plus) , put staements this: insert table your_table values(1,'aa'); insert table your_table values(2/0,'bb'); insert table your_table values(3,'cc'); commit; even though statement (2) throw execption, since it's not in block continue next command. update: according @cheranshunmugavel comment, add whenever sqlerror continue none at top of script (especially if using sql*plus there difault exit ).

How to embed html5 webpage in flex -

using flex mx html component can preview website @ air, seems did not support features(audio,video) of html5. such following example: <mx:html location="http://www.w3schools.com/html5/tryit.asp?filename=tryhtml5_video_bear" width="100%" height="100%"/> when running application, video can not displayed in air windows. video/audio html5 tags disabled in air. here's article items , aren't supported in air right now.

image processing - Android rotate bitmap without making a copy -

is there way rotate bitmap without making copy of it? or maybe imageview that's holding bitmap? right i've got similar to: bitmap bm = bitmapfactory.decodefile(... // orientation matrix m = new matrix m.postrotate(orientation) bitmap new = bitmap.createfrombitmap(bm, ..., m); there algorithmically isnt easy way of performing rotation without separate new place put rotated copy, deleting current (non-rotated) copy. can think of potential algorithm have have 1 pixel' worth of memory have spend more time figuring out actual algorithm. also @ stackoverflow link: algorithm rotate image 90 degrees in place? (no memory)

Microsoft Excel C API and Visual Studio -

i trying figure out best solution rather complicated problem. need able publish data database webpage dashboard. not allowed query database directly except through program called xtraction. however, xtraction has ability export queried data ms excel. i wondering can tell me whether c api excel allow me grab data in excel , use excel's native charting functionality produce rich charts need post on webpage. right now, way know explore getting ms visual studio 2010 , don't want put out money if it's not going able me. any advice appreciated. regards. the c api allow write udfs. purposes- charting etc - need use automation. before go overboard , buy vs 2010, there few options can explore - 1. vs 2010 express - free edition. code using c++/com or c#/excel interop. 2. use excel vba - it's built excel itself. press alt-f11. open vba development environment. can go creating vba add-in (.xlam) , write vba code there creates graphs. however create graph...

jQuery Arrays and a Dropdown Menu -

i've been looking around , feel i'm jumping learning curve here , head explode searching , coming nothing. my problem have horizontal menu, designed unordered lists, , make dropdown menu nested unordered lists in first unordered list. <ul class="top-level"> <li><a href="#"></a> <ul class="dropdown"> <li><a href="#"></a> </li> <ul> <li> </ul> now, nested unordered list set "display:none;". since have dropdown lists in same class, when try toggle 'display:none;' attribute 'display: block' of dropdown lists toggled. i know can put each of dropdown lists own seperate classes, there way array? able click on top-level list item , bring appropriate dropdown list. thanks help $("ul.top-level li").click(function(event) { $(this).find("ul.dropdown").toggle(); }); ...

css - Selector for descendents including the element itself -

i wonder if there easier in order achieve (the selection of descendents plus element itself): <div id="parent"> <div></div> <div></div> </div> #parent, #parent * { background-color: red; } if have existing rule many classes e.g. .b20120411, .b20120630, .b20120711, .b20121010, .b20130109, .b20121214 { ... } and have descendents messy: .b20120411, .b20120411 *, .b20120630, .b20120630 *, .b20120711, .b20120711 *, .b20121010, .b20121010 *, .b20130109, .b20130109 *, .b20121214, .b20121214 * { ... } only: <div id="grand-parent"> <div id="parent"> <div></div> <div></div> </div> </div> #grand-parent * { background-color: red; }

ruby on rails - how do you stub/expect a state_machine event? -

i want this: @vehicle.should_receive(:park) @vehicle.stub!(:park) vehicle.any_instance.stub(:park) # etc. so can validate interaction or use state_machine in other specs without overhead of changing states... how accomplish this? use of above methods wrote about. note, think in versions of rspec, stubbing directly, or #should_receive replace body of said stubbed method. if later test side effects, won't present. usually work around with. @vehicle.should_receive(:park) @vehicle.state = :parked end expect @person.exit_vehicle end.should change(@vehicle.state).from(:driving).to(:parked)

javascript - Recursively replaced element with editor (and back) breaks event listeners -

background: there values on website shall editable via javascript , ajax. ajax working fine , can edit values after saved value cannot edit again without reloading page. i reduced problem this: original element gets replaced html form. when form submitted form replaced new version of display element, event listener broken. i put sample js code ( jsfiddle ) doesn't work expect. var text = $('<em/>').text('click me!'); text.click(function() { var button = $('<input type="button" value="click me, too" />'); button.click(function() { $('#container').html(text); }); $('#container').html(button); }) $('#container').html(text); what shall happen: current value displayed after text click ed text replaced form (text element saved simplicity) after button click text displayed again click on text works again in step 2 (doesn't work now) why click event lost w...

Git repo: internal and open source external branches -

what best way set git repo project company uses internally, want open-source (but potentially modified history)? let's acme company has repo "supercoolproject". want open source it, don't want company name associated @ all. set github account under 1 of developer's names (or group, etc), , create repo. clone internal acme server. "acme" mentioned. now comes problem - in given organization there developers understand open source , authorized push code public. there others don't understand nuances. when 1 of these makes commit, perhaps include company name or other proprietary information. or, make horrible commit can reverted internally (not rewriting history - i'm talking adding "revert" commit). but, don't want proprietary commits going out open source branches. so, create "acme_internal_{dev,qa,production}" branches, , external "master" branch (and maybe others). what's best way keep in s...

sql server - Can I replicate from Postgres to MS SQL? -

i have postgres database in production want use ms sql (whatever edition) reporting. so, have replication set ms sql subscribes postgres. possible? all heterogeneous replication scenarios deprecated microsoft, , recommend building solutions using ssis , cdc instead. we load data postgresql our sql server reporting database using ssis , works well, although had use commercial ole db provider because of limitations (at time) in open-source one. actually copying data easy part; of work comes in gathering requirements, understanding data, transforming it, implementing logging , error handling etc. ssis can things right away (e.g. logging) general advice use workflow tool , simple data copying minimal transformation logic (e.g. data type conversion). if seems seems difficult or clumsy in ssis can put stored procedure or script , call ssis instead.

Share ASP.NET Session Id between WCF and a Silverlight Http client -

i have wcf service configured use asp.net session state. have tested wcf service wpf client , session state maintained across different web requests. now trying use same wcf service silverlight app uses new http stack independent browser. need use stack in order able understand our wcf service faults. problem in case not able read responses set-cookie header asp.net_sessionid cookie or set cookie header in requests. this binding silverligth application: <custombinding> <binding name="customhttpbinding_ibasoawebservice" sendtimeout="01:00:00"> <binarymessageencoding /> <httpcookiecontainer /> <httptransport maxbuffersize="2147483647" maxreceivedmessagesize="2147483647" /> </binding> </custombinding> and binding of wcf service: <basichttpbinding> <binding name="basichttp" closetimeout="01:00:00" opentimeout="01:...

mysql - Two duplicate delete queries using primary key causing deadlock -

i don't understand how 2 duplicate queries each delete single row against single table using primary key have deadlocked. can explain? it seems me 1 of transactions should have gotten lock , other 1 have wait. here's deadlock report, queries: fri jun 01 2012 13:50:23 *** (1) transaction: transaction 3 1439005348, active 0 sec, process no 22419, os thread id 1166235968 starting index read mysql tables in use 1, locked 1 lock wait 2 lock struct(s), heap size 368 mysql thread id 125597624, query id 3426379709 node3-int 10.5.1.119 application-devel updating delete `sessdata` `sesskey` = '87edf1479a275557ac8280dca78ab886' , `name` = 'currentrequesturl' *** (2) transaction: transaction 3 1439005340, active 0 sec, process no 22419, os thread id 1234073920 starting index read, thread declared inside innodb 0 mysql tables in use 1, locked 1 3 lock struct(s), heap size 1216 mysql thread id 125597622, query id 3426379705 node2-int 10.5.1.118 application-devel up...

java - Android Service Multiple Services opened -

i'm doing project have sync every 10 sec, take on server people want sync. save preferences in array , go around array see user preferences (what want sync). if id 1 selected log.i (); this giving me problem: every time syncs log.i("starting service"); + log.i ("big sheet"). time passes becoming way: 2nd sync: log.i("starting service"); log.i("big sheet!") log.i("big sheet!") 3rd sync: log.i("starting service"); log.i("big sheet!") log.i("big sheet!") log.i("big sheet!") ...and every time same, may i'm opening multiple services? public class service extends service{ context context; timer t=new timer(); timertask timertask=new timertask(); database db; list checksync =new arraylist(); @override public ibinder onbind(intent arg0) { return null; } public void oncreate(){ //se comienza aqui! super.oncreate(); //cojemos el contexto del thread de ui ...

api - REST - Shouldn't PUT = Create and POST = Update -

shouldn't put used create , post used update since put idempotent. that way multiple puts same order place 1 order? the fundemental difference put known resource, , therefor used updating, as stated here in rfc2616. the fundamental difference between post , put requests reflected in different meaning of request-uri. uri in post request identifies resource handle enclosed entity. resource might data-accepting process, gateway other protocol, or separate entity accepts annotations. in contrast, uri in put request identifies entity enclosed request -- user agent knows uri intended , server must not attempt apply request other resource. if server desires request applied different uri i see coming based on names however. i @ post should uri handle content of request (in cases params form values) , creating new resource, , put uri subject of request (/users/1234), resource exists. i believe nomenclature goes long ways, consider web. 1 might...

jquery - Image upload plugin -

i want able upload image via ajax. after uploading plugin should show user uploaded image without reloading page. user should able crop image in case if want crop there face instead of whole photo. plugin must support coldfusion. summary user should browse image there pc. the image should show in thumbnail part of html without reloading page. the user should able crop part of image there actual profile pic. if knows such plugin, please let me know. thanks i don't think you're going able find plugin suit of needs. i've build similar functionality, every bit of had pieced other plugins or custom code. general workflow follows: user uploads image via iframe in page (ajax uploads difficult pull off). the iframe updates parent page processed image through cfm handler in iframe. using jquery plugin, jcrop , crop image, , send resulting image server when user completes form. you're not going able find of you, recommendation start on 1 piece @ tim...

character - strange behavior of xcode 4.2 -

strange , funny think going on code: -(void)savefile { nsfilemanager *filemng = [nsfilemanager defaultmanager]; if(![filemng fileexistsatpath:self.appfilespath]) { nserror *error = nil; bool success = [filemng createdirectoryatpath:self.appfilespath withintermediatedirectories:yes attributes:nil error:&error]; if(!success) { nslog([error localizeddescription]); } } nslog([nsstring stringwithformat:@"%@",self.appfilespath]); [filemng createfileatpath:self.filefullpath contents:self.filedata attributes:nil]; [self.filedata writetofile:self.filefullpath atomically:yes]; } and line nslog([nsstring stringwithformat:@"%@",self.appfilespath]); should give me this file://localhost/users/user/library/application%20support/iphone%20simulator/5.0/applications/bf35b859-514b-45aa-8e3a-b2ce65bd82b6/documents/appfiles directory appfiles should created under ../documents/ directory, it's not there... and nslog gives me thi...

javascript - Render action in two different controllers -

i have list of stockmovements , ajax picking list of stock_movements . my application has ajax search will_paginate , elasticsearch . add list picking list put following code in each column of stockmovement's list: <%= button_to 'retornar', linha_devolucaos_path(stock_movement_id: stock_movement.id, page: params[:page]), class: 'btn btn-mini' if !stock_movement.back , !stock_movement.linha_devolucaos.present? %> it updates picking list js response of item: $('#romaneio').html("<%=j render @devolucao %>") in ajax runs fine, doesn't hide retornar button because div isn't updated. know need request js response of stockmovement#index action, how , call action , how pass params? linhadevolucao#create controller def create @devolucao = current_devolucao_romaneio stock_movement = stockmovement.find(params[:stock_movement_id]) @devolucao.add_stock_movement(stock_movement.id) respond_to |format| if @devolucao.sav...

caching - Android Bitmap Cache -

i'm working on implementing cache lot of bitmap tiles have. i've done far: successfully implemented lru cache system, tiles still load when must loaded app's resources. cache has 85% hit rate. whenever must load bitmap resources, still slow said. in mind, loading bitmaps async task. before this, load without error, slow. now, it's faster since it's not working on main thread, inevitably run oom error. here's code async task: public class loadbitmap extends asynctask<void,void,void> { bitmap bit; @override protected void doinbackground(void... params) { options opts = new options(); bit = bitmapfactory.decoderesource(reso, drawable, opts); return null; } @override protected void onpostexecute(void result) { // todo auto-generated method stub drawloadedbit(bit); super.onpostexecute(result); } } any ideas on how can implement don't out of memory error? since...

spring java configuration issue: Rejected bean name 'requestMappingHandlerMapping': no URL paths identified -

i using spring java configs create web app. when run on tomcat says resource /myapp/myapp not found in console output noticed following. not sure whether causing issue. i showing log lines odd. log big info: validatejarfile(c:\libraries\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\myapp\web-inf\lib\javax.servlet-api-3.0.1.jar) - jar not loaded. see servlet spec 2.3, section 9.7.2. offending class: javax/servlet/servlet.class creating instance of bean 'beannamehandlermapping' returning cached instance of singleton bean 'delegatingwebmvcconfiguration' eagerly caching bean 'beannamehandlermapping' allow resolving potential circular references looking url mappings in application context: root webapplicationcontext: startup date [mon j un 04 13:28:33 edt 2012]; root of context hierarchy rejected bean name 'org.springframework.context.annotation.internalconfigurationannotationprocessor': no url paths identified rejected...

java - Apache HTTP Client socks proxy -

i working @ web requests project , using apache http client library. try connect server (e.g. http://www.google.com ) working socks v4/5 tested mozilla firefox problem never response. different errors... here code snippet: //httpclient defaulthttpclient http = new defaulthttpclient(); //a class defined me proxy proxy = bla bla; httphost host = new httphost(proxy.getip(), proxy.getport()); if (proxy.getusername() != null) { http.getcredentialsprovider().setcredentials( new authscope(proxy.getip(), proxy.getport()), new usernamepasswordcredentials(proxy.getusername(), proxy.getpassword())); } http.getparams().setparameter(connroutepnames.default_proxy, host); can tell proper way initiate comunnication through socks proxies? thanks! note: code above works perfect http proxies. http proxy , socks proxy has different protocols ( http://en.wikipedia.org/wiki/socks#comparison ). question: can thtis native java so...

c - In double (*foo)[2] what does the [2] represent -

in double (*foo)[2] [2] represent? , how convert array such array of float* in c? double (*foo)[2] foo pointer array of 2 double elements. for example: double bla[2]; double (*foo)[2] = &bla;

Grails giving me 404 on controller when submitting form -

i have basic controller, this: class bookingcontroller { def periodcheck(){ } def periodinput(){ } both booking/periodcheck.gsp , booking/periodinput.gsp have been created, , they work if access typing url directly. however, have form in periodinput.gsp supposed send data periodcheck , , every time, when send form, 404 error, saying the requested resource (/hoteledison/booking/periodcheck) not available . form defined this: <g:form action="periodcheck"> <!-- here go fields --> <g:actionsubmit class="btn" value="comprobar" /> </g:form> what doing wrong? i've tried defining allowedmethods in controller, not help. ok, according this blog post , there's difference between using actionsubmit , submitbutton . forms mine, 1 action, should have used later. now it's working.

Overlay several images on a video with Avisynth -

i've read lot of tutorials on how overlay image in avisynth, wonder if there way place several images on video @ specific time positions. i've been able render videos transparent png logo, didn't find tutorial how place different images @ different frame positions. i believe have figure out time positions frame rate. instance below sample show overlay image between 101 - 200 frames (4th 8th second): avisource("sample.avi", false).assumefps(25).converttorgb img = imagesource("sample.png") trim(0, 100) + trim(101, 200).overlay(img, 20, 30, opacity = 0.5) + trim(201, 0)

How can I convert that QueryOver<> code to use Query<> with NHibernate 3.3 -

i have class have class b list ... so, queryover have : classb lb = null; var result = session.queryover<classa> .joinalias(x => x.listb, () => lb, jointype.leftouterjoin) .where(() => lb.property == 1) .list<classa>(); how can using nhibernate query<> ? thanks paul assuming want list of classa having @ least 1 classb property == 1 : var result = session.query<classa>() .where(a => a.listb.any(b => b.property == 1)) .tolist(); this wouldn't outer join, though. might emulate adding || !a.listb.any() .

android - onMeasure with wrap_content is taking parameters that are not Integer.MIN_VALUE -

in xml specified wrap_content both width , height when override onmeasure function width , height passed -2147483348 oddly 300 > integer.min_value there reason this? why not integer.min_value or 0 if didn't have inside it. btw custom view i'm making have setmeasureddimension believe. the arguments onmeasure not available width , height, encoding of available width , height along flags how values supposed used. decode them using view.measurespec class: protected void onmeasure(int widthspec, int heightspec) { final int widthmode = measurespec.getmode(widthspec); final int widthsize = measurespec.getsize(widthspec); // etc. } the mode 1 of at_most , exactly , or unspecified . see docs how supposed use this. in particular, if mode not unspecified must not use value greater size dimension when call setmeasureddimension .

android - Using Roboguice to inject a dependency that does not have a default constructor -

if have class single constructor, how can roboguice inject activity? the service injected: public flightmanager(context context){ //do context } the activity: public class recordflight extends roboactivity { @injectresource flightmanager manager; //whatever code here } the dependency context, gather should injected without problem. additoinally, of other usages, such @injectview , @inject of classes default constructor seem fine, usage above kills app without giving me stack trace. any ideas? thanks jon mark constructor @inject annotation: @inject public flightmanager(context context){ //do context } then inject flightmanager so: public class recordflight extends roboactivity { @inject flightmanager manager; //whatever code here } @injectresource not necessary here, since it's regular java class you're injecting, not android resource.

php - ajax checking username onblur -

here case guys, i'm trying check username on onblur event of ajax , checking username availability in mysql database. here ajax script => document.getelementbyid("r_username").onblur = function(){ var http = false; var error = document.getelementbyid("error_username"); var numletter = /^[a-za-z-0-9]+$/; if (this.value==""){ error.innerhtml = "empty field !!!"; error.style.display = "inline"; } else { if (this.value.match(numletter)){ if (window.xmlhttprequest){ http = new xmlhttprequest(); } else { http = new activexobject("microsoft.xmlhttp"); } if (http){ http.open("post","./config/ajaxusernameemail.php",true); http.setrequestheader("content-type", "applicatio...

android - Configure Eclipse to use signed keystore -

i have created 'final' keystore app. app using google maps, take have update layouts use new api key resulting app well.. now i'm aware of requirement export signed apk release, after that? thoughts further development , testing, easiest if configure eclipse use final keystore instead of debug keystore … found no way that? allows me configure 'alternative' debug key guess that's not same. sorry if confused if have totally misunderstood here. i able to use google play release keystore custom debug keystore debugging in-app purchase functionality. same no doubt applied debugging google maps stuff well. as devunwired mentioned , there caveats. solution this: copy release key somewhere. change keystore password/key password , key alias following the instructions here (also, following devunwired's recommendations make debug keystore). change eclipse's preferences > android > build > custom keystore setting path of copy made ...

perl - HTTP::Proxy: how to replace a whole html page -

i'm trying use http::proxy server 403 error specific domain. managed modify headers, proxy continue serve original page. here code i'm using: package filters::filter403; use strict; use warnings; use http::proxy::headerfilter::simple; use http::proxy::bodyfilter::simple; our $header = http::proxy::headerfilter::simple->new ( sub { $_[2]->code( 403 ); $_[2]->message ( 'forbidden' ); } ); our $body = http::proxy::bodyfilter::simple->new ( sub { $_[1] = \<<'html'; <!doctype html> <html><head><title>403 forbidden</title><style type="text/css"> body { padding: 40pt; } body, h1, h2, p { color: #333; font-family: arial, sans-serif; margin: 0; } div { width: 200px; background: #eee; padding: 2em; } </style></head><body><div><h1>403</h1><h2>forbidden</h2></div></body></html> html } ); ...

configure - Restrict Which Node a Jenkins Job can be Run On, but only allow this field to be modified by Administrator -

i know can restrict project run, filling in field in in job. hoping find way allow individual users have configuration access job still able edit rest of job, remove field view. system administrator able modify it. reason doing have number of nodes set tied individual users , want prevent 1 user running on user's node (aka running other user), still want user able change other parts of job. as know security system, can allow user edit job, or allow specific users edit job. once can edit job, can edit of fields available , there no way restrict specific configuration value. i think letting users edit jobs permission not practice, , if had let users have kind of control using parameters can add.

c# - Algorithm to retrieve every possible combination of sublists of a two lists -

suppose have 2 lists, how iterate through every possible combination of every sublist, such each item appears once , once. i guess example if have employees , jobs , want split them teams, each employee can in 1 team , each job can in 1 team. eg list<string> employees = new list<string>() { "adam", "bob"} ; list<string> jobs = new list<string>() { "1", "2", "3"}; i want adam : 1 bob : 2 , 3 adam : 1 , 2 bob : 3 adam : 1 , 3 bob : 2 adam : 2 bob : 1 , 3 adam : 2 , 3 bob : 1 adam : 3 bob : 1 , 2 adam, bob : 1, 2, 3 i tried using answer this stackoverflow question generate list of every possible combination of employees , every possible combination of jobs , select 1 item each each list, that's far got. i don't know maximum size of lists, less 100 , there may other limiting factors (such each team can...

machine learning - Gibbs Sampling Code -

does 1 here have implemented gibbs sampling using test. have implement gibbs sampling have problems in in nailing down implementation level. ----how , choose test data? ----how create bayesian network based on data? (as far understanding should have had bayesian network sample from.) if body can guide me in great help.... there open-source bugs software bn inference using gibbs sampling. general software. not suggest creating bayes net data however. should have data corresponds bn. can try infer posterior probability distributions node in bn given observations.

html - Internet Explorer 9 displaying CSS sprite image, but with strange content -

i've got image sprite i'm using, ie9 isn't displaying properly. it works fine in firefox, displays grey border , symbol on top image (as shown). doesn't quite work in chrome - displays image, has grey border it. here's css code grabs it: #see_more_vendors { background:url('vendor_sprite.png') no-repeat 0px 0px; height: 60px; width:135px; display:block;} this html: <td><a href="#"><img id="see_more_vendors" alt=""/></a> (i've removed leading address of image, isn't problem.) initially, thought border, since in chrome showing grey border. then, saw in internet explorer, , haven't seen case online. this image looks like, when should have no border , no icon in top left corner. http://imageshack.us/photo/my-images/713/examplec.jpg/ if use more 1 times make class in css: .see_more_vendors { background:url('vendor_sprite.png') no-repeat 0px 0px; height: 60px;...

internet explorer - Simple javascript function not working in IE7 -

code works across major browsers, firing simple alert on click not working. this in header <script type="text/javascript"> function this_function() { alert("got here mango!"); } </script> this in body <button type="button" onclick="this_function()">click me</button> if put "onclick" tag works fine , dandy. any , suggestions on how work in ie great. in advance. sorry, "into tag" meant putting onclick="alert()" tag. try: <button type="button" onclick="javascript:this_function();">click me</button> it's advised separate javascript , markup. regardless should assign id button , attach onclick handler this: document.getelementbyid("button").onclick = function() { alert("got here mango!"); }; ​

sql server - Is it possible to convert a C# string to a SqlChars? -

i'm creating unit tests piece of code returns sqlgeography type. mock sqlgeography column i'd use sqlgeography.stlinefromtext create line string. problem stlinefromtext takes sqlchars parameter. know how convert c# string sqlchars? new sqlchars(new sqlstring(text));

php - How to determine where a redirect to https is occurring -

i working on site that, when accessed via http , gets auto redirected https . we're trying determine occurring. far we've looked in following places: .htaccess in apache in httpd.conf in php file of test page wrote (site.com/test.php) i'm thinking there other conf file in apache redirect stuff occurring.. where else should look? i have had same exact problem before. did take in vhost file(s)? usually stored in /etc/httpd/conf/vhosts/ my bet have general rule redirect such www.google.com/cars/* redirect https.

azure - Can a WebRole be "recycled" programmatically? -

iis7 application pools can recycled programmatically. there equivalent concept web role in azure? that basic question, background on why ask, include following... we attempting umbraco installed in azure, , umbraco installation wizard writes it's configuration information , manually restarts application pool (in iis) reread configuration wrote. needs work same way in azure, @ point not able reinitialize scratch (as in iis7). you can call roleenvironment.requestrecycle() given role instance. has windows server vm restart, re-executes startup scripts, onstart() method, , run() method. when doing this, may want consider type of breadcrumb leave yourself: if find installed upon restart, skip install process; otherwise, install , request recycle.

user interface - Javascript boolean "toggle" -

i have function looks @ cursor (x, y) see if falls within 1 of several rectangles ( a<x<b, c<y<d ). however, need set boolean based on whether cursor ever fell particular rectangle , reset when cursor falls other rectangles. in other words a true if cursor fall within rectangle x a false if cursor falls within rectangle 1, 2, 3 or 4 a retains former value if it's anywhere y or z the trouble no matter boolean returns false if leave first rectangle, whether visit other 2 rectangles or not. tried making boolean global no help. code; var r var s var l var incenter = false function makerects(a,b) { r = a-b s = (a/2) - (b/2) l = (a/2) + (b/2) lside = new array(4) lside[0] = 0 lside[1] = 0 lside[2] = lside[3] = b tside = new array(4) tside[0] = 0 tside[1] = 0 tside[2] = b tside[3] = rside = new array(4) rside[0] = r rside[1] = 0 rside[2] = b rside[3] = b bside = new array...

regex - regular expression for finding and replacing variable URL strings in XML -

i'm having difficulty figuring out regular expression stripping part of string within particular xml tag , replacing it. have number of url paths variable parts, need find between string , last slash in url. example, might have tags , urls this: <bpoc:resourcemetadataloc>http://app01/media/images/i//1951-1960_embark_object_photos/1957.59.jpg</bpoc:resourcemetadataloc> or <bpoc:resourcemetadataloc>http://app01/media/images/contemporary/1986-2005/1991.2.jpg</bpoc:resourcemetadataloc> the output should like <bpoc:resourcemetadataloc>http://app01/media/previews/1957.59.jpg</bpoc:resourcemetadataloc> this far got, captures last slash in string, , not second-to-last slash: (<bpoc:resourcemetadataloc>http://app01/media/images)+(.*[/]) that regex capture following: <bpoc:resourcemetadataloc>http://app01/media/images/i//1951-1960_embark_object_photos/1957.59.jpg</ what need add regex exclude </...

visual studio 2010 - Cannot initialize XML Serializer in C# -

[serializable] public class appdata { public string datafile { get; set; } public string logfile { get; set; } public string uploadurl { get; set; } public string rssurl { get; set; } public icollection<rss.items> rssfeed = new collection<rss.items>(); } public class rss { [serializable] public struct items { public string guid; public datetime date; public string title; public string description; public string link; } } internal static appdata appdata; private static xmlserializer xml; static void main() { xml = new xmlserializer(typeof(appdata)); } when run in vs 2010 debugger throws error there error reflecting type 'fol.appdata'. yes, code have more, basic parts. these within same assembly. interfaces can't serialized - you'll need change this: public icollection<rss.items> rssfeed = new collection<rss.items>(); to this: public collection...

Android USB Host API: bulk transfer buffer size -

i writing software communicate between tablet (motorola xoom android version 4.0.3 , kernel version 2.6.39.4) and peripheral device using usb host api provided android. use 2 types of communication: control - controltransfer(int requesttype, int request, int value, int index, byte[] buffer, int length, int timeout) bulk - bulktransfer(usbendpoint endpoint, byte[] buffer, int length, int timeout) control transfer works fine, have a problem bulk transfer. can use 32768 size of buffer bulktransfer function. not possible use less or more. know cannot use more because of limit of buffer pipe (size: 32769 bytes). this peripheral device streams data not correctly read bulktranfer function. suppose data lost. i find this: in linux if process attempts read empty pipe (buffer), read(2) block until data available. if process attempts write full pipe , write(2) blocks until sufficient data has been read pipe allow write complete. and based on that, explanation of problem dat...