Posts

ios - Can NSManagedObject conform to NSCoding -

i need transfer single object across device. right converting nsmanagedobject dictionary , archiving , sending nsdata. upon receiving unarchiving it. transfer nsmanagedobject archiving , unarchiving instead of creating intermediate data object. @interface test : nsmanagedobject<nscoding> @property (nonatomic, retain) nsstring * title; @end @implementation test @dynamic title; - (id)initwithcoder:(nscoder *)coder { self = [super init]; if (self) { self.title = [coder decodeobjectforkey:@"title"]; //<crash } return self; } - (void)encodewithcoder:(nscoder *)coder { [coder encodeobject:self.title forkey:@"title"]; } @end nsdata *archivedobjects = [nskeyedarchiver archiveddatawithrootobject:testobj]; nsdata *objectsdata = archivedobjects; if ([objectsdata length] > 0) { nsarray *objects = [nskeyedunarchiver unarchiveobjectwithdata:objectsdata]; } the problem above code is. crashes @ self.title in initwithcoder sa...

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

i have simple page in intranet uses razor/asp fetch single record table , display it, plus few graphic, dashboard display. meaning, no user intervention other first time open ie internal url. the problem having every morning ie displays "page not found or network error" message. refresh page, , it's stuck , doesn't display anything. try different pc, open ie internal url , it's stuck... ...until following: login server hosting page run inetmgr go web sites, etc right click on page that's giving me problem , select browse at moment, error message: server error in '/' application. -------------------------------------------------------------------------------- type of page not served. description: type of page have requested not served because has been explicitly forbidden. extension '.cshtml' may incorrect. please review url below , make sure spelled correctly. requested url: /application/dashboard.cshtml ---------------...

Most efficient way to access 2D Maps (Maps of Maps) in Java? -

i'm implementing weightedslopeone prediciton algorithm recommender system , @ point in code need have 2 2d maps, 1 map<integer, map<integer, integer>> , 1 map<integer, map<integer, double>> as can understand accessing these , assigning values cumbersome procedure: //the following 20 lines 1 line in python. sigh... hashmap<integer, integer> freqsforitem1 = frequencies.get(curitemid); //see if have value curitemid if (freqsforitem1 == null) { freqsforitem1 = new hashmap<integer, integer>(); freqsforitem1.put(curitemid_2, 1); frequencies.put(curitemid, freqsforitem1); } else {//see if have value curitemid+curitemid_2 integer freqforitem1item2 = freqsforitem1.get(curitemid_2); if (freqforitem1item2 == null) { //if don't have value item1+item2 put 1 freqsforitem1.put(curitemid_2, 1); } else {//we have value curitemid+curitemid_2 //so increment freqsforitem1.put(curitemid_2, freqf...

java - Jmockit String final length method mocking Issue -

using jmockit 1.2 jar, trying mock string's length method getting unexpected invocation exception: failed: test java.lang.illegalstateexception: missing invocation mocked type @ point; please make sure such invocations appear after declaration of suitable mock field or parameter @ stringdemo.testa$1.<init>(testa.java:17) @ stringdemo.testa.test(testa.java:13) i using testng: @test public void test() throws exception { new expectations() { @mocked("length") string astring; { astring.length(); result = 2; } }; system.out.println(a.showa("test")); } } actual class a: public class { public static int showa(string str){ int a= str.length(); return a; } } this wrong way of recording expected results. shouldn't mock , record string's length() method, record showa() instead. here solution @suppresswarnings("unused...

c++ - wxwidget compiling on windows command prompt -

can please guide me on method,as how compile wxwidget using windows command prompt or msys. [i can't seem find on wxwiki/wxwidget official book/anywhere else] i have compiled wxwidget instructions have provided (using msys). from searching on internet seems 1 can (maybe?) through use of makefile (is correct?) if yes: directory & how should link wx libraries in makefile if no: way besides makefile? i know can use ide's code::block , make life simpler prefer compile using command prompt/msys. thanks in advance.

c# - Linq to SQL search for wildcard in double -

in linq sql trying search value of type double: var q = in db.gettable<hkks_medlemmer>() g in db.hkks_get_grader_kun_grad(convert.toint32(a.skif)) a.aktiv == true && (a.skif.tostring().startswith(searchvalue) || sqlmethods.like(a.navn, "%" + searchvalue + "%") || sqlmethods.like(a.mellemnavn, "%" + searchvalue + "%") || sqlmethods.like(a.efternavn, "%" + searchvalue + "%") || sqlmethods.like(a.adresse, "%" + searchvalue + "%") || sqlmethods.like(a.telefon, "%" + searchvalue + "%") || sqlmethods.like(a.mobil, "%" + searchvalue + "%") || sqlmethods.like(a.postnr, "%" + searchvalue + "%") || sqlmethods.like(a.town, "%" + searchvalue + "%") || sqlmethods...

What is the difference between data design and data model(ERD) -

i have google question , find answer in day. know, data design many many table have list column,and mark pk , fk. why er-diagram have find this? data design process of designing database. main output of data design detailed logical data model of database. some people data design includes of needed logical , physical design choices , physical storage parameters needed generate design in data definition language. technically, database analysis, database analysts (dbas) trained do. while person can both data design , database analysis, these 2 different tasks. data design models data. database analysis takes model , applies 1 or more database engines (relational, hierarchical, nosql). a logical data model 1 of main outputs of data design. data model represented entity relationship diagram, or er diagram.

vim - How to create an alias for ctags in vimscript -

i have function invoked based on simple key mapping function! jumptodefinition() let filetype=&ft if filetype == 'coffee' exe '<c-]>' endif endfunction this works when manually <c-]> when try "exe" above "trailing whitespace" error. how can invoke in standalone function have above? note :execute runs resulting expression ex command, isn't want since there no <c-]> ex command. should using :normal . however, able use these "special keys", instead of characters represent, have pay attention 3 things: the correct way represent them backslash \<xxx> . check expr-string . use double quotes, not single quotes :normal accepts commands, not expression :execute so, items 1 , 2 above know "\<c-]>" should used, can't put in front of :normal . well, can, executed "quote, backslash, c, ...". solution go using :execut...

html - adding img in paragraph is causing all its adjacent div slightly moved downward -

Image
i have set of div on webpage following html , css. <style type="text/css"> .div-set { margin: 5px 2px; } .div-set > .widget:nth-child(3n-1) { margin: 20px 32px; } .widget { width: 300px; height: 300px; border: 2px solid #dbdbdb; padding: 0px; position: relative; display:inline-block; } .widget h2 { color: white; text-align: center; margin: 0; padding: 2px 5px; font-weight: bold; margin: 2px; border-top-left-radius: 8px; border-top-right-radius: 8px; } .widget p { padding: 3px 10px; padding-bottom: 15px; } .widget > { position:absolute; bottom:0px; ...

c++ - Calculate transformation matrix from three 3D points -

i have 3d coordinate system of track 3 outer points 3d camera. have 3 points in (x,y,z) space. next frame track these 3 points again. use first 3 points initial situation. need draft transformation matrix gives me translation, rotation , scaling of second 3 points, in comparison initial position. now not know how this. there way directly make transformation matrix, or first have work out translation, rotation , scale matrix , make transformation matrix of these three? i work in c++ opencv , qt. got suggestions? not need full working example, can me on way appreciated. thanks! j this tutorial looks pretty nice (what looking called affine transform)!

forms - Restrict scope of HTML autocompletion -

i have web application frontend on / , backend on /backend, both have different login-sets. currently, autocompletion fills frontend user/pass in backend, , vice versa - way prevent this, still allow user/pass autocompletion? thanks! <form autocomplete ="off"> or use <input type="text" autocomplete ="off">

delphi - Reading ini file onCreate event causes 8 second delay -

i have complex software, , whittled delay in piece of code: procedure tform1.formcreate(sender: tobject); begin inherited; tinifile.create(path + '\filename.ini') try checkbox1.checked :=readbool('header','key',true); free; end; end; when debugging code, debugger showed hanging on create factory of tform inherited create(aowner); question time: why delphi hang when query ini file? ini file few keys big, standing in 64k windows api limit. oncreate has this? ini limitations , downsides tinifile class uses windows api imposes limit of 64kb on ini files. if need store more 64kb of data, should use tmeminifile. update: many comments ill try relate. i reason blame code, simple "try , see". removed ini file call, on create, , code run smoothly , instant window open. when compiling ini file call on oncreate, software hangs 8 seconds. moved call oncreate constructor create, code works smoothly. the ini...

Universal Image Loader cache -

i'm trying integrate universal image loader android app. has gridview , shows images acquired internet. implemented using arrayadapter loads images in getview() in usual way. it works in terms of displaying picture correctly. found unexpected behavior in loading images memory cache. when activity launched, uil loads image internet or disc cache if exists. (of course, expected behavior.) scrolling down gridview until first column go out screen, , scroll top. in time, images @ first column loaded disc cache, instead of memory cache. then scrolling down , again. in time, images @ first column loaded memory cache. i expect images loaded memory cache @ second time of displaying, step 2 in operation above. don't know why disc cache used in case. here codes. imageloaderconfiguration imageloaderconfiguration mimageloaderconfig = new imageloaderconfiguration.builder(getapplicationcontext()) .defaultdisplayimageoptions(defaultoptions) ...

python - "Least Astonishment" and the Mutable Default Argument -

anyone tinkering python long enough has been bitten (or torn pieces) following issue: def foo(a=[]): a.append(5) return python novices expect function return list 1 element: [5] . result instead different, , astonishing (for novice): >>> foo() [5] >>> foo() [5, 5] >>> foo() [5, 5, 5] >>> foo() [5, 5, 5, 5] >>> foo() a manager of mine once had first encounter feature, , called "a dramatic design flaw" of language. replied behavior had underlying explanation, , indeed puzzling , unexpected if don't understand internals. however, not able answer (to myself) following question: reason binding default argument @ function definition, , not @ function execution? doubt experienced behavior has practical use (who used static variables in c, without breeding bugs?) edit : baczek made interesting example. of comments , utaal's in particular, elaborated further: >>> def a(): ... print("a exec...

C : Array of strings - Can input only n-1 strings for an input size of n -

i have sort strings in lexicographical order using bubble sort technique without using library functions. have written following code working fine in sorting strings. problem if give n input (say n = 4), can enter n-1 strings (only 3 strings). problem can solved running loops 0 n, isn't logical solution. doing wrong here? #include <stdio.h> #include <string.h> #include <malloc.h> void swap(int indx[], int j) { int temp; temp = indx[j]; indx[j] = indx[j+1]; indx[j+1] = temp; } void sort(char **str, int indx[], int n) { int i, j, k; for(i=0; i<n; i++) { for(j=0; j<n-i-1; j++) { k = 0; while(str[j][k] != '\0') { if((str[indx[j]][k]) > (str[indx[j+1]][k])) { swap(indx, j); break; } else if((str[indx[j]][k]) < (str[indx[j+1]][k])) break; ...

php - Merging arrays in foreach loop -

i performing csv import database , have trouble adding loop inside array being inserted table. $lines = 0; $queries = ""; $linearray = array(); $data = array(); if ($csvcontent) $query = "truncate table $databasetable;"; @mysql_query($query); echo "part list ".$databasetable." updated.\n</br>"; foreach(explode($lineseparator,$csvcontent) $value){ $lines++; $value = trim($value," \t"); $value = str_replace("\r","",$value); $value = str_replace("'","\'",$value); $linearray = explode($fieldseparator,$value); $linemysql = implode("','",$linearray); $first = array_splice($linearray, 0, 2); <... here need have function takes values table , creates array looks $b variable....> $b=array("1","2","3","4","5","6"); foreach($linearray $x){ $b = implode(...

ios - Is there a UIImagePickerController replacement that I can use from a controller that is already in a popover? -

i'm writing app uses uiimagepickercontroller let user choose images library. on ipad, shows in popover (because must) controller showing in popover, , you're not allowed show popover popover. can't rework whole app avoid files controller being in popover, i'd push image picker onto files controller's navigation stack. obviously isn't going work stock image picker, there a lot of alternatives . has used of them let me push them onto navigation stack, or need write own? the proper solution present image picker modal view controller existing view controller. set image picker's modalpresentationstyle uimodalpresentationcurrentcontext . this show image picker in same popover modal view controller on calling view controller.

reporting services - Formatting subtotals in a matrix report -

so have matrix report formatting data cells not inherited subtotals. read article ( http://social.msdn.microsoft.com/forums/en-us/sqlreportingservices/thread/d4d21769-2cb0-4bb1-b74b-89e4d31fb724 ) , seems need remove formatting of subtotals , add formatting data cells (i.e. inscope(row_rowgroup1) , such types of formulas). i've never used inscope before thought bothcing syntax. such, tried entering following 1 of data cells , still doesn't come in bold i'd expect. =iif(1=1,"bold","normal") i'm adding fontweight condition on data cell, should bold, right? i'm struggling see why bold data cell (i'm thinking should bold individual rows , subtotals literally nothing bold). i figured out. working, no displaying in preview mode. once deployed functionality desired. sheesh.

javascript - Slimit python minifier strange behaviour -

i trying minify javascript python 'slimit' package. import slimit slimit.minify('[1,2,3,4,5,6,7,8]') runs fine , returns '[1,2,3,4,5,6,7,8]' import slimit slimit.minify('[01,02,03,04,05,06,07,08]') gives error: syntaxerror: unexpected token (number, '8') @ 1:23 between lextoken(number,'0',1,22) , lextoken(rbracket,']',1,24) the strange thing minifying string [01,02,03,04,05,06,07] works ok. slimit returns error when minifying 8 or more 0 padded integers in array. this down lexer used slimit. numbers starting "0" (but not "0x") treated octal integers. sequence "08" therefore ends 2 separate tokens ("0", "8") hence "unexpected token" error. note following: >>> slimit import lexer >>> l = lexer() >>> l.input("02") >>> l.token() lextoken(number,'02',1,0) >>> l.input("08...

Pagination links with a locale prefix in URLs Grails -

if you're using language prefix in url mappings such as /$lang/$controller/$action?/$id? and urls generating contain parameters in addition lang parameter, you'll following url, additional param such offset: /book/list?offset=10&lang=en but breaks mappings. instead, want url this: /en/book/list?offset=10 how can achieve that? create following bean (assuming lang param called "lang"): class langawareurlmappingsholderfactorybean extends urlmappingsholderfactorybean { @override public urlmappingsholder getobject() throws exception { def obj = super.object obj.default_controller_params = [urlmapping.controller, urlmapping.action, "lang"] set obj } } and adjust resources.groovy : "org.grails.internal.url_mappings_holder"(langawareurlmappingsholderfactorybean) { bean -> bean.lazyinit = true } and you'll get /en/book/list?offset=10 instead of /book/list?offse...