Posts

ios - Is it safe to pass NSManagedObjectID-s between multiple NSPersistentStoreCoordinator-s? -

i have multiple nspersistentstorecoordinator instances have 1 nspersistentstore each, pointing same sqlite file. , in testing passing nsmanagedobjectid objects between them, , calling - (nsmanagedobject *)existingobjectwithid:(nsmanagedobjectid *)objectid error:(nserror **)error on nsmanagedobjectcontext seems work fine, have yet come across documentation apple confirms supposed work fine. so, question is, if knows if supposed work (a link apple documentation confirming awesome!), of if knows not supposed work, , should not doing this, awesome too! it's safe call method. whether returns object story. when using object id different context, you'll non-nil result if object accessible context call method on. implies object exists in persistent store, meaning has been saved on original managed object context. or in other words, you'll non-nil result if you've saved object id, , if you're using object's permanent (post-save) id.

javascript - Backbone model save() method not doing anything -

i'm using backbone rails , trying save new model server. however, calling .save() on model doesn't seem doing anything. looking @ "network" tab in chrome, don't see request being made. here's code: model class myapp.models.chain extends backbone.model defaults: steps: [] id: null urlroot: '/chains' validate: (attrs) -> if $.trim(attrs.steps[@step_number - 1]) == '' return "step can't blank." view class myapp.views.chainsnew extends backbone.view # @template defined conditional inside render() initialize: -> @is_saving = false events: 'click #btn-go': 'add_step' 'click #btn-done': 'save' render: (step_number) -> @model.step_number = step_number @template = if @model.step_number 1 jst['chains/new'] else jst['chains/step'] $(@el).html(@template({pre...

Prevent action attribute from running php script with javascript -

this question has answer here: prevent form posting until javascript code satisfied 4 answers is there way can use javascript prevent form runing php script. example this: <form action="somepage.php" method="post> <input type= "text" class= "field" name = "blah"> <input type="submit" value="send" > </form> i know how validate what's in text box using javascript, want prevent somepage.php run if text box empty. haven't tried cause don't know how it. hope guys understand problem. thanks you can attach function submit event of form : document.getelementbyid('form-id').addeventlistener("submit", function(e){ var field1 = getelementbyid('field1').value; if(field1=='' || field1 == null){ e.preventdefaul...

Mysql 5.5 database charset issue. Database charset changes from utf8 to latin1 -

i have problem mysql 5.5. when type in console show variables 'char%'; show variables 'collation%'; my output should be character_set_database | utf8 collation_database | utf8_unicode_ci when change database use final; example, character set , collation change latin1. need utf8 because want store data in greek , change entries '?'. do wrong? , when yes, how change in order use time utf8? i create database , tables code below: create database if not exists finalessay character set utf8 collate utf8_unicode_ci; and create table if not exists `department` ( `deptid` int(6) not null , `description` varchar(250) null default null , `schoolid` int(6) null default null , primary key (`deptid`) ) engine = innodb, character set utf8, collate utf8_general_ci; would appreciate if me.

iframe - Embedded Google calendar : how to set range of hours to display? -

given following embedding code: <iframe src="https://www.google.com/calendar/embed? title=2014 plidam international symposium (paris)& dates=20140611/20140615& mode=week&amp; shownav=1&amp; showdate=1&amp; showprint=1&amp; showtabs=1&amp; showcalendars=0&amp; showtz=1; height=600&amp; wkst=2&amp; bgcolor=%23666666&amp; src=vdfmfbp0msroletduigs2qtkoc%40group.calendar.google.com&amp; color=%232952a3&amp; ctz=europe%2fparis" style=" border:solid 1px #777 " width="800" height="600" frameborder="0" scrolling="no"></iframe> is there parameter set hours display/focus_on 09:00 18:00 (6pm), aka working hours ? same days, there someways display/focus_on rights 4 days only. fiddle here there doesn't appear way through api, currently. use javascript/jquery remove elements don't want show in dom after iframe has finished loading. so, delete wedne...

javascript - Get local time representation of Date in arbitrary timezone in arbitrary day - considering Daylight Savings Time -

for sure, there lot of questions date objects , timezones many of them converting current time timezone, , others not clear want do. i want display day, hour, minute etc. in arbitrary timezone, in arbitrary day. example, function f(t, s) that: given timestamp 1357041600 (which 2013/1/1 12:00:00 utc) , string "america/los angeles" , satisfy comparison below: f(1357041600, "america/los angeles") == "2013/01/01 04:00:00" given timestamp 1372680000 (2013/07/01 12:00:00 utc), satisfy comparison below: f(1357041600, "america/los angeles") == "2013/07/01 05:00:00" will behave way if timezone in browser is, let "europe/london" or "america/são paulo" . will behave way if time in browser is, let 2014/02/05 19:32, or 2002/08/04 07:12; and as final restriction, not request server side (because i'm doing myself :) ) is possible? given timestamp 1357041600 (which 2013/1/1 12:00:00 utc) ...

C++, output of one digit after the decimal -

i'm new in c++ , help. don't understand why i'm getting output of 1 digit after decimal on sum below. have tried solve no success. int main() { double alt, t; t = 4.5; // function calculating altitude on time. alt = (-0.12)*pow(t, 4) +(12.0)*pow(t, 3) -(380.0)*pow(t, 2) +(4100.0)*t +220.0; cout << alt << endl; return 0; } the default behaviour of cout print 6 significant digits of floating points. can change with: cout.precision(10); cout << alt << endl; which gives output: 12019.2925 which seems correct solution. you should not try set precision higher 15, because precision limit of double type (typically). can use numeric_limits<double>::digits10 <limits> make sure precision have.