Posts

How to integrate frontend and admin theme together in ruby on rails -

Image
i have application admin in ruby on rails. need add front-end in application. don't know how ingrate both in single application. you can create "admin" area pretty once know how. comes down namespaces , specifically: #config/routes.rb namespace :admin # sets "/admin" root "application#index" end namespaces "folders", influence names of rails classes (for example, controller class names). this means you'll able use following: #app/controllers/admin/application_controller.rb class admin::applicationcontroller < actioncontroller::base layout :admin def index #do stuff here end end your models remain (no need make them admin namespaced). -- the above code should give ability access yoururl.com/admin , have controller/action work with. of course, negates fact you're going have populate area data & controller actions; works "standard" rails app once working. you'...

ios - How to convert [String : String?] to [NSObject : AnyObject]! in Swift 2.0 for Firebase Api? -

Image
how can convert [string : string?] [nsobject : anyobject]!? right project using firebase backend swift app. after updated xcode 7 , swift 2.0, i got error .updatechildvalues function , image below. how can fix this? thanks! the problem values in dictionary of type string? , , contain nil . when dictionary passed objective-c code in firebase, it's converted nsdictionary . values in nsdictionary can't nil . i'm guessing self.deckname.text or self.deckdetails.text returning string? instead of string part of sdk update in xcode 7. if you're absolutely never return nil , can add exclamation point after self.deckname.text and/or self.deckdetails.text unwrap string? string . note if make bad assumption , return nil , program crash. if you're uncertain, self.deckname.text ?? "" , means "return deckname.text if it's not nil, otherwise return empty string".

c# - DataAdapter throws error while filling DataTable -

Image
i trying fill datatable using npgsqldataadapter. have prepared command string commandstring=@" drop table if exists tempdata; create temp table tempdata select x x x x (_query_); select x+x, xx, x-y newtemptable tempdata; and using below function fill data in datatable public datatable searchpg(string commandstring, npgsqlparameter[] param) { datatable resulttable = new datatable(); try { openconnection(); dbcommandpg.commandtext = commandstring; dbcommandpg.connection = databaseconnectionpg; dbcommandpg.parameters.clear(); if (param != null) { dbcommandpg.parameters.addrange(param); } adappg.selectcommand = dbcommandpg; resulttable.clear(); adappg.fill(resulttable); } catch (exception ex) { file.writeexception(ex.message, null); throw ex; } { databaseconnectionpg.close(); } return resulttable; } error oc...

c# - Deserialize list set index to object property -

i have following xml <itemsroot> <itemlist> <item> <name>a</name> <itemlist> <item> <name>aa</name> </item> <item> <name>ab</name> </item> </itemlist> </item> <item> <name>b</name> </item> <item> <name>c</name> </item> </itemlist> </itemsroot> my classes are public class item { [xmlignore()] public int itemindex {get;set;} public string name {get;set;} private item[] itemslist; [xmlelement(isnullable = true)] [xmlarrayitem("item", typeof(item))] [xmlarray("itemlist")] public item[] itemslist { { return itemslist; ...

android - Extract Images from JSON Object -

i fetching popular movies api, , trying poster images each movie. need extract poster_path parameter json string. this code extract information json string: final string owm_results = "results"; final string owm_posterpath = "poster_path"; string aux; // moviejsonstr string full http request jsonobject moviejson = new jsonobject(moviejsonstr); jsonarray moviearray = moviejson.getjsonarray(owm_results); for(int = 0; < moviearray.length(); i++) { jsonobject movieobj = moviearray.getjsonobject(i); aux = movieobj.getstring(owm_posterpath); log.v("aux: ", aux); } the json string looks this: { "page":1, "results":[ { "adult":false, "backdrop_path":"/tbhdm8ujab4victsulyfl3lxmcd.jpg", "genre_ids":[ 53, 28, 12 ], "id":76341, "original_language":"en", "original_title":...

android - Map Fragment doesn't load with same GPS location and Map Type -

i'm new android programming. i'm working on android project need access google maps. i've navigation drawer couple of options include google map location too. so whenever try load map first time works fine , loads map current gps location , map type defined. but whenever try switch other fragment , come map fragment, gps function , map type doesn't work. help needed. in advance. i'm trying possible fix it. :) my code below. what i'm trying here whenever user touches somewhere, marker placed on location. public class addcustomerlocationfragment extends fragment implements locationlistener { private mapview mapview; private googlemap map; private marker marker; private boolean markeravailable; private bundle bundle; button btnreset, btnsetlocation; locationmanager locationmanager; private view view; private double[] addcustomerlocation = new double[10]; @override public view oncreat...

iphone - draw route with multiple markers on Google Map iOS -

i'm new iphone development, in application want draw route between 2 points , show multiple markers on route. i'm done route between 2 points don't know how draw multiple markers on route. please me this. thanks in advance!!! _markerstart = [gmsmarker new]; _markerstart.title = [[[routedict objectforkey:@"legs"] objectatindex:0]objectforkey:@"start_address"]; _markerstart.icon = newimage; //[uiimage imagenamed:@"startmarker.png"]; _markerstart.map = gmsmapview; _markerstart.position = startpoint; _markerfinish = [gmsmarker new]; _markerfinish.title = [[[routedict objectforkey:@"legs"] objectatindex:0]objectforkey:@"end_address"]; _markerfinish.icon = newimage; //[uiimage imagenamed:@"finishmarker.png"]; _markerfinish.map = gmsmapview; _markerfinish.position = endpoint; here have added start , end marker. as completed drawing route between 2 points, have co-ordinates route. can take co-ordinates ...