Posts

Showing posts from June, 2015

python - Pipe Twisted Request Content to STDIN of Process -

i'm looking pipe content of http post or put stdin of process. i'm using klein library , have following code: from klein import run, route twisted.internet import reactor, defer, protocol import os class curlprocprotocol(protocol.processprotocol): def __init__(self, data): self.data = data def connectionmade(self): self.transport.write(self.data) self.transport.closestdin() def outreceived(self, data): return 'got ' + str(data) @route('/') def home(request): d = defer.deferred() reactor.spawnprocess(curlprocprotocol(request.channel), '/usr/bin/curl', args=['curl', '-t', '-', 'ftp://localhost/test.txt'], env={'home': os.environ['home']}, usepty=false) d.addcallback(reactor.run) return d run("localhost", 8080) the problem

methods - Is Java "pass-by-reference" or "pass-by-value"? -

i thought java pass-by-reference ; i've seen couple of blog posts (for example, this blog ) claim it's not. don't think understand distinction they're making. what explanation? java pass-by-value . unfortunately, decided call location of object "reference". when pass value of object, passing reference it. confusing beginners. it goes this: public static void main( string[] args ) { dog adog = new dog("max"); // pass object foo foo(adog); // adog variable still pointing "max" dog when foo(...) returns adog.getname().equals("max"); // true, java passes value adog.getname().equals("fifi"); // false } public static void foo(dog d) { d.getname().equals("max"); // true // change d inside of foo() point new dog instance "fifi" d = new dog("fifi"); d.getname().equals("fifi"); // true } in example adog.getname() still retur

oop - C++ Design: Overloading/Overriding many many functions, way to clean up? -

the case trying implement here base class has function (let's call modify_command) can accept many different types virtually derived classes can implement modify_command function see fit. right have along these lines in base class: class base { template<typename command> void modify_command(command cmd) { std::cout << "modify command called unimplemented command type:" << typeid(cmd).name(); } virtual void modify_command(specificcommanda cmd) { modify_command<specificcommanda>(cmd); // calls templated function } virtual void modify_command(specificcommandb cmd) { modify_command<specificcommandb>(cmd); // calls templated function } // etc. }; then in derived class: class derived : public base { virtual void modify_command(specificcommanda cmd) { cmd.x = 1; cmd.y = 2; } } obviously virtual template function isn't possibility i

windows - Accessing Remote Registry for the currently logged in user with Powershell -

i'm trying find printer ports in use user logged in multiple machines. however, when run script running regedit myself... how go getting user logged in? here current script: get-content -path c:\listofcomputers.txt | foreach-object { get-itemproperty -path registry::"hkey_current_user\software\microsoft\windows nt\currentversion\printerports\" | foreach-object {get-itemproperty $_.pspath} | format-list | out-file c:\portresults.txt }

Copying all files of a directory to one text file in python -

my intention copy text of c# (and later aspx) files 1 final text file, doesn't work. for reason, "yo.txt" file not created. i know iteration on files works, can't write data .txt file. the variable 'data' contain text files . . . *******could connected fact there non-ascii characters in text of c# files? here code: import os import sys src_path = sys.argv[1] os.chdir(src_path) data = "" file in os.listdir('.'): if os.path.isfile(file): if file.split('.')[-1]=="cs" , (len(file.split('.'))==2 or len(file.split('.'))==3): print "copying", file open(file, "r") f: data += f.read() print data open("yo.txt", "w") f: f.write(data) if has idea, great :) thanks you have ensure directory file created has sufficient write permissions, if not run chmod -r 777 . to make directory writab

javascript - how to make ReactCSSTransitionGroup animate elements on setState? -

how make elements animate on changing state setinterval ? trying render elements in random position , try animate position changes following: var elem = react.createclass({ render: function () { return ( <h1 classname="elem"> hello, {this.props.name} ! </h1> ); } }); var maincontainer = react.createclass({ componentdidmount: function () { setinterval(this.shf, 777); }, getinitialstate: function () { return {source: []}; }, shf: function () { var source = this.props.source.sort(function () { return .5 - math.random(); }); this.setstate({ source: source }); }, render: function () { var reactcsstransitiongroup = react.addons.csstransitiongroup; var elems = this.state.source.

python - Django - Rendering Markdown Sanitizied with Bleach -

when markdown(text), without bleach, desired result (raw): <p>blah</p> and displays correctly as: blah where "p" tags rendered correctly paragraph block. when bleach.clean(markdown.markdown(text)), (raw): &lt;p&gt;blah&lt;/p&gt; and displays incorrectly as: <p>blah</p> where "p" tags part of text , not html paragraph block. you need mark bleach ed html safe from django.utils.safestring import mark_safe ... return mark_safe(bleach.clean(markdown.markdown(text))) but, there django-bleach provides integration django , ready-made tags use bleach in django. {% load markdown_deux_tags bleach_tags %} {{ view_user.profile.about|markdown:"user"|bleach }} in settings.py can tell django-bleach tags okay bleach_allowed_tags = ['h1', 'h2', 'p', 'b', 'i', 'strong', 'a'] bleach_allowed_attributes = ['href', 'title'

python - How do I mark the percentage change between two lines in matplotlib? -

Image
i plot 2 lines matplotlib , mark maximum improvements. use ax.annotate , got following undesirable result, here source code. from __future__ import division import matplotlib.pyplot plt fig, (ax1, ax2) = plt.subplots(1, 2) x = range(10) y1 = range(10) y2 = [2*i in range(10)] # plot line graphs ax1.plot(x, y1) ax1.plot(x, y2) # maximum improvements x_max = max(x) y1_max = max(y1) y2_max = max(y2) improvements = "{:.2%}".format((y2_max-y1_max)/y1_max) # percentage ax1.annotate(improvements, xy=(x_max, y2_max), xycoords='data', xytext=(x_max, y1_max), textcoords='data', color='r', arrowprops=dict(arrowstyle="->", connectionstyle="arc3", color='r')) # showing expected result ax2.plot(x, y1) ax2.plot(x, y2) plt.show() is there better way mark percentage change between 2 lines? i agree @hobenkr. have split annotation on 2 annotationa: first arrow , second text la

objective c - AVFoundation set white balance values back to auto -

i'm building app want change white balance using avcapturewhitebalancetemperatureandtintvalues, after while want change white balance automatic. there variable in avfoundation allows reset temperature , tint values auto? figured out. in same boat, line of code added: [_videodevice setwhitebalancemode:avcapturewhitebalancemodecontinuousautowhitebalance];

java - Android memory leak on device, not on emulator -

i'm writing game teach son phonics: it's first attempt @ programming in java , although i've used other languages. game has 4 activities: splash screen initializes array of variables before dismiss it; choose user; third choose level of game play; , fourth play game. my problem if go in , out of game activity repeatedly, activity crash -- logcat showed oom error . watching heap size did this, , looking @ heap dump mat , looked though leaking whole of fourth activity -- gc not being triggered. i've tried lots of things track down , fix leak -- of are, i'm sure improvements (e.g. getting rid of non-static inner classes activity) without fixing problem. however, i've tried running same thing on emulator (same target , api device) , there's no leak -- heap size goes , down, gc regularly triggered, doesn't crash. so going post code activity on here , ask spotting might causing leak, i'm no longer sure that's right question. instead i'm

ios - What i should change in my code to access all the contacts instead of just 1 contact with swift? -

i have specific problem. want access , present table view user's contact list. problem when run code access 1 contact contact list. i'm trying think should change nothing far. given code below need change achieve result want? here code: import uikit import contacts import addressbook class masterviewcontroller: uitableviewcontroller { var detailviewcontroller: detailviewcontroller? = nil var objects = [cncontact]() override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. let addexisting = uibarbuttonitem(title: "add existing", style: .plain, target: self, action: #selector(masterviewcontroller.addexistingcontact)) self.navigationitem.leftbarbuttonitem = addexisting if let split = self.splitviewcontroller { let controllers = split.viewcontrollers self.detailviewcontroller = (controllers[controllers.count-1] as! uinavigationcontroller).topviewcontroller as? detailviewcontroll

swift - Definition conflicts with previous value - also, when is override deleted? -

so attempting make tableview out of array of cloudkit downloaded items. however, i'm having simple little "definition conflicts pervious value" error. error occurs cellforrowatindexpath function - supposedly conflicts numberofrowsinsection function. have attempted moving/deleting brackets of latter function , placing question mark/optional @ end... "-> uitableviewcell?" no avail. error coming from? also, stands, xcode deleted override portion of each tableview function. why stay , when deleted? import uikit import cloudkit class diningtable: uitableviewcontroller { var categories: array<ckrecord> = [] override func viewdidload() { super.viewdidload() func getrecords() { categories = [] let publicdatabase = ckcontainer.defaultcontainer().publicclouddatabase let predicate = nspredicate(value: true) let query = ckquery(recordtype: "diningtypes", predicate: predicate) let queryoperat

go - Why is reflection working with UNEXPORTED Struct and Unexported Fields? -

i expected in code work struct dish exported dish. expected program fail when structure dish unexported , not see unexported field within it. (ok, see unexported field being present in exported structure, seems wrong). but program still works shown?? how can reflection package see 'dish' if unexported? --------------program follows---------- //modified example blog: http://merbist.com/2011/06/27/golang-reflection-exampl/ package main import ( "fmt" "reflect" ) func main() { // iterate through attributes of data model instance name, mtype := range attributes(&dish{}) { fmt.printf("name: %s, type: %s\n", name, mtype) } } // data model type dish struct { id int last string name string origin string query func() } // example of how use go's reflection // print attributes of data model func attributes(m interface{}) map[string]reflect.type { typ := reflect.type

html - hot reload in jekyll not working -

i've installed jekyll 3.1.6 on mint 17 (ubuntu 14.4) ruby 2.2 + python 2.7 browsers chromium , firefox i think i've tried every trick can find on internet, still won't auto-reload, though terminal auto-regeneration has been enabled , each file content change , save, terminal logs change , tells me it's been done. i'm still forced refresh page manually see changes. open , suggestions. jekyll auto-generation future(using jekyll server ) automatically change/modify files on _site folder only , not refresh browser windows automatically, have use grunt that. there many of npm packages , repo that.

jquery - reactjs - expose react component methods outside react tree -

question: how can expose react component's methods other places? for example, want call react-router's this.context.router.push(location) element outside of react. perhaps add react component's method window object can called generic dom event listener or console? background/use case: i want use jquery datatables in react app because provides many plugins , config still unavailable in react ecosystem. i started existing react datatable component (implementation below). the original provides nice option pass render function can, example, render other react components inside cells. below, cells in 'product name' column rendered react-router < link /> components. const data = [ { product_id: '5001', product_price: '$5', product_name: 'apple' }, ... ]; const renderurl = (val, row) => { return (<link to={`/product/${row.product_

ios - App not firing as expected when launched with a deeplink -

i using https://branch.io/ in ios app. i followed documentation in start.branch.io set deeplink. it works point. continuously thrown safari , place on appstore download app, when app should fired. here code in case: - (bool)application:(uiapplication*)application didfinishlaunchingwithoptions:(nsdictionary*)launchoptions { branch *branch = [branch getinstance]; [branch initsessionwithlaunchoptions:launchoptions andregisterdeeplinkhandler:^(nsdictionary *params, nserror *error) { if (!error && params && [params objectforkey:@"xp"]) { // things parameter xp! } }]; return yes; } - (bool)application:(uiapplication *)application continueuseractivity:(nsuseractivity *)useractivity restorationhandler:(void (^)(nsarray *restorableobjects))restorationhandler { bool handledbybranch = [[branch getinstance] continueuseractivity:useractivity]; return handledbybranch; } what may wrong

CSS not working on id on jsp -

on jsp page outputtext tag when use id, css style sheet doesn't pick on it, when change class works. jsp: <h:outputtext id="namelabel" value="name:" /> css: #namelabel { font-weight: bold; } when used id parent <h:form> make font bold whole form, don't understand difference, explain? feel im missing obvious.. at moment not problem, im wondering future reference if wanted give unique css rules particular outputtext , or add class rule it? suppose im asking best practice here too. im using ajax, netbeans , deploying glassfish. jsf change id of input box component. id changed following form form_name:component_id use following code styles form_name\:id ex: <h:form name="testform"> <h:outputtext id="namelable" value="name:" /> </h:form> <style> #testform\:namelabel{ font-weight: bold; } </style>

assembly - c++ - use asm in functions with just bytes instead of instruction name -

is there way write assembly instructions using corresponding bytes. i'm thinking: __asm { 0x7d8802a6 0x9181fff8 } instead of like: __asm { stw r12, -8(r1) } this highly compiler-dependent. gcc's inline assembly syntax accommodate assembler ok with, e.g. __asm__(".word 0x7d8802a6, 0x9181fff8") i not familiar whichever compiler has __asm { ... } syntax refer to.

ruby on rails - ExecJS::RuntimeError in Aaa_core#index -

my rails application working fine until typed following command line windows cmd prompt: "bundle exec rake assets:clean". after did , went rails server again, following error popped on homepage. how rid of below-mentioned error or how reverse whatever "bundle exec rake assets:clean" did cause error? execjs::runtimeerror in aaa_core#index showing c:/sites/aaa_website_new/app/views/layouts/application.html.erb line #7 raised: (in c:/sites/aaa_website_new/app/assets/javascripts/aaa_core.js.coffee) extracted source (around line #7): 4: <meta charset="utf-8"> 5: <title><%=title%></title> 6: <%= stylesheet_link_tag "application", :media => "all" %> 7: <%= javascript_include_tag "application" %> 8: <%= csrf_meta_tags %> 9: </head> 10: <body> here application trace: app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__510

java - equals method not returning expected o/p -

please solve doubt equals(). think equlas() checks content in following example should print true because content same of both t1 , t2, prints false. why? public class test { public static void main(string args[]) { test1 t1 = new test1(10); test1 t2 = new test1(10); system.out.println(t1.equals(t2)); } } class test1 { int ; test1( int x){ = x ; } } thanks in advance you need override equals in test1 class desired behavior. otherwise, class inherit equals object , determines if 2 references refer same object. here, have different instances, false result. quoting linked javadocs: the equals method class object implements discriminating possible equivalence relation on objects; is, non-null reference values x , y, method returns true if , if x , y refer same object (x == y has value true). typically test if other object of same class, compare ind

php - Getting next and previous MySQL id according to views -

i have mysql database im saving post id, post , views. want add link next , previous post based on views. ------------------------------- | id | post | views | ------------------------------- | 1 | title 01 | 10 | | 2 | title 02 | 20 | | 3 | title 03 | 5 | | 4 | title 04 | 0 | | 5 | title 05 | 0 | | 6 | title 06 | 0 | | 7 | title 06 | 6 | ------------------------------- so try following queries. $post_id current post id. // previous select * posts id>'$post_id' order views asc limit 1 // next select * posts id<'$post_id' order views desc limit 1 above queries returning wrong results. // previous select * posts views>'$views' order views asc limit 1 // next select * posts views<'$views' order views desc limit 1 those returning results until 0 occurs (from example data added above) change clause views>='$views' (previous) ,

sql - Executing the stored procedure causes error -

i have stored procedure in want reportdate while executing. i pass 1 parameter stored procedure executing it,. pass this exec userreportdata '10-06-2016' but error: the conversion of char data type datetime data type resulted in out-of-range datetime value. this stored procedure: alter procedure [dbo].[userreportdata] @as_ondate datetime begin declare @reportdate datetime --declare @opening int select * #temptable (select a.cuser_id, b.user_id, a.u_datetime reportdate inward_doc_tracking_trl a, user_mst b a.cuser_id = b.mkey , convert(varchar(50), a.u_datetime, 103) = @as_ondate) x declare cur_1 cursor select cuser_id, user_id #temptable open cur_1 declare @cuser_id int declare @user_id int fetch next cur_1 @cuser_id, @user_id while (@@fetch_status = 0) begin select convert(var

javascript - Synchronizing multiple graphs using nvd3 -

i have 2 basic line graphs on page share same x axis. trying accomplish syncing these graphs when hovering on point on 1 graph, same hover event triggered on second graph. so far have figured out how listen event via: chart.lines.dispatch.on('elementmouseover.tooltip', function(e) { // need trigger same event on xaxis of separate graph }); digging thru nvd3 , d3 source code hasn't brought revelation onto how accomplish far. something should work guess. chart1.lines.dispatch.on('customevent', chart2.lines.dispatch.customevent);

openerp - while editing, validation of date not working in ODOO -

hi beginner in odoo technology, when click create button validation of date working not validating in edit mode everything correct, create , edit different things. create when creating object , edit when apply changes created object. so when creating object function create() runs , after edit function write() run. during making changes none of function works mentioned above, can use onchange method validate field after being changed or catch them in write() function , try validation there

java - jasper report studio can't deal with hibernate.cfg.xml -

Image
i using hibernate framework in project, choose use annotation approches.i'm using h2 embbeded database "file mode". every thing work fine in editor , in distribuatable jar file.i choose jasper reports create reports hit problem setup hibernate datasource in jrsudio. please notce have setup class path classes folder in jrstudio. and stack trace problem. net.sf.jasperreports.engine.jrexception: java.lang.reflect.invocationtargetexception @ net.sf.jasperreports.data.hibernate.hibernatedataadapterservice.contributeparameters(hibernatedataadapterservice.java:129) @ net.sf.jasperreports.data.abstractdataadapterservice.test(abstractdataadapterservice.java:105) @ com.jaspersoft.studio.data.wizard.abstractdataadapterwizard$3.runoperations(abstractdataadapterwizard.java:162) @ com.jaspersoft.studio.utils.jobs.checkedrunnablewithprogress$1.run(checkedrunnablewithprogress.java:59) @ java.lang.thread.run(thread.java:745) caused by: java.lang.reflect

android - Flip effect in an image gallery -

i'm trying make image gallery includes effect when click image turns around , show different one. in case when click on image1 turns , show image11 when click on image2 turns , show image12 , on. have done gallery have no idea how implement effect. appreciate help. public class carrusel extends activity implements onclicklistener { imageview lastclicked = null; int padding = 10; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.start); linearlayout l; l = (linearlayout) findviewbyid(r.id.carrusel); int[] images = new int[] { r.drawable.image1, r.drawable.image2, r.drawable.image3,r.drawable.image4,r.drawable.image5, r.drawable.image6,r.drawable.image7,r.drawable.image8, r.drawable.image9,r.drawable.image10,r.drawable.image11, r.drawable.image12, r.drawable.image13,r.drawable.image14, r.drawable.image15,r.drawable.image16,r.

php - On actionDelete how we redirect on same page with flash in yii -

if(!empty($check)) { yii::app()->user->setflash('failure',"example"); $this->redirect(isset($_post['returnurl']) ? $_post['returnurl'] : array('admin')); //its not redirecting } try this, public function actiondelete($id) { try { $this->loadmodel($id)->delete(); return $this->redirect(['create']); } catch (cdbexception $e) { if (1451 == $e->errorinfo[1]) { // message goes here $msg = 'unable delete field.'; } else { $msg = 'deletion failed'; } if (isset($_get['ajax'])) { throw new chttpexception(400, $msg); } else

javascript - jQuery if hasClass hide element on blur -

i have form displays error message in html label when users don't enter valid data form fields. label displays beneath form field onblur , stays there until data entered form field. label show when users click form field instead of showing persistently. below script i'm attempting hide error label user tabs out of form field. figured i'd worry making appear again once can hide it. here html: <div class="field"> <input type="text" name="firstname" id="firstname" class="error has-error"> <label for="firstname" class="error">first name required.</label> </div> and script <script type="text/javascript"> if($('.fieldset #firstname').hasclass('error')) { $(this).blur($('.field label')).hide(); } </script> you need pass function .blur() function callback, this: $(".fieldset #firstnam

c - getting dynamic symbol table information from elf -

i'm trying dynamic & static symbol table information elf. that's code wrote: void symbols(){ int i; elf32_ehdr *header; /* point header structure */ header = (elf32_ehdr *) map_start; elf32_shdr *shdr = (elf32_shdr *)(map_start + header->e_shoff); int shnum = header->e_shnum; const char * str_p =null; elf32_shdr *sh_strtab = &shdr[header->e_shstrndx]; const char *const sh_strtab_p = map_start + sh_strtab->sh_offset; int j; int k; (i = 0; < shnum; ++i) { if ((shdr[i].sh_type == sht_symtab)||(shdr[i].sh_type==sht_dynsym)){ str_p =(char *) shdr[shdr[i].sh_link].sh_offset; elf32_sym *symboler =(elf32_sym *)(map_start + shdr[i].sh_offset); for(j=0;j<(shdr[i].sh_size/shdr[i].sh_entsize);j++){ printf("%u ", symboler->st_size); printf("%x ", symboler->st_value); printf("%u ", symboler->

java - Better to use reflection or my little hack to access a private method? -

i need access private method class. have 2 ways of accessing it. first obvious reflection. second sort of hack. private method need call being called protected inner class's accessprivatemethod method. method literally call private method need. so, better access using reflection or better sort of "hack" extending protected inner class calls it. see code: method = object.getclass().getdeclaredmethod("privatemethod"); method.setaccessible(true); object r = method.invoke(object); or: (protectedinnerclass protected inner class in class private method want access.) class hack extends protectedinnerclass { public void accessprivatemethod() { // callprivatemethod literally calls private method // need call. super.callprivatemethod(); } } ... hack.accessprivatemethod(); some additional thoughts: 1) i've seen many people on here use reflection last resort. 2) reflection cause security issues? (securitymanager ca

android - Kontakt sdk not detecting Radius beacon -

i using th kontakt sdk along radius beacon. here activity code: http://pastebin.com/tqxdkwkx but isn't able detect beacon, see in logs is: d/bluetoothlescanner: onclientregistered() - status=0 clientif=5 how can possibly fixed ? thanks

excel - Loop cell offset? -

i'm new vba i've done few macros speed processes in workshop automating workshop sheets etc, excuse long winded code, 1 has me stumped. we have tool sheet our machines , want automate when put 4 digit code in cell i.e "1 4 v" fill out various sections of tool sheets more detailed descriptions parameter worksheet, here code. sub toolsheet() 'start box 1----------------------------------------- dim box1 string dim box1array() string box1 = cells(6, "b").value box1array = split(box1) 'tool description ---------------------------------------- if box1array(0) = 1 worksheets(1).range("c7") = worksheets(4).range("g3") worksheets(1).range("b7") = 1 elseif box1array(0) = 2 worksheets(1).range("c7") = worksheets(4).range("g4") worksheets(1).range("b7") = 2 elseif box1array(0) = 3 worksheets(1).range("c7") = worksheets(4).range("g5") worksheets(1).range("b7"

javascript - JQuery submits the form on second or third click - Validate -

i can't figure out why validation not working on first click later. i've add validate plugin js file form being validated after click. as can see, validator set when document ready. then, when form clicked, validator checks, whether form valid. function submit(form) { var formdata = new formdata($(form).get(0)); alert('thank message! our support reply possible.'); $.ajax({ url: '/contact-us-ajax/', type: 'post', data: formdata, async: true, cache: false, contenttype: false, processdata: false, success: function (data) { alert('success'); } }); return false; } $(document).ready(function () { jquery.validator.setdefaults({ debug: true, success: "valid" }); $("#contact-us-form").submit(function (b) { b.preventdefault(); this_form = $(this); $("#contact-us-f

html - Nav highlight current page -

please solve problem, because ideas have been exhausted...( i have : <nav class="nav_editor" ng-show="status.editormenuon"> <ul class="menu_editor"> <li class=""><a ng-href="/articles/user/{{ status.userid }}">my articles</a></li> <li class=""><a href="/articles">create article</a></li> <li class=""><a href="#">comments</a></li> </ul> </nav> and css classes: .menu_editor li { color: rgb(125,125,125); font-size: 1.25vw; margin-right: 20px; text-decoration: none; } i want make highlighting item in menu when page active (not pseudo ":active"), when watching current page, example "my articles". i have tried 3 variants css/html only, javascript , jquery, either not working or not working @ all. ple

git - how to chain two migrations through migraions ids and to create a linear chain to collapse the branches? -

i deployed flask app heroku. when run command error. heroku run python manage.py deploy this error message: raise util.commanderror('only single head supported. ' alembic.util.commanderror: single head supported. script directory has multiple heads (due branching), must resolved manually editing revision files form linear sequence. run alembic branches see divergence(s). ao googled it,then got this: this happens when go revision not last , create new migration. have 2 branches, alembic cannot handle. look @ how migration files chained through migration ids, need create linear chain collapse branches. but i'm still confused how solve that. think problem caused git branches. (i tried merge 2 branches, didn't work?) looks quoted comment made long ago in 1 of blog articles. since then, have written article dedicated topic of resolving migration conflicts: http://blog.miguelgrinberg.com/post/resolving-database-schema-confli

Uber Rush API Sandbox -

trying test uber rush api (from localhost , linux server). calling token works - token trying implement sanbox example: curl -x "put /v1/sandbox/deliveries/{delivery_id}" \ -h "authorization: bearer <oauth token>" \ -d "{\"status\":\"en_route_to_pickup\"}" with url https://sandbox-api.uber.com/ and tried same request file_get_contents (in php) so, error "405 method not allowed" {"message":"method not supported endpoint.","code":"method_not_allowed"} what need access method sandbox example https://developer.uber.com/docs/rush/sandbox ? corrent syntax curl -x "put" -h "authorization: bearer <token>" -h "content-type: application/json" -d "{\"status\":\"en_route_to_pickup\"}" https://sandbox-api.uber.com/v1/sandbox/deliveries/delivery_id edit : updated reflect both issues in question..

java - Jar file execution issue? -

i using command run jar file java -cp otpreq.jar com.otp.req.sendrequest and giving error-: error: jni error has occurred, please check installation , try again exception in thread "main" java.lang.noclassdeffounderror: org/apache/commons/httpclient/methods/requestentity @ java.lang.class.getdeclaredmethods0(native method) @ java.lang.class.privategetdeclaredmethods(unknown source) @ java.lang.class.privategetmethodrecursive(unknown source) @ java.lang.class.getmethod0(unknown source) @ java.lang.class.getmethod(unknown source) @ sun.launcher.launcherhelper.validatemainclass(unknown source) @ sun.launcher.launcherhelper.checkandloadmain(unknown source) caused by: java.lang.classnotfoundexception: org.apache.commons.httpclient.methods.requestentity @ java.net.urlclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ sun.misc.launcher$appclassloader.loadclass(unknown source) @ java.lang

For android device how to check wifi status when there is web authentication needed for open wifi connection -

i have application makes check of network connectivity before making server request. used connectivity manger check network state. when connecting wifi open network needs authentication credential entered browser. if have not enter wifi credential, connectivity manager returns me true, showing internet connected. not allow me browse. can tell me how handle case. public static boolean getwifienabled(context context) { boolean result = false; connectivitymanager connectivitymanager = (connectivitymanager) context .getsystemservice(context.connectivity_service); android.net.networkinfo activenetwork = connectivitymanager .getactivenetworkinfo(); if (activenetwork != null && (activenetwork.gettype() == connectivitymanager.type_wifi)) { if (activenetwork.getstate() == networkinfo.state.connected) { result = true; activenetwork.getdetailedstate();

Validation doesn't work as expected for related models in Rails 4? -

i use 1 form enter data 2 models. when save parent model (tenant) child model (user) gets saved, if don't validate tenant_id in user model. if validates :tenant_id, presence: true in user model validation error "users tenant can't blank" displayed. ideas why? tenant model: class tenant < activerecord::base has_many :users, dependent: :destroy, inverse_of: :tenant accepts_nested_attributes_for :users before_validation self.status = 0 self.name = name_orig.upcase email.downcase! end validates :name_orig, presence: true, length: { maximum: 255 } validates :name, uniqueness: { case_sensitive: false } valid_email_regex = /\a[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i validates :email, presence: true, length: { maximum: 255 }, format: { with: valid_email_regex }, uniqueness: { case_sensitive: false } validates :status, presence: true end user model: class user < active