Posts

Showing posts from January, 2011

angularjs - Is there any limitation to use ng-include -

i developing product. there, separating page many templates, use atleast 5-8 ng-include per page. there problem use many ng-include in page? the major problem each ng-include generates http request, impact page load times. if doing splitting page, have couple of options: create directives, if html can used in others areas of app. use templating engine handlebars , preprocessor combine partials, in single page, gulpjs or grunt (i prefer gulp).

w3c validation - Cannot get my html pass W3 Validator, what is wrong? -

Image
i trying validate 1 page, validator gives me ridiculous errors. for example attribute name not allowed on element meta @ point. i using <meta name="description" https://validator.w3.org/nu/?showsource=yes&doc=http%3a%2f%2fwww.ayurvedabansko.bg%2f the client wants code validated, crazy... anyone ideas? i fixed issues, , validating html source returns 2 info messages only. you main problem seems closing div tag without opening match. search <a href="#" class="scrolltotop"></a> , remove closing div tag right afterwards. here's list of fixes applied: closing div tag without opening match (as mentioned) <hgroup> being outdated/deprecated (try replacing div or p (besides div not support nesting hgroup tags (among others) inside it) make <title> tag 1st child in head element update : seems need define charset first thing before proceeding inside head tag. also, got rid of http-equiv...

c# - Slow Performance When Reading Excel -

i want read excel file in way slow. pattern should use read excel file faster. should try csv ? i using following code: applicationclass excelapp = excelapp = new applicationclass(); workbook myworkbook = excelapp.workbooks.open(@"c:\users\owner\desktop\employees.xlsx"); worksheet mysheet = (worksheet)myworkbook.sheets["sheet1"]; (int row = 1; row <= mysheet.usedrange.rows.count; row++) { (int col = 1; col <= mysheet.usedrange.columns.count; col++) { range datarange = (range)mysheet.cells[row, col]; console.write(string.format(datarange.value2.tostring() + " ")); } console.writeline(); } excelapp.quit(); the reason program slow because using excel open excel files. whenever doing file have com+ interop, extremely slow, have pass memory across 2 different processes. microsoft has dropped support reading .xlsx files using excel interop. released openxml library reason. i suggest use wrapper libra...

getting IOException: Premature EOF when running import.io -

i have created crawler using import.io first issue faced import.io not identify data on webpage after clicking "detect optimal settings". asks "is data want extract still in browser?" data not highlighted click no. data still not highlighted. same thing happens extractor. proceeded issue, clicking yes when asked "is data want extract still in browser?" though data not highlighted. went on build crawler , works fine. put around 15k urls in start url page depth 0. what happens out of 15k pages, around 10% of pages not crawled. checked log file , shows ioexception: premature eof against rows not crawled. if manually go page in browser, page loads fine , in same format in trained crawler. tried train pages showed error, doesnt help. how can around error? as responded support ticket, thought put information here well. error related website detecting using crawler , blocking urls. suggest rerunning crawler increased "pause between pages...

java - Android: What happens with all the permissions groups that arent listed under android M? -

this doc google lists permissions groups under android m: https://developer.android.com/preview/features/runtime-permissions.html and doc links permissions in android permission group: https://github.com/android/platform_frameworks_base/blob/master/core/res/androidmanifest.xml now, not permissions existed pre-m exist post-m, leads question: happens these permissions after m comes out? for example, use_credentials belongs account permissions group - under m neither permission nor group exist. happens app using permission? still work fine? need ask different permission instead? must change manifest @ these unlisted permissions or unlisted permissions supported default post-m?

OpenLayers 3 multiple feature selection -

i use click interaction select multiple features , show division names. using following code, if add new feature (using shift key) infobox2 updated additional feature name (division) repeated again in infobox2 when try remove feature selection (with altkey). i whould deselect feature , have division name removed infobox2. how possible? thanks var infobox2 = document.getelementbyid('info2'); var selectclick = new ol.interaction.select({ addcondition: ol.events.condition.shiftkeyonly , togglecondition: ol.events.condition.never, removecondition: ol.events.condition.altkeyonly, }); select = selectclick; map.addinteraction(select); var features = select.getfeatures(); var info = []; var displayfeatureinfoclick = function(pixel) { var features = []; map.foreachfeatureatpixel(pixel, function(feature, layer) { features.push(feature); }); if ( features.length > 0) { (var = 0, ii = features.length; < ii; ++...

c++ - Creating a generic conversion function -

i have resourcemanager takes in classes of type resource . resource parent class of other classes such shaderprogram , texture , mesh , camera unrelated 1 another. suffice say, resourcemanager works. there 1 thing tedious , annoying, , that's when retrieve objects resourcemanager . here problem: in order object resourcemanager call either of these functions: static resource* get(int id); static resource* get(const std::string &name); the first function checks 1 std::unordered_map integer id; whereas second function checks std::unordered_map name manually given client. have 2 versions of these functions flexibility sakes because there times don't care object contained within resourcemanager (like mesh ) , there times care (like camera or shaderprogram ) because may want retrieve said objects name rather id. either way, both functions return pointer resource . when call function, it's easy like: rm::get("skyboxshader"); where rm typed...

ios - UICollectionviewCell: compute perfect cellsize -

i'm having uicollectionview gets populated different numbers of cells. cells should use available space perfect possible. compute available space per cell. the available space should computed when view initializes. each cell has spacing of 2pt everything. have hard code space of navigationbar , statusbar 64pt, not future proof. with code below working in simulator, not on real hardware (iphone5s): on physical iphone height not computed correctly , and gap 30pt appears between last row , bottom of collection view. any idea how improve code? private func computecellsizes(var size :cgsize){ if(size == cgsizezero){ size = self.collectionview!.frame.size } self.numberofrows = int(size.width / 103) //spacing of 2 points between each cell let availablewidth = size.width - cgfloat((self.numberofrows + 1) * 2) let cellwidth = availablewidth / cgfloat(numberofrows) self.numberofcolumns = int(size.height / (...

c++ - Boost.Asio: Writing a SSL Server/Client Too many file types -

i want make simple ssl server/client couple using boost.asio. before doing have read ssl, certificates, private keys, public keys etc. used openssl generate private key (.key) , certificate (.crt). certificate self-signed. then, started digging boost.asio samples. first tried write client. in sample verify file *.pem file. had no idea was. after searching little (googling "how convert crt pem" etc.) got .crt file .pem file since starts -----begin , encoded in base64. so have done writing client , using .crt file argument of ctx.load_verify_file() . appropriate practice? to test client, have started writing server. have 3 kinds of files, 2 of them not familiar. are: certificate chain file private key file (the 1 familiar) temporary dh file in example private key file *.pem file, private key file *.key file. confused. need make conversion? so explain me: what *.pem file? how can represent private key verification? what certificate chain file? what temp...

app engine ndb - Google appengine search api sort by ndb value -

i having list of products. have added google appengine search api index each product being each document. user can search products. far good. now want user able sort price of product ascending or descending. if have fixed price each product, build separate indexes , put documents inside them. unfortunately, prices dynamic. product price can change 3-4 times day. have more 200,000 products. since rewriting document each time price changes bad, have ndb datastore model has documentid , price entity attributes. is there way sort search api results, based on price in ndb model. alternate design solutions welcome.

c# - What is a good algorithm to manipulate a lot of DateTime Records? -

i have sql server table in form of data,startdatetime,enddatetime and means sensor has state of data in duration of startdatetime , enddatetime . have lots of these data. there algorithm or class or way query (in c# level or sql level) can ask in specific time sensor state? in sql if want data instance '2015-08-16 17:33:45' select data your_table '2015-08-16 17:33:45' between startdatetime , enddatetime

Recursion with Double Call (C++) -

can please explain me how adds 26? i confused 'double call'. maybe don't understand recursion think do. #include <iostream> using namespace std; int rec(int * n, int max) { if (max < 0) return 0; return n[max] + rec(n, max - 1) + rec(n, max - 2); } int main() { const int max = 5; int n[] = { 1, 2, 3, 4, 5 }; int f = rec(n, max - 1); cout << f << endl; return 0; } int f = rec(n, 4) = n[4] + rec(n, 3) + rec(n, 2) = 5 + (n[3] + rec(n, 2) + rec(n, 1)) + (n[2] + rec(n, 1) + rec(n, 0)) = 5 + (4 + (n[2] + rec(n, 1) + rec(n, 0)) + (n[1] + rec(n, 0) + rec(n, -1)) + (3 + (n[1] + rec(n, 0) + rec(n, -1)) + (n[0] + rec(n, -1) + rec(n, -2))) = 5 + (4 + (3 + rec(n, 1) + rec(n, 0)) + (2 + rec(n, 0) + 0) + (3 + (2 + rec(n, 0) + 0) + (1 + 0 + 0)) = 5 + (4 + (3 + (n[1] + rec(n, 0) + rec(n, -1)) + (n[0] + rec(n, -1) + rec(n, -2))) + (2 + (n[0] + rec(n, -1) + rec(n, -2)) + 0) + (3 + (2 + ...

c# - Compiled Binding to IsChecked checkbox -

i've got checkboxes in list i'm trying use compiled binding bind ischecked propertie... so tried this: <datatemplate x:datatype="local:rdo"> <stackpanel orientation="horizontal"> <checkbox content="{x:bind content}" ischecked="{x:bind check}"/> </stackpanel> </datatemplate> and model class this: class rdo { public string content { get; set; } public boolean check { get; set; } } but doesn't work , return error saying severity code description project file line error invalid binding path 'check' : cannot bind type 'system.boolean' 'system.nullable(system.boolean)' without converter how fix this? and what's difference between boolean , nullable(boolean)? your model must implement property check like class rdo { public string content { get; set; } public boolean? check { get; set; } } see ? on boolean...

ruby on rails - Separating out user management and Stripe payments into a second app and linking via API. My Neo4j knowledgebase -

i've built database in neo4j , use rails neo4jrb easy way manipulate database. reasons explain below, below call knowledgebase (kb) instead of database. i starting working friend wants provide access kb users of app. built api in rails can access it. now friend , talking building membership site subscription payments. figured needed figure out how build stripe subscription payments app. found great tutorial railsapps in terms of functionality need, relies on gem called payola makes stripe integration easy. payola great works activerecord, not neo4j. thinking i'd have figure out how payola neo4j. but have idea of building separate app using railsapp+payola approach, , hooking app kb's api. the reason knowledgebase because purpose structure knowledge within particular domain. use graph database neo4j because graph-based data model suits goal, example (object of type a) -[has influence on]-> (object of type b). so idea of using separate app managin...

ios - Using MKDirections to get Map Directions and Routes not working -

i trying provide user navigation direction click of button. reason doesn't seem working. @ibaction func directiontodestination(sender: anyobject) { getdirections() } func getdirections(){ let request = mkdirectionsrequest() let destination = mkplacemark(coordinate: cllocationcoordinate2dmake(place.latitude, place.longitude), addressdictionary: nil) request.setsource(mkmapitem.mapitemforcurrentlocation()) request.setdestination(mkmapitem(placemark: destination)) request.transporttype = mkdirectionstransporttype.automobile var directions = mkdirections(request: request) directions.calculatedirectionswithcompletionhandler({(response: mkdirectionsresponse!, error: nserror!) in if error != nil { // handle error } else { self.showroute(response) } }) } func showroute(response: mkdirectionsresponse) { ...

php - jQuery updates hidden input value, but does not pass to POST variable -

i have built html form address data, , want compute latitude , longitude of address before commit form fields sql database via post variables. right console shows edited hidden "latinput" , "lnginput" field dom lat/lng values. however, change not being captured post variables in php script. hidden form fields : <input type="hidden" name="latinput" id="latinput" value=""> <input type="hidden" name="lnginput" id="lnginput" value=""> jquery setting/checking dom updates hidden fields : //insert new lat/lng variables hidden form inputs, php can access post , insert sql database $("#latinput").attr('value',locallat); $("#lnginput").attr('value',locallng); //confirm hidden input fields set lat/lng values console.log("latinput set to: " + $("input[name=latinput]").val()); console.log("lnginput set to: " ...

android - How can I implement filter in Navigation Drawer List Item -

Image
i have long list item on navigation drawer, have added edittext on top of it, implemented filterable on custom adapter, application crashes when add line of code edittext searchsongs = (edittext)findviewbyid(r.id.searchinput); if(adapter != null) { searchsongs.addtextchangedlistener(new textwatcher() { @override public void beforetextchanged(charsequence s, int start, int count, int after) { } @override public void ontextchanged(charsequence s, int start, int before, int count) { //adapter.getfilter().filter(s); } @override public void aftertextchanged(editable s) { } }); } if remove code works well, when comment out getfilter method, still crashes.

ruby on rails - one-to-many through referance table -

i'm trying understand how implement one-to-many relationship through reference table. i'm looking on this guide though write on 1 model has_many one-to-many i'm not sure (i wrote it's not working). anyway i'm doing save me table, , doing right , not working. the model following: microposts, :id, :content tag, :id, :name tag_microposts, :tag_id, :micropost_id article, :id, :text article_microposts, :article_id, :micropost_id i can 2 microposts tables id of tag/article. think doing better , righter. in end what's interesting me microposts through tag model. in tag_controller able do: def index @tag = tag.find(params[:id]) @microposts = @tag.microposts end some code: class tag < activerecord::base ... has_many :tag_microposts, foreign_key: :tag_id, dependent: :destroy has_many :microposts, through: :tag_microposts, source: :micropost ... end class tagmicropost < activerecord::base validates :tag_id, presence: true v...

access all php array rows using mysql limit clause -

using following method mysql query limit clause, if try access array values using foreach loop, display limited rows inside $query_data array per limit clause. while ($row = mysqli_fetch_assoc($result1)) { $query_data[] = $row; } array $query_data contains 8 rows result-set. if limit clause of query set 0,3 display 3 records array values. is there way fetch records ignoring limit clause every time @ place using foreach or other loop? no. limit clause means data not fetched. if wish fetch additional data, must rid of limit clause.

excel vba - Having Trouble passing a Cell object? (i could be wrong) -

first off thank much. on last few months (i believe) coding has progressed drastically. , criticize welcome (rip me apart). recently started try use different subs (i dont quite understand when use functions etc, figure structure practice when figure out. i hitting run-time 424 error following bit of code in sub ownercheck sub occupationnormalization() dim infobx string ' initialize variables lrow = activesheet.usedrange.rows.count lcol = activesheet.usedrange.columns.count statuscounter = lrow while infobx = "" infobx = inputbox("enter occupation column", "occupation column") loop restaurcheck (infobx) application.screenupdating = true application.statusbar = "" end sub - sub restaurcheck(infobx string) dim restaurants(), restaurantdqs() variant dim i, lrow, lcol, statuscounter long dim rrng range lrow = activesheet.usedrange.rows.count ...

apache storm reliablity timeout configuration -

i have nodejs->kafka>storm->mongo deployed in linux ubuntu. normal originally. changed method in storm worker makes storm worker process message slow, around 1 minute per message, notice message sent again , again storm. revert original method, fine. (original method process time 90ms per message). i guess storm reliability come player. when message not acknowledged, or time out, sends message again. if guess right, how configure timeout? if guess wrong, why same message sent twice or 3 times? you can set timeout via configuration parameter config.topology_message_timeout_secs . see https://storm.apache.org/javadoc/apidocs/backtype/storm/config.html#topology_message_timeout_secs the default value 30 seconds, see defaults.yaml here: https://github.com/apache/storm/blob/master/conf/defaults.yaml # maximum amount of time message has complete before it's considered failed topology.message.timeout.secs: 30 when tuple fails, should show in storm ui , sh...

Get Date Autofilter in Excel VBA -

i trying extract autofilter parameters using vba. can 1 me getting autofilter parameters, when date autofilter applied? e.g. have table 2 columns, 1 contains text data, , second contains date data. to set text filter first colum: range.autofilter field:=1, criteria1=array("text1","text2","text3","text4"), operator:=xlfiltervalues then filter information can loop through criteria1 variant array (indexed 1) each filter, in = 1 4: print range.autofilter.filters(1).criteria1(i) now column 2 date filter has been set: range.autofilter field:=2, operator:=xlfiltervalues, criteria2:=array(2, "8/10/2015", 2, "8/20/2015") if follow same logic text filter, i'd expect filter information variant array in criteria2 property, statement produce error (1004: application-defined or object-defined error), whereas you'd expect integer '2' output: print range.autofilter.filters(2).criteria2(1) i've go...

matplotlib - I cannot figure out how to spread out the space on the y axis for my scatterplot in Python -

Image
i entered code x , y , , size defined variables created earlier. problem points bunched , want stretch out y-axis. plt.scatter(rets.mean(),rets.std(),s = area) plt.xlabel('expected return') plt.ylabel('risk') for example, right y-axis goes -0.005 0.04 in increments of 0.005 , how adjust count in increments of 0.0025 ? import matplotlib.pyplot plt import matplotlib.ticker mticks fig, ax = plt.subplots() ax.set_ylim((-.005, .04)) ax.yaxis.set_major_locator(mticks.multiplelocator(.0025))

How to limit comments through youtube data api v3 -

im looking method of youtube data api v3 in: https://developers.google.com/youtube/v3/docs/videos i want prohibit comments on youtube videos. seems no method that. there way how limit video comments? looks disabling comments youtube data api v3 doesn't work right. , removed feature. there bug reported on over here .

java - Queue has more items that I put in it -

Image
in java program, initialized queue numbers 0 1000. emptyframes = new priorityqueue<integer>(); (int = 0; < 1000; i++) { emptyframes.add(i); } system.out.println("debug"); however, when go in debug, there 1155 items in queue. why happening? the indices greater 1000 related queue's capacity, rather size. internally, priorityqueue backed array of objects. when adding objects queue full backing array, queue expand array moderate amount calling grow , have internal space ( capacity ) available future add calls. avoids queue having expand array every time add called, horribly inefficient. private void grow(int mincapacity) { int oldcapacity = queue.length; // double size if small; else grow 50% int newcapacity = oldcapacity + ((oldcapacity < 64) ? (oldcapacity + 2) : (oldcapacity >> 1)); // overflow-c...

ios - Best practice for retrieving many images from Parse? -

i have app photo-based, , had ton of large-scaled resolution images on parse. have app set grab these images parse query, , storing each photo uiimage array loop, , displaying these photos in uicollectionview. it works great, if pulling less 10 photos parse. however, if retrieving, 20 photos, when scroll down uicollectonview after photos have been loaded, around 18th or photo, app crash, , xcodes console output "received memory warning". what best practice retrieving large amount of large sized photos parse? (if displaying them in uicollectionview) i download thumbnails. can using lazy loading ( http://www.theappguruz.com/blog/ios-lazy-loading-images ) if inclined. when image clicked on , want see full size, download full size image :) set limit on how many images want retain in memory, , use queue decide when store/get rid of old images.

javascript - How to make the "jqGrid toolbar search" search for the at in any occurrence, not just the beginning -

i've implemented jqgrid toolbar search enabled on it. problem search working '%search_criteria' (only matching beginning) need '%search_criteria%' (any occurrence in column value). e.g: grid has column "class" values: math-101, , math-102 if searched for: "101" ==> 0 matches. have search whole word "math-101". i saw example working wont, , not different grid @ all, , don't how working on example below , not on mine!!! ex: http://www.ok-soft-gmbh.com/jqgrid/simplelocalgridwithsearchingtoolbar.htm my grid: var data = [[1, "math-101", "oc", "intel", "09-02-15", "09-30-15", "a", 120, "general", 200]] $("#grid").jqgrid({ datatype: "local", height: 200, colnames:['#','class','loc','type','start dt','end dt','section...

html - Bootstrap date-picker not being set -

i'm using laravel's illuminate date forum. <div class="form-group"> {!! form::label('published_at', 'publish on:') !!} {!! form::input('date', 'published_at') !!} </div> my page source this: <div class="form-group"> <label for="published_at">publish on:</label> <input name="published_at" type="date" id="published_at"> </div> i'm picking date through eloquent so: public function setpublishedatattribute($date){ $this->attributes['published_at'] = carbon::parse($date); } for reason, changing date not changing, picking current date. laravel or bootstrap issue? edit tried debugging form. http response: remote address:[::1]:8000 request url:http://localhost:8000/articles request method:post status code:200 ok response headers view source cache-control:no-store, no-cache, must-revalidate cache-con...

Memory Leakage in ThirdParty C-Code/C-Library -

i have memory leakage in absolut frustrating third party static library...i narrow down following function "read_lut". think leakage because of p = (struct csoln*) malloc(ns*sizeof(struct csoln)); c very rusty when comes down memory handling... can me free memory correctly? void readlut() { unsigned char charnum[256], line[32], *linep, c; file *fpwv, *fprt; struct csoln *p; int d, i, j, k, kk, ns, nn; init_param(); (i=0; i<=255; i++) { if ('0'<=i && i<='9') charnum[i] = - '0'; else if (i>='a') charnum[i] = - 'a' + 10; else // if (i=='$' || i=='\n' || ... ) charnum[i] = 0; } fpwv=fopen(powvfile, "r"); if (fpwv == null) { printf("error in opening %s\n", powvfile); exit(1); } #if routing==1 fprt=fopen(postfile, "r"); ...

ios - addSubview turning my view to default -

it seems when use addsubview add image viewcontroller, view turned it's view when loads. reason why , how fix? here's code if needed: let target = targets[i] bullet = uiimageview(image: uiimage(named:"bullethole")) bullet.frame = cgrectmake(target.center.x,target.center.y,20,20) bullet.hidden = false self.view.addsubview(bullet) your image not moving seems due view inheritance line self.view.addsubview(bullet) expresses. this, pasting image onto whole view itself. if want move image have 2 options: move bullet hole same way move other image, or add bullet hole subview of view moving, not main view (as in self.view )

Template Haskell Function for Record Accessor Inheritance -

i have 2 datatypes, a , b , have defined as: data = { afoo :: int, abar :: string } data b = b { bfoo :: int, bbar :: string, bbaz :: float } i need create heterogeneous list of a s , b s, define sum type, c , as: data c = ca | cb b i define functions cfoo :: c -> int cbar :: c -> string this can achieved pattern matching... cfoo (ca a) = afoo cfoo (cb b) = bfoo b cbar (ca a) = abar cbar (cb b) = bbar b ...but becomes tedious data types of many fields. wondering if there simple solution using template haskell, or if wouldn't worth effort. have intermediate knowledge of haskell, relatively new template haskell. appreciated.

java - JOptionPane parsing arrays -

i new java , arrays. trying parse string input int , array. import javax.swing.joptionpane; public class osl { string[] colortype = {"blue", "green", "white"}; final int colours = 3; // tshirt colours choices int[] color = new int[colours]; int order; public osl() { (int index = 0; index < colortype.length; index++) { string orderitems = joptionpane.showinputdialog("please enter number of t-shirts " + colortype[index]); int items = integer.parseint(orderitems); } (int index = 0; index < color.length; index++) { joptionpane.showmessagedialog(null, colortype[index] + ": " + color[index]); } } int orderitems; public int g...

arrays - Can forEach in JavaScript make a return? -

i wonder if foreach in javascript can make return, here code: var = [0, 1, 2, 3, 4]; function fn(array) { array.foreach(function(item) { if (item === 2) return false; }); return true; } var ans = fn(a); console.log(ans); // true i want find out if 2 in array, if so, return false, seems foreach function has looped whole array , ignore return. i wonder if can answer want foreach ( know can want using for(..))? dear friend, pls me, great thanks! you can use indexof instead https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/array/indexof function fn(array) { return (array.indexof(2) === -1); } also documentation foreach - https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/array/foreach note: there no way stop or break foreach() loop other throwing exception. if need such behaviour, .foreach() method wrong tool, use plain loop instead. so, return value cannot used way using it....

wpf - MouseDoubleClick gets wrong TreeViewItem -

this 1 weird unless i'm missing basic. i have attached event handler treeviewitem 's mousedoubleclick event through itemcontainerstyle : <treeview.itemcontainerstyle> <style targettype="treeviewitem"> <eventsetter event="mousedoubleclick" handler="treeviewitem_mousedoubleclick" /> </style> </treeview.itemcontainerstyle> here's event handler: private sub treeviewitem_mousedoubleclick(sender object, e mousebuttoneventargs) if typeof sender treeviewitem dim tvi = directcast(sender, treeviewitem) msgbox(tvi.header) end if end sub the problem msgbox shows header text of root node, not node on double-clicked. can't see obvious mistake here. can point me in right direction? yup, you're missing 1 of basic weird things treeview :). not sure how can illustrate in post, i'll try explain it. treeviewitem has sub items. when expand root treeviewitem show sub items, sub t...

ios - non-optional relations one-to-one failed to save with 1570 error sometimes -

i have task , person classes. task has relationship one-to-one person, relation called "assignee". have nsmanagedobject inheritors both classes. getting instance of person (with aid of nsfetchrequest), , create new task (with nsentitydescription), , task.assignee = person; [context save:&error]; some times saves, of time getting “cocoa error 1570” saying "assignee" null! how be? i added assert(task.assignee) before saving i check [task validateforinsert:&error]; , error empty!! i using same context fetched person second ago nobody touches in background and funniest thing: when check "optional" in relation, works! saves correct data: task person. is bug or what? looks did stupid threading mistake. i had context nsprivatequeueconcurrencytype , , used objects obtained on main thread, not allowed (managed objects not thread safe). should switch nsmainqueueconcurrencytype or use managedobjectid refetch objects different...

jquery - Wrapping a series of elements between classes until it meets another class -

i trying wrap content between class "product-category", class "content". , stop wrapping when meets class "end". given markup: <div class="product-category"> <p>lorem ipsum dolor sit amet.</p> <p>quae aliquid, ex enim eveniet!</p> <p>eligendi similique maxime, fugiat porro.</p> </div> <div class="product-category"> <p>lorem ipsum dolor sit amet.</p> <p>quae aliquid, ex enim eveniet!</p> <p>eligendi similique maxime, fugiat porro.</p> </div> <div class="end"> <p>lorem ipsum dolor sit amet.</p> </div> what want make it: <div class="content"> <div class="product-category"> <p>lorem ipsum dolor sit amet.</p> <p>quae aliquid, ex enim eveniet!</p> <p>eligendi similique maxime, fugiat por...