Posts

prototype - Rails not submitting form values -

working on old app uses rails/prototype view helpers/rjs extensively. have recurring problem (happens half dozen times week, on same pages) form params not getting submitted. controllers point of view, params hash contains values router able pick route. looking @ forms themselves, tend basic. one thing in common use remote_form_for, has form disabling code runs after prototype kicks off ajax. in few places, more explicit, (uses ancient syntax, started rails 1 app): remote_form_for :pallet_move, :row_id => 'new_pallet_move', :html => {:id => 'new_pallet_move_form'}, :method => :post, :after => "$('new_pallet_move_form').disable();', :url => create_many_pallet_moves_path |f| in controller, doing this palletmove.new params[:pallet_move].merge(:move => move) now, code works like, 99% of time. according hoptoad, ten times in last month, nomethoderror: undefined method 'merge' nil:nilclass params {...

javascript - JQuery addClass opacity function fade through images - Solve a Fiddle -

this function uses jquery , ui fade images through 1 in gallery. getting strange results. on our site appears images not timing correctly , fading seemingly intimitantly. anyway built fiddle http://jsfiddle.net/tggc5/17/ this fiddle not function @ all, ie. nothing happens yet far can see has resources needs. can solve fiddle - images should fade smoothly through each other creating lovely transition effect. any ideas? marvellous update - getting there still not quite http://jsfiddle.net/tggc5/39/ watch transition between last slide , first one. static not fading through. when thumbnail clicked needs perform function , reset timer. any ideas? here: http://jsfiddle.net/7qrbe/ some mistakes corrected: no need set opacity changing class, use hide / fadein / fadeout remember cleartimeout using global var, or else timer override real clicks first() don't work in case, call '.thumbs.first' had reformulate condition of loop end (checking ...

python - How to improve performance of this recursive function? -

i'm trying write function search str substr, taking account different possibilities write weird letters, such æ, ø, å in danish language. example can search 'Ålborg' , function return true if there is, 'aalborg' in str. the function below works, performance unbearable. recommend improve performance? def danish_tolerating_search(substr, str): '''figure out if substr in str, taking account possible deviations in writing letters æ, ø, å. æ <-> ae ea ø <-> oe o å <-> aa o ''' # normalize input substr = substr.lower().replace('aa',u'å') str = str.lower() # normalized recursive search # todo fix perfomance def s(substr, str): if str.find(substr) >= 0: return true if substr.find(u'æ') >= 0: if s(substr.replace(u'æ','ae', 1), str): return true elif s(substr.replace(u'æ', ...

C++ problem with Datagram (UDP)winsocket to sendto and recvfrom on the same socket through the loopback adapter -

i trying send data udp socket , receive them on same socket through windows loopback adatper. in network properties set loopback adapter have following ip 192.168.1.1 the recvfrom function returns -1 indicating error. monitor traffic on loopback adapter wireshark , nothing seem sent loopback adapter, see no trafic. is true on windows can't use loopback address(127.0.0.1) ? saw on forums, why try use loopback adapter. tried send directly own ip, gives no better results. btw possible send own ip , data back? i appreciate , in case, new socket programming. below code: #define dst "192.168.1.1" int _tmain(int argc, char* argv[]) { int numbytes; int bytes_sent; int server_sock; char send_msg[100]; int send_msg_length = 100; char rcv_msg[100] = { 0 }; int rcv_msg_length = 100; int i; wsadata wsadata; if(wsastartup(makeword(2, 2), &wsadata) != 0) { fprintf(stderr, "wsastartup failed.\n"); return 1; } sockaddr_in t...

ruby on rails - Change JSON formatting -

the following 2 pages provide same json object. possible have facebook style json formatting rails application?? desired formatting: https://graph.facebook.com/19292868552 my application formatting: http://sframework.heroku.com/api/graphs thanks ruby json library has pretty_generate function. require 'json' puts json.pretty_generate(fbjson)

Duplex WCF service channels continuously alive (WSDualHttpBinding) -

the arhitecture: console application contains wcf duplex service; windows app consumers; every app subscribe duplex, have list of subscribers , service must send notifications of them in case events apper; the problem: how maintain connection alive continuously service can send notifications clients ? i found there 2 channels binding. need have permanently channel service (for callbacks) open. thanks; as long client connected service, callback channel alive. once client disconnects (or channel gets faulted), callback channel close.

Scale text in WPF -

how can automatically scale text inside control based on control's size make sure it's readable (that is, want font size stays between 9pt , 30pt) try use scaletransform. in order understand how calculate scale size may refer http://social.msdn.microsoft.com/forums/en-us/wpf/thread/d73c9eb2-9c68-428d-b99b-d23d0c62c095/