Posts by user12010 • 62 points
6 posts
-
-2
votes8
answers3166
viewsA: Fewer moves from a horse to a given house in Chess
p=(5, 3) s=(1, 1) def f(x,y):x=abs(x);y=abs(y);s=x+y;return(.9+max(x/4,y/4,s/6)-s/2+(s==1or x==y==2))//1*2+s print(int(f(s[0]-p[0],s[1]-p[1])))
-
1
votes1
answer84
viewsQ: Relationship Through Many-To-Many Activerecord
I have the following configuration in Rails: Company has_many :company_products has_many :products, :through => :company_products Product has_many :company_products has_many :companies, :through…
-
0
votes1
answer67
viewsQ: Performance problem when returning json with rabl after query with activerecord
I’m having trouble adjusting performance when returning json after a database query. I’ve tried a lot of things, and I’m not getting any faster. Someone can give me a boost with this ? This is the…
-
0
votes1
answer89
viewsQ: Consultation on the Activerecord
I have this relationship . How do I consult on ActiveRecord to return data from Works, WorkZei and Wi_schools? I tried so: r = Responsible.find(1) students = r.students students.each {|s|…
-
1
votes1
answer7998
viewsQ: ERROR 1241 (21000): Operand should contain 1 column(s)
I have this select SELECT `works`.`grade_id` FROM `works` INNER JOIN `work_images` ON `work_images`.`work_id` = `works`.`id` INNER JOIN `work_students` ON `work_students`.`work_id` = `works`.`id`…
-
3
votes1
answer96
viewsA: How do I return the number of lines that appear with a given start?
open ([FILEHANDLE, '[FILE OPENING TYPE]',[DIRECTORY/FILE] ); If the @n array contains the file information read the array directly: open my $new_file, '>', 'new_sequence_file' or die "Not…