Posts

objective c - Determine when UITableViewCell is deallocated -

i using core data in app along nsfetchedresultscontroller populate table. database has 40k+ entries table rather long. each table cell has thumbnail image loaded web using sdwebimage . works great if scroll slowly, if begin scroll fast within couple of seconds crash. nszombies isn't showing useful. i'm guessing has sdwebimage , loading web. way sdwebimage works loading image in background setting downloaded image after completes downloading (wordy). thought cells being deallocated uitableview , sdwebimage tries set image on deallocated cell. if can determine when uitableviewcell going deallocated can stop sdwebimage downloading process , fix issue. i've tried add - (void)dealloc { nslog(@"dealloc"); } to catch when cell going deallocated never anything. edit have -(void)dealloc method in subclass uitableviewcell. edit here where/how create cell - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpa...

java - Jtable cellRenderer change background of row -

i have been tryng time , looking on internet find solution have failed. i'm trying change row background of jtable dynamically. have created arraylist keeps numbers of selected rows (adding them everytime user press alt+click on cell) , in own tablecellrenderer have added for(integer c: leftselectedcells){ if(c.equals(row)){comp.setforeground(color.red); } else { comp.setforeground(color.black);} } it working, few cells, or time after selected columns oryginal color, have checked, ints still in array thats not problem, idea might cause issue? as suggested in comments above, need provide custom renderer required columns. alternative, can override jtable.preparerenderer set background according list of affected rows. table row rendering @camickr explains approach. below example highlights rows clicked mouse + alt key. simplicity, list of highlighted rows kept client property. import java.awt.color; import java.awt.component; import java.awt.event.mouseadapter; ...

mips associative floating point -

okay testing have code .data # shows can use .word , directly encode value in hex # if choose num1: .word 0x3f800000 num2: .float 1234.567 num3: .float 45.67834 num4: .float 0.0004 result: .word 0 string: .asciiz "\n" .text main: la $t0, num1 lwc1 $f2, 4($t0) lwc1 $f4, 8($t0) lwc1 $f6, 12($t0) # print out values of summands li $v0, 2 mov.s $f12, $f2 syscall li $v0, 4 la $a0, string syscall li $v0, 2 mov.s $f12, $f4 syscall li $v0, 4 la $a0, string syscall li $v0, 4 la $a0, string syscall # actual addition add.s $f12, $f2, $f6 add.s $f12, $f12, $f4 # transfer value floating point reg integer reg swc1 $f12, 8($t0) lw $s0, 8($t0) # @ point, $f12 holds sum, , $s0 holds sum can # read in hexadecimal li $v0, 2 syscall li $v0, 4 la $a0, string syscall # jr crashes mars # jr $ra i have this add.s...

ruby on rails - How to handle nested resources/routes correctly? -

i trying build rails app modded michael hartl's railstutorial . code located on github . i using following nested resources: resources :users resources :scaffolds end but getting following error: actionview::template::error (undefined method `scaffolds_path' #<# <class:0x007f87848019d0>:0x007f8782651948>): 4: 5: <div class="row"> 6: <div class="span6 offset3"> 7: <%= form_for(@scaffold) |f| %> 8: <%= render 'shared/error_messages', object: f.object %> 9: <%= f.text_field :name, placeholder: "scaffold name" %> 10: <%= f.text_area :description, placeholder: "description" %> app/views/scaffolds/new.html.erb:7:in `_app_views_scaffolds_new_html_erb___1119296061714080468_70109999031900' i puzzled why looking scaffolds_path , not user_scaffolds_path ? the @scaffold created in app/controller/scaffolds_controller.rb: def new @sc...

error 404 on web.py subapps. How to handle urls? -

last time wrote answer fast , efficient, here go again. i got these 3 files, 2 .py , html. thing reason error 404. it's url handing issue. here code # encoding: utf-8 import web import os import gettext import signup import verify_email urls = ( "/", 'index', "/sign-up", signup.app_signup, "/verify_email", verify_email.app_verify_email ) # internacionalización: current_directory = os.path.abspath(os.path.dirname(__file__)) locales_directory = current_directory + '/i18n' gettext.install('messages', locales_directory, unicode = true) gettext.translation('messages', locales_directory, languages = ['es']).install(true) web.config.debug = false app = web.application(urls, locals()) session = web.session.session(app, web.session.diskstore('sessions')) db = web.database(dbn='postgres', user='zoosalud', pw='pbf8zcxd4gzumhrxd8asjfhn', db='zo...

iphone - Can't update an NSMutableDictionary value from within a for-in loop? -

i'm having weird issue updating nsmutabledictionary value. i'm running for-in loop, retrieved fine, , math fine. the problem lies when try update dictionary setvalue: forkey: method. for(nsstring *key in self.planetdictionary){ if(![key isequaltostring:planet]){ * * * //do math , stuff, create nsnumber: nsnumber *update = [nsnumber numberwithfloat:updatedprobability]; //problem code, exc_bad_access here: [self.planetdictionary setvalue:update forkey:key]; } } i exc_bad_access crashes. can confirm else fine, single line try update value. what's going on? thanks you're not allowed mutate object you're fast enumerating. crash every time. work around, can make copy first: nsdictionary *dictionary = [self.planetdictionary copy]; (nsstring *key in dictionary) { if (![key isequaltostring:planet]) { nsnumber *update = [nsnumber numberw...

android - How to put an image in an ImageView from the Activity not the XML file? -

what trying put multiple images without out of memory problem i'm using method putimage() , trying put image in imageview activity not xml file here xml code <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" android:alwaysdrawnwithcache="false"> <imageview android:id="@+id/imageview1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignparenttop="true" /> </relativelayout> and here activity public class recipebanana extends activity { imageview v; button button; context localcontext = null; public static drawable getassetimage(context context, string filename) throws ioexception { assetmanager assets...