Posts

ruby on rails - FactoryGirls randomly fails with 'Factory not registered', why? -

i've tests randomly fail, approx. 20% of times. means without changing code, each time run tests 1 time out of 5 fail "factory not registered" error. it's weird.. :( this consone output: failures: 1) unit#new_from_string returns factor metric conversions failure/error: factorygirl.create :taza argumenterror: factory not registered: taza # ./spec/models/unit_spec.rb:29:in `block (2 levels) in <top (required)>' finished in 0.29619 seconds 4 examples, 1 failure failed examples: rspec ./spec/models/unit_spec.rb:22 # unit#new_from_string returns factor metric conversions randomized seed 61727 and code: file: "unit_spec.rb" require 'spec_helper' describe unit, "#new_from_string" "parses string , returns unit object" [some tests...] factorygirl.find_definitions u = factorygirl.create :taza factorygirl.create :tbsp [tests...] end "returns factor metric...

html - TD taking up entire width of row -

i need set html table email in each column has set width. the left column image , right have text. have set td width td renders 600px wide no matter what. the email can viewed here here code <!doctype html> <html> <head> <meta charset="utf-8"> <meta name="description" content="fitzgerald description"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title> fitzgerald email </title> </head> <body bgcolor="#ffffff" style="margin:0; padding:0; width:100% !important; background-color:#f8f6f2; font-family:calibri, 'helvetica neue', helvetical, arial, geneva, clean, sans-serif;"> <table bgcolor="#ffffff" align="center" border="0" cellpadding="0" cellspacing="0" style="width:600px; max-width:600px; margin:0 auto 0 auto;" width="60...

performance - Is Redis good choice for performing large scale of calculations? -

currently pulling large scale of data oracle database & performing calculation on web side generating html reports. using groovy & grails frame work report generation. now problem , having huge calculation & takes lots of time generate report on web side. i planning re-architecture reports , generate reports quickly. i don't have command on oracle database it's third-party production database. i don't want replication of database , because has millions of records , can't schedule & replication slow down production. i came caching architecture , perform calculation engine. anyone can me providing best solution ? thanks what structure of data? want query sql can you, or binary/document? do need persistence (durability) or not? redis fast. if have single threaded app using ms sql , bulk importer, it's incredibly fast too. redis key/value stores need perform single set every column within domain object, can slower othe...

regex - regular expression which should allow limited special characters -

can 1 tell me regular expression textfield should not allow following characters , can accept other special characters,alphabets,numbers , on : + - && || ! ( ) { } [ ] ^ " ~ * ? : \ @ & this not allow string contains of characters in part of string mentioned above. ^(?!.*[+\-&|!(){}[\]^"~*?:@&]+).*$ see here brief explanation assert position @ beginning of line (at beginning of string or after line break character) ^ assert impossible match regex below starting @ position ( negative lookahead ) (?!.*[+\-&|!(){}[\]^"~*?:@&]+) match single character not line break character .* between 0 , unlimited times, many times possible, giving needed (greedy) * match single character present in list below [+\-&|!(){}[\]^"~*?:@&]+ between 1 , unlimited times, many times possible, giving needed (greedy) + the character "+" + a "-" character \- one of characters &|!(){}[” «&|!(){}[...

javascript - Passing method through a directive to a parent directive -

edit: modified code per stevuu's suggestion added plunkr here i'm attempting have child directive call method(resolve) through directive way parent directive i'm having difficulties identifying problem approach. the problem right seems although resolve() called expected on click, selected remains undefined. the html: <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>angular: directive using &amp; - jsfiddle demo</title> <script type='text/javascript' src='//code.jquery.com/jquery-1.9.1.js'></script> <link rel="stylesheet" type="text/css" href="/css/normalize.css"> <link rel="stylesheet" type="text/css" href="/css/result-light.css"> <script type='text/javascript' src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0....

sql - FOR INSERT trigger not firing -

i having problem insert trigger this trigger code : set ansi_nulls on go set quoted_identifier on go create trigger [dbo].[vtriggers] on [dbo].[stats] insert insert [newdb].dbo.newstat (statid) select id inserted the weird thing , build table exact table want make trigger in , trigger works new 1 , on old 1 not working. info : in old table have multiple inserts in same time. here schema both table : old stat ( trigger not working on it) set ansi_nulls on go set quoted_identifier on go create table [dbo].[stats]( [id] [int] identity(1,1) not null, [code] [nvarchar](100) null, constraint [pk_stat] primary key clustered ( [id] asc )with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on, allow_page_locks = on, fillfactor = 80) on [primary] ) on [primary] textimage_on [primary] and new test stat ( trigger works on it) : set ansi_nulls on go set quoted_identifier on go create table [dbo].[teststats]( ...

asp.net - how to delete image file after upload in C#? -

i have problem on deleting or moving files after upload in asp.net. i using radupload uploading files , want have remove button delete physical file. however, right after successful upload can't delete physical file , error raised "file in use". you should delete self writing code, , think should upload code too. anyway here sample code delete file. fileinfo info1 = new fileinfo(folderpath + filename); if (info1.exists) { info1.delete(); }