Posts

ruby on rails - routing error on something/new -

i'm receiving action controller exception on 'new' path of http://bob.dev/assessments/new . added devise , sextant project , path that's giving me issue working previously. i'm doing wrong , stand little getting right. thanksyou! the exception: uninitialized constant errorscontroller (actioncontroller::routingerror) the routes: bob::application.routes.draw devise_for :users mount_sextant # sextant gem ##################### match '*not_found' => 'errors#handle404' # visit http://bob.dev/rails/routes match "*path" => 'errors#handle404' ################################### # resources :users # authentication scratch ##### # resources :sessions ################################### root :to => "assessments#index" resources :assessments end and finally, output http://bob.dev/rails/...

mysql - Filter with an array -

i know can search id array using id in ($array) like $ids = join(',',$galleries); $sql = "select * galleries id in ($ids)"; can done in reverse there's column of ids stored in table , pass single id condition in clause?

android - Picking image always gives landscape image -

i have used following code pick image phone's gallery: intent intent = new intent(); intent.settype("image/*"); intent.setaction(intent.action_get_content); startactivityforresult(intent.createchooser(intent, "select picture"), use_library_pic_request); in onactivityresult(), gives filepath, tried getting bitmap using filepath, gives in landscape view. there way image in portrait view always? code getting filepath: uri selectedimageuri = data.getdata(); selectedimagepath = getpath(selectedimageuri); this how got bitmap using file path: bitmap bmp=bitmapfactory.decodefile(selectedimagepath); to original image can use method. public static bitmap getbitmap(string uri, context mcontext) { bitmap bitmap = null; uri actualuri = uri.parse(uri); bitmapfactory.options options = new bitmapfactory.options(); options.intempstorage = new byte[16 * 1024]; options.insamplesize = 2; contentresolver cr = mcontext....

ios - How to rotate UITableViewCellAccessoryDisclosureIndicator? -

i'm making uitableview expandable/collapsable cells ios app. put uitableviewcellaccessorydisclosureindicator on these cells i'd make arrow headed up/down when cell expanded/collapsed. i found it's possible make button custom image , change button according state of cell seems dirty me because don't need button there , have add 2 images project (ok it's not big anyway). so shouldn't better rotate existing uitableviewcellaccessorydisclosureindicator ? , if how can that? this not want, first thing thought of. first, instantiate button of type uibuttontypedetaildisclosure: uibutton *button = [uibutton buttonwithtype:uibuttontypedetaildisclosure]; next, rotate button 90 degrees: cgaffinetransform rotationtransform = cgaffinetransformidentity; rotationtransform = cgaffinetransformrotate(rotationtransform, degreestoradians(90)); button.transform = rotationtransform; finally, use button accessoryview: cell.accessoryview = button; hope he...

How do I expand a built in Git command with an alias? -

when answering " git pull hook script executes locally ", stumbled upon use-case alias built-in git command such pull or push extension. how do that? first thought was: [alias] push = "!echo -n \"really push? [y/n]\";read -s -n 1 really;if [[ $really == \"y\" ]];then git push; else echo \"aborting\"; fi" this works fine long don't name alias push (for example qp or that). call push , it's somehow ignored. is there git way expand built in git command alias or have set alias in .bashrc ? short answer: you can't . git disallows explicitly prevent confusion , shadowing might affect invocation of git commands (in scripts, etc.). see git-config manpage . alias.* command aliases git(1) command wrapper - e.g. after defining "alias.last = cat-file commit head", invocation "git last" equivalent "git cat-file commit head". avoid confusion , troubles script usage, a...

ruby on rails - How to create a user using code when i am using devise gem for Sign up / Sign in -

i using devise gem application. create user using code, in database table "users" password encrypted. hope cannot directly save as new_user = user.new new_user.email = "xyz@xys.com" new_user.password = "1sdf" - cannot use becs : encrypted_password new_user.save is possible? you should able actually, devise's encrypted_password method handle encrypting password pass in , storing in database u = user.new(:email => "foo@bar.com", :password => '1sdf', :password_confirmation => '1sdf') u.save try out in rails console.

linq - EF 4.3 Code First - Querying a navigation property backwards -

i trying query 1 many relationship cannot figure out how this. problem have id of field want filter lives in join table (not main table)... its easier illustrate rather explain!! the 2 classes have are public class dbuserclient { public virtual string userid { get; set; } public virtual int clientid { get; set; } public virtual datetime assignedon { get; set; } public virtual datetime? clearedon { get; set; } // navigation properties public virtual dbuser user { get; set; } public virtual dbclient client { get; set; } } and public class dbclient { public virtual int clientid {get;set;} public virtual string entityname { get; set; } public virtual bool deleted { get; set; } // navigation properties public icollection<dbuserclient> userclients { get; set; } } in program have repository exposes clients i.e. public observablecollection<dbclient> clients { { return context.clients.local; } ...