Posts

Showing posts from September, 2015

c# - Are delegates created via lambda expressions guaranteed to be cached? -

it seems working way, stated somewhere in spec or implementation detail can't depend on? i'm trying speed property/field name extraction faster creating expression tree once , caching it. wrapping tree in lambda , using key cache. , break down miserably if runtime decides create new delegate every time hits same lambda expression. // keyvaluepair<string, t> getpair<t>(func<expression<func<t>>> val)... var item = new item { num = 42 }; var pair = getpair(() => () => item.num); // guaranteed same instance? // pair.key = "num" // pair.value = 42 edit: ok, here full thing. seems works , doesn't seem generate garbage in process. another edit: ok, changed it, doesn't seem capture anything, , works faster! using system; using system.diagnostics; using system.linq.expressions; using system.runtime.compilerservices; class program { static void main(string[] args) { var pair = new pair<int>();

c - sscanf() double showing zeros -

i'm having troubles sscanf() function read doubles. have comma separated text file this: abc,def,0.465798,0.754314 ghi,jkl,0.784613,0.135264 mno,opq,0.489614,0.745812 etc. so first line fgets() , use sscanf() 2 string , 2 double variables. fgets(buffer, 28, file); sscanf(buffer, "%4[^,],%4[^,],%lf[^,],%lf[^\n]", string1, string2, &double1, &double2); printf("%s %s %f %f\n", string1, string2, double1, double2); but output is: abc def 0.465798 0.000000 ghi jkl 0.784613 0.000000 mno opq 0.489614 0.000000 so somehow doesn't scan last float. i've tried %lf[^ \t\n\r\v\f,] , %lf still doesn't work. change "%4[^,],%4[^,],%lf[^,],%lf[^\n]" to int result; result = sscanf(buffer, "%4[^,],%4[^,],%lf,%lf", string1, string2, &double1, &double2); if (result != 4) // handle error notice & on double1 , double2 - likley typo. also strongly recommend check result 4. not checking sscanf(

wordpress - Get images used in, but not attached to page? -

i want of images used in page. code i'm using: function get_page_images($id) { $photos = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'asc', 'orderby' => 'menu_order id') ); $results = array(); if ($photos) { foreach ($photos $photo) { // correct image html selected size $results[] = wp_get_attachment_image($photo->id, $size); } } return $results; } this gets images uploaded page, if have reused image uploaded different page/post, aren't retrieved (as attached post uploaded to, not posts reused in). know way all images used in page/post? use built-in php dom parser grab images located in content. code untested, should started in right direction: <

php - Select element from other table on the form zf2 -

i have 2 table manytoone relation on database between client , sale , want select id_client on sale form . o used . saleform : public function __construct(clienttable $table) { parent::__construct('vente'); $this->setattribute('method', 'post'); $this->clienttable = $table; $this->add(array( 'name' => 'id', 'attributes' => array( 'type' => 'hidden', ), )); $this->add( array( 'name' => 'id_client', 'type' => 'select', 'attributes' => array( 'id' => 'id_client' ), 'options' => array( 'label' => 'catégory',

camera - code work on android 4.1 but don't on 4.2 (possible?) -

i'm writing application record video front camera. possible app can't work on android 4.2? i've tried tablet 4.1.1, customer says not work in tablet. this code related recording: //create surface view public void surfacecreated(surfaceholder holder) { mcamera= camera.open(1); setcameradisplayorientation( this, 1, mcamera); viewgroup.layoutparams params = msurfaceview.getlayoutparams(); parameters parameters = mcamera.getparameters(); list<size> sizes = parameters.getsupportedpreviewsizes(); params.width = (sizes.get(0).width / 4); params.height = (sizes.get(0).height / 4); msurfaceview.setlayoutparams(params); } i things error in code edit i have insert lot of log... app freezing when stopping recorder. call on trycatch.. try{ appendlog(&

node.js - REFERENCE KEY in node-orm2 -

i working on rest api based on node.js , chose postgresql database store data. suppose database has 2 tables names user , comment . comment belongs 1 user , when decide remove user , comment 's of him/her must removed. so, designed table follows: create table user( user_id serial, username varchar(32) not null, password varchar(32) not null, constraint pk_user primary key (user_id), constraint uq_user unique (username) ) create table comment( comment_id serial, user_id integer not null, content text not null, constraint pk_cmnt primary key (comment_id), constraint fk_cmnt foreign key (user_id) references user(user_id) on update cascade on delete cascade ) but don't run code , use node-orm2 instead. designed 2 simple models handle simple code: var user = db.define('user', { username: { type: 'text', size: 32, // varchar(32) required: true, // not null unique: true

command line - Python: find current directory of remote "cmd.exe" processes -

i write script among other things erases directory using shutil.rmtree i have ensure no "cmd.exe" opened in directory (and blocking me erasing directory). i can killing "cmd.exe" on remote computer: process_name = "cmd.exe" computer_name = "atacama6" try: subprocess.check_call('taskkill.exe /s {} /u admin1 /p abc$ /im {}'\ .format(computer_name, process_name)) except subprocess.calledprocesserror: # no matches found - thats ok! pass but afraid of killing "cmd.exe" processes opened in other directories , need run. how can kill ones opened in specific directory?

Semantic Web-rdf-Workers' projects and used computers in a company according to years -

i want sesame rdf database workers in company. workers involved in projects in date range. have computers. after database, must able search database according computers used people or people worked in projects in past or now. so, cant decide how order attributes of worker, company, project, computer because dont know place attribute year . example, workers' past companies or past projects... how can place year in rdf file below? didnt place year in file in proper way, think. because start , end dates should defined in way or date range? after how search sparql find people working in special project or before now? or people using same computer in different years? <rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:worker="http://www.semantic.fake/worker#" xmlns:company="http://www.semantic.fake/company" xmlns:project="http://www.semantic.fake/project"> <rdf:description rdf:about="http://www.semantic

tomcat - Continuous Delivery with Grails -

background: my team has been using jenkins run our continuous integration (ci) our grails applications. trying move closer continuous delivery setting deployment pipeline , having push button deployments multiple environments (dev, itg, prod). have tried use jenkins tomcat plugin deploy our code have run occasional permgen issues on tomcat , have manually restart after deployment. questions: is jenkins right tool use automated deployments grails? how can automate deployment tomcat without having manually restart afterwords? i don't think can if jenkins "right" tool, one. when hot-deploy tomcat, permgen inevitably grow. restart easiest way handle this. see other questions what makes hot deployment "hard problem"? more information. can use post build task run shell script on jenkins server deploys war , restart tomcat.

css3 - Pure CSS scrolling UL LI table with fixed header -

i'm trying implement pure css scrolling ul-li table fixed header. my requirements: using table css (table, table-row, table-cell, table-header-group...) all cells have list items (li) header has fixed when table content scrolling when table column changes width, appropriate header width should changed currently have html: <ul class="testtable"> <div class="testheader"> <li class="testrow"> <span>id</span> <span>name</span> <span>description</span> <span>other details 1</span> <span>other details 2</span> </li> </div> <div class="testbody"> <li class="testrow"> <span>1</span> <span>2</span> <span>3</span> <span>4</span>

python - Data import from excel breaking up the values -

taking data excel spreadsheet fourth column fourth_column = [32.86667, 34.08333, 39.0, 36.63333, -13.2, 30.8, 14.3] these values latitude , similar values longitude. wondered if there easy way running them each separately through code 1 after other, setting latitude equal take each value in turn. for value in fourth_column: do_something(value)

c++ - Unpacking msgpack to an arbitrary object, without msgpack_define -

i'm working on body of code deals custom string implementation rather std::string (long story various reasons has used) refer "string" here on. i able pack string without issue using "raw" type pack raw char bytes , size i'm having problems unpacking it. i able manually unpack shown below. // before i've unpacked point following object has string msgpack::object_kv& kv = obj.via.map.ptr[0]; // kv.key == string want string key = string(key.via.raw.ptr, key.via.raw.size); // works but want use built in >> operator or .as template function , haven't been able manage it. don't have access modify string class add msgpack_unpack function nor add msgpack_define i tried creating struct , giving msgpack_unpack function, apparently calls msgpack::object::implicit_type compiler replies error: 'struct msgpack::object::implicit_type' private and can't figure out way of getting msgpack::object out of "implicit_type&

php - cURL returns same results with different query -

curl returns same results different query ajax. if copy query in url field of browser, works , returns correct results. test.php <?php header("content-type: text/html; charset=iso-8859-1"); curl_setopt($c, curlopt_fresh_connect, 1); // don't use cached version of url $query = $_get['query']; $source = $_get['source']; $startdate = $_get['startdate']; $enddate = $_get['enddate']; if($query != ""){ $query = '%20and%20' . $query ;} $req = '...:['. $startdate .'t00:00:00z%20to%20'. $enddate .'t00:00:00z]%20and%20origin:'. $source . $query; $curl1 = curl_init($req); curl_setopt($curl1,curlopt_fresh_connect, true); curl_setopt($curl1,curlopt_returntransfer, true); $result = curl_exec($curl1); echo $result; script.js $.ajax({ url : 'test.php', type: 'get', datatype: 'json',

c# - Method must have a return type on an InitializeComponent() method -

i have partial public class namespace bugnetwpf { public partial class reportscreen_idrangereport : page { public generatereport(mainwindow mainwindow) { initializecomponent(); } } } the error saying method must have return type, ideas how fix this? what else saying return type true, i'm guessing want: namespace bugnetwpf { public partial class reportscreen_idrangereport : page { public reportscreen_idrangereport(mainwindow mainwindow) { initializecomponent(); } } } the constructor needs have same name class.

Error creating folder in google drive through ruby -

i'm having trouble creating folder in google drive using google-drive-api library in ruby. can log in, list folders, add file root folder. have folder called 'applications' under root folder. listing files show id folder, lets call "0bwivxebt'. in controller init google drive connection (as i'm able list files) , call create_parent('test') method in google_drive_connection.rb: def create_folder (title) file = @drive.files.insert.request_schema.new({ 'title' => title, 'description' => title, 'mimetype' => 'application/vnd.google-apps.folder' }) file.parents = [{"id" => '0bwivxebt'}] # 0bwivxebt id applications folder media = google::apiclient::uploadio.new(title, 'application/vnd.google-apps.folder') result = @client.execute( :api_method => @drive.files.insert, :body_object => file, :media => media, :parameters => {

php - Jquery form post errors -

i new in jquery. i'm working on form. title , text (textarea) when fill out fields , click send, 2 alerts appear when click ok 2 times scroll page up. fill in fields , starts again beginning. how can ensure after 2 checks continues page? jquery: $("#formpages").submit( function(event) { var title = $('#title').val(); var text = $('#text').val(); if(title == ''){ $("#titleerror").html("<p>fill title</p>"); alert('title empty'); } if(text == ''){ $("#texterror").html("<p>fill text</p>"); alert('text empty'); } $("html, body").animate({ scrolltop: 0 }, 600); event.preventdefault(); }); form: <form class="form" id="formpages"> <div> <label class="title"

html - Separate CSS for label checkbox to label input -

i have used label both input textboxes: <label for="username">username</label> <input id="username" type="text" value=""> and checkboxes/radioboxes <label for="live">system live</label> <input id="live" name="live" type="checkbox" value="false"> the trouble have how specify different css labels different input types. if generic label css: label { color: #00a8c3; line-height: 20px; padding: 2px; display: block; float: left; width: 160px; } i find either end unaligned checkboxes or badly positioned textboxes. you add classes labels. example: <label for="username" class="textbox-label">username</label> <input id="username" type="text" value=""> <label for="live" class="checkbox-label">system live</label> <inpu

app store - iTunes Connect Autoingestion.class doing nothing -

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

css - DIVs Failing to Align Properly -

i trying align 2 divs side side. image on left, text on right first item. text on left, image on right second item. , image on left, text on right third item. it works first , third items. second item fails align. have done wrong? <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> <style type="text/css"> .container { padding: 5px; background-color:#66c; } .imagecontainer { margin: 0 25px 0 0; float: left; height: 301px; width: 301px; background-color:#0cc; position:absolute; margin-bottom: 50px; } .imagecontainerrt { margin: 0 0 0 0px ; float: left; height: 301px; width: 301px; background-color:#0cc;

python - Scrapyd init error when running scrapy spider -

i'm trying deploy crawler 4 spiders. 1 of spiders uses xmlfeedspider , runs fine shell , scrapyd, others use basespider , give error when run in scrapyd, run fine shell typeerror: init () got unexpected keyword argument '_job' from i've read points problem init function in spiders, cannot seem solve problem. don't need init function , if remove still error! my spider looks this from scrapy import log scrapy.spider import basespider scrapy.selector import xmlxpathselector betfeeds_master.items import odds # parameters myglobal = 39 class homespider(basespider): name = "home" #con = none allowed_domains = ["www.myhome.com"] start_urls = [ "http://www.myhome.com/oddxml.aspx?lang=en&subscriber=mysubscriber", ] def parse(self, response): items = [] tracecompetition = "" xxs = xmlxpathselector(response) oddsobjects = xxs.select("//oo[odd

c# - What could cause this memory issue? -

Image
i'm working on app windows phone 8, , i'm having memory leak problem. first background. app works (unfortunately) using webbrowsers pages. pages pretty complex lot of javascript involved. the native part of app, written in c#, responsible doing simple communication javascript(e.g. native delegate javascript communicate server), make animation page transition, tracking, persistance, etc. done in unique phoneapplicationpage. after had crashes out of memory exceptions, started profiling app. can see webbrowsers, big part of the app, being disposed correctly. problem i'm seeing memory continues increase. what's worse, have little feedback profiler. understand, profiler graph says there big problem, while profiler numbers there's no problem @ all... note: step represents navigation webbrowser webbrowser. spike created (i suppose) animation between 2 controls. in span i've selected in image, doing navigation forward , 1 backward having maxium of 5 web

c++ - libc++abi.dylib: terminate called throwing an exception -

exercise 4-6 of accelerated c++ wants me write program reads in , calculates student's overall grade. have following code: // source file student_info-related functions #include "student_info.h" #include "grade.h" using std::istream; using std::vector; using namespace std; bool compare(const student_info& x, const student_info& y) { return x.name < y.name; } istream& read(istream& is, student_info& s) //void read(istream& is, student_info& s) { double midterm, final; // read , store student's name , midterm , final exam grades >> s.name >> midterm >> final; std::vector<double> homework; read_hw(is, homework); // read , store student's homework grades s.grade = grade(midterm, final, homework); cout << "name is: " << s.name << endl; /// cout << "midterm is: " << midterm << endl; /// cout <&l

Excel VBA: How to Unfilter Only One Autofilter Range at a Time? Code Provided -

thanks coming thread. what have: -a report autofilter on rows a:g what need: -circumstantial code unfilters specific column if there filter on it. -running code below unfilters entire range of a:g. -in instance, want "f" unfiltered, leaving other filters alone if filtered. with sheets("data") if .range("f1").autofilter = true activesheet.range("$a$1:$g$59826").autofilter field:=6 else end if end any , ideas appreciated! thank much! try this: sub unfilter() dim ws excel.worksheet set ws = worksheets("data") ws if .autofiltermode = true if not intersect(.autofilter.range, .range("g1")) nothing .range("$a$1:$g$59826").autofilter field:=.range("g:g").column end if end if end end sub this line in code: if .range("f1").autofilter = true ... turns off filtering whole sheet. instead code checks if sheet filtered

Spring Batch 'RunIdIncrementer' not generating next value -

i have several spring batch (2.1.9.release) jobs running in production use org.springframework.batch.core.launch.support.runidincrementer . sporadically, following error: org.springframework.batch.core.repository.jobinstancealreadycompleteexception: job instance exists , complete parameters={run.id=23, tenant.code=xxx}. if want run job again, change parameters. @ org.springframework.batch.core.repository.support.simplejobrepository.createjobexecution(simplejobrepository.java:122) ~[spring-batch-core-2.1.9.release.jar:na] @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) ~[na:1.6.0_39] @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39) ~[na:1.6.0_39] @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25) ~[na:1.6.0_39] @ java.lang.reflect.method.invoke(method.java:597) ~[na:1.6.0_39] @ org.springframework.aop.support.aoputils.invokejoinpointusingreflection(aoputils.java:318) ~[spri

php - Singleton database class method -

i'm trying write query() method singleton database class. have ain't flying yet , looking inspiration. <?php class database { static private $instance = null; protected $mysqli; static public function getinstance() { if (null === self::$instance) { self::$instance = new self; } return self::$instance; } private function __construct(){ if(!$this->mysqli = new mysqli('localhost','user','pass','db')) throw new exception('error - database connection'); } public function query($query) { while ($this->mysqli->query($query)) { $row = $this->mysqli->fetch_assoc(); } return $row; // loop through array } private function __clone(){} } ?> i'm not entirely sure if i'm going down correct road. mysqli work in context? instance mysqli class has query() method part of class. i'm introducing namespace clashes here? my query method

debugging - GDB an ELF File Under Win32 -

i wanted study elf relocation mechanism, assembled x86 assembly program using nasm produce elf file, under win32. used mingw32's gdb debug it. loaded nicely , view program using "list" command. however, couldn't run it. got following messages: starting program: c:\projects\nasmprojects\test01\hello.o error creating process c:\projects\nasmprojects\test01\hello.o is there way around this? is there way around this? no. first, have assembled relocatable object file (of type et_rel ). there no os "run" such files -- oses support executing elf files, require linked executable (of type et_exec or et_dyn ). second, if manage link et_exec , still need os know how load , start executing such file. linux , solaris kernels know this, aix , windows kernels not .

php - Showing link of which random swf was opened -

i'm new php , seems i'm asking code in reality want know how implement link along random selector. my code: <?php $imglist=''; //$img_folder variable holds path swf files. // see dont forget "/" @ end $img_folder = "../files/flash/"; mt_srand((double)microtime()*1000); //use directory class $imgs = dir($img_folder); //read files directory, ad them list while ($file = $imgs->read()) { if (preg_match("/\.swf$/i", $file)) $imglist .= "$file "; } closedir($imgs->handle); //put images array $imglist = explode(" ", $imglist); $no = sizeof($imglist)-2; //generate random number between 0 , number of images $random = mt_rand(0, $no); $image = $imglist[$random]; //display random swf echo '<embed src="'.$img_folder.$image.'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="650" height

javascript - Parse JSON and add markers to google map -

i trying parse json data , transform google map markers, problem still getting error: unexpected non-whitespace character after json data function initialize() { var mylatlng = new google.maps.latlng(-35.889050,-64.735108); var mapoptions = { zoom: 4, center: mylatlng, maptypeid: google.maps.maptypeid.roadmap } var map = new google.maps.map(document.getelementbyid('map_canvas'), mapoptions); var jsonarch = '{ "codigo" : "3127" , "nombre" : "name" , "zona" : "3127" , "geox" : "-58.443597" , "geoy" : "-34.807164" },{ "codigo" : "3128" , "nombre" : "name" , "zona" : "3128" , "geox" : "-58.488797" , "geoy" : "-34.576852" },{ "codigo" : "3124" , "nombre" : "name" , "zona" : "3124" , &quo

excel - More efficient way to write this script -

i printing lot of excel charts using vba. @ point have ~35 sheets print from, i'm wondering if there's script easier modify 1 working with. sheets("euro graph").select activesheet.chartobjects("chart 1").activate activechart.plotarea.select activechart.pagesetup.rightheader = "nominal lcu" activechart.pagesetup.rightfooter = "&d &t" activechart.pagesetup.centerfooter = "&a" activechart.pagesetup.leftfooter = "&z&f" selection.width = 921 selection.left = 23 selection.top = 61 selection.height = 550 activewindow.selectedsheets.printout copies:=1, collate:=true so works fine. each chart want print first select sheet, , activate chart want print referring chart number. there efficient way change chart printing specs (like changing header/footer) without manually having change every block of code use each chart? edit: remove lot lines , have sheets("euro graph").select activesheet.

Visual Studio Error display -

Image
how can errors in visual studio displayed in image: instead of using error list? the exceptions displayed this: (the images from: how tell debugger ignore breaking on thrown exceptions? , where did visual studio exception assistant go? ) if under tools | options in debugging | general node, sure "enable exception assistant" checked.

c# - How to compile and add the form designed by user to a project -

Image
i going let users create forms during runtime , add them project. have done designing , ui of form of open source form designer . here image of form designer : lets assume have form1.cs , form1.cs[designer] files enough winform . how compile dll or exe , add project? ideas? clues? thanks!! edit it creates code. public partial class form1 : form { public form1() { initializecomponent(); } private system.windows.forms.button button1; private system.windows.forms.textbox textbox1; private system.windows.forms.checkbox checkbox1; private void initializecomponent() { this.button1 = new system.windows.forms.button(); this.textbox1 = new system.windows.forms.textbox(); this.checkbox1 = new system.windows.forms.checkbox(); this.suspendlayout(); // // button1 // this.button1.location = new system.drawing.point(71, 49); this.button1.name = "button1";

java - How to get an AdminClient Websphere object without using a username or password ? -

i use following code , works: properties props = new properties(); props.setproperty(adminclient.connector_host, "localhost"); props.setproperty(adminclient.connector_port, port); //2809 props.setproperty(adminclient.connector_type, adminclient.connector_type_rmi); props.setproperty(adminclient.connector_security_enabled, "true"); props.setproperty(adminclient.username, user); props.setproperty(adminclient.password, password); adminclient = adminclientfactory.createadminclient(props); but i'd find way not use user name or password, have idea how achieve this? maybe j2c authentication alias of used here? the alternative have (as far aware) configure soap.client.props username/password , run wsadmin script without connection/authentication information. in scenario, can leverage websphere's ability protect password within properties file. there 2 caveats scenario though. if utilize soap.client.props in websphere profile, running wsadmin le

elisp - A quick way to repeatedly enter a variable name in Emacs? -

i typing in sort of code nth time: menu.add_item(spamspamspam, "spamspamspam"); and i'm wondering if there's faster way it. i'd behavior similar yasnippet's mirrors, except don't want create snippet: argument order varies project project , language language. the thing that's constant variable name needs repeated several times on same line. i'd type in menu.add_item($,"") and point between quotes, call shortcut , start typing, , exit c-e . this seems advantageous me, since there's 0 cursor movement. have idea of how this, i'm wondering if it's done, or if better/faster can done. upd yasnippet way after all. thanks thisirs answer. indeed yasnippet code had in mind: (defun yas-one-line () (interactive) (insert "$") (let ((snippet (replace-regexp-in-string "\\$" "$1" (substring-no-properties (delete-and-extract-region

javascript - How do I remove checked nodes from a Kendo TreeView? -

here's configuration: $(function() { var data = new kendo.data.hierarchicaldatasource({ transport: { read: { url: "../api/notifications/byuserid/10078261", contenttype: "application/json" } }, schema: { model: { children: "notifications" } } }); $("#treeview").kendotreeview({ datasource: data, loadondemand: false, checkboxes: { checkchildren: true }, datatextfield: ["notificationtype", "notificationdesc"] }); }); on click event of button "delete," want remove of nodes checked. $(document).ready(function() { $('#btndelete').click(function() { var treeview = $('#treeview').data("kendotreeview"); var selectednodes = treeview.select(); //here's im not s

c# - Add new winforms into a big application after shipping to the customer -

lets assume have developed , shipped application many customers. add new screens application without removing , re-installing customers computers entire application. want send dll or exe file customer, put file , place application folder. application find , recognize dll or exe , let user use winform ? how can that? please give me idea? professional , complete solution mef if want simple, use assembly.loadfrom(filepath) , iterate types in it. check if type derived system.windows.forms.form (you should use typeof(form).isassignablefrom(loadedtype))

spring - Am I using @ModelAttribute wrong in my Controller? -

for years have been using @modelattribute create , initialize command object so: @requestmapping() public string somehandler(@modelattribute("formbean") formbean formbean) { // } @modelattribute("formbean") public formbean createformbean() { formbean formbean = new formbean(); // sort of initialization return formbean; } in example, have handler in controller needs formbean, , "create" method gives 1 if 1 isn't in model (or session, if using @sessionattributes). so, when somehandler() method ran, formbean there , populated because createformbean() had ran. however, colleague claiming that, although works fine, misusing @modelattribute purpose wasn't intended for, namely in creation of command object. in interpretation the javadoc , should use @modelattribute create static data, items used populate dropdown list or such. i know works creating , initializing command object quite well, using purpose not intended for? breaking c

hadoop - Does combiner runs conditionally -

min.num.spills.for.combine (default 3) what signify? a) min no. of map spills have combiner run? though have specified combiner, not guaranteed run? b) min no. of spills have before combiner runs on merged/sorted single file created via io.sort.factor. each time new file created merging, combiner runs onto it, provided no. of spills min 3 i feel correct answer a) , can confirm that. when map function generate intermediate result , first sent them buffer, partitioning , sorting start , , if combiner specified, invoked @ time. process in parallel map function. when map function finishes, spills on disk merged, , combiners invoked @ time too. the buffer threshold limited io.sort.spill.percent , during spills created. if number of spills more min.num.spills.for.combine , combiner gets invoked on spills created before writing disk. so answer question: right choice a) . ref : this mail thread.

c# - How can I put unescaped XML into the XmlText field for a class? -

i have class want put xml (html, actually) unescaped. not conform specification since can arbitrary html. how can achieve declaratively? ex: public class material { [xmlelement(elementname = "mattext")] public string materialtext { get; set; } public bool shouldserializematerialtext() { return !string.isnullorempty(materialtext); } } if put: <p>test</p> materialtext , produces &lt;p&gt;test&lt;/p&gt; in it's serialized output. how can modify produce string literal xml instead of escaped sequence? to clear, output i'm looking is: <mattext><p>test</p></mattext> btw - isn't first choice, else's schema must, unfortunately, adhered to. thanks! if cannot use cdata section, have use following workaround: public class material { [xmlignore] public string materialtext { get; set; } [xmlelement(elementname = "mattext")] public xml

xamarin.ios - Can not log into sandbox by test account on iOS -

i implementing in app purchases app. logged out appstore, created test accounts, have not verify e-mail. , every time tried log in sandbox app-purchase got transaction error. btw product info restored correctly. looking notice after attempt log in, appstore account setting in device filled info test account! think tries log in real appstore instead of sandbox. what doing wrong? why test accounts tries login real appstore , how fix it? to know if you're in sandbox environment or not, can have @ purchase popup. if can read "[sandbox environment]" @ bottom, means you're using sandbox. otherwise, you're using real appstore (but i'm pretty sure it's not case since automatically chosen device). anyway, seems apple sansbox environment experiencing problems today. example, have app dealing correctly inapp purchase yesterday. today, retrieving skproducts ok. i recommend patient until problem fixed apple.

html - Python: Write an entire file to another file after a specific line that meets a particular condition -

i'm working on python script when run cobble text different files can create alternative versions of website compare different designs , make sure have same inherent data, viz. menu items consistent across versions. one specific problem area making sure menu, cornucopia of different meals, same. therefore i've made function: def insert_menu(): open("index.html", "r+") index: open("menu.html", "r+") menu: in index: if "<!-- insert menu here -->" in i: j in menu: index.write(j) however, doesn't behave way want because have been unable find way extract need other answers here on stack overflow. in it's current state append text have stored in menu.html @ end of index.html . i want write text in menu.html below line, in index.html (but not @ same line number, therefore ruling out option of writing @ specific line) , con

what practical purpose does Android NDK serve? -

i trying understand why want use ndk feature in android programming? c++ important learn android ? the 3 (and perhaps fourth) main reasons are: performance . critical inner loops marginal performance advantage of c/c++ on java, before in time compilation (jit) available in android compiler, may decisive factor. to use existing c/c++ libraries . reasoning here pretty obvious. to ndk allows java api can't manage . low level operations close hardware, particularly touch manufacturer-specific hardware, might possible through c/c++ as yojimbo suggested, obfuscation . it's more difficult reverse engineer compiled machine code java byte code, though should never count on security obscurity. having said that, should sure need ndk before decide use it. testing , maintenance costs of ndk code higher equivalent java.

VBA function to include CDATA -

i have following function include cdata: function cdatasection() dim objdom domdocument dim objkmlrootelement ikmldomelement dim objkmlelement ikmldomelement dim cdata ikmldomcdatasection set objdom = new domdocument set objkmlrootelement = objdom.createelement("balloonstyle") objdom.appendchild objkmlrootelement set objkmlelement = objdom.createelement("text") objkmlrootelement.appendchild objkmlelement set cdata = objdom.createcdatasection("text") cdata.data = "<![cdata[<b>latitude = $[latitude]</b>?]]>;" end function when run above, getting error "user defined data type not found" function. yes ripster says find library reference. vba window tools>references for list of relevant references see... http://msdn.microsoft.com/en-us/library/windows/desktop/ms763701%28v=vs.85%29.aspx however, if have hard time tracking down reference, replace dim sta

javascript - Use superscript in d3 -

how use superscript in d3? have following code: var counter = 2; textnode.text("event" + counter);// want counter superscript should use: textnode.style(args); to add superscripts? use select tag , use text set text d3.select('sup').text("event" + counter) or if need create d3.select('body').append('sup').text("event" + counter)

AngularJS Directive to Modify ng-bind and Add Ellipsis -

i've made angularjs directive add ellipsis overflow: hidden text. doesn't seem work in firefox, , don't believe i've structured possible. flow is: add directive attribute html element directive reads ng-bind attribute scope directive watches changes ng-bind in link function on ng-bind change, directive fancy calculations determine text should split , ellipsis added (i've not included code here, assume works) directive sets element's html equal new string, not touching ng-bind html <p data-ng-bind="articletext" data-add-ellipsis></p> directive app.directive('addellipsis', function(){ return { restrict : 'a', scope : { ngbind : '=' // full-length original string }, link : function(scope, element, attrs){ var newvalue; scope.$watch('ngbind', function () { /* * code

Excel VBA, Custom Class: Function call raises "method not supported" error -

i writing first classes. 1 ccrelist collection of ccre instances (some specialized events). i want there sub or function inside ccrelist load cre's worksheet 1 big collection can work with. created function , worked ok when called normal code module, tried move code class. having trouble calling function loadfromworksheet(myws worksheet). the error "object not support property or method". have tried making sub, function, making public, not public, have tried turning property let instead of sub. have flimsy grasp on does. have tried call crelist.loadfromworksheet(myws) and crelist.loadfromworksheet myws same error every time. here test code uses class , calls function: sub testclassobj() dim crelist ccrelist set crelist = new ccrelist dim myws worksheet set myws = thisworkbook.activesheet crelist.loadfromworksheet (myws) end sub here snippet of class ccrelist: ' **** class ccrelist option explicit ' collection of