Posts

Showing posts from June, 2015

php - Slug function isnt working -

function createslug($slug){ $lettersnumbersspaceshyphens = '/[^\-\s\pn\pl]+/u'; $slug = preg_replace($lettersnumbersspaceshyphens,'',mb_strtolower($slug, 'utf-8')); $slug = preg_replace($spacesduplicatehyphens,'-',$slug); $slug = trim($slug, '-'); return $slug; } $slug = createslug($_post['label']); when remove function createslug $_post['label'], slug being added database string is. i'm getting no return value. insert line error_reporting(e_all ); , before call createslug(). , after can see several problems code.

php - Creating a new product in magento -

i started magento development , starting hang of it. found examples on how create new product , code: $p2 = mage::getmodel('catalog/product'); $p2->setsku('art002'); $p2->setattributesetid(2); $p2->setprice(20); $p2->save(); is supposed that. however, when running code, takes forever (cpu usage peaks 100%) , never finishes. i had same issue updating product, got working this: mage::getsingleton('catalog/product_action') ->updateattributes(array($product->getid()), array('price'=>10), 1); but fail see how use create new product. (background: trying create interface module wms, need able upload/update products, update stock.) i repeated code on test machine, couldn't reproduce problem. think need change index mode 'update on save' 'update when scheduled', in admin >> system >> advanced >> index management

javascript - Include CSS (Sass) from multiple modules -

i'm putting repo available on npm. repo consists of multiple modules, similar react-leaflet , react-d3 . application developers include modules within npm package via require / import , e.g.: import { moduleone, moduletwo } 'mynpmpackage`; i need package css along each of these modules, , css compiled sass files within each module. given folder structure mynpmpackage like: ├── src │ ├── moduleone │ │ ├── index.js │ │ ├── style.scss │ ├── moduletwo │ │ ├── index.js │ │ ├── style.scss ├── package.json what publish flow make .scss files (compiled .css ) available consumers of mynpmpackage , without requiring consumers explicitly include / @import / link rel="stylesheet" css? i'm using gulp , browserify , prefer stick pipeline. update: i've found parcelify some of need. add following mynpmpackage/package.json : "style": "src/**/*.scss", "transforms": [ "sass-css-stream" ]...

osx - python: sslv3 alert handshake failure when scraping a site -

i using requests scrape project gutenberg when do: import requests requests.get("https://www.gutenberg.org/wiki/science_fiction_(bookshelf)", verify = true) i error: sslerror traceback (most recent call last) <ipython-input-33-15981c36e1d3> in <module>() ----> 1 requests.get("https://www.gutenberg.org/wiki/science_fiction_(bookshelf)", verify=true) /library/python/2.7/site-packages/requests/api.pyc in get(url, params, **kwargs) 67 68 kwargs.setdefault('allow_redirects', true) ---> 69 return request('get', url, params=params, **kwargs) 70 71 /library/python/2.7/site-packages/requests/api.pyc in request(method, url, **kwargs) 48 49 session = sessions.session() ---> 50 response = session.request(method=method, url=url, **kwargs) 51 # explicitly closing session, avoid leaving sockets open 52 # can trigger resourcewarn...

ios - Retrieve object data from Parse in Swift -

Image
i have set small test database in parse can see below: there country ' name ', country ' code ' , country ' currency ' so main context of app this: on first screen, there textfield, if press, takes them tableview controller , populates list of countries parse (the 6 see above - works fine) when select country, takes them first vc , saves country variable, of type string. called ' countrychosen ' (this works fine) when press confirm button, takes them resultsvc. has 3 labels on it, 1 name of country chose in tableview, , 1 'code', , 1 'currency' of selected country. see layout below: on screen, currently, have updated top label country name no problem. used code: import uikit import parse class resultsviewcontroller: uiviewcontroller { @iboutlet weak var countrychosenlabel: uilabel! @iboutlet weak var countrycodelabel: uilabel! @iboutlet weak var countrycurrencylabel: uilabel! override func viewdidload() { sup...

javascript - Saving multiple SVGs to canvas with text then getting dataURL -

i have built angularjs application, in application svg files represent garments user chooses. have download button (currently) saves first svg png database , use view display "preview". the directive created looks this: .directive('kdexport', function () { return { restrict: 'a', scope: { target: '@kdexport', team: '=' }, controller: 'exportimagecontroller', link: function (scope, element, attrs, controller) { console.log(scope.team); // bind onclick event of our button element.bind('click', function (e) { // prevent default action e.preventdefault(); // generate image controller.generateimage(scope.target, scope.team, function (preview) { // create our url var url = '/kits/preview/' + preview.id; ...

Swift - How do I save inputed information in UITextfield via time interval? -

how save inputed information in multiple uitextfields? , when switch between viewcontrollers how inputed information stay within uitextfields when switching , forward? perhaps set within time frame resets itself? i want uitextfields set automatically without using "load" function recall information back. can see example in "view controller.swift" thanks. i using xcode 7 - swift 2. it depends how switching view controllers. if popping, or other method destroys view controller, need store text text fields somewhere else. you've written, seems losing data. you should make class hold data, , reference singleton on class. make class singleton so: class somemanager { var mysavedstring: string? static let sharedinstance = somemanager() } then in view controller's viewdidload method, access information singleton class , fill views it. self.mytextfield.text = somemanager.sharedinstance.mysavedstring you can make uitextfield...

java - How can I merge and then distinct collections with the Stream API? -

this question has answer here: java lambda stream distinct() on arbitrary key? 9 answers let's prefix objects equals implementation not how need filter distinct not work. class myobject { string foo; myobject( string foo ) { this.foo = foo; } public string getfoo() { return foo; } } collection<myobject> lista = arrays.aslist("a", "b", "c").stream().map(myobject::new) .collect(collectors.tolist()); collection<myobject> listb = arrays.aslist("b", "d").stream().map(myobject::new) .collect(collectors.tolist()); // magic how can merge , deduplicate lists resulting list should of myobjects containing "a", "b", "c", "d"? note: simplification of methods need deduplicate, complex dtos of entities loaded hibernate, example should ade...

iOS Show UIAlert in Safari when using My App's Share Extension -

i'm developing simple content blocker ios 9+ devices. seems working fine in terms of blocking ad's / trackers etc , have ability 'whitelist' websites directly safari using share extension action. my question when user taps action > apps share extension [which adds list inside main app] want show simple alert says 'this site has been added whitelist..." few seconds , disappear. ... how do this? **update have read of apples documentation on still can't figure out. post here refer how design streamlined ui doesn't cover situation. hoping know :-) why don't use notifications , can have notification style set show uialert. can see in calendar app in ios. update: i did little bit more digging , it's not possible change style programmatically according this . best choice handling when app in foreground. can't think of other os wide solution other local notifications.

python - Twitter Trending List Printing First Character Instead of First Entry -

i'm having issue can twitter api provide me top 10 list of trending topics in given area, can entirety print, or first character print, not first entry in list. the following code tried print first entry in list (entry 0) first character each list entry instead (character 0). from twitter import * access_token = "myaccesstoken" access_token_secret = "myaccesstokensecret" consumer_key = "consumerkey" consumer_secret = "consumersecret" t = twitter(auth=oauth(access_token, access_token_secret, consumer_key, consumer_secret)) results = t.trends.place(_id = 2442047) #i used los angeles woeid location in results: trend in location["trends"]: trendlist = trend["name"] print trendlist[0] if use simple list this, can python print first entry: trendlist = ['one', 'two', 'three'] print trendlist[0] can provide pointer on why behavior different , how 1 entry print trending ...

javascript - Create button and click handler with JQuery -

currently displaying table of values, last column provides "edit" , "delete" option. simplicity, when edit row, clearing each column's innerhtml , placing input fields there instead. need replace edit/delete links save/cancel, need create these buttons js/jquery, attach click handlers them append them innerhtml. while have found similar examples, not quite clear on how accomplish , appreciate help. function editrecord(line) { var zone = "<?= $data['zone']; ?>"; // store original field values var valuename = document.getelementbyid("entryname" + line).innerhtml; var valuettl = document.getelementbyid("entryttl" + line).innerhtml; var valueaddress = document.getelementbyid("entryaddress" + line).innerhtml; // replace existing row value input fields make edits document.getelementbyid("entryname" + line).innerhtml = "<input type='text' value='...

javascript - high charts - lost animation when pie chart sliced is programmatically set -

as can see basic example, http://www.highcharts.com/demo/pie-basic when select pie, selected pie got pulled out animation. , handled option. pie: { allowpointselect: true } however, don't want mouse click select point. have, say, button outside of pie chart, when press button, first pie/point should selected. i have following $scope.sawchartconfig.series[0].data[0].selected = true; $scope.sawchartconfig.series[0].data[0].sliced = true; programatically set first point selected when button clicked. works fine, lost animation (where should pull outward). my questions are: how can add animation back? series[0].data contains few data points, need reset data[i].sliced false each of them after button clicked. there easy way instead of loop through items? .controller('spendingpiechartctrl', ['$scope', '$q', 'transactionservice', 'categoryservice','chartcolors', function ($scope, $q, transactionsvc, category...

javascript - Grunt is not correctly building locally - missing files -

grunt has stopped building correctly locally. it's not building assets served angular, , console giving following message: uncaught error: inc/../../../common/js/sv-common missing inc/../../../common/js/./lib/ngui-sortable edit: more detail uncaught error: ../../common/js/sv-common missing ../../common/js/./lib/ngui-sortable > main @ www-app.js:296call > dep @ www-app.js:166 > main @ www-app.js:291call > dep @ www-app.js:166main @ www-app.js:291 > req @ www-app.js:359 > (anonymous function) @ www-app.js:3737 > (anonymous function) @ www-app.js:3738 i've done fresh checkout of repo, , no 1 else on team having same issue. missing file absolutely in local repo, , it's in tmp/ directory of it. have no idea how debug this. $ grunt --stack -d running "jshint:local" (jshint) task [d] task source: /workspace/survata-com/node_modules/grunt-contrib-jshint/tasks/jshint.js >> 0 files linted. please check ignored files. running "c...

dynamics crm - Performing two Left Outer Joins in a Single LINQ to CRM query -

i'm attempting perform 2 left outer joins in crm online 2015 update 1 instance, getting error. have currently: var query_join8 = in crmcontext.accountset join c in crmcontext.contactset on a.primarycontactid.id equals c.contactid gr c_joined in gr.defaultifempty() join c in crmcontext.contactset on a.name equals c.fullname gr2 c2_joined in gr2.defaultifempty() select new { contact_name = c_joined.fullname, account_name = a.name, other_name = c2_joined.fullname }; when attempt execute it, error: an exception of type 'system.notsupportedexception' occurred in microsoft.xrm.sdk.dll not handled in user code additional information: method 'groupjoin' cannot follow method 'selectmany...

java - Use a string from an outside class to the main class -

i have main class file calls methods objects other outside class files. i'm having hard time using string in main class file defined in outside class file. this main class: import java.util.scanner; public class tw5k { public static void main(string[] args) { citenum citenumber = new citenum(); platenum platenumber = new platenum(); datenum datenumber = new datenum(); citenumber.citeent(); platenumber.plateent(); datenumber.dateent(); system.out.println(); // want print string "dateld" here, outside class. } } this outside class: import java.util.scanner; public class datenum { public void dateent() { scanner input = new scanner(system.in); system.out.print("enter date of violation: "); string dateld = input.nextline(); system.out.println(); } } return value: public string dateent() { scanner input = new scanner(system...

Randomizing not working c# -

so have been trying work on randomizing of dice, there seems problem. question doing wrong? code below. on design page, have 2 picture boxes, each 6 faces of dice. have 2 labels showing dice number got. have 2 more labels underneath picture boxes win. have 1 label in middle says tie if tie. appreciated! using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; namespace practice_randomizing { public partial class form1 : form { public form1() { initializecomponent(); } private void button1_click(object sender, eventargs e) { random rand = new random(); int random = rand.next(6); int player1; player1 = 0; int player2; player2 = 0; if (random == 0) { picturebox1.image = properties.resources.dice_11; ...

ipython notebook - How to add latex figure captions below jupyter / matplotlib figures -

from within jupyter notebook, there way add latex figure caption below each inline matplotlib figure? desired each figure annotated when running nbconvert --to latex. but not clear on how position latex relative figure ends in \begin{verbatim} block. can place in markdown cell after plot; but, not wrap figure want. a bit of workaround following helper function calls plt.close() keep inline figures being displayed leaving generated latex block figure. bshowinline = true # set = false document generation def makeplot( plt, figlabel, figcaption): figname = figlabel+'.png' plt.savefig(figname) if bshowinline: plt.show() else: plt.close() strlatex=""" \\begin{figure}[b] \centering \includegraphics[totalheight=10.0cm]{%s} \caption{%s} \label{fig:%s} \end{figure}"""%(figname, figcaption, figlabel) return display(latex(strlatex)) is there cleaner way? ...

How to roll a sliding panel on top of Android Activity -

i have sliding panel in activity. when rolls out pushes activity. make slide on top of activity. how can that? slidingpanelayout.panelslidelistener panellistener = new slidingpanelayout.panelslidelistener() { @override public void onpanelclosed(view arg0) { // todo auto-genxxerated method stub getactionbar().settitle(getstring(r.string.app_name)); } @override public void onpanelopened(view arg0) { // todo auto-generated method stub getactionbar().settitle("titles"); } @override public void onpanelslide(view arg0, float arg1) { // todo auto-generated method stub } }; then use navigationdrawer instead of using slidingpanel

javascript - Return url from global template helper using CollectionFS -

im trying url of uploaded image using global template helper. far tried doing isprimary.url() null, otherwise isprimary.url returns function. idea how deal this? user_item.html <template name="useritem"> <div class="col-md-3"> <div class="text-center"> <img width="80" class="img-rounded" src="{{primarypicture store='thumb'}}"> </div> </div> </template> global_templates.js template.registerhelper('primarypicture', function () { var isprimary = images.findone({userid: this._id, primary: true}); if (isprimary) { return isprimary.url(); } else { return '/user.png'; } }); i dont know why isprimary.url(); returns null when should return original url, fix doing isprimary.url({store:'thumb'});

c++ - Why is char neither signed or unsigned, but wchar_t is? -

Image
the following c++ program compiles without errors: void f(char){} void f(signed char){} void f(unsigned char){} int main(){} the wchar_t version of same program not: void f(wchar_t){} void f(signed wchar_t){} void f(unsigned wchar_t){} int main(){} error: redefinition of ‘void f(wchar_t)’ void f(signed wchar_t){} it seems wchar_t unsigned . why there inconsistency in overloading? the char s distinct types , can overloaded [basic.fundamental] / 1 [...] plain char , signed char , , unsigned char 3 distinct types, collectively called narrow character types. [...] wchar_t distinct type, cannot qualified signed or unsigned , can used standard integer types. [dcl.type] / 2 as general rule, @ 1 type-specifier allowed in complete decl-specifier-seq of declaration or in type-specifier-seq or trailing-type-specifier-seq . exceptions rule following: [...] signed or unsigned can combined char , long , short , or int . ...

c# - Multiple where statements in Entity Framework -

database structure sample: department table -departmentid facility table -facility id -departmentid (fk) -block -level -name -etc i trying select database ef using 2 clause. not sure went wrong @ clause. stuck @ it. please , advice. have googled on internet cannot find solution it. string departmentid = "sit"; string block = "l"; string level = "4"; string name = "l.425"; using (var db = new kioskcontext()) { var facilitys = f in db.facilitys where clause select departmentid equals sit , block or level or name contains alphabets. please advice how should write statement 2 clause. thank you! f.department.departmentid == departmentid && (f.block.contains("%" + block + "%") || f.level.contains("%" + level + "%") || f.name.contains("%"...

javascript - Recommendation where to store supporting image or document files for jsfiddle or plunker -

Image
like everyone, run issues stackoverflow community great @ assisting. many times, easier "show" issue via jsfiddle, plunker, or other online code tool. works scenarios, in scenarios need reference files such images or documents have part of scenario, not sure best store these reference. i evaluating using dropbox allow code in jsfiddle or plunker "load" images from, unsure if there better/more commonplace location store temporary files purposes of troubleshooting community. where/how others store image or document files used in jsfiddle, plunker, etc. posted here in stackoverflow? pros/cons? you should using service stackoverflow offers: pretend you're adding new image question: upload file want , click on add picture then, generated image in question: and use inside plnkr or jsfiddle . you don't need use generated image question: can upload here, , use there.

Try statement not catching the exception vb.net -

my exception isn't working excel file searched , returned information. below see cycles through first column , returns information according variables set globally. have put exception if try fails message box pop , tell them failed find them, not catching it. instead if user isn't listed in database freezes program. private sub exceptiontoolstripmenuitem_click(byval sender system.object, byval e system.eventargs) handles exceptiontoolstripmenuitem.click dim objexcel new excel.application dim objworkbook excel.workbook dim objworksheet excel.worksheet objexcel.displayalerts = false if global_variables.savedresults.userm = nothing , global_variables.savedresults.userl = nothing objworkbook = objexcel.workbooks.open("filepath", [readonly]:=true) objworksheet = ctype(objworkbook.worksheets.item("sheet1"), excel.worksheet) try x integer = 1 objworksheet.rows.count step 1 if obj...

.net - How to add a value using Web.Release.config -

in web.config have: <appsettings> <add key="version" value="1" /> </appsettings> in web.release.config <appsettings> <add key="approot" value="/root" xdt:transform="insert" /> </appsettings> in app_code\globalval.cshtml public static readonly string approot = system.configuration.configurationmanager.appsettings["approot"]; then change project settings use release build profile. the value @globalval.approot null though. after build , publish machine still null. how build using optional approot value using visual studio 2013 mvc application? [update] press play in visual studio , set breakpoint right after setting approot in globalval.cshtml. build output contains: build started: project: yourapp, configuration: release cpu ------ but approot still null. you need specify transform needs take place (e.g. insert in case): <appsettings> <a...

windows - How to set up a thread pool for an IOCP server with connections that may perform blocking operations -

i'm working on server application that's written in proactor style, using select() + dynamically sized thread pool (there's simple mechanism based on keeping track of idle worker threads). i need modify use iocp instead of select() on windows, , i'm wondering best way utilize threads is. for background information, server has stateful, long-lived connections, , request may require significant processing, , block. in fact, requests call customer-written code, may block @ will. i've read os can tell when iocp thread blocks, , unblock one, doesn't there's support creating additional threads under heavy load, or if many of threads blocked. i've read 1 site suggested have small, fixed-size thread pool uses iocp deal i/o only, sends requests can block another, dynamically-sized thread pool. seems non-optimal due additional thread synchronization required (although can use iocp tasks second thread pool), , larger number of threads needed (extra cont...

java - How to use offline bytecode writer with Cofoja? -

i'm trying offline instrumentation of code using cofoja (contracts java). cannot seem contracts in compiled class file using offline bytecode writer (this feature briefly mentioned in invocation section of github page). execute resulting class file , purposely fail contract. nothing happens. here java code... in main like: return divide(10, 0); @requires("y != 0") public static int divide(int x, int y) { return x / y; } then following: i build .java file via ide, intellij , class file. execute offline bytecode writer this: java -dcom.google.java.contract.classoutput=cofoja -cp cofoja.asm-1.2-20140817.jar com.google.java.contract.core.agent.premain javatest.class this results in "javatest.class" file being generated in "cofoja" directory. however, when execute don't see contract errors. does know correct steps use "com.google.java.contract.core.agent.premain" generate class files contracts weaved in...

r - Scoping-related (?): anova() on list of created mixed-effects models -

in project i'm performing mixed-effects modelling using lme , i'm trying compare models different correlation structures , equal fixed parts. i'll building lot of these models (for different dependent variables), tried write function generate list of models different correlation structures, in example below (i tried keep minimum working example). if run anova() on elements of list, works, only if fixedpart in global environment. why case? there way circumvent problem, can keep m , re-use/delete fixedpart ? i presume problem related (lexical) scoping in r, cannot find way fix it. thanks in advance! #dependencies library(multilevel) library(multcomp) #generate sample data nvals = 100 sdata = rnorm(nvals, mean = 1, sd = 1) df <- data.frame(nsubject = 1:nvals, v1data = sdata + rnorm(nvals, mean = 0, sd = 0.1), v2data = sdata + rnorm(nvals, mean = 0, sd = 0.1), v3data = sdata + rnorm(nvals, mean = 0, sd = 0.4...

css - Alter text size to fit button width in html -

Image
this question has answer here: how set font size based on container size? 10 answers is way in html or css change text size in order fit in button of width changes according container. have 3 buttons of same width, 3rd text little small , 2 letters go out of button if button shrinks. svg can here. consider following: <button style="position: relative; width: 400px; height: 200px; "> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100%" height="100%" viewbox="0 0 100 50"> <text y="50%" x="50%" text-anchor="middle" font-size="20">foobar</text> </svg> </button> the 20 in font-size="20" refers coordinates specified viewbox , font size 1/5 (20/100) of size of button. of course, not precisely s...

What is Swagger and does it relate to OData? -

i familiar microsoft stack. using odata of restful services. came across swagger api documentation , trying understand how relates odata. both of them seem restful specifications. 1 used? swagger specification documenting apis . creating swagger document api, can pass instance of swagger ui, renders document in neat, readable format , provides tooling invoke apis. see swagger.io website further information. odata specification creating data services on http , defines how service should constructed , patterns should follow. example, use of $top directive provide first n results of data set. odata @ version 4, v2 documentation has very overview . swashbuckle nuget package microsoft stack produces swagger documents api's automatically , based on inspecting code , additional metadata provide shape output document. if want swashbuckle automatically generate swagger documents odata api building, can use swashbuckle.odata provide you. i hope helps clear confusio...

c - Array in JAVA., repeat? -

i'm writing function using java language takes in 1d array , size of array inputs function. want find out how many function values of in array. how this? approach 1( o(nlogn) ): sort array. compare adjacent elements in array increment count whenever adjacent elements unequal. please take care of 3 consecutive same elements using variable. approach 2( o(n) space complexity of o(n) ): create hash table value. insert value if not present in hash table. count , print values present in hashtable

hibernate - Allow EntityManagerFactory injection to be null when database service is off -

i have jersey web service uses hibernate persistence. have implemented creation/disposal of entitymanagerfactory using hk2 provider logic found stack overflow, has helped keep number of db connections low. don't want force users have db, want code gracefully handle case. however, can't seem figure out, other having comment out @inject annotation. know how use custom @inject , code allow null? i tried catch exception in dbmanager when persistence.create fails , check null in webserviceclass. crashes @ @inject line , exception not caught. looked around @ findorcreate null exception , saw there method called supportsnullcreation() have not found examples on how use it. this code looks like: injectable db provider using hk2: public class dbmanager implements factory<entitymanagerfactory> { private static entitymanagerfactory factory = null; @inject public dbmanager() { try { factory = persistence.createentitymanager...

php - Cannot start artisan serve in laravel 5 -

i using laravel 5, when try start server from php artisan serve i following error : [symfony\component\debug\exception\fatalerrorexception] app\providers\routeserviceprovider::app\providers{closure}(): failed opening required 'd:\test\app\app\http/routes.php' (include_path='.;c:\xampp\php\pear') i tried composer dump-autoload , successfull, when composer update i same error. how resolve it? routes.php never in app\http , in someother dir. moving belongs fixed issue

http POST request using webrequest C# -

see html code below post input data http://demo.com/data/a.aspx product id: return url: how can same thing using asp.net web form ( mean using asp.button server control , webrequest(c#).

javascript - how to Find element Locator in Protractor -

iam new protractor, please me find element locator using below code in protractor/angularjs have tried using xpath , css. locator can used code <button type="submit" value="autofocus" class="btn" data-ng-click="reset()">reset</button> here various methods can use apart xpath , css. locators specific protractor - get element using buttontext . element(by.buttontext('reset')); you can add custom locator button using addlocator in protractor. here's example of it . use csscontainingtext element using both css , text properties. element(by.csscontainingtext('.btn', 'reset')); if @ have longer text in button element(for ex, "reset value"), use partialbuttontext it. element(by.partialbuttontext('value')); you can use shortcut find elements using css. $('.btn'); // = element(by.css('.btn')) more details of locators in protractor here . you can...

android - ImageView crop image disappear when change orientation -

i have activity take picture, crop image , show cropped image. here code. public class mainactivity extends activity { private static final int takepicture = 1; imageview imgview; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); imgview = (imageview) findviewbyid(r.id.imageview1); button buttoncamera = (button) findviewbyid(r.id.btn_take_camera); buttoncamera.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { // call android default camera intent intent = new intent(mediastore.action_image_capture); intent.putextra(mediastore.extra_output,mediastore.images.media.external_content_uri.tostring()); // ******** code crop image intent.putextra("crop", "true"); intent.putextra("aspectx...

android - listview not refresh properly after call notifyDataSetChanged() -

i've facing problem refresh listview after delete item database. problem when i'm call notifydatasetchanged() return listview removing last index element list instead of specific index every time (eg want delete 2nd index item after deleting item listview show removing last item every time actual list , database contain right value). i cant understand problem why notifydatasetchanged() method behave like , solution it. code inside baseadapter class: public class customreminderadapter extends baseadapter { private context context; private list<reminderdata> datalist; viewholder holder; private addreminderhelperdao dao; public customreminderadapter(context context, list<reminderdata> datalist) { super(); this.context = context; this.datalist = datalist; } @override public int getcount() { return datalist.size(); } @override public object getitem(int positio...

Common Navigation Menu drawer In Android -

i need add navigation drawer menu in android application. application has many modules can't code each activity display navigation menu. decided put navigation menu code in base activity. each activity extends base activity. navigation drawer menu's working problem activity components not working. don't know happening. there changes needed? in advance. baseactivity.java public class baseactivity extends actionbaractivity { relativelayout fulllayout; drawerlayout dlayout; @override public void setcontentview(int layoutresid) { fulllayout = (relativelayout) getlayoutinflater().inflate( r.layout.activity_base, null); framelayout framelayout = (framelayout) fulllayout .findviewbyid(r.id.content_frame); listview dlist = (listview) fulllayout.findviewbyid(r.id.left_drawer); dlayout = (drawerlayout) fulllayout.findviewbyid(r.id.drawer_layout); getlayoutinflater().inflate(layoutresid, framelayout, true); setcontentview(fulllay...