Posts

Showing posts from August, 2015

c# - How to change upload folder dynamicly -

i'm using backload file upload controller in customerportal build mvc4. within customerportal can add supportcalls. within supportcall can attach files. every supportcall has own guid. the web.backload.default.config file contains default upload location of file "~/files". want file location different every supportcall. like: "~/files/d764578d-2f13-4820-bf1f-3d4427aedf22" guid differs every time. how can achieve that? i found answer question here : https://github.com/blackcity/backload/wiki/example-06 <form id="fileupload" action="/backload/uploadhandler" method="post" enctype="multipart/form-data"> <input type="hidden" name="objectcontext" value="@html.viewbag.id" /> </form>` just had add hidden field id

mysql - SQL statement for GROUP BY -

Image
i stucked 1 sql select statement. this output/result sql statement below: what need: need have columns assignedvouchersnumber , usedvouchersnumber in 1 row msisdn. example if can see "msisdn" 723709656 there 2 rows now.. 1 assignedvouchersnumber = 1 , second assignedvouchersnumber = 1 too. but need have in 1 row assignedvouchersnumber = 2. problem? select eu.msisdn, eu.id userid, sum(case ev.voucherstate when '1' 1 else 0 end) assignedvouchersnumber, sum(case ev.voucherstate when '2' 1 else 0 end) usedvouchersnumber, ev.extra_offer_id, ev.create_time, ev.use_time, ev.id voucherid, ev.voucherstate extra_users eu join (select sn.msisdn telcislo, stn.numberid stats_number sn join stats_target_number stn on ( sn.numberid = stn.numberid ) stn.targetid = 1) xy on eu.msisdn = xy.telcislo join extra_vouchers ev on ( eu.id = ev.extra_user_id...

sql server - Running SSIS package for different databases on selection of a drop down on a windows form -

i have made ssis package transfer data between 2 databases on different server. issue unable pass connection string in package dynamically @ run time. have windows form execute package. on windows form have drop downs select source , destination databases transfer data. can have way tell package connection string of source , destination database needs perform actions @ running time, dynamically on click of windows form drop down clicks.. if destination server not change each time can concatenate server name in ssis package connection string variable , if not need pass server name form windows form.

java - Adding view causes "Child already has parent" error -

i'm making gallery app , adding image buttons dynamically using code below, works on 1 of devices on other a java.lang.runtimeexception: unable start activity componentinfo{package/package.mainactivity}: java.lang.illegalstateexception: specified child has parent. must call removeview() on child's parent first. caused by: java.lang.illegalstateexception: specified child has parent. must call removeview() on child's parent first. e/androidruntime( 3358): @ android.view.viewgroup.addviewinner(viewgroup.java:3381) e/androidruntime( 3358): @ android.view.viewgroup.addview(viewgroup.java:3252) e/androidruntime( 3358): @ android.view.viewgroup.addview(viewgroup.java:3197) e/androidruntime( 3358): @ android.view.viewgroup.addview(viewgroup.java:3173) e/androidruntime( 3358): @ package.mainactivity.oncreate(mainactivity.java:74) error, on other device no problems @ , runs fine. 1 works on running 4.1.2 , 1 crashes on running 4.1.1 it?...

websphere - Location and logic of SAML TAI class ACSTrustAssociationInterceptor -

in websphere saml sso, configure "com.ibm.ws.security.web.saml.acstrustassociationinterceptor" tai class. as per understating of tai classes, step 1) saml tai deduce user name saml response. , asserts same sp application. asserted user "kaushik" not present in application. step 2) sp application checks if user exists in sp application step 3) if user not exist in application, redirected error page (configured sso_1.sp.acserrorpage ) now questions :- 1) understanding correct ? 2) if correct, how control comes tai class when sp not have required user ? 3) jar containing "com.ibm.ws.security.web.saml.acstrustassociationinterceptor" ? 4) jar location in appserver. not find anywhere your understanding not correct. in step 1, saml tai indeed deduce user name saml response. in manner determined saml tai custom properties . step 2 believe begin stray. term "application" general here. saml tai checks registry configured security d...

maven - Is there a centralized Java libraries repository such like CPAN for Perl? -

people build repositories of software (like these contains gnu/linux packages) or code, documentation, centralized in 1 place. all modules/libraries installations can done through it. re-using code thing, , helps developers not reinvent wheel, debugging existing code , share work others. using system one, retrieve security-updates easily. helps develop community too. cpan example of large , comprehensive ecosystem, , become a strength of perl language . i know if similar thing exists java world , main differences perl/cpan world (i don't try open opinion based debate hope constructive discussion). i've heard maven's central repository if maven provides " patterns project's build infrastructure in order promote comprehension , productivity providing clear path in use of best practices ", largely used promote publishing of open source code? i know kinds of tools used today , experiences around problematic. maven way go ! it has plugins e...

jquery - Pass values from view to controller model on httppost from ajaxcall not working -

i have requirement insert text entered in textareafor when text changed in textbox.i used jquery change function done.i controller hit on actionmethod ajax but, text view not getting passed model. ( code used: mvc4 /entity dbfirst/ razor ) here detailed code. controller: public actionresult index() { return view(); } public actionresult dailynotes() { return view(); } //i’m getting code hit ajaxcall, dashboard model null???????? tbldailynotes note = new tbldailynotes(); [httppost] public actionresult dailynotes(dashboardviewmodel model) { int noteid = 0; model.dailynotes = note.note; _scheduler.insertdailynote(note);//this sp insert note return view(); } index.cshtml: <div id="content"> @(html.kendo().tabstrip() .name("tabstrip") .items(tabstrip => { tabstrip.add().text("daily notes") ...

linux - Eclipse ABAP Development: Cannot Retrieve Connection configuration -

i have installed abap development tools on eclipse 4.2 , kubuntu 12.04 64 bit , went fine. when try create new abap project , search configured sap connections on sap gui (i have sap gui java 7.30 rev 3) eclipse shows following error: "configuration not found in settings file '/home/dfabbri/.sapgui/settings', include 'null', , message server 'null'" i verified file '/home/dfabbri/.sapgui/settings' present , not empty; here content: ############################################################ # # file : /home/dfabbri/.sapgui/settings # created : 08.05.2012 12:42:08 cest # encoding: utf-8 # ############################################################ @logonframey = "83" @logonframex = "137" @glf_showdetailcol = "1" @glf_columnstate = "0 / 75" @logonframe_2_x = "970" @logonframe_2_y = "241" @framewidth = "778" @frameheight = "900" @logonframe_2_width = ...

Null reference in C# Mono / GTK# -

i trying create simple note-taking application own use. idea learn c#/mono xml editing. i can't find nullreference compiler complaining about. no idea why. can't see it. after few days of searching give up... help. :) here code making bug. application runs fine until press button add new note. crashes. add_activated function runs when button pressed , should use addnote function. the code incomplete , has logic bugs. can handle those. i'm wondering why won't run. mainactivity.cs: // (...) protected void add_activated (object sender, system.eventargs e) { gtk.textbuffer buffer; buffer = textview1.buffer; note note = new note(entry3.text, buffer.text); addnote (note); } public static void addnote (note note) { string xmlfile = "/home/tomasz/.keeper/keeper.xml"; xmldocument xmldoc = new xmldocument (); xmldoc.load (xmlfile); xmlnode xmlroot = xmldoc.c...

javascript - How to attach for every Array-Element in jQuery different Animationeffects? And animate one by one forwards and backwards with 2 Buttons(back&next)? -

update: title changed! maybe or stil wrong defined. sorry bad english! i'm new in jquery , in programming, javascript, css3 , html5. , i'm trying animate html elements if click on "next-button". works jquery own "animate"! want add each element own animation css-file. here html snippet: <div id="output0" class="output0">output0</div> <div id="output1" class="output1">output1</div> <div id="output2" class="output2">output2</div> <div id="output3" class="output3">output3</div> <div id="output4" class="output4">output4</div> here css snippet: .output0 { position: absolute; top: 120px; left: 300px; width: 200px; height: 500px; border-top-left-radius: 10px 5px; border-bottom-right-radius : 10% 5%; border-top-right-radius : 10px; background: #4d4ea3; te...

javascript - how to validate data on drop event of itemselecter in extjs? -

Image
we not add 3 word again in selected item. validate on drag , drop event , need show message u added record. try below code not able fine relevant event validate listeners: { added:function(obj,event){ console.log("added"); },change:function(obj,event){ console.log("change"); },removed:function(obj,event){ console.log("removed"); }, blur:function(obj,event){ console.log("blur"); }, click: function( obj) { console.log('click'); }, select: function( obj) { console.log('select'); } } please see attached image bellow. i using extjs 3.4 the change event fires when item selected or deselected... @ stage, won't able prevent anymore. so, apparently, best move override onaddbtnclick me...

jquery - How to analyze JavaScript function execution order -

i have optimize website uses lot of javascript. i'm not author of site. need understand way works , optimize few things related javascript. , need understand js code executed during page load. i'm looking way display javascript functions execution order. site i'm dealing uses 40 external scripts , 20-40 inline js stuffed here , there. best firefox add-on. i know can add console.log("script name"); each of js files amount of code it's ridiculously unpractical. know firebug ships profiler, not allow me see when function executed. besides crashes on site i'm trying analyze. i want know order of function execution. site heavily relays on jquery. of these scripts jquery. as in earlier comment, try using chrome. useful links here use developer tools profile js:- https://developers.google.com/chrome-developer-tools/docs/cpu-profiling http://coding.smashingmagazine.com/2012/06/12/javascript-profiling-chrome-developer-tools/ https://develop...

How to implement MySQL SET concept with over 64 members? -

what best way replicate behaviour of mysql set col type, on 64 members? i need naturally mysql set around 85 different options. (the limit 64.) best way implement this? i've looked @ this question , suggests join , members 6-char strings, efficient way really create entire new, 1-column table of these members (i'll call table 2), , third table of 2 cols linking id table 1 (where have created set column) , table 2? normalise second table uses enum : from single-table design this: id , ..., set_col to these: table1: id , ... table2: table1_id , enum_col you can have zero-or-more relationship table1 pk ( id ) values in "set", not set normalised enum value. space benefits of set or enum , multiplicity of set , overcome 64 member limit of set .

sql server - T-SQL - query filtering -

table1: id customer no_ 7044900804 z0172132 7044900804 z0194585 7044907735 z0172222 7044907735 z0172222 7044910337 z0172216 7044911903 z0117392 i values same id , different customer no_ table1. id customer no_ 7044900804 z0172132 7044900804 z0194585 i've tried use query finding duplicates, won't filter values same id , same customer no_ table1. select id , [customer no_] table1 group id, [customer no_] having count(*) > 1 could me t-sql query solution? advices. try this select * table1 id in ( select id table1 group id having count(distinct [customer no_]) > 1 ) sql fiddle demo

javascript - asp.net (VB) countdown timer that is persistent through postbacks -

i have button , label on asp.net vb page , when button pressed need countdown timer begin 10 mins , update every seconds, 09:59, 09:58, 09:57 etc.... need timer continue countdown despite postbacks or temporarily redirecting different page. so far have tried using asp.net timers (with async triggers/update panels) seconds countdown needs 1 second postback , going quite resource expensive when there hundreds of users accessing system. writes exact countdown time session variable retrieved when page reloaded - ugly method way can work. update - have found solution problem: using great javascript countdown script http://scripts.hashemian.com/js/countdown.js aspx page: <asp:literal runat="server" id="jstimemarker"/> <script type="text/javascript" src="http://scripts.hashemian.com/js/countdown.jss"></script> <asp:button runat="server" text="10 mins" id="btn10mins"/> code b...

java - Log4j Does not Send Mail unless Thread.sleep -

i having problem log4j , sending notification emails. my log4j.properties log4j.appender.mail=org.apache.log4j.net.smtpappender log4j.appender.mail.threshold=error log4j.appender.mail.buffersize=512 log4j.appender.mail.smtphost=10.10.10.10 log4j.appender.mail.from=team@domain.com log4j.appender.mail.subject=subject here log4j.appender.mail.to=team@domain.com log4j.appender.mail.layout=org.apache.log4j.patternlayout log4j.appender.mail.layout.conversionpattern=%d{yyyy/mm/dd hh:mm:ss,sss} [%t] %-5p %c %x - %m%n the program caused error when trying send , email made log.error() test it. i tested code below, still did not send emails. public static void main(string[] args) { log.error("error "); } when add thread.sleep in above code. works! public static void main(string[] args) throws exception{ log.error("error "); thread.sleep(1000000l); } the problem main thread exits , causes mail sending thread terminate. decided change program...

java - Play Framework 1.2.6 connect multiple database -

i able connect default database. added want connect database. using play framework 1.2.6. know support present in main branch of play 1.2.x. can 1 please me, how can achieve in 1.2.6. thank you play 1.2.6 (or 1.2.x branch) doesn't support multiple database connections out of box. support available in play 1.3 has not been released yet. here according ticket play bug tracker: http://play.lighthouseapp.com/projects/57987-play-framework/tickets/706

php - Key Generator without storing in database -

my code creates random key , stores in database on button click, keygen button name, if user/customer has key gets key database in text box on click else generates new key , stores in database . there way can achieve without storing key in database , same key particular user/customer each time. code: <?php include('session.php'); $result = mysql_query("select * customer customer_no = '$customer_no'"); $row = mysql_fetch_array($result); if (isset($_post['keygen'])){ $customer_no = $_post['customer_no']; $customer_no = mysql_real_escape_string($customer_no); $result = mysql_query("select * customer customer_no = '$customer_no'"); while ($row = mysql_fetch_assoc($result)) { $keystring = $row['key']; if($keystring == ""){ $keystring = mysql_real_escape_string($keystring); $query = mysql_query("update customer set `key` = '$keystring' customer_no = '$customer_no'"); } e...

php - How to select a record with upcoming date and time? -

i have table called events . table contains event_date , event_time in separate columns. i'm working on page show upcoming events. how query records events table date , time still upcoming? mean, how calculate or write query, where clause, using mysql? i'm using php , codeigniter. thanks answer. edit: used gordon linoff's suggestion: where event_date >= now() or (event_date = date(now()) , event_time > time(now())) but modified to where event_date>date(now()) or (event_date=date(now()) , event_time>time(now())) because gordon's didn't quite return result expecting (events dated on current day time has not yet come not appearing upcoming events). anyway, gordon , other people answered. not yet expert in mysql date queries, guys did me huge favor. you use: where event_date >= now() or (event_date = date(now()) , event_time > time(now()))

visual c++ - How do I create a browser Interface or mini browser which will use very low amount of RAM? -

i need keep page open within browser auto reload @ every 35 seconds keep connection active isp. have tried creating windows form application using visual c++ 2008, seems inefficient in memory management. after running 10 mins ram use goes above 35 mb. don't want that. expect ram usage stay below 10 mb ! how create browser interface minimize ram usage serve purpose of keeping connection alive. you don't want browser. need periodic network connection server. in programming libraries, called 'socket' . start research there.

css - Why won't my divs overlap? -

i'm trying these divs overlap , have text inside triangle text can moved around outside triangle. jsfiddle this html+css: <div class="tri"> <div class="test"> test </div> .tri { width: 0; height: 0; border-top: 100px solid black; border-left: 100px solid transparent; position:relative; } .test { display:inline-block; -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -ms-transform: rotate(45deg); -o-transform: rotate(45deg); filter: progid:dximagetransform.microsoft.basicimage(rotation=3); zoom:1; margin-top:-80px; margin-left:-80px; color:red; } you can use position: relative; container element , use position: absolute; child element, way, absolute positioned element won't flow out in wild, , relative parent element, overlapped way demo also it's css triangle borders , height , width set 0 respectively, canno...

ruby on rails - ROR delete action not working -

i beginner ror , following tutorial http://guides.rubyonrails.org/getting_started.html . so according tutorial want delete 1 post. not working showing error the action 'destroy' not found postscontroller my post controller delete method looks def destroy @post = post.find(params[:id]) logger.debug "***********************: #{@post.id}" @post.destroy redirect_to posts_path end in routes mentioned resource resources :posts still giving error destroy action. doing wrong. need help. did mention method delete in views? if using rails 4, should do: <%=link_to 'destroy', post_path(post), method: :delete, data: { confirm: 'are sure?' } %> in rails 3: <%=link_to 'destroy', post_path(post), method: :delete, confirm: 'are sure?' %>

java - Struts make a link with wildcard parameter -

so have following action mapping: <action path="/admin/nst-*/manage/" type="com.company.backend.actions.admin.nstmanageaction" name="nstmgmtform" attribute="form" validate="false" scope="request" parameter="{1}" input="/web-inf/company/pages/nstmgmt.jsp"> <forward name="view" path="/web-inf/company/pages/nstmgmt.jsp"/> </action> as can see, has wildcard institution passed in parameter attribute. say on jsp page wanted link action struts html tag. how automatically insert institution id the link struts link tag? instance /admin/nst-22/manage/ or /admin/nst-99/manage . possible the link tag? use el expression in action attribute <html:link action="/admin/nst-${id}/manage/">manage</html:link> struts1 tag attributes accept el expressions, it's possible.

javascript - How do I convert an array of audio data into a wav file? -

i have feature records audio annotations user. uses html5 flash fallback. able audio data html5 version via getusermedia(), flash fallback provides data array of floats. i need data wav file, , can't figure out how it. appreciated! var reclength = 0, recbuffersl = [], recbuffersr = [], samplerate; this.onmessage = function (e) { switch (e.data.command) { case 'init': init(e.data.config); break; case 'record': record(e.data.buffer); break; case 'exportwav': exportwav(e.data.type); break; case 'getbuffer': getbuffer(); break; case 'clear': clear(); break; } }; function init(config) { samplerate = config.samplerate; } function record(inputbuffer) { recbuffersl.push(inputbuffer[0]); recbuffersr.push(inputbuffer[1]); reclength += inputbuffer[0].length; } function exportwav(type) { var bufferl = mergebuffers(recbuffersl, recleng...

linux - How to scroll up and down in sliced "screen" terminal -

Image
i installed screen , idea divide linux terminal multiple pieces. can't figure out 1 thing: how scroll , down, when i'm in screen . when i'm using regular linux terminal can achieve shift + pg up or shift _ pg dn . unfortunatelly doesn't work in divided terminal. that's mean when saying screen , divided terminal: and that's regular termina (just in case): try control+a , escape . after that, should able move cursor around using arrow keys.

php - Doctrine ManyToMany distinction field - possible? -

i'm trying achieve subscription model can applied multiple entities using single table/class doctrine 2. see explanation example below. schema (yml): user: type: entity table: users id: int name: string subscription: type: entity table: subscriptions id: int object_type: string object_id: int user_id: int feature: type: entity table: features id: int name: string manytomany: subscribers: targetentity: user jointable: name: subscriptions joincolumns: object_id: referencedcolumnname: id issue: type: entity table: issues id: int subject: string manytomany: subscribers: targetentity: user jointable: name: subscriptions joincolumns: object_id: referencedcolumnname: id the table data this: users: | id | name | | 1 | john | | 2 | joe | features: | id | name | | 1 | feature | | 2 | feature b | issues: | id | subject |...

caching - Github API Conditional Requests with paging -

context: let's want retrieve whole list of starred repositories given user periodically (ones per day, hour or few minutes). there @ least 2 approaches that: 1) execute https://api.github.com/users/evereq/starred , use url rel='next' in 'link' response headers next page url (we should till no "next" page in response, mean reach end). seems recommended approach (by github). 2) iterating 'page' parameter (from 1 infinite) using https://api.github.com/users/evereq/starred?page=xxx till 0 results in response. ones 0 results, finish (not recommended because example instead of page numbers github can move "hash" values. github did api operations.). now, let's want make sure use conditional requests (see http://developer.github.com/v3/#conditional-requests ) save our api usage limits (and traffic, trees in world, etc.). so add example 'if-none-match' our requests headers , check if response status 304 (not modified). ...

c# - Compare regular expression -

i want compare following string regular expression. have surf lot of time unable it's pattern. string str = "full name: atif mahmood" + "id number: 12345678901" + "mobile number: +921234567890"; in above string full name: id number: mobile number: are necessary sequence , there should string after these constants. var regex = "full name:(.*)id number:(.*)mobile number:(.*)"; var match = regex.match(string, regex); match.groups[1] contain name, [2] contain id number, etc. (groups[0] whole match group, counting each match starts @ 1) this needs bullet proofing, idea?

Meaning of data in release certificate for Android -

Image
when create new keystore / certificate use production release of android apk, can fill out lots of stuff city, state, country code etc. when have @ certificate jarsigner -verify -certs -verbose some_application.apk those aren't visible. do data have meaning, example legal one? or organizational purpose (say have manage hundreds of keystores / certificates)? they organizational purpose. first section (alias, password, validity...) important. recommended filling first , last name input, other aren't required , important application.

asp.net - Why my cookie is not visible from Global.asax? -

i'm going crazy please me. i'm doing mvc application using asp.net 4.0 razor render, in application need build authentication system. have accontcontroller.cs file have following method: public actionresult login(loginmodel model, string returnurl) { var privatetoken = sessionhelper.gettoken(); var user = _application.login(privatetoken, model.username, model.password).results; if (modelstate.isvalid && !user.isnull()) { var serializemodel = new customprincipalserializedmodel { userid = user.username, firstname = user.name, token = privatetoken, email = user.email }; var serializer = new javascriptserializer(); string userdata = serializer.serialize(ser...

jquery - Displaying datepicker on custom DIV -

i have bound jqueryui datepicker input , have custom div --i'd bind datepicker instead. for example: <input type="textbox" id="date"> <div id="datepickerdiv"> </div> script: $("#date").datepicker(); // binding textbox. i want display datepicker in datepickerdiv div. please me this... you can initialize datepicker directly div. $("#datepickerdiv").datepicker(); or $("#date").on('click', function () { $("#datepickerdiv").datepicker(); //initialze datepicker div });

jquery - Data object with different language options. Javascript implementation -

i have weird case when have manage few small texts depending on page language using javascript. imagine need replace parts of template depending on html lang attribute. created multidimensional data object , decided go following way around it. works fine feel not best practice , maybe avoid using switch: jsbin version: http://jsbin.com/eveciva/2/ $(function(){ var lang = $('html').attr('lang'), text; var obj = { 'en' : { 'title' : 'title english', 'url' : 'en.html' }, 'fr' : { 'title' : 'title french', 'url' : 'fr.html', } }; switch(lang){ case'fr': text = [obj.fr.title,obj.fr.url]; break; default: text = [obj.en.title,obj.en.url]; } $('body').prepend('<a href="'+text[1]+'">'+text[0]+'</a>'); }); the question is: far have lan...

c++ - Get BOOST TEST test suite name inside a test case -

i'm using boost test , wonder if there way find out test suite inside test case . know can find test case 's name by: boost::unit_test::framework::current_test_case().p_name is there way find out suite name also? my suites-cases structure is: suite ---> case 1 ______|--> case 2 ______|--> case 3 thanks a unit_test has not p_name p_parent_id , id of test suite. both properties inherited test_unit , common base class unit_test , test_suite . to suite id, can @ how current_test_case works: test_case const& current_test_case() { return get<test_case>( s_frk_impl().m_curr_test_case ); } the m_curr_test_case member test_unit_id , p_parent_id . so, test suite of current test case, can use this: framework::get<test_suite>(current_test_case().p_parent_id) finally, test_suite has p_name property unit_test , should find name there.

microsoft metro - Tailoring Windows store app for Fair -

Image
i'm developing app available @ regional fair , public use download "perks" theirs pen-drives. when move mouse top-right corner of screen "menu" appears (there's similar thing on tablets) , enables user quit/switch-out-of app, , can't allow! how block that? you have wait windows 8.1 i.e. 18th october. 8.1 offers such thing manage. offers kiosk mode . through can allow 1 app open on top most. source

c# - Will Server-Sent Events or SignalR perform better? -

putting aside moment fact ie doesn't support sse, if there's large number of clients, server-sent events or signalr going perform better? one thing bear in mind that, under hood, signalr default best available method of sending/receiving data e.g. ajax long polling, server side events, web sockets. the decision based on attributes such browser in use, plus web server (e.g. iis8 has support web sockets, signalr use if user's browser supports it). i'm saying that, signalr can support many ways of creating connection, there no 1 way available. if use server side events, signalr can use them, or next best thing web sockets. so best isn't fair question in hindsight. edit: extract this article : though signalr tries choose "best" connection supported server , client...

Adaptation of nearest neighbour R code to identify locations of ponds within 1 km for each pond -

i have csv file pond areas , latitude , longitude coordinates 17,305 ponds. each pond identify coordinates of ponds within 1 km of it. r novice thought adapt nearest neighbour code. found loop in r book crawley: x<-runif(100) y<-runif(100) par(pty="s") plot(x,y,pch=16) distance<-function(x1, y1, x2, y2) sqrt((x2 − x1)^2 + (y2 − y1)^2) r<-numeric(100) nn<-numeric(100) d<-numeric(100) (i in 1:100) { (k in 1:100) d[k]<-distance(x[i],y[i],x[k],y[k]) r[i]<-min(d[-i]) nn[i]<-which(d==min(d[-i])) } (i in 1:100) lines(c(x[i],x[nn[i]]),c(y[i],y[nn[i]])) i adapted , used deg.dist function in fossil uses haversine formula instead of using pythagoras. install.packages("fossil") library(fossil) pond_a<-read.csv("c:\\ pondarea_data\\pond_areas.csv") r<-numeric(17305) nn<-numeric(17305) d<-numeric(17305) (i in 1:17305){ (k in 1:17305) d[k]<-with(pond_a,deg.dist(longitude[i],latitude[i],longitude[k],latitude[k]...

ruby on rails 4 - How to find out which parameter is not permitted -

i'm getting error activemodel::forbiddenattributeserror , can't find out parameter causing problem. know how can find out parameter causes raise error activemodel::forbiddenattributeserror ? install gem byebug , read description > https://rubygems.org/gems/byebug . happy bug hunting

Parse RFC 2822 email addresses in Java -

as many people unaware, email addresses require library parse. simple regexes, @(.*) , not sufficient. email addresses can contain comments, can contain characters @ , breaking simple regexes. there node.js library parses rfc 2822 addresses: var address = addresses[0]; console.log("email address: " + address.address); console.log("email name: " + address.name()); console.log("reformatted: " + address.format()); console.log("user part: " + address.user()); console.log("host part: " + address.host()); which direct port of perl module mail::address . this expect exist in java's internetaddress class, doesn't break things down further full address, can include e.g. user@gmail.com . i'm trying extract gmail.com part, doesn't include method do. i'm surprised can't find common library solves this, presumably many people have problem. how can solved using library or no? if need domain part emai...

javascript - stopping an animated object - jQuery & spritely plug in -

i trying set animated div rolls across screen once stops unless page reloaded. // javascript document jquery(document).ready(function() { $('#far-clouds').pan({ fps: 20, no_of_frames: 24, on_first_frame: function(obj) { obj.spstate(1); // change state 1 (first row) on frame 1 }, on_last_frame: function(obj) { obj.spstop(); // stop animation on last frame }, on_frame: { // note - on_frame object not function 19: function(obj) { // called on frame 19 obj.spstate(2); // change state 2 (row 2) on frame 19 }, 16: function(obj) { // called on frame 16 obj.spstate(3); // change state 3 (row 3) on frame 16 } } }); $('#near-clouds').pan({ fps: 20, no_of_frames: 24, on_first_frame: function(obj) { obj.spstate(1); // change state 1 (first row) on frame 1 }, on_last_frame: function(obj) { obj.spstop(); // stop animation on l...

jquery - how to update an event in fullCalendar? -

i want update json in fullcalendar, here trying do. have json string directly trying feed in event objects in full calendar. --> var json[ { "id": "1", // optional "title": "demo event", // required "start": "2013-08-28 10:20:00", // required "end": "2013-08-28 11:00:00", // optional "allday": false, // optional "url": "http://google.com", // optional, not open because of browser-iframe security issues "classname": "test-class", // optional "editable": true, // optional "color": "yellow", // optional "bordercolor": "red", // optional "backgroundcolor": "yellow", // optional "textcolor": "green" // optional }, { "id": "2", //...

java - Unicode characters not converting from pptx to png -

i have written program convert pptx png. conversion happens fine issue ever there unicode character in pptx file - converts junk character. here code. tried add fonts did not help. pptx contains - " /ˌinəˈvāshən/ ". converts letters i, n, v, a, s, h, n fine not others. fileinputstream = new fileinputstream(strtemppath); xmlslideshow pptx = new xmlslideshow(is); is.close(); double zoom = 2; // magnify 2 affinetransform @ = new affinetransform(); at.settoscale(zoom, zoom); dimension pgsize = pptx.getpagesize(); xslfslide[] slide = pptx.getslides(); } // bufferedimage img = new bufferedimage((int)math.ceil(pgsize.width*zoom), (int)math.ceil(pgsize.height*zoom), bufferedimage.type_int_rgb); bufferedimage img = new bufferedimage(pgsize.width, pgsize.height, bufferedimage.type_int_rgb); graphics2d graphics = img.creategraphics(); //graphics.settransform(at); graphics.setpaint(c...

asp.net mvc - Multiple Navigation Paths to a Single Page -

i'm trying use multiple navigation paths single page feature mvcsitemapprovider: https://github.com/maartenba/mvcsitemapprovider/wiki/multiple-navigation-paths-to-a-single-page and these 2 different navigation path that's pointing same resource: <mvcsitemapnode title="multi analysis" controller="report" action="multianalysis" preservedrouteparameters="id"> <mvcsitemapnode title="analysis" controller="report" action="analysis" preservedrouteparameters="id,type" type="ma" /> </mvcsitemapnode> <mvcsitemapnode title="single analysis" controller="report" action="singleanalysis" preservedrouteparameters="id"> <mvcsitemapnode title="analysis" controller="report" action="analysis" preservedrouteparameters="id,type" type="sa" /> </mvcsitemapnode> but, breadcrumb g...

javascript - Highlighting an area of an image map based on search text -

this new question feeding question answered here . i working highlight <div> based on search text. we've accomplished that, alex. now, i'm trying apply same concept mapped coordinates on image map. there's jsfiddle here . here's js(jquery 1.10.2)... function dosearch(text) { $('#content div').removeclass('highlight'); $('#content div:contains(' + text + ')').addclass('highlight'); } if want method without svg, can use maphilight jquery plugin ( github ). i have updated jsfiddle . function dosearch(text) { $('#content div').removeclass('highlight'); $('#content div:contains(' + text + ')').addclass('highlight'); $('#map area').mouseout(); $('#map area[data-text*="' + text + '"]').mouseover(); } $(function() { $('#imgmap').maphilight({ stroke: false, fillcolor: "ffff00", fillo...

grails - Exclude a specific Error from being logged? -

i want exclude following error being logged. have set on config.groovy? 2013-08-28 15:10:13,501 [http-nio-8080-exec-85] error websocket.defaultwebsocketprocessor - java.lang.illegalstateexception: request object no longer valid. object has been cancelled @ org.atmosphere.cpr.atmosphereresourceimpl.getrequest(atmosphereresourceimpl.java:447) @ org.atmosphere.cpr.atmosphereresourceimpl.getrequest(atmosphereresourceimpl.java:467) @ org.atmosphere.websocket.protocol.simplehttpprotocol.onmessage(simplehttpprotocol.java:95) @ org.atmosphere.websocket.defaultwebsocketprocessor.invokewebsocketprotocol(defaultwebsocketprocessor.java:293) @ org.atmosphere.websocket.defaultwebsocketprocessor.dispatchreader(defaultwebsocketprocessor.java:627) @ org.atmosphere.websocket.defaultwebsocketprocessor.invokewebsocketprotocol(defaultwebsocketprocessor.java:402) @ org.atmosphere.container.tomcatwebsockethandler.ontextdata(tomcatwebsockethandler.java:100) @ java.util....

python - Correct path/url for media files in django -

i using django 1.5.2 , having hard time understanding purpose of media directory vs. static directory , how include stylesheets in django project. this directory structure: django_books beer __init__.py admin.py models.py views.py random_book (same beer above) django_books (the actual django project; beer , random_book above apps) templates base.html beersall.html __init__.py settings.py urls.py views.py wsgi.py static css beers.css media css beers.css static css beers.css manage.py my beersall.html template (the beer output correct, linking stylesheet wrong): {% extends 'base.html' %} {% block content %} <div id="beer_list"> {% beer in beers %} {{ beer }}, {% endfor %} </div> {% endblock %} my base.h...

java - spring mvc + jpa + hibernate + transaction issue -

i seem unable persist data in db using injected entitymgr in spring mvc. have seen multiple similar questions (like entitymanager cannot use persist save element database ) , none of answers seem solve issue. here config: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/aop http://www.springframework.org...