Posts

Showing posts from May, 2014

maven - Getting java classes from multiple wsdls -

i have maven project need generate java classes multiple wsdl files. have analysed using maven plugins axistools-maven-plugin , cxf-codegen-plugin problem facing java files different wsdl's should go different packages. i have checked link : http://decimalsolutions.blogspot.in/2011/10/wsdl2java-maven2.html doesn't solve problem. how achieve this? the documentation states can use <extraarg> element pass in parameters wdsl java process . so, can configure cxf-codegen-plugin in following manner <configuration> <sourceroot>${project.build.directory}/generated-code/mywebservice</sourceroot> <wsdloptions> <wsdloption> <wsdl>${basedir}/src/main/resources/wsdl/serviceone.wsdl</wsdl> <extraargs> <extraarg>-p</extraarg> <extraarg>first.packagename</extraarg> </extraargs> </wsdloption

php - Putting breaks into a text written on a image -

Image
if write text on picture code below, code tries type text in 1 line. text overflows out of image in picture1. want write in picture2. if there function in php enables writting in picture2 it? if there no function that, how can writting code? can give me clue? $text = $_post['text']; // text comes form. $im = @imagecreate(700, 350) or die("cannot initialize new gd image stream"); $background_color = imagecolorallocate($im, 0, 0, 0); $text_color = imagecolorallocate($im, 233, 14, 91); imagettftext($im, 22, 0, 5, 25, $text_color, 'fonts/coolvetica rg.ttf', propertext($text)); imagepng($im, 'image.png'); picture1: picture2: put in bounding box using imagettfbbox() text wrap. there's full example on php.net: http://www.php.net/manual/en/function.imagettfbbox.php

ruby - Consolidate nested arrays and erase the subarrays that have been consolidated? -

i'm trying take bunch of number-word pairs , group words according common numbers. can match numbers, merge subarrays share number, , erase first of subarrays. when try delete second, error: "in block in <main>': undefined method []' nil:nilclass (nomethoderror)" the guilty line -- ary.delete_at(i+1) -- has been commented out. secondary problem: mrbtree not taking nested arrays input... ary = [[2.28, "cat"], [2.28, "bat"], [2.327, "bear"], [2.68, "ant"], [2.68, "anu"]] = 0 in 0 ... ary.size - 1 if ary[i][0] == ary[i+1][0] b = (ary[i]+ary[i+1]).uniq ary.delete_at(i) # ary.delete_at(i+1) c = [b.first], b.pop(b.length - 1) h = hash[*c] ary.push(*h) # mrbtree = multirbtree[c] end end puts ary.inspect output: # => [ # => [2.28, "bat"], # => [2.327, "bear"], # => [2.68, "anu"],

javascript - Refactoring WeatherSlider code -

i working weatherslider widget http://kreaturamedia.com/weatherslider-premium-jquery-weather-widget/ client’s intranet , refactor wrote facilitate readability. so far have: $(document).ready(function() { $('.ws-widget').weatherslider({ imgpath : 'includes/weatherslider/img/', cssanimations : true, jsanimations : true, snow : true, rain : true, wind : true, lightnings : true, //further options removed brevity wwoapikey : '3jwfoo7mk9ktvgrnsbythbar' }); }); $('ul li a').click(function() { var cityloc = $(this).attr("data-city"); if (cityloc == 'toronto') { var data = '<span class="ws-location">toronto, ontario, canada</span>'; $(".ws-widget").hide().html(data).fadein('fast'); $('.ws-widget').weatherslider({ imgpath : 'includes/weatherslider/

java - Flickering overlapped button - GWT -

this class implement simple pics display gwt project public class photosslideshow extends composite { private list<image> photos; private int curr; private absolutepanel mainpnl; private simplepanel centerpnl; private image n; private image p; private final int width = 800; public photosslideshow(final list<string> result) { curr = 0; photos = new arraylist<image>(); mainpnl = new absolutepanel(); this.initwidget(mainpnl); this.setstylename("slideshow"); centerpnl = new simplepanel(); string path = gwt.getmodulebaseurl() + "imageupload?src="; (string foto : result) { string url = path.concat(foto); image.prefetch(url); final image curr = new image(url); double ratio = getratio(curr); curr.setpixelsize(width, (int) (ratio * width)); curr.addmouseoverhandler(new mouseoverhandler() { @override public void onmouseover(mouseoverevent event

Rails and Validation -

i'm still (for have helped before) having issues validating data. the scenario i have 2 models - user , accommodation each user having 1 accommodation (has_one). able access logged in user using current_user. the problem when validate users upon registration works fine validation error messages displayed accordingly each validation rule. however, trying validate accommodations when entered , rails error page: unknown action the action 'show' not found accommodationscontroller but interestingly url has changed /accommodations//edit appears missing id accommodations id (i want divert edit if ok). i don't think it's validation rules more how handling redirection (which confusing me honest!). data saves correctly , redirects correctly if passes validation rules not sure how handle "non-save" gracefully. the code accommodation model class accommodation < activerecord::base belongs_to :user #validation rules validates :user_

meta boxes - wordpress metabox: how to divide one metabox in 2 or more -

Image
i have code <?php $prefix = 'wtf_'; $meta_box = array( 'id' => 'propertybox', 'title' => 'property listing details', 'page' => 'listings', 'context' => 'normal', 'priority' => 'high', 'fields' => array( array( 'name' => 'propert id number', 'desc' => 'enter property id number, if ', 'id' => $prefix . 'pid', 'type' => 'text', 'std' => '' ), array( 'name' => 'bath', 'desc' => 'number of bathrooms.', 'id' => $prefix . 'bath', 'type' => 'text', 'std' => '' ), array( 'name&#

osx - Postgres.app fails to start -

Image
i trying run postgres.app on os x 10.7.5. when run postgres.app error: the report follows: process: com.heroku.postgres-service [934] path: /applications/postgres.app/contents/xpcservices/com.heroku.postgres-service.xpc/contents/macos/com.heroku.postgres-service identifier: com.heroku.postgres-service version: ??? (???) code type: x86-64 (native) parent process: com.heroku.postgres-service [931] date/time: 2013-09-03 11:55:56.466 -0400 os version: mac os x 10.7.5 (11g63b) report version: 9 anonymous uuid: 3cf7d445-3eba-4d64-aa7e-ade812e0f3f0 crashed thread: unknown exception type: exc_bad_access (sigsegv) exception codes: kern_protection_failure @ 0x00007fff5fc01028 backtrace not available unknown thread crashed x86 thread state (64-bit): rax: 0x0000000000000055 rbx: 0x0000000000000000 rcx: 0x0000000000000000 rdx: 0x0000000000000000 rdi: 0x0000000000000000 rsi: 0x0000000000000000 rbp: 0x000

javascript - It worked in jquery 1.3.0 but it will not work on 1.10.1 -

the goal onclick change input , displayed price. code below works in jquery 1.3.0 not in 1.10.1. missing? if there better way please let me know. $(document).ready(function () { $("").click(update2); }); function update2() { var myprice = $("#price").val(); $('#displayprice').html('price: ' + myprice + ''); } html markup - <input type="hidden" name="price" id="price" class="item_price" value="$15.00"> </label> <div id="displayprice" name="displayprice" class="form_total">price: $25.00</div> <div class="xsshirt"> <input id="size5" class="product-attr-size" name="size" type="radio" value="xsmall" onclick="document.getelementbyid('price').value='$25.00'" /> <label for="xsmall"></label> </div&

jquery - Conditionally executing javascript & performance -

i've inherited project i'm seeing lot of conditional lines in coffeescript files such $ -> if $('#listing_address').length > 0 #javascript here which is, understand, executing following javascript if first finds #listing_address element on page. does have noticeable performance benefit? standard practice? should giving pages unique id, executing page's javascript on page needed? as @kevinb said, depend on code there's after. simple $('.x').show() ? if yes, doesn't matter. but instead of using style, i'd rather recommend use modules (like, commonjs modules) , require 1 page. believe you're using rails (because seems js code compilated), can use sprockets gems allow use files modules

c# - Upload a Single File to Blob Storage Azure -

how can upload file c# ? need upload file dialogwindow. using microsoft.windowsazure.storage; using microsoft.windowsazure.storage.auth; using microsoft.windowsazure.storage.blob; // retrieve storage account connection string. cloudstorageaccount storageaccount = cloudstorageaccount.parse("storagekey"); // create blob client. cloudblobclient blobclient = storageaccount.createcloudblobclient(); // retrieve reference created container. cloudblobcontainer container = blobclient.getcontainerreference("mycontainer"); // retrieve reference blob named "myblob". cloudblockblob blockblob = container.getblockblobreference("myblob"); // create or overwrite "myblob" blob contents local file. using (var filestream = system.io.file.openread(@"path\myfile")) { blockblob.uploadfromstream(filestream); } see here needed sdk , references i think it's need

vbscript - Presentations.Open requires PowerPoint 2007 to be open? -

i have macro runtest in powerpoint file test.pptm wish call using following vb script. works when script called on machine office 2010, script work office 2007 providing powerpoint application has been opened before calling script. i'd interested hear whether has experienced similar problem, or hear of potential solutions. option explicit on error resume next runprocess sub runprocess() dim pptapp dim pptpresentation set pptapp = createobject("powerpoint.application") set pptpresentation = pptapp.presentations.open("c:\test.pptm", true) pptapp.run "test.pptm!runtest" pptapp.quit set pptpresentation = nothing set pptapp = nothing end sub i resolved problem adding pptapp.visible = true after creating pptapp , before opening presentation.

apache felix - OSGI Pax logging -

i want write custom appender collect logs coming fuse.log in fuse container , relay them on scribe central log store. want add event listener in container. couldn't figure out how can that. went through pax logging code. couldn't figure out. suggestions appreciated. i wrote once blog post this, can found @ my blog . need create appender, tricky part in adding pax-logging in container via fragment bundle.

javascript - D3 SVG visualization using CSV data to style Topojson geometries -

i'm building visualization d3 in dynamically style svg elements according variable values i've imported csv file. my current approach looks this: import geometry data topojson file so: d3.json("geoms.json", function(error, data) { var path = d3.geo.path() .projection(projection.translate([0.5*width, 0.5*height])); svg.selectall(".map") .data(topojson.object(data, data.objects.map).geometries) .enter().append("path") .attr("id", function(d) { return "c_" + d.id; }) and import attribute data csv file , attach various values , associated classes/categories dom elements this: d3.csv("data.csv", function(data) { data.foreach(function(d) { d3.selectall("#c_" + d.iso_a3) .attr("name", d.name) .attr("area", parsefloat(d.area)) .attr("area_class", d.area_class) .attr(... in above s

moq - Autofixture: Using AutoMoqCustomization & SetupAllProperties to have all properties of a mocked interface fillled? -

i trying autofixture setup , create me anonymous of interface. using automoqcustomization, keep getting error. my code is var configuration = fixture.createanonymous<mock<iconfiguration>>(); mock.get(configuration).setupallproperties(); it errors on setupallproperties with system.argumentexception : object instance not created moq. parameter name: mocked anyone know doing wrong? you're trying mock<iconfiguration> mock<iconfiguration> instance, hardly necessary. use var configuration = fixture.createanonymous<mock<iconfiguration>>(); configuration.setupallproperties();

php - how to download 2000+ images to zip when loading web page -

This summary is not available. Please click here to view the post.

c# - Clicking Update in the EditCommandColumn of an ASP.NET DataGrid does not initiate the Click event defined in codebehind -

i have datagrid receives data several tables in entity data model.i used editcommandcolumn provide editing of data templatecolumns bound columns of function import stored procedure on database. here portion of .aspx code creation of asp:datagrid <asp:updatepanel id="gridupdate" runat="server" updatemode="conditional"> <contenttemplate> <div style="vertical-align: top; height:250px; overflow:auto; width:1800px;"> <asp:datagrid id="dgdeditq" runat="server" allowpaging="true" allowsorting="true" backcolor="antiquewhite" bordercolor="green" borderstyle="ridge" cellpadding="10" font-bold="true" font-size="large" width="1800px" height="250px" oneditcommand="dgdeditq_edit" oncancelcommand=&quo

asp.net mvc - ELMAH SqlErrorLog -

i using elmah catch unhandled exceptions in application. run custom code when elmah writes log entry. i created custom errorlog derived elmah.sqlerrorlog , set errorlog in web config files. namespace test.logging { public class mysqlerrorlog : elmah.sqlerrorlog { public mysqlerrorlog(string connectionstring) : base(connectionstring) { } public override string log(elmah.error error) { return base.log(error); //custom code } } } <errorlog type="test.logging.mysqlerrorlog, test" connectionstringname="elmah-sqlserver" /> it seems nothing happend. there no log record in database. anybody me? thanks advanced! don't know if ever fixed this. came across post when trying fix similar problem. turned out missing constructor. in case, think it's namespace that's wrong, namespace test.logging, not test. so, web.config line be: <errorlog type="test.l

processing - NPE in simple sketch -

i finding hard understand array objects. in case don't know why 'wal[i].walk();' considered null pointer exception. walker[] wal; int num= 70; void setup() { size(800, 600); wal = new walker[num]; background(255); } void draw() { (int = 0; < num; i++) { wal[i].walk(); wal[i].display(); } } class walker { int x, y; float r, g, b; walker(float red, float green, float blue) { x = width/2; y = height/2; r = red; g= green; b= blue; } void walk() { int choice = int(random(4)); if (choice == 0) { x++; } else if (choice == 1) { x--; } else if (choice == 2) { y++; } else { y--; } x = constrain(x, 0, width-1); y = constrain(y, 0, height-1); } void display() { stroke(r, g, b); point(x, y); } } then add filler text i'm being told have posted code amount of text have, though text above code sufficiently explains problem without b

java - Calling from wrong thread exception -

i trying develop application, uses threads implement slideshow. retrieving image path sqlite , displaying them on imageview. problem, got struck is, got confused , unable understand, thread calling images() method, implementing slideshow. i got logcat follows - 09-03 13:47:00.248: e/androidruntime(10642): fatal exception: thread-151 09-03 13:47:00.248: e/androidruntime(10642): android.view.viewrootimpl$calledfromwrongthreadexception: original thread created view hierarchy can touch views. 09-03 13:47:00.248: e/androidruntime(10642): @ android.view.viewrootimpl.checkthread(viewrootimpl.java:5908) 09-03 13:47:00.248: e/androidruntime(10642): @ com.example.fromstart.mainactivity.images(mainactivity.java:90) 09-03 13:47:00.248: e/androidruntime(10642): @ com.example.fromstart.mainactivity$2.run(mainactivity.java:59) 09-03 13:47:00.248: e/androidruntime(10642): @ java.lang.thread.run(thread.java:841) mainactivity.java: public class mainactivity extends activity

c++ - Window creation fails with non-NULL hMenu parameter -

in addition main window, i'm trying create top level window. problem when i'm setting second window's hmenu parameter non-null value, doesn't show up. e.g: this window shows (hmenu == 0) case idc_button_send_command: { createwindowexw(null, l"commandwindow", l"send command", ws_visible | ws_overlapped | ws_caption | ws_sysmenu | ws_minimizebox, 100, 100, 600, 400, null, (hmenu)0, (hinstance)getwindowlong(hwnd, gwl_hinstance), null); break; } this window doesn't show (hmenu == 4) case idc_button_send_command: { createwindowexw(null, l"commandwindow", l"send command", ws_visible | ws_overlapped | ws_caption | ws_sysmenu | ws_minimizebox, 100, 100, 600, 400, null, (hmenu)4,

java - screen signing document not appear, and event=ttl_expired -

hi, i've tried sign document using docusign's embedded signing feature, when send request, screen signing document doesn't appear, , redirects me page url parameter of event=ttl_expired . i know ttl (time-to-life) = 5 minutes url tokens, can please me? url tokens valid 5 minutes. if being re-directed screen has url parameter of event=ttl_expired means trying access signing workflow expired url token. when url tokens expire need generate new one. have seen docusign's api walkthroughs? there's 9 common use-cases of docusign's rest api , 1 of them embedded signing. each walkthrough has code showing how accomplish task in 6 different languages (php, javascript, java, c#, objective-c, python). see here walkhthroughs: http://iodocs.docusign.com/apiwalkthroughs for instance, since php easy run command line here working php program generate valid url token signing, taken embedded signing api walkthrough . enter credentials , valid template id

How to get an OpenLayers Vector Layer to always draw all features, regardless of zoom, range, etc? -

i have huge polygon (20km x 100km) , can't render @ zoom level greater 15 or so. it seems related zoom level, because have 20km , 100km lines drawn across screen sanity check. zooming in level 16, polygon , 100km lines disappear, 20km lines remain through level 17, disappear @ max zoom on level 18. have pretty basic vector layer default settings: var vectorlayer = new openlayers.layer.vector('my layer', { ratio: 10, alwaysinrange: true }); demo: http://jsfiddle.net/colllin/9xkbh/ put following script tag, placed somewhere after openlayers.js has been loaded (eg. on top of js fiddle): openlayers.renderer.svg.prototype.max_pixel = number.max_value; source: open issues on github

symfony - Event Subscriber postUpdate query is not updated -

i'm trying compare data on database before , after upgrade, in order perform operations. specifically: association: artist manytomany soundtrack. when remove artist record soundtrack, check if artist has been without associations, if true removes artist. public function postupdate(lifecycleeventargs $args) { $entity = $args->getentity(); $em = $args->getentitymanager(); if ($entity instanceof soundtrack) { //$this->difference contains difference between artists before , artists after change. if(!empty($this->difference)) { foreach($this->difference $m) { $art = $em->getrepository('acmeuserbundle:artist')->findartistbyidjoinsoundtrack($m); var_dump($art->getid()); } } } } query findartistbyidjoinsoundtrack(): public function findartistbyidjoinsoundtrack($id) { $qb = $this->createquerybuilder('a'); $query = $qb->s

excel - How do I write a code to copy data from one sheet to another when "x" is found and not duplicate -

i trying figure out how macro copy data 1 sheet titled used car log onto sheet titled used pending when x found in column l on used car log. if x found in column l need data in cells b through k (on row) copied onto used pending corresponding columns b through k. need find next blank row insert , need not duplicate data. appreciated! using excel 2007. the code below ask for, not more that. sets value in l column xx (instead of x) not copy data twice, , assumes x-es in l column in order, of course false assumption. sub copydata() dim run boolean dim integer = 1 run = true while run if worksheets("used car log").range("l" + cstr(i)).value = "x" worksheets("used pending").range("b" + cstr(i) + ":k" + cstr(i)).value = worksheets("used car log").range("b" + cstr(i) + ":k" + cstr(i)).value 'mark value copied setting value in column l xx worksheets("use

go - First goroutine example, weird results -

this example taken tour.golang.org/#63 package main import ( "fmt" "time" ) func say(s string) { := 0; < 5; i++ { time.sleep(100 * time.millisecond) fmt.println(s) } } func main() { go say("world") say("hello") } the output hello world hello world hello world hello world hello why world printed 4 times instead of 5 ? edit: answer can quoted golang specification : program execution begins initializing main package , invoking function main. when function main returns, program exits. not wait other (non-main) goroutines complete. when main function ends program ends, i.e. goroutines terminated. main terminates before go say("world") done. if sleep time @ end of main should see last world.

jquery - Removing or Disabling the search tools bar (or filer row) from grid -

i'm using jqgrid in project , since i'm new datagrid i'm taking jqwidgets here, i've used sorting, adding rows, deleting rows , filtering rows. code follow: // initialize jqxgrid $("#jqxgrid").jqxgrid( { width: 900, source: dataadapter, theme: theme, editable: true, height: 300, pageable: true, sortable: true, showfilterrow: true, filterable: true, rendergridrows: function(obj) { return obj.data; }, columns: [ { text: 'employeeid', editable: false, datafield: 'employeeid', width: 100 }, { text: 'first name', datafield: 'firstname', width: 100 }, { text: 'last name', datafield: &#

How to check if an XML element has a certain attribute with XSLT -

i've inherited xslt transformation project , first time using technology. have xml: <report> <data> <group> <row> <cell email="true"> <stuff>testing@testing.com</stuff> </cell> <cell> <stuff>not email</stuff> </cell> </row> </group> </data> </report> how can test in xslt see if cell has email attribute, and/or if attribute set? try //cell[@email] for xpath expresssion. use pattern in template contain instructions ... <xsl:if test=".[@email]"> <!-- structures generate / further processing --> </xsl:if> or <xsl:if test=".[@email = 'true']"> <!-- structures generate / further processing --> </xsl:if> the test expression may contain

php - Splash screen to disappear after index is visited for the first time -

well title sums everything: i have splash screen on index.php, have no idea how make disappear since dont want show each time index loaded. need hint not asking job done thanks in advance. you can use local storage or cookie save value checked in code before showing splash screen. can use php sessions, won't last long enough you're looking accomplish.

indexing - How does mongodb index lists -

for example: if had db collection called stores, , each store document has list of items sell, , stores share items, how mongodb build index on that? build btree index on possible items , on each leaf of tree (each item) reference documents contain it? background: i'm trying perform queries using index: db.store.find({merchandise:{$exists:true}}) // 'merchandise' list db.store.find()[merchandise].count() would index on 'merchandise' me? if not, option creating separate meta field on 'merchandise' size, , index that? schema: { _id: 123456, name: macys merchandise: [ 248651234564, 54862101248, 12450184, 1256001456 ] } from document sample if build index on merchandise multikey index , index on every item on array. see multikey indexes section in here . if merchandise array of subdocuments, indexing on merchandise put index on field of subdocument in array. index can make queries db.store.find("merchandise":248651234564

python - Manipulate CSV file 1 column into multiple - NFL scores -

working on nfl csv file can me automate scoring games. right now, can upload teams , scores 1 column of csv file. these in column a example: a 1 nyj 2 27 3 phi 4 20 5 buf 6 13 7 det 8 35 9 cin 10 27 11 ind 12 10 13 mia 14 24 15 no 16 21 or [['nyj`'], ['27'], ['phi'], ['20'], ['buf'], ['13'], ['det'], ['35'], ['cin'], ['27'], ['ind'], ['10'], ['mia'], ['24'], ['no'], ['21'], ['tb'], ['12'], ['was'], ['30'], ['car'], ['25'], ['pit'], ['10'], ['atl'], ['16'], ['jac'], ['20'], ['ne'], ['28'], ['nyg'], ['20'], ['min'], ['24'], ['ten'], ['23'], ['stl'], ['24'], ['bal'], ['21'], ['chi'], ['16'], ['cle'], [

google apps script - Jquery and ScriptDB connexion -

i novice developer, i'm working google apps script, , seems easy, have encountered problem, have database in scriptdb, have suggestion box jquery question if can connect scriptdb jquery or there bridge, helpful answers thanks! the "bridge" .gs code. takes jquery gives (from browsers js in htmlservice) , pass server function in .gs has access scriptdb.

c++ - std::bad_alloc error with SFML -

i working on project sfml involves lot of menus lot of buttons, creating functions take minimal input , automatically create , format these buttons. had working splendidly when function called constructed buttons parameters, want simplify take strings, used construct buttons, stored in vector. when tried doing this, recieved error: unhandled exception @ 0x76a7c41f in menu.exe: microsoft c++ exception: std::bad_alloc @ memory location 0x003cd0a0.. and pointed in dbgheap.c: (;;) { /* allocation */ here>>> pvblk = _heap_alloc_dbg_impl(nsize, nblockuse, szfilename, nline, errno_tmp); if (pvblk) { return pvblk; } if (nhflag == 0) { if (errno_tmp) { *errno_tmp = enomem; } return pvblk; } /* call installed new handler */ if (!_callnewh(nsize)) { if (errno_tmp) { *er

asp.net mvc - Is it possible to use Umbraco's admin login to secure an external MVC application -

i have umbraco website , mvc application , use umbraco login/administration secure mvc application. know how can this? thanks the latest versions of umbraco works right along side managing members membership, standard system.web.security. use umbraco 6 added after 4.1 think. brief summary of setting up. create login forms in umbraco using windows membership code in controller, (there many tutorials on internet). add member type in umbraco admin members section. set defaultmembertypealias member type in web.config. set public access clicking right on pages in umbraco admin content panel. login , should see member in members section. add code menu show , hide member pages. there nice nuget package code started: pm> install-package cws.umbraco.standard.membership

javascript - Storing form action URLs in a checkbox's value and making an AJAX request using that URL results in an inexplicable failure -

so, have flask app. right now, i'm trying make column of checkboxes on html table. when click "delete selected" button, it'll delete entries doing this: iterate through table , checked checkboxes. the value of checkbox url make request delete row. i make ajax request url taken value of checkbox. url in format /item_type/id id number. type of ajax request delete. each checked check box, make delete request url. though, fails when make these requests. don't know how status code http request. app's logs aren't showing 3xx, 4xx, or 5xx errors related url. however, if have alert before first request, succeed. though, if have single row checked, single request fail. after looking @ network tab, none of requests complete because reload page after making request. making page reload after request completed succeeds.

ios - Core Data - fetching object -

i have tableviewcontroller food names in it. when click on accessorybutton: - fetches object in row, open detailviewcontroller , pass in init method, string containing name of food object fetched. the detailviewcontroller let me edit name, , delegate ( detaildidsavetext:(nsstring *) )pass string value tableviewcontroller the tableviewcontroller in it's delegate implementation wants save value. if had create new object easy, create new managedobject , call nsentitydescription insertnewentityforname. but in case need edit object exists. how can that? how retrieve object editing ? ( know correct way pass object detailvc, i'm doing tests better learn core data, , love try way ) store reference object @property (nonatomic) food *fooditemtoedit; and set property when accessory button tapped - (void)tableview:(uitableview *)tableview accessorybuttontappedforrowwithindexpath:(nsindexpath *)indexpath { self.fooditemtoedit = [self.fetchedresultscontrol

Update MySQL: Duplicate unique key #1062 -

i have table this: create table if not exists `activity` ( `id` int(8) not null auto_increment, `action` tinyint(1) not null, `userid` int(8) not null, `categoryid` int(8) not null, primary key (`id`), unique key `unique` (`userid`,`categoryid`), key `categoryid` (`categoryid`) ) engine=innodb default charset=utf8 collate=utf8_unicode_ci auto_increment=2 ; with next information: insert `activity` (`id`, `action`, `userid`, `categoryid`) values (1, 2, 11, 312); i'm trying execute query: update `activity` set `action` = '3' `userid` = '11' , `categoryid` = '312' ; and response me that: duplicate entry '11-312' key 'unique' i don't know why. ain't changing unique keys or inserting new record. problem? thanks. i don't know why, when export whole database, instead of show before sql, show this: create table if not exists `activity` ( `id` int(8) not null auto_increment, `action` tinyi

PHP cURL same HTML element -

this question has answer here: how parse , process html/xml in php? 27 answers i want output third element same html element. know how output div or span id or class have no idea how output same html element. thought p[1] doesn't work. i know there lot of answered questions never explained how output same html element without class or id . website : http://localhost/ <p>example</p> <p>example1</p> <!-- want take 1 --> <p>example2</p> ------------------- php script : <?php $curl = curl_init('http://localhost/'); curl_setopt($curl, curlopt_returntransfer, true); $code3 = curl_exec($curl); curl_close($curl); $code = '/<p>(.*?)<\/p>/s'; $code6= preg_match($code, $code3, $code4); echo $code4[1] ?> /* doesn't work .. ph

spring - Connection get/return listener? -

using hibernate , spring, app needs opportunity manipulate connection @ start , end of every database update. our first guess override transaction manager, seeming have side effects intermittent "pre-bound jdbc connection found!" error few other harder describe symptoms. what best/easiest way oppostunity. saw suggest overriding data source , wrapping connection, best idea? wrapping connection seems dangerous, espceially since websphere has it's own version (wsconnection). ideas? manipulation of connection done easiest when datasource.getconnection done, way know going happen. create datasourceproxy/-wrapper (give name) this. there 1 thing have take care of , is, on close of connection, undo manipulation (if needed is). instead of creating proxy use aop execute code (like in this answer .

java - XMLPullParser Unexpected token -

i trying parse xml located on remote server using xmlpullparser on android. following exception thrown: org.xmlpull.v1.xmlpullparserexception: unexpected token (position:text @1:2 in java.io.inputstreamreader@4113ab20) the xml file begins this: <arrayofmoney xmlns="http://schemas.datacontract.org/2004/07/demo.samples" xmlns:i="http://www.w3.org/2001/xmlschema-instance"> and here code using parse it: defaulthttpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(url); // response httpresponse httpresponse = httpclient.execute(httppost); httpentity httpentity = httpresponse.getentity(); string xmlcontent = entityutils.tostring(httpentity); // create xmlpullparser instance xmlpullparserfactory factory = xmlpullparserfactory.newinstance(); factory.setnamespaceaware(true); xmlpullparser parser = factory.newpullparser(); parser.setinput(new stringreader(xmlcontent)); int eventtype = parser.geteventtype(); while (eventtyp