Posts

javascript - modifying a multiple selects validation with jquery -

what i've got far: jsfiddle what want is: add class "invalid" <select> if not selected in it's row remove class if 3 selects in row selected if <select> s in 1 row selected submit form if 1 <select> selected add "invalid" class other 2 selects in same row this html , js included in fiddle link above : <form id="productoptions" name="product-options"> <div class="selects s1"> <select name="selectss1" id="size1" class="product-select-options-size"> <option>-size</option> <option>small</option> <option>medium</option> <option>large</option> <option>x-large</option> </select> <select name="selectsc1" id="color1" class="product-select-options-color"> <option>-color</option> <opti...

xcode - Reading file line by line in iOS SDK -

i have texfile follows: line1 line2 line3 line4 line5 .... i want read file 2 arrays of string line1, line3, line 5,... go array1 , line 2, line 4, line 6,... go array2 . each element of arrays stores 1 line. step 1) read file ( [nsstring stringwithcontentsoffile:encoding:error:] ) step 2) split string ( [nsstring componentsseparatedbycharactersinset:[nscharacterset newlinecharacterset]] ) step 3) iterate on array , insert 2 arrays

Heap corruption while freeing allocated memory in C -

in attempt free memory after malloc command prevent memory leaks, running heap corruption problem during runtime. debug telling me application trying write memory after end of heap buffer has been reached. here have simplified isolate problem. #include <stdio.h> #include <stdlib.h> #include <math.h> main(){ int i,j,n; int temp[4]; int **a; printf("amount of intervals entered: "); scanf("%d", &n); //allocate memory 2d array of size (n x 4) = (int**) malloc(n*sizeof(int*)); (i=0;i<4;i++){ a[i] = (int*) malloc(4*sizeof(int)); } if (!a){ printf("malloc failed %d\n",__line__); exit(0); } printf("please enter intervals line @ time followed return: \n"); for(i=0;i<n;i++){ scanf("%d %d %d %d",&a[i][0], &a[i][1], &a[i][2], &a[i][3]); } for(i=0;i<n;i++){ printf("%d, %d, %d, %d\n", a[i][0], a[i][1], a[i][2], a[i][3]); } // free allocated memory (i=0;...

mySQL to PostgreSQL concat first name and last name for name search (Ruby on Rails) -

hey i'm trying figure out how convert statement works in mysql postgresql , curious if knows solution. here statement works in mysql: def self.by_name(keywords) if keywords find(:all, :conditions => ["concat(first_name," ",last_name) like?", "%#{keywords}%"]) end end here statement found on this site had similar problem, doesn't work me, in, if search contact.by_name("bobby"), there no results. def self.by_name(keywords) if keywords find(:all, :conditions => ["textcat(textcat(first_name,text ' '),last_name) like?", "%#{keywords}%"]) end end the idea search "bobby", "fishcer", or "bobby fischer" , match either first name, last name, or both first , last name. thanks! you can use concatenation operator ( || ) paste together: :conditions => [ "coalesce(first_name, '') || ' ' || coalesce(las...

spring - How springSecurityFilterChain Skips Authentication for already logged in requests -

i have been working on spring security, , working well. went debugging how works. filters configured springsecurityfilterchain via http namespace. 1 of them authentication filter providing authentication. found when new login request comes(no previous session) authentication filter invoked, when request comes logged in user, i.e, session existing, authenticationfilter not invoked. coudn't find , how 'springsecurity' skips authentication logged in requests. please me understand this. thanks i think sessionmanagementfilter takes care of this: if (!securitycontextrepository.containscontext(request)) { authentication authentication = securitycontextholder.getcontext().getauthentication(); if (authentication != null && !authenticationtrustresolver.isanonymous(authentication)) { // user has been authenticated during current request, call session strategy try { sessionauthenticationstrategy.onau...

download image using php form -

i need download particular image page using submit button, using form , php submit action, here html , php code html code <form name="logo" action="" method="post"> <input type="hidden" name="lgpath" value="images/logo/<?php echo $selpro['lgpat'];?>"> <img src="images/cmplogo/<?php echo $selpro['lgpat'];?>"> <div><input type="submit" value="<?php echo $selpro['lgname'];?>" name="dwnlg" id="dwnlg"></div></div> </form> php code <?php if($_post['dwnlg']) { $lgpath=$_post['lgpath']; header('content-disposition: attachment; filename="'.$lgpath.'"'); } ?> i gave path download image header it's downloaded current page file, how can solve it? try following code download...

sql server - How to group the rows and move them into new column in the same table? -

Image
i want group rows , move them new column in same table. here ilustration: and query i've made far: select month([date]) bulan, [type] tipe, sum([net qty]) total_karton, cast(sum([cm1 (rp)]) decimal) total_uang tbl_weeklyflash_id datediff(month,[date],current_timestamp) between 0 , 2 group month([date]), [type] order month([date]), [type] how that? you want pivot - there's example @ http://www.mssqltips.com/sqlservertip/1019/crosstab-queries-using-pivot-in-sql-server-2005/