Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

rails helper to give a upload file a unique name? -


hey guys i'm working on project require upload lot of videos, rails have helper can handle this, address of youtube video :

www.youtube.com/watch?v=kyuhtpv_lk4

thanks

are using activerecord model files or flat files somewhere?

if have model uploadedfile << activerecord::base each file can use id of model or if want string can hash string added salt.

irb(main):021:0> file_id = 1 => 1 irb(main):022:0> digest::sha1.hexdigest('somerandomstring' + file_id.to_s) => "70f5eedc8d4f02fd8f5d4e09ca8925c2f8d6b942" 

if keeping them flat files on system, can hash path+filename create unique string.

irb(main):016:0> digest::sha1.hexdigest '/home/bob/somefile.mp4' => "204a038eddff90637c529af7003e77d600428271" 

and can add in timestamp of current time , random number prevent dupes.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -