Posts

Showing posts from May, 2015

spring boot - Apply further configuration to Jackson2ObjectMapperBuilder before it is used -

springboot comes own pre-configured jackson2objectmapperbuilder used through framework configure various objectmapper . the builder doesn't expose facets of objectmapper , wondering how apply additional configuration builder before used? i can provide own jackson2objectmapperbuilder instance loose default initialisation provided springboot... is there way? create beans extend com.fasterxml.jackson.databind.module.simplemodule, there configure example own seriealizers , deserializers. in newer spring versions (dont know since when @ least since spring 4 ) these beans picked automatically. in older versions of spring may need add modules manually objectmapper, tricky, because spring creates many beans of type objetmapper , not easy find right one.

python - Creating template from different block in django? -

i trying create single page different content different template in django can print it. kind of summary of different page base.html - maincontent block rendered inside template main.html - need maincontent block here graph.html - need maincontent block here charts.html - need maincontent block here summary.html - need content main, graph, charts here (require) i have base template extended on every page (it has navbar, footer , sidebar) {% extends "base.html" %} there block inside base template graph, main, chart content displayed. trying accomplish maincontent page , add new template called summary.html since every page extending base not sure how that? tried using include include base every page. edit: know can separate maincontent own separate files have lot of templates , looking other solutions. you separate content. i guess have this: <!-- graph.html --> {% extends "base.html" %} {% block 'maincontent'%}

java - Unable to use send keys for disabled Element in selenium -

Image
the input field trying write code in selenium: input class="tt-hint" type="text" disabled="" spellcheck="off" autocomplete="off" style="position: absolute; top: 0px; left: 0px; border-color: transparent; box-shadow: none; background: none repeat scroll 0% 0% rgb(255, 255, 255);" my code is: webelementy inp= driver.findelement(by.classname("tt-hint")); inp.sendkeys(new string[] { "mo" }); but above code not work. error keep getting is: exception in thread "main" org.openqa.selenium.invalidelementstateexception: element disabled , may not used actions any appreciated. i have modified code javascriptexecutor js = (javascriptexecutor) driver; js.executescript("arguments[0].removeattribute('disabled')",inp); inp.sendkeys("mo"); output the exception says all. element not ready accept interaction , disabled. javascript op

How to get AIC, BIC for fitted lee carter in demography package in R? -

i have trouble finding bic , aic values lee carter fitted using lca command in demography package, how fitted model: uklcam<-lca(data=uk, series="male", years=1950:2011, max.age=100, adjust = "dxt", chooseperiod=false, scale = true, restype = "logrates", interpolate = false) can help? bic() command give following errors > bic(uklcam) error in usemethod("loglik") : no applicable method 'loglik' applied object of class "lca"

excel - R1C1 Formula: Using Row counter for R[ ] -

im trying use row counter make range countif. giving me error every time run , suspect syntax error. thoughts? dim nrows integer 'row counter nrows = range(range("b4"), range("b4").end(xldown)).rows.count range("y5").select activecell.formular1c1 = _ "=if(countif("r5c5:r" & nrows & "c5",rc[-20])>=2,""duplicate account combination"","""")" range("y5").select selection.autofill destination:=range("y5:y" & nrows) i believe issue @ "=if(countif("r5c5:r" & nrows & "c5",rc[-20])>=2," part of code. the problem having in fact in line suspected was. problem escaping string @ wrong time. need change quotation marks such: activecell.formular1c1 = _ "=if(countif(r5c5:r" & nrows & "c5,rc[-20])>=2,""duplicate account combination"","""&quo

php - what i can do with error : permission denied in hosting service -

i registered in 1 of free hosting service have problem extracting files , in panel of host haven't facility extract files write script in php , got error : permission denied ! in idea can (like changing permission) or should linux administrator ??? (i can chmode change access permission on files , folders) <?php $zip = new ziparchive; if ($zip->open('main.zip') === true) { $zip->extractto('/myzip/'); $zip->close(); echo 'ok'; } else { echo 'failed'; } ?> the code line $zip->extractto('/myzip/'); implies extracting against root directory of file system or assigned chroot. might not have permissions - try instead: $zip->extractto('./myzip/');

jsp - How to print cn.replace("cn=", "") as <input value> using EL -

i turnig jsp code: <% (int = 0; < list.size(); i++) { entry var = (entry) list.get(i); out.println(var.getcn().replace("cn=", "")); string cn = var.getcn(); out.println("<form method=\"get\" action=\"controller\">" + "<input type =\"hidden\" name=\"act1\" value = \"" + cn.replace("cn=", "") + "\">" + "<button type=\"submit\" name=\"act\" value=\"show\" id=\"act\" >show</button>" } into jstl: <c:foreach var="item" items="${list}"> <p> <c:out value="${item.getcn()} "></c:out> <p> <c:set var="item" value="${item.getcn()}"></c:set> <input type ="hidden" name="act1

javascript - how to call an ajax function with dynamic ID's- MVC -

i try update dropdownlist selected item in dropdownlist . page contain option multiple dropdownlist same data @model list<cimenacityproject.models.timescreening> @{ viewbag.title = "create"; int? numberofnewtimescreening = viewbag.number; if (!numberofnewtimescreening.hasvalue) { numberofnewtimescreening = 1; } (int = 0; < numberofnewtimescreening; i++) { } var selectmovieid = (selectlist)viewbag.movieid; var selecthomecinemaid = (selectlist)viewbag.homecinemaid; } <h2>create</h2> @using (html.beginform("create", "timescreening", formmethod.post)) { @html.antiforgerytoken() <div class="form-horizontal"> <h4>timescreening</h4> <hr /> @html.validationsummary(true) <table> <tr> <th> @html.label("showtime", new { @class = "control-label col-md-2" }) </th> <th>

iframe - YouTube embeds slowing down page -

i have page bunch of thumbnail images when clicked open embedded youtube videos in modals. here html: <li> <div class="videold"> <a class="video-link" title="video title" href="#video" role="button" data-toggle="modal" data-id="youtubeid"> <img class="responsive-imamge" src="//www.mysite.com/video.jpg" alt="" > </a> <h4>video title</h4> <p>video description</p> <div id="video" class="modal hide fade in" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <button type="button" class="close" data-dismiss=&qu

css3 - Transition from one animation to another -

so, simple question: i have element, has animation in normal state - transform-animation ( perspective , rotatex , rotatez - rotatez changes) runs constantly. on :hover want change animation (remove rotatex , perspective transform, keep rotatez animation) - that's no problem, want animation transition new animation , have no clue how accomplish that. jsfiddle from: @-webkit-keyframes rotatespace { 0% { transform:perspective(555px) rotatex(55deg) rotatey(0deg) rotatez(0deg) scale(1.25); } 100% { transform:perspective(555px) rotatex(55deg) rotatey(0deg) rotatez(360deg) scale(1.25); } } to: @-webkit-keyframes rotateflat { 0% { transform:perspective(0) rotatex(0deg) rotatey(0deg) rotatez(0deg) scale(1.25); } 100% { transform:perspective(0) rotatex(0deg) rotatey(0deg) rotatez(360deg) scale(1.25); } } instead of applying transform styles 1 element use :before pseudo element animated block , element "3d" effect (

imagemagick - Optimization of in memory load time of image -

i using imagemagick utility resize images. before download image s3 , keep in memory reduce time. still when print time taken image s3 , time load image in memory comes out 300-400 ms , 500-900ms . question time image s3 depands on region download image. time load image in memory taking 500-900ms . there way can optimize ? string accesskey = "access_key"; string secretkey = "secret_key"; amazons3 client = amazon.awsclientfactory.createamazons3client( accesskey, secretkey ); getobjectrequest request = new getobjectrequest { bucketname = "buckey_name", key = keyname }; stopwatch sw = new stopwatch(); sw.start(); var response = client.getobject(request); sw.stop(); console.writeline("time image : " +

Integrate VAST compliant video player into a windows application -

we play videos in our windows application using flash.ocx need change vast compliant solution... can make recommendations? thanks there plenty if video players supporting vast (both html , flash), of them have native support of vast1/2/3 , vpaid1/2, , need plugins: veeplay jwplayer projekktor flowplayer and free , open source video.js they design web, anyway if need play vast compliant ad goes web, can implement players anywhere.

jquery - Inline textarea filling remaining width -

i'm trying make element editable when user clicks on it, i'm having difficulties placing new textarea properly. here's work far: $.fn.replacewithpush = function(a) { var $a = $(a); this.replacewith($a); return $a; }; $(document).ready(function(){ $(".editable").click(function(event){ event.preventdefault(); switchtotextarea($(this)); }); function switchtotextarea(element) { var mnxx = element.height(); var replaced = element.replacewithpush('<textarea name = "' + element.attr('id') + '" class = "editable" rows = "1" columns = "26">' + $(element).text() + '</textarea>'); $(replaced).css({"min-height": (mnxx + 20) + "px"}); $(replaced).focus(); $(replaced).parent().addclass('editable'); $(replaced).focusout(function(){ var data = {id: author }; data[$(replaced).attr('name'

python - How to type in arguments in the middle of the code? -

we can thing type in arguments: from sys import argv script, argument_1, argument_2 = argv is possible type in arguments in middle of code, not in beginning? i want smth same: print "la-la-la" print "any string" # , here want program take file name argument work file have @ argparse python class command line parsing

html - Variable PHP inside a Div Modal -

i have php variavel named $table , , want show modal variable, it's no working <div class="modal-dialog modal-lg"> <div class="modal-content" value="'.$table.'"> </div> how can solve ? your php values have emitted server-side code. html markup alone won't interpret them. this: <div class="modal-content" value="<?php echo $table; ?>">

hadoop - How to run Apache Tez Locally? -

one of ways 1 can execute tez in local mode beside integrated hadoop. in order run localy read this page , understood changes have make , updated tez-site.xml configuration. don't know how start it. i tried running 1 of tez-examples (e.g. wordcount) has main method. stalls , don't print stdout. there have start first? how can run tez in local mode? i managed run including needed libraries. changing pom , build final jar file dependencies, preferred not change project. after building mvn clean install -dskiptests=true -dmaven.javadoc.skip=true i ran setting java classpath: java -cp tez-dist/target/tez-0.7.0/lib/*:tez-dist/target/tez-0.7.0/* org.apache.tez.examples.orderedwordcount in.txt out

javascript - Google Books API JSON object trouble -

i trying pull google books api , insert titles first 10 results web page. have site pulling correct request , have following callback function handling results function insert(books) { var list = books.items; var i; for(i = 0; < 10; i++){ var title = list[i].title; var tag = "result" + i; var x = document.getelementbyid(tag); x.innerhtml = title; } } for ease lets suppose following call made <script src="https://www.googleapis.com/books/v1/volumes?q=way of kings&filter=partial&callback=insert"></script> right inserts word "undefined" in every place should insert title. can't find error here. the response data has title placed in volumeinfo object. replace: var title = list[i].title; with: var title = list[i].volumeinfo.title;

Ruby HTTPNotFound Error with Mechanize -

i have ruby on rails application trying access various links on yahoo sports , when tries reach page, gives me error below. error consistent , of links fails on, fails on. not case of work , don't. find though page exist , loads fine, i'm not sure why giving me error. has experienced type of behavior before , if so, have suggestions on how work? 404 => net::httpnotfound http://sports.yahoo.com/mlb/players/9893/ -- unhandled response @client = mechanize.new() @client.request_headers = { "accept-encoding" => "" } @client.ignore_bad_chunking = true #works #url = 'http://sports.yahoo.com/mlb/players/7307' #doesn't work url = 'http://sports.yahoo.com/mlb/players/9893' result = @client.get(url) i wasn't able figure out mechanize, able url httparty. if rescue mechanize failure , retry looking redirect uri should set: require 'mechanize' require 'httparty' @client = mechanize.new() url = &

unix - Shell script: Check if a Directory is of YYYY_MM_DD_HH this format -

i have script creates file list of directories available in path. now, tasks if directory of format "yyyy_mm_dd_hh" in file list. my file list has following entries: 2014_04_21_01 asdf 2012_01_19_10 2010_01 now move directories names yyyy_mm_dd_hh path. i.e., 2014_04_21_01 & 2012_01_19_10 must moved. please advise. use bash regex pattern matching: for dir in $list if [[ "$dir" =~ ^[0-9]{4}_[0-9]{2}_[0-9]{2}_[0-9]{2}$ ]] mv "$dir" newdir/ fi done

jquery - Get nearest component from a id begining with -

i have tree column similar one. <div class="col-md-4 column"> <div class="form-group"> <input type="hidden" name="identitycardlist[0].identitycardid"> <label for="identitycardtype1" class="col-sm-3 control-label">type</label> <div class="col-sm-9"> <select id="identitycardtype1" name="identitycardlist[0].identitycardtype" class="form-control"> </select> </div> </div> <div class="form-group"> <label for="idcardvalue1" class="col-sm-3 control-label">valeur</label> <div class="col-sm-9"> <input type="text" class="form-control" id="idcardvalue1" name="identitycardlist[0].value" placeholder="entrer la valeur"> </div

C++ error at the last line of code -

i'm begineer in c++ programming know basics. started writing simple game. program chooses random number (1-100) , have guess it. there 2 modes: normal - whenever enter number program tells if it's bigger random or smaller. hard - no clues, pure luck. everything running ok when added fixes displayed text program won't compile. use code::blocks. screenshot: http://scr.hu/81tw/m6cm0 apreciate help. full code below: #include <iostream> #include <cstdlib> #include <time.h> using namespace std; int number_normal; int number_hard; int guess_normal; int guess_hard; int tries_normal=0; int tries_hard=0; int mode; int main() { { cout<<"choose mode..."<<endl; cout<<"normal (press 1) or hard (press 2)"<<endl; cin>>mode; if(mode=1) cout<<"normal mode chosen."<<endl; goto normal; if(mode=2) cout<<"hard mode chosen!&qu

maven - Project analysis (Sonar Report )for branches -

i configured our build server using bamboo , sonar. in our case have multiple developer environment , chose not analyse our trunk branch. nightly builds of trunk , branch analysed sonar. , there lies our problem. last build build saved in sonar, plausible sonar point-of-view, ie projects have same name same. in branch have fixes our major release projects name , code same in branch have bug fixes. love see analysis of branch , trunk separately in sonar dashboard. the question there way make multiple version of same project in sonar? or there other best practice in situations? looking forward replies :) use sonar.branch analysis property distinguish branches head , each other. note there limitations. e.g. issues marked "false positive" in 1 version of project will not show fp's in other versions. more analysis params in docs

java - Redis Sentinel and ShardedJedis for ShardedJedisPipeline -

i using redis in cluster mode @ production. later realised if use redis independent servers using shardedjedis java api , can use shardedjedispipeline has better performance due obvious reasons. while using redis server maintain automatic fail on , high availability, must use redis sentinel . so, started looking sentinel . while doing initial poc , got know can not use shardedjedis , sentinel @ same time. now seems paths closed as redis cluster not support pipeline i can not achieve high availability , automatic fail on without sentinel i can not use sentinel shardedjedis . please correct me if wrong anywhere , please suggest me best strategy achieve performance high availability , automatic fail over. spoken in general terms: redis cluster supports pipelining same way redis standalone does. important part here hit right node when issuing commands keys. commands without keys (such multi or exec ) no-go redis cluster the ha-part not 100% correct. whi

windows - Batch File: If file doesn't exist, create, if file does exist create a new one, compare two files, and delete the largest one -

i create batch file exports reg key folder on server, file needs perform few checks before , after. currently have: regedit /e "\\pdc\users\%username%\application data\printer registration.reg" "hkey_current_user\software\generic" the above works export registry key, batch file turned logon script, little more clever. 1: needs assess whether " printer registration.reg " exists in directory.if file not exist, must continue create file " printer registration.reg " , progress number '#2' below. if file exists, script must export registry key file called " printer registration2.reg ", , check see if file created larger 625kb. if file larger 625kb, or same size file exists " printer registration.reg ", delete " printer registration2.reg ". if less 625kb , differs in file size " printer registration.reg ", must delete " printer registration.reg " , rename " printer registra

css - PHPStorm File Watcher not working while not in focus -

Image
i have following sass file watcher configuration: my goal enable auto-synchronization of .sass & .css chrome dev-tools, as explained here . however, noticed file watcher active & recompile's .sass files when phpstorm window in focus. is there way still make work while in background? thanks!

php - Doctrine2: DBAL connection to Sql-Server -

connecting mssql using doctrine2 on unix im developing project uses doctrine2 php on ubuntu server (x64). it's required fetch data mssql-server running externally. problem doctrine2 doesn't support pdo_dblib driver, neither there's support sqlsrv on unix-like machines ( sqlsrv windows only). being given, seems doctrine doesn't have built-in support mssql-servers on unix-machines. solutions these solutions tried without success. 1. write own wrapper pdo_dblib , integrate in doctrine's dbal i couldn't figure out how write own driver, platform , schema doctrines dbal neither found usefull in docs or per google. actual question is there kind of support mssql-servers doctrine 2 without using symfony or other third-party code ? your original solution not hard achieve. i've run issue trying connect sql server using odbc, 1 option linux hosts, , change needed in this file . if update function , use valid odbc co

mapping - marklogic pojo databinding without annotate -

is possible define mapping without using annotate? mentioned below: @id or @pathindexproperty(scalartype = scalartype.string) i want define binding in external file , newpojorepository use in order mapping. thanks. pinna you can create new class extends independent pojo object , attach pojo annotations new class. here's example. remember create path range index of type int on managedcat/averageheight. cat.java public class cat { private string id; private int averageheight; public cat() {} public cat(string id, int averageheight) { this.id = id; this.averageheight = averageheight; } public string getid() { return id; } public void setid(string id) { this.id = id; } public int getaverageheight() { return averageheight; } public void setaverageheight(int averageheight) { this.averageheight = averageheight; } public string tostring() {

javascript - inconsistent HTML5 canvas results -

i've got following html5 javascript: <!doctype html> <html> <head> <style> canvas {width:200px; height:200px; border: solid blue 1px } </style> </head> <body> <canvas id="mycanvas" ></canvas> <script> var canvas, ctx, i, tlineh = 70; canvas = document.getelementbyid('mycanvas'); ctx = canvas.getcontext('2d'); for(i=0; i<50; i++){ ctx.linewidth = 1; ctx.moveto(i*3+0.5, tlineh-15); ctx.lineto(i*3+0.5, tlineh+15); ctx.stroke(); } for(i=200; i<240; i+=4){ ctx.linewidth = 2; ctx.moveto(i, tlineh-30); ctx.lineto(i, tlineh-15); ctx.stroke(); } </script> </body> </html> which produces first image. if reverse order of for loops second image drawn! , if change height of canvas 300px third image drawn!! i post images here show happens don't have enough reputation points, i've put them @ https://www.dropbox.com/s/dun1vr4vjj

node.js - Best way to re-render form values in a MEAN stack app in form validation -

it necessary re-render user filled form values user during form validation. in typical mean stack app, tried following, satisfied none of them: (1) submitting form ajax, therefore no need re-render form values because form values there there were. in case difficult display error messages , highlighting error fields. (2) store form values in session , values session re-render them. (3) store form values in cookies , use cookies re-fill form. is there other better approach? (1) submitting form ajax, therefore no need re-render form values because form values there there were. in case difficult display error messages , highlighting error fields. i suggest go , re-evaluate option. if don't this, mean stack not right stack you. angularjs on side of spas , ajax form submission. validation , error message capabilities in form subsystem robust , substantial. if struggling them, dumping them full-page load form post requests perhaps indication need redouble effort

R - repetition with dplyr -

in order transform "long compact" format data wide format need use rep function. i can not figure out how integrate dplyr flow. this repetition need use dta1 = as.data.frame(cbind(rep(dta$id, dta$duration), rep(dta$act, dta$duration) ) ) colnames(dta1) <- c('id', 'act') here dplyr code. dta1 %>% group_by(id) %>% mutate( time = 1:n() ) %>% spread(time, act) do have idea how put these 2 codes ? the data dta = structure(list(id = c("b10001n1", "b10001n1", "b10001n1", "b10001n1", "b10001n1", "b10001n1", "b10001n1", "b10001n1", "b10001n1", "b10001n1", "b10001n1", "b10001n1", "b10001n1", "b10001n1", "b10001n1", "b10001n1", "b10001n2", "b10001n2", "b10001n2", "b10001n2", "

Crate write behaviour -

i have question on crate write behavior. from crate documentation one reason replicas written synchronously. making write task wait replicas written somewhere in data center hundreds of miles away can lead noticeable latency , cause cluster slow down. if have cluster of 3 nodes , if 1 node down, behavior when insert data? fail or crate sync data node down when up? regards albin as written here: https://crate.io/docs/en/latest/storage_consistency.html?highlight=quorum write operations handled differently reads. such operations synchronous on active replicas following flow: the primary shard , active replicas looked in cluster state given operation. primary shard , quorum of configured replicas need available step succeed. ... the default quorum is: int( (primary + number_of_replicas) / 2 ) + 1 so not fail long quorum achieved. after failed node operate normal again, crate take care create replicas again on node if replica not c

excel - Convert between two currencies by the click of a button in the same cells -

i want create function in excel workbook converts cells in 3 sheets using currency format 1 currency (sll) (dkk) click of button (the same button converts in sll or in dkk depending on currency values in). my code is: sub convertcurrency() dim userrate1 long dim userrate2 long each cell in activeworkbook.worksheets userrate1 = 625 if cells.numberformat = "dkk" & "$ #,##0.00" _ cell.value = "sll" & userrate1 * cell.value elseif cells.numberformat = "sll" & "$ #,##0.00" _ cell.value = "dkk" & (1 / userrate1) * cell.value _ end if end sub but it's not working. error "compile error. else without if". how can use else without if, if need include second restriction. sub test() dim userrate1 long dim userrate2 long each cell in activeworkbook.worksheets userrate1 = 625 if cells.numberformat = "dkk"

Showing animated gif in C# while loading Data from SQL to multiple ListViews -

i have created application multiple people scan qr codes on products before dispatching. the application created using winforms, c# language , sql database. i using mdi form multiple forms scan products, generate mis, dashboard etc. the application running pretty well, working on optimization. i stuck in dashboard form, contains multiple pivot count database scan per users, scan per product, scanning done per hour etc. the form working fine loading data takes time in want show animated gif untill process executed , listviews , labels updated. using below code image not visible, when code run in background. please guide need do. i have pasted 1 method example others similar: private void refreshbtn_click(object sender, eventargs e) { cursor.current = cursors.waitcursor; picturebox2.visible = true; displaystats(); cursor.current = cursors.arrow; picturebox2.visible = false; } private void displaystats() {

geometry - Slicing a circle in equal segments, Python -

Image
i have set of close of 10,000 points on sky. plotted using ra (right ascension) , dec (declination) on sky. when plotted, take shape of circle. what slice circle 8 equal parts , remove each part 1 @ time , calculations using remaining parts. to came illustration in mind, i.e. slicing them using arcs. i know equation of arc given by: s = r * theta where r --> radius theta --> angle (in our case 45 degrees) i somehow like: slice1 = [] a,b in zip(ra,dec): if a>some value , a<some value , b>some value , b<some value: slice1.append(a,b) if square, becomes easy, , above equation can applied. so once have slice, can numpy.where() find out rest of circle. i can slice 4 slices mentioning min(ra),max(ra),min(dec) , max(dec) . 1 such example when first quadrant give me this: ra>0.0 , ra<max(ra) dec>0.0 , dec<max(dec) i don't know how go doing in case (i.e. 8 quadrants!!), wherein i have x,y coordinates of data poin

ios - Application idle Timer disable not working -

application idle timer disable not working after record video application. put below code in application did finish launching. please suggest me if 1 have idea handle idle timer. [[uiapplication sharedapplication] setidletimerdisabled: yes]; in past there have been bugs in ios, in forgets have set idletimerdisabled , example after have used uiimagepickercontroller take picture. not sure whether apple has fixed bugs yet. a work-around set more often, example in viewwillappear of main view.

jquery - Adding an image in place of a button in html javascript -

the problem : have "+" , "-" @ end of row add , delete rows accordingly. instead of "-" icon, want replace trashbox.. tried replacing imgsrc. skews alignment. even if remove box "+" , keep + alone adding row , delete trashbox "-", great. can me out this? code below. <tr> <td align="left"> <g:select name="standard[]" id="standard" class="statsele valid" from="${standardlist}" value="" noselection="['':'select regulatory standard...']"/> <g:select name="standard_version[]" id="standard_version" class="statsele valid" from="${standardversion}" value="" noselection="['':'select version...']" style="width:150px !important;"/> <g:select name="standard_domainnumbers[

For each loop not executing more than once in php -

i have 2 fields in form 1 name , other email this. <td class="left"><input style=" width: 30%; text-align: center;" type="text" name="name[]" value="<?php echo $geo_zone['name']; ?>" /></td> <td class="left"><input style=" width: 30%; text-align: center;" type="email" name="email[]" value="<?php echo $geo_zone['email']; ?>" /></td> there name array types can store multiple values in them on run time because form generated on run time , may have multiple names , emails depending on database result. in controller iam fetching these values in print_r() iam getting writes results. when execute each loop runs 1 time , inserts last row in database. $name= $this->request->post['name']; $email= $this->request->post['email']; foreach( $name $key => $n ) { $this->data['geo_zone_id

java - What is the right place for checking a resource presence in Spring REST MVC project? -

i have spring rest mvc project consists of repositories, models, services, , controllers. after code review there discovered resource existence checked on different layers (the in services , controllers). is ok have code below in few layers, or should in 1 place? if (resource == null) { throw new resourcenotfoundexception(); } this code should placed in 1 particular layer. choose services. why? place resource looked for. it's service job find resource or throw appropriate exception. endpoint/controller should used receive request , return response - should dummy possible. of work should done in services. basically can put such logic in chosen layer, 1 , same resources.

java - How to rename only the first found duplicate acrofield in pdf? -

Image
on pdf have duplicate field named text1. want rename first found acrofield name text1 foobar. other field name text1 should unchanged new form contains fields text1 , foobar. i using itext library , there rename function method rename fields name text1 foobar. if wants test pdf, here link . public class renamefield { public static final string src = "c:\\test_duplicate_field2.pdf"; public static final string dest = "c:\\test_duplicate_field_mod.pdf"; public static void main(string[] args) throws documentexception, ioexception { file file = new file(dest); file.getparentfile().mkdirs(); new renamefield().manipulatepdf(src, dest); } public void manipulatepdf(string src, string dest) throws documentexception, ioexception { pdfreader reader = new pdfreader(src); pdfstamper stamper = new pdfstamper(reader, new fileoutputstream(dest)); acrofields form = stamper.getacrof

mysql - Creating a php web server in XAMPP -

i trying create web server in php of xampp php has errors; changed localhost port 80 85 have added mysql database phpmyadmin. don't know why getting error fatal error: class 'mysql' not found in c:\xampp\htdocs\chitchat\index.php on line 7 <?php //must change below variables ones $dbhost = "localhost:85"; $dbusername = "root"; $dbpassword = ""; $dbname = "chitchat"; $db = new mysql($dbhost,$dbusername,$dbpassword,$dbname); // if operation failed unknown reason define("failed", 0); define("successful", 1); // when signing up, if username taken, return error define("sign_up_username_crashed", 2); // when add new friend request, if friend not found, return error define("add_new_username_not_found", 2); // time_interval_for_user_status: if last authentication time of user older // - time_interval_for_user_status, user considered offline define("time_interval_for_user_stat

Where do i find the code behind for a drupal 6 menu? -

i have taken on drupal 6 website , need change link image. the image menu item , menu items path not change when change in backend. assume whole file has been on written not sure find file. have looked in "bartik" themes file .tpl.php files cant find anything. any please the core code behind menu in includes/menu.inc , have problem if have overwritten initial logic there. the first thing know drupal — not override core behavior. the primary theme functions, involved in menu rendering are: theme_menu_item generate html output menu item , submenu. theme_menu_item_link generate html output single menu link. theme_menu_tree generate html output menu tree i recommend check source first on api.drupal.org/api/drupal/includesmenu.inc/6 if none of above makes sense, please check this article learn, how override theme functions.