Posts

ios - How to know the object name based on memory address in objective c -

hi 1 of app crashing repeatedly , giving below error. *** -[cfstring release]: message sent deallocated instance 0x1b7a3b70 is there way object name using memory address. used instruments (zombie) , enabled zombies in xcode no luck. can please me in issue stuck please me. it's string. cfstring bridged nsstring. knowledge, use debugger , breakpoints. break points can step through code, , use quicklook see details objects.

java - Android Tabhost show fragment overlay -

i having problem using tabhost, when starting app, shows main fragmentactivity, shows me fragment should visible when tab selected main.java extending fragmentactivity mtabhost = (fragmenttabhost)findviewbyid(android.r.id.tabhost); mtabhost.setup(this, getsupportfragmentmanager(), r.id.realtabcontent); mtabhost.addtab(mtabhost.newtabspec("tab1").setindicator("tab1"),myfragment.class, null); myfragment.java public class myfragment extends fragment { public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate){ return inflater.inflate(r.layout.fragmentlayout, container, false); } } main.xml <android.support.v4.app.fragmenttabhost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="match_parent" android:background="@color/black" android:layout_height="m...

r - Extracting unique partial elements from vector -

i need list of unique subject ids (the part before _ , after /) contents of folder below. [1] "." "./4101_0" "./4101_0/4101 baseline" [4] "./4101_1" "./4101_2" "./4101_2_2" [7] "./4101_3" "./4101_4" "./4101_5" [10] "./4101_6" right i'm doing (using packages stringr , foreach). # create list of contents folder.list <- list.dirs() # split entries "/" subids <- str_split(folder.list, "/") # each entry in list, retrieve second element subids <- unlist(foreach(i=1:length(subids)) %do% subids[[i]][2]) # split entries "_" subids <- str_split(subids, "_") # take second element after splitting, unlist it, find unique entries, remove na , coerce numeric subids <- as.numeric(na.omit(unique(unlist(foreach(i=1:len...

z3 - How to get all the variables that were added to any constraint in a Solver? -

i using z3py , trying set of variables in constraint in solver. can call solver.assertions() astvector , loop on vector , objects of type boolref , example, i'm stuck. how can recursively iterate on assertion, boolref instance example, individual variables? thanks taylor answer. think second link addresses question. in more detail, python script leo added in previous answer walks ast, astmap ensures shared sub-expressions walked once.

ember.js - adding action to select (combobox) in emberJs -

i trying add events 2 values in combobox using emberjs. have tried. <select class="bs-select form-control input-small"> <option {{action 'alldata' }}>all data </option> <option {{action 'mydata' }}>my data </option> </select> i have added 2 functions in controller name alldata & mydata these functions never gets called. should ? you can try using binding instead. {{view ember.select}} see: http://emberjs.com/api/classes/ember.select.html you can add binding value , add observer in controller when seƱection changes.

Highlight Normal only for filetype in vim -

so, i'm pretty happy i've discovered how set highlighting when open particular file in vim. i'm doing javascript files, of them 'hi jsstringd' , 'hi jsfunction' etc. use trigger it: if has("autocmd") augroup javascript au! au bufreadpost *.js call setupjavascript() augroup end ... i want change color of 'normal' or foreground text, javascript files. this works set color: execute 'hi normal ctermfg=' normaltext but how limit filetype? results in files having 'normal' highlighted color. edit: clarify, open javascript file , works. open file (say .jade file) , 'normal' color remains 'normaltext' value. use autocmd fires javascript file type autocmd filetype javascript execute 'hi normal ctermfg=' normaltext however think have problems if switch between multiple files in 1 session since highlighting global. to work around add filetype autocmd fires on bufenter (o...

c# - Model Validation from Unit Testing only works for string -

i have got class this model: public class circle { [required(errormessage = "diameter required")] public int diameter { get; set; } [required(errormessage = "name required")] public string color { get; set; } } testing: [testmethod] public void testcircle() { circle circle = new circle(); circle.diameter = 5; circle.color = "black"; validationcontext contex = new validationcontext(circle, null, null); validator.validateobject(circle , contex); } i expecting it'd fail whenever diameter or color null. however, above testing failed when string parameter, color, null. why? how should in order validate diameter well? you shouldn't use required attribute numeric properties. use range attribute instead: the requiredattribute attribute specifies when field on form validated, field must contain value. validation exception raised if property null, contains empty string (""), or...