Posts

Showing posts from August, 2015

java - Automated XML (de)serialization on Android? -

what enterprise-level options xml databinding on android? it's possible i'm misusing term "databinding": i'm looking support automatic (de)serialization of java pojos & xml. in context of communicating rest services not have client package use. initial research problem has demonstrated, surprise, accomplishing task on android has many barriers: the java-standard jaxb library isn't present on android the java-standard xml streaming package isn't present on android jackson xml doesn't work without xml streaming (or suspect workaround) simplexml isn't jax-rs compliant, requires pojo re-annotations, , worst: requires significant work handle non-trivial variety of common objects (eg; uuid, uri) i'm quite surprised such common & trivial problem on other platforms leads feels dead-end. the services i'm working in alpha state, not have stable domain model. before diving fragile world of sax parsers, pull parsers, and/or x

android - AppCompat and EditText different underline on different API -

Image
i'm trying make underline line color change edittext (it used input's validation, must able change in runtime). i'm using appcompat library. problem on api 21 , above, see transparent black line (gray overlay), instead of bolded version. how make same in api 16? i used code change tint: final drawable originaldrawable = view.getbackground(); final drawable wrappeddrawable = drawablecompat.wrap(originaldrawable); drawablecompat.settint(wrappeddrawable, color.red); setbackground(view,wrappeddrawable); solution found adding these lines theme: <item name="edittextstyle">@style/base.v7.widget.appcompat.edittext</item> <item name="edittextbackground">@drawable/abc_edit_text_material</item>

ruby on rails - Multiple User Types - Group Authentication - Devise Token Auth -

i using devise token auth gem ( https://github.com/lynndylanhurley/devise_token_auth ) multiple users, , getting weird bug when trying authenticate. create devise_token_auth_group lets me authenticate multiple user types. however, neither of if or elsif conditions below met, although before_action :authenticate_user! seems pass index action (because doesn't render or redirect , allows index action run). ideas if doing wrong or missing something? i signed in shopper , should getting locations when send request action. @ first, locations. however, after repeatedly accessing server every 5 seconds, @locations ends being empty because neither if or elsif conditions met... leads me believe before action not working properly. test, tried hitting route using postman rest client without access token, , somehow returned empty array, believe problem is. devise_token_auth_group :user, contains: [:shopper, :merchant] before_action :authenticate_user!, except: [:update] before_ac

how to reformat this javascript array? -

i have variable this var item = [ {'id': '1', 'quantity': '100'}, {'id': '2', 'quantity': '200'} ]; but need change format var new_item = { '1': {'quantity': '100'}, '2': {'quantity': '200'} }; i loop this, errors for(i=0; i<item.length; i++){ new_item = { item[i].id: {'quantity': item[i].quantity} }; } how can change format t__t update fix: oh yes need change this for(i=0; i<item.length; i++){ new_item[item[i].id] = {'quantity': item[i].quantity}; } that work, sorry damn question, think i'm sleepy, thx guys ^_^ you need use bracket notation set derived keys. initialize new_item = {} first. new_item[item[i].id] = {quantity: item[i].quantity} note if using ecmascript6 can use com

How to limit access to a controller using Authorize(Users="Alice,Bob") -

i created mvc 5 application uses active directory authentication. how can limit access controller selected users. know can [authorize(users="alice,bob")] don't know if work ad authentication well. ' alice & bob ' need on database? thank you ceci in little knowledge in this, understand objects (alice,bob) need in session, mean, after authenticate sucessfully in app access controller, database not reference session is.

ruby on rails 3 - ubuntu server 14.04 not rendering local characters generated using wicked_pdf -

i have pdf page containing ethiopian characters. works in ubuntu desktop 14.04, when deploy ubuntu server 14.04 characters not being displayed. using wicked_pdf gem generate pdf page. i stuck here whole day. welcomed. for pdf creators need have fonts using available on machine doing creation on. in case ethiopian font installed on desk top machine, not on server, leaving blanks in pdf.

android - CursorLoader Sort Order and updates -

i have gallery app using cursorloader allows sorting of images metadata. sort defined when cursorloader created. // returns new cursorloader return new cursorloader( this, // parent activity context meta.data.content_uri, // table query projection, // projection return selection, // no selection clause selectionargs, // no selection arguments sort // default sort order ); if user selects images taken viewer. have opportunity manipulate metadata. causes automatic resort, can confusing. selected image may move middle end based on sorting , user won't realize this, they'll unable swipe when thought could. is there way sort cursorloader initially, have maintain _id order, henceforth, if data sort based on changes? edit: possible solutio

ios - Integrate swift in objective c framewok -

i starting objective framework , wanna integrating swift code in it. according official document. ( https://developer.apple.com/library/ios/documentation/swift/conceptual/buildingcocoaapps/mixandmatch.html#//apple_ref/doc/uid/tp40014216-ch10-xid_78 ) because generated header framework target part of framework’s public interface, declarations marked public modifier appear in generated header framework target. can still use swift methods , properties marked internal modifier within objective-c part of framework, long declared within class inherits objective-c class. however, found impossible access internal part of swift like: @objc internal class a: nsobject {} the quote says “you can still use swift methods , properties marked internal modifier” (emphasis added). in example class (not method or property) internal . if make class public , add internal method, should able access method. edit : following works me: swift: @objc public class myclass : nsobjec

javascript - Coloring row based on a field value in Angular UI Grid -

i'm trying color row depending on each row's field value in latest angular-ui-grid. dont have particular column definitions since columns generated dynamically.we using ui grid selection. i have read through answers , found can using rowtemplate. here row template rowtemplate:'<div ng-class="{ \'grey\':row.entity.locked=="true" }"> <div ng-repeat="(colrenderindex, col) in colcontainer.renderedcolumns track col.uid" class="ui-grid-cell" ng-class="{ "ui-grid-row-header-cell": col.isrowheader }" ui-grid-cell></div></div>' i trying color respective row grey, if value in "locked" column "true" in it. not working. row template correct or there other way acheive ? $scope.gridoptions={ showgridfooter: true, data:'mydata', paginationpagesizes: [10, 15, 20], paginationpagesize: 10, enableco

Android / Internal Phone Storage / File Access -

Image
how file in android's internal storage. here's screenshot of file manager of android: i want folder named "csentry". to figure out path csentry, examined entire filesystem structure using code (i'm running code directly on device, have device connected laptop through usb, developer debug mode on, device running android 4.1.1): protected void onhandleintent(intent workintent) { file rootdirectory = environment.getrootdirectory(); log.d("filez", "-----------------"); traverse(0, rootdirectory); log.d("filez", "-----------------"); } private void traverse(int level, file f) { if (f != null && f.isdirectory()) { stringbuilder sb = new stringbuilder(); (int = 0; < level; i++) { sb.append("."); } sb.append(f.getname()); log.d("traverse", sb.tostring()); file[] f2s = f.listfiles(); if (f2s != null)

html - How to get line break in javascript inside variable -

i have array: var social = [ ["facebook", "#link", "#62b500", "images/facebook.png"], ["instagram", "#link", "#62b500", "images/instagram.png"], ["twitter", "#link", "#62b500", "images/twitter.png"] ]; i want add line breaks or space/margin between icons @ positions. the result should this: facebook instagram ----linebreak/free space--- twitter ----linebreak/free space--- else else else my transformation-code far looks this: $("#socialside").append('<ul class="mainul"></ul>'); /// generating bars for(var i=0;i<social.length;i++){ $(".mainul").append("<li>" + '<ul class="scli" style="background-color:' + social[i][2] + '">' + '<li>' + social[i][0] + '<img src="

Outputing prime numbers- Java -

this question has answer here: prime numbers in java - algorithms 6 answers i'm having trouble code. i'm trying write method output prime numbers 2-10,000. i'm still beginner in java , wasn't sure how go doing this, know use binary search method , loops this. tried follow examples reading through in textbook , online; came with, not working properly. i'm not sure if it's entirely correct. or advice on how go doing or fixing appreciated. public static void prime() { int i; // variable loop for(i=2; i<=10000; i++) { int factors =0; int j = 1; while(j<=i) { if(i%j == 0) { factors++; } //end if j++; } if(factors == 2) { system.out.println(i); } //end if }// end } // end method pr

multithreading - catch undefined method exception from a thread and restart it in ruby -

i have activemq topic subscriber in ruby uses stomp protocol failover connect broker , if somehow activemq gets restarted exception : undefined method `command' nil:nilclass /usr/lib64/ruby/gems/1.8/gems/stomp-1.1.8/lib/stomp/client.rb:295:in `start_listeners' /usr/lib64/ruby/gems/1.8/gems/stomp-1.1.8/lib/stomp/client.rb:108:in `join' /usr/lib64/ruby/gems/1.8/gems/stomp-1.1.8/lib/stomp/client.rb:108:in `join' ./lib/active_mq_topic_reader.rb:31:in `active_mq_topic_reader' main.rb:164 main.rb:163:in `initialize' main.rb:163:in `new' but exception when use join() method on broker thread, otherwise no exception appears , subscriber unsubscribed topic. problem facing have different mechanism of shutting down process sending shutdown signal, , till process waits, if use join() process stuck on line , not able close method shutdown signal.so should catch exception , restart listener thread? active_mq_topic_reader.rb : require 'rubygems' requ

xslt - Stuck Campaign Monitor XML into FileMaker -

i'm trying import export campaign monitor api filemaker stuck getting xslt work custom fields. i'm trying key values of id , mr_or_mrs. i think need key function whatever i've tried hasn't worked. xml: <pagedresult> <numberofpages>1</numberofpages> <orderdirection>asc</orderdirection> <pagenumber>1</pagenumber> <pagesize>1000</pagesize> <recordsonthispage>439</recordsonthispage> <results> <subscriber> <customfields> <customfield> <key>[mr_or_mrs]</key> <value>mrs_email</value> </customfield> <customfield> <key>[id]</key> <value>abcef1234</value> </customfield> </customfields> <date>2015-06-15 17:40:00</date> <emailaddress>mrssmith@email.com</emailaddress> <name>mrs smith</name> <readsemailwith/> <state

php - I can't connect to db or pull data -

i using same code ` php $postid = 41; <!-- hidden items , variables. elements not revealed !--> <span id="gamelength"><?php // mysql connect configuration $dbname="my_db"; $host="localhost"; $user="guessthe"; $dbh=mysql_connect ($host,$user,"correctpassword?") or die ('i cannot connect database because: ' . mysql_error(). ''); mysql_select_db ("$dbname") or die('i cannot select database because: ' . mysql_error()); $sql="select * games postid = $postid"; $result=mysql_query($sql); $rows=mysql_fetch_array($result); $gameid = $rows['id']; $game100s = $rows['game100s']; $gamesplayedalltime = $rows['gamesplayed']; $gamespointsalltime = $rows['gamescore']; $gamelength = $rows['gamelength']; // number of questions $gamescore = $rows['gamescore']; $gametype = $rows['gametype']; $gametitle = $rows[&

I want to add up the number which is coming in the string.Can anyone please tell me the program in JAVA? -

example: input: string s = "my favorite pet 43 12 cat 32 " output: number = 43+12+33 = 88 how can generate output? split --> parse --> sum up public static void main(string[] args) { string s = "my favorite pet 43 12 cat 32 "; string split[] = s.split(" "); int sum=0; for(string str:split){ try{ int temp=integer.parseint(str); sum+=temp; }catch(exception e){ // continue; } } system.out.println(sum); }

validation - Validating fields as unique in cakephp 3.0 -

how validate field unique in cakephp 3.0? there doesn't appear validation function listed in api. you want use rule validateunique . example, check email address unique on userstable :- public function validationdefault(validator $validator) { $validator->add( 'email', ['unique' => [ 'rule' => 'validateunique', 'provider' => 'table', 'message' => 'not unique'] ] ); return $validator; } details can found in the api docs .

Does JavaScript support array/list comprehensions like Python? -

i'm practicing/studying both javascript , python. i'm wondering if javascript has equivalence type of coding. i'm trying array each individual integer string practice purposes. i'm more proficient in python javascript python: string = '1234-5' forbidden = '-' print([int(i) in str(string) if not in forbidden]) does javascript have similar me above? yes, javascript support array comprehensions in upcoming ecmascript version 7: https://developer.mozilla.org/en-us/docs/web/javascript/reference/operators/array_comprehensions . here's example: array comprehensions . var str = "1234-5"; var ignore = "-"; console.log([for (i of str) if (!ignore.includes(i)) i]);

android - Autostart and Getting data from internet in Background -

i have app data mysql getactivity activity , save in mysqlite , create notifications how want app run automatic , start getactivity in background data you'll want services threads run in background of android. within there you'll able load data sql database. to take care of automatic starting, you'll want broadcastreceivers , boot_completed receiver.

fullcalendar not getting events from google calendar -

fullcalendar not retrieving events google calendar, read google calendar api not support fullcalendar anymore?.i don't know if true. here code $(function () { $('#calendar').fullcalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaweek,agendaday' }, buttontext: { today: 'today', month: 'month', week: 'week', day: 'day' }, googlecalendarapikey: 'myapi', eventsources: { googlecalendarid: 'example@gmail.com' } }) }); update make work using code eventsources: [ { googlecalendarapikey: 'your api key', googlecalendarid: 'email@gmail.com', classname: 'fc-event-email'}]; from nov 17th 2014, google shutdown v1 , v2 of calendar api's.for full calendar work google calendar upgrade latest version of fullcalendar or @ least replace gcal.js file github.com/arshaw/fullcalendar/blob/v1.x/gcal.js . in above co

snmp - snmpd timeout: No response from localhost -

i running centos 6.3 , attempting use snmp v3 query oid's on server. running paessler's snmp tester 5.1.3 no response host. have made sure iptables not have odd firewall settings. can verify snmpd listening on port 161. have made sure selinux disabled. able install on centos 7.1 without issue. have done tail on messages in var/log/messages , can see incoming traffic snmpd. stumped , have no idea why work on 1 version of os not another. wonder if has suggestions. thank you

javascript - RxJS: Locked horizontal or vertical mouse dragging -

i want build interface can drag in various directions mode selected after distance. instance if drag 25px horizontally locks mode , stays there until release mouse. if drag vertically same. other actions happen if click or press , hold long time. here's simplified fiddle illustrating goal: https://jsfiddle.net/ud37p0y2/2/ it seems reactive programming perfect can't seem figure out how start these modes , stick them until release mouse. starting point has been many drag , drop examples can't seem take further.. some code (typescript): var mousedown = rx.observable.fromevent($element[0], 'mousedown').select((event: mouseevent): ipoint => { event.preventdefault(); return { x: event.clientx, y: event.clienty }; }); var mouseup = rx.observable.fromevent($element[0], 'mouseup'); var mousemove = rx.observable.fromevent($element[0], 'mousemove'); var mousedrag = mousedown.selectmany((mousedownpos: ipoint) => { return mousemove

php - Difference between sqlsrv_fetch_array and sqlsrv_fetch_object -

im working php , ms sql server 2005 , 2012 , question difference between sqlsrv_fetch_array , sqlsrv_fetch_object? sqlsrv_fetch_object returns object on success, null if there no more rows return, , false if error occurs or if specified class not exist. sqlsrv_fetch_array returns array on success, null if there no more rows return, , false if error occurs. so difference 1 returns array , other returns object. which 1 better? neither, subjective preference 1 use. depends upon own implementation. both job done. this code worked in ms sql 2012 doesn't in ms sql 2005. suggestions, thanks error messages can tell more can.

php - Single url variable with multiple values into array -

this question has answer here: how can split comma delimited string array in php? 5 answers i have url single variable (category), variable has multiple values. example: http://websiteurl.com/?category=cat+dog+rabbit+-cow i'd generate array information. <?$category[] = $_get['category'];?> print_r reveals this: $category = array ( [0] => cat dog rabbit -cow ) here's need like: $category = array('cat','dog','rabbit','-cow'); have tried... $categories = explode(' ', $_get['category']);

listview - How to determine the number of checkboxes that can be checked in Android? -

hi have checkboxes inside listview have 8 choices, , want user able check four, lock checkboxes unless unchecks one. this main: public class ch2 extends activity implements onitemclicklistener{ listview lv; arrayadapter<model> adapter; list<model> list = new arraylist<model>(); int num; public void oncreate(bundle icicle) { super.oncreate(icicle); setcontentview(r.layout.activity_ch2); lv = (listview) findviewbyid(r.id.listview2); adapter = new cusch2(this,getmodel()); lv.setadapter(adapter); lv.setonitemclicklistener(this); } @override public void onitemclick(adapterview<?> arg0, view v, int position, long arg3) { textview label = (textview) v.gettag(r.id.label); final checkbox checkbox = (checkbox) v.gettag(r.id.check); checkbox.setoncheckedchangelistener(new compoundbutton.oncheckedchangelistener(){ @override public void

ruby on rails - How do I tune a slow view -

i have rails 3.2 app view slow. at=error code=h12 desc="request timeout" method=get path="/calendar" host=xxxx.ndeavor3.com request_id=8f38737e-f193-4949-be83-5295dd9c18dd fwd="198.50.4.5" dyno=web.1 connect=2ms service=30002ms status=503 bytes=0 calendar view contains query : <%= collection_select :workorder, :id, workorder.wonotclosed.where("employee_id = ?", current_user.employee.id), :id, :wonum_desc, :include_blank => 'none' %> would if index workorders on employee_id? wonotclosed comparing wostatus_id - should index that? thanks help! first, i'd move gathering of work orders controller , out of view code. also, think you're right index on employee_id here.

sharepoint - Need a Web Based Code Repository, not a Source Control System -

my company uses tfs manage source code. looking way share code examples , snippets between various teams enable better collaboration. ideally, submitter able author short article go code. code pre-formatted html in article, or attached downloadable file. so, need non-source control, web-based, code repository. leaning towards sharepoint, i'm sure there better out there. ending going customized sharepoint wiki solution.

jsf 2.2 - Params of button always empty even after clicking jsf -

i opening modal has form in it. trying check if button clicked or not #{empty param['buttonid']} . shows empty when clicked. <div class="modal fade" jsf:id="datareset"> <div class="modal-dialog"> <form jsf:id="reset-data-form" class="form-horizontal"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title">modal header</h4> </div> <div class="modal-body"> <div class="form-group"> <label for="inputemail" class="col-sm-3 control-label">email</label> <div class="col-sm-9"> <input type="text&quo

javascript - ngAnimate animations not showing -

i trying past 10 hours make animations work, , work when add animate.css stylesheet , use "animated classname", when want make custom animations enter , leave cant make work anyhow. here simple plunkr code, i've tried different versions of nganimate, still nothing. plunkr tried adding "animation: animationname", still cant make work .ng-hide-remove { -webkit-animation: bouncein 2.5s; animation: bouncein 2.5s; } the problem version of angular , angular-animate. changed 1.4.0 , fine now

Wrote a python script in windows 8 and used py2exe to get a single exe, when moved to windows 7 it opens cmd then closes -

windows 8 running in 32-bit using vs-code write simple python script configure ip address through command line. able (after many attempts) create single exe , launch in windows 8. tried moving other laptop running windows 7 , show command line , close out. not sure i'm missing, both machines running similar software except windows 7 in 64-bit windows. i'm not getting errors , py2exe ran without problems. can compile again on windows 7 box , try there able write on 1 machine both. any appreciated. i stumbled upon other day. the executable created of time forward compatible: if create executable in windows xp, run in vista , 7. not backwards-compatible: if create executable in windows 7 not going run on windows xp. from: http://www.pythoncentral.io/py2exe-python-to-exe-introduction/

java - What is the relationship between Jasper Reports and Spring MVC versions? -

a close friend of mine teaching colleagues java jasper reports , wondering why correct working depends on version of spring mvc? i looked around answer google skills either aren't should or hasn't been asked, because found specific questions on using libraries. i appreciate help! thanks! jasper reports reporting java library, that's all. doesn't matter spring mvc version, have safe calling xml template sending query results. regards

php - What's difference between different ways to get GET parameter in Controller-Action in Zend framework 2? -

i found several ways get parameters inside controller > action in zend framework 2 : $this->params()->fromroute('id'); $this->params('id'); $this->getrequest()->getquery()->get('id'); is there difference among these ways? i guess, params('id') may give values get , post both. fromroute , getquery give value get only, fromroute may give advantages sanitation or something? $this->params()->fromroute('id'); this uses params plugin , returns single named route parameter. used parameters in segment routes (e.g. 'slug' /blog/:slug or 'year' /archive/:year/:month/:day ). $this->params('id'); this shorthand $this->params()->fromroute('id'); . $this->getrequest()->getquery()->get('id'); this grabs value query string.

osx - Getting HDBC working on Mac -

im trying understand how work sql databases using haskell , hdbc on mac. to hdbc working debian can use following setup: sudo apt-get install sqlite3 sudo apt-get install libghc-hdbc-sqlite3-dev cabal install hdbc sqlite hdbc-sqlite3 my questions are: how , install libghc-hdbc-sqlite3-dev on mac? why need libghc-hdbc-sqlite3-dev? why can not use cabal libghc-hdbc-sqlite3-dev? why need both sqlite , hdbc-sqlite3, not sqlite dependency hdbc-sqlite3 , downloaded automatically? i'm not sure need apt-get install libghc-hdbc-sqlite3-dev . have @ this page manifest of debian package. looks contains compiled version of hdbc-sqlite3 haskell package, , installing cabal install ... command.

php - Grocery crud filtering issue -

i want know how filter retrieval of records in table. using grocery_crud on top of codeigniter. don't know how put condition on results retrieved. example,i have customers crud , want retrieve ones in new york. please help this function , want narrow results before rendering view public function employees(){ $crud = new grocery_crud(); $crud->set_subject('employees'); $crud->set_table('employees'); $crud->columns('firstname','email'); $crud->display_as('firstname','first name'); $crud->display_as('email','e-mail address'); $crud->required_fields('email'); $output = $crud->render(); $this->output($output); } you use where function: $crud->where('city','new york'); there lot of nifty functions available !

Multiple Bitmap update on same android SurfaceView -

recently tried write app captures frame buffer usb camera (that need displayed preview), , image processed output need overlapped on preview. can give me pointers how start? need draw rectangle on preview. i trying use multiple surfaceview draw not succeeded. can me out? what need bitmap , image view reference counting. android keeps image data in native array, not recycling automatically when vm gc running. vm part garbage collected 1 way , native part way , later. app may run out of memory pretty quickly. here set of classes can help. think i've got them android image tutorial , modified bit own convenience. package com.example.android.streaming.ui.cache; import android.content.context; import android.graphics.drawable.drawable; import android.graphics.drawable.layerdrawable; import android.util.attributeset; import android.widget.imageview; /** * sub-class of imageview automatically notifies drawable when * being displayed. */ public class recyclingimage

ruby on rails - Philosophy: is erb the right choice for a dynamic web application? -

i joined large ongoing ruby on rails project (my first ror) 6 months ago. website application-like, not bunch of static webpages. seems me erb not suited building dynamic, application websites, erb seems better suited static webpages maybe forms. javascript real choice dynamic websites. sound right? no. doesn't sound right @ all.

python - Tkinter widget opens two windows -

i running tkinter 3.5 on win machine , when run code, 2 windows . expecting 1 . btw, got code form web.it working fine, except bothers me second(in backgorund) window . widget navigate trough different windows(pages) buttons . #!/usr/bin/env python # -*- coding: utf-8 -*- # try: import tkinter tk # python2 except importerror: import tkinter tk # python3 class wizard(tk.toplevel): def __init__(self, npages, master=none): self.pages = [] self.current = 0 tk.toplevel.__init__(self) self.attributes('-topmost', true) page in range(npages): self.pages.append(tk.frame(self)) self.pages[0].pack(fill='both', expand=1) self.__wizard_buttons() def onquit(self): pass def __wizard_buttons(self): indx, frm in enumerate(self.pages): btnframe = tk.frame(frm, bd=1, bg='#3c3b37') btnframe.pack(side='bottom', fill='x')

node.js - Redis and MongoDB; How should I store large JSON objects, Performance issue -

i developing node.js app. has mysql database server use store of data in app. however, find myself storing lot of data pertains user in session storage. how have been doing using express-session store contents of user class these user classes can quite large. thinking writing middleware save user class json either redis or mongodb , store key storage within session cookie. when retrieve json redis or mongodb, parse , use reconstruct user class. my question method fastest performing , scalable: storing json strings in redis, or storing mongo document representation of user class in mongodb? thanks! edit: planning include mongodb in part of app, solving different issue. json parsing redis more time-consuming , memory intensive parsing mongo? @ reoccuring user count server memory sessions become problem? express-session has various session store options save session data to. afaik, these work through same principle: serialize session object json string, , store string

uikit - How to add an image picker to the main storyboard xcode swift? -

i want add feature of choosing image images in iphone on iphone application in swift, wanted know given features , how can them. need basic features allow me browse albums , choose in image loaded in uiimageview. implementing retrieve image gallery in swift work make view controller class should have implement delegate methods of uiimagepickercontrollerdelegate. make top of class this: class viewcontroller: uiviewcontroller, uiimagepickercontrollerdelegate, uinavigationcontrollerdelegate { @iboutlet var imageview: uiimageview! let imagepicker = uiimagepickercontroller() override func viewdidload() { super.viewdidload() imagepicker.delegate = self } buttontapped action made earlier, , we’ll call uiimagepickercontroller there: @ibaction func loadimagebuttontapped(sender: uibutton) { imagepicker.allowsediting = false imagepicker.sourcetype = .photolibrary presentviewcontroller(imagepicker, animated: true, completion: nil) } uiimage