I use MagicalRecord for my CoreData store. I have a statement that is generating multiple crashes by different users when this statement is executed:
PreferenceData *prefDataFound = [PreferenceData MR_findFirst];
The error is:
+entityForName: nil is not a legal NSManagedObjectContext parameter searching for entity name 'PreferenceData'
coming from this sequence of calls (from Crashlytics):
1 libobjc.A.dylib objc_exception_throw + 30
2 CoreData +[NSEntityDescription entityForName:inManagedObjectContext:] + 104
3 SalonBook NSManagedObject+MagicalRecord.m line 91
+[NSManagedObject(MagicalRecord) MR_entityDescriptionInContext:]
4 SalonBook NSManagedObject+MagicalRequests.m line 19
+[NSManagedObject(MagicalRequests) MR_createFetchRequestInContext:]
5 SalonBook NSManagedObject+MagicalFinders.m line 79
+[NSManagedObject(MagicalFinders) MR_findFirstInContext:]
6 SalonBook NSManagedObject+MagicalFinders.m line 86
+[NSManagedObject(MagicalFinders) MR_findFirst]
7 SalonBook SubViewGrid.m line 37
-[SubViewGrid drawRect:]
All of this indicates to me that there is no valid context for the MR_findFirst call; oher than using *MR_findFirstWithPredicate:* (for which I have no predicate, I just want the first and only record), what can I do to fix this?
You can call
PreferenceData *prefDataFound = [PreferenceData MR_findFirstInContext:context];
with your current context, instead of relying on Magical Record to determine the
current context magically.
Related
How do I fix USER FATAL MESSAGE 740? This error is generated by Nastran when I try to run a BDF/DAT file of mine.
*** USER FATAL MESSAGE 740 (RDASGN)
UNIT NUMBER 5 HAS ALREADY BEEN ASSIGNED TO THE LOGICAL NAME INPUT
USER ACTION: CHANGE THE UNIT NUMBER ON THE ASSIGN STATEMENT AND IF THE UNIT IS USED FOR
PARAM,POST,<0 THEN SPECIFY PARAM,OUNIT2 WITH THE NEW UNIT NUMBER.
AVOID USING THE FOLLOWING UNIT NUMBERS THAT ARE ASSIGNED TO SPECIAL FILES IN MSC.NASTRAN:
1 THRU 12, 14 THRU 22, 40, 50, 51, 91, 92. SEE THE MSC.NASTRAN INSTALLATIONS/OPERATIONS
GUIDE SECTION ON MAKING FILE ASSIGNMENTS OR MSC.NASTRAN QUICK REFERENCE GUIDE ON
ASSIGN PHYSICAL FILE FOR REFERENCE.
Below is the head of my BDF file.
assign userfile='SUB1_PLATE.csv', status=UNKNOWN, form=formatted, unit=52
SOL 200
CEND
ECHO = NONE
DESOBJ(MIN) = 35
set 30=1008,1007,1015,1016
DESMOD=SUB1_PLATE
SUBCASE 1
$! Subcase name : DefaultLoadCase
$LBCSET SUBCASE1 DefaultLbcSet
ANALYSIS = STATICS
SPC = 1
LOAD = 6
DESSUB = 99
DISPLACEMENT(SORT1,PLOT,REAL)=ALL
STRESS(SORT1,PLOT,VONMISES,CORNER)=ALL
BEGIN BULK
param,xyunit,52
[...]
ENDDATA
Below is the solution
Correct
assign userfile='SUB1_PLAT.csv', status=UNKNOWN, form=formatted, unit=52
I shortened the name of CSV file to SUB1_PLAT.csv. This reduced the length of the line to 72 characters.
Incorrect
assign userfile='SUB1_PLATE.csv', status=UNKNOWN, form=formatted, unit=52
The file management section is limited to 72 characters, spaces included. The incorrect line stretches 73 characters. The nastran reader ignores the 73rd character and on. Instead of reading "unit=52" the reader reads "unit=5" which triggers the error.
|<--------------------- 72 Characters -------------------------------->||<- Characters are ignored truncated ->
assign userfile='SUB1_PLATE.csv', status=UNKNOWN, form=formatted, unit=52
References
MSC Nastran Reference Guide
The records of the first four sections are input in free-field format
and only columns 1 through 72 are used for data. Any information in
columns 73 through 80 may appear in the printed echo, but will not be
used by the program. If the last character in a record is a comma,
then the record is continued to the next record.
I am trying to reading this pajek file in Google Colab's version of Jupyter and I get an error when executing the following very simple code:
J = nx.MultiDiGraph()
J=nx.read_pajek("/content/data/graphdatasets/jazz.net")
print(nx.info(J))
The error is the following:
/usr/local/lib/python3.6/dist-packages/networkx/readwrite/pajek.py in parse_pajek(lines)
211 except AttributeError:
212 splitline = shlex.split(str(l))
--> 213 id, label = splitline[0:2]
214 labels.append(label)
215 G.add_node(label)
ValueError: not enough values to unpack (expected 2, got 1)
With pip show networkx, I see that I'm running Networkx version: 2.3. Am I doing something wrong in the code?
Update: Pasting below the file's first few lines:
*Vertices 198
*Arcs
*Edges
1 8 1
1 24 1
1 35 1
1 42 1
1 46 1
1 60 1
1 74 1
1 78 1
According to the Pajek definition the first two lines of your file are not according to the standard. After *vertices n, n lines with details about the vertices are expected. In addition, *edges and *arcs is a duplicate. NetworkX assumes use for an edge list, which started with *arcs a MultiDiGraph and for *edges a MultiGraph (see current code). To resolve your problem, you only need to delete the first two lines of your .net-file.
I've got a little problem with the findPath function.
I'm working with a mix of two tutorials (one from Haxeflixel, and the second from haxecoder) and the second one uses CSV instead of Ogmo and uses a findPath when we click.
But when I click, the game crashes, nice.
This is my code: http://hastebin.com/xunidubiyi.avrasm
The problem is on the 86th line (split into multiple lines to fit the width):
var nodes:Array<FlxPoint> = _mWalls.findPath(
FlxPoint.get(
_player.x + 16 / 2,
_player.y + 16 / 2
),
FlxPoint.get(
tileCoordX * 16 + 16 / 2,
tileCoordY * 16 + 16 / 2
)
);
Output:
Invalid field access : allowCollisions
Called from flixel.tile.FlxTilemap::computePathDistance line 1806
Called from flixel.tile.FlxTilemap::findPath line 796
Called from PlayState::update line 87
Called from flixel.FlxState::tryUpdate line 155
Called from flixel.FlxGame::update line 700
Called from flixel.FlxGame::step line 648
Called from flixel.FlxGame::onEnterFrame line 493
Called from openfl._legacy.events.EventDispatcher::dispatchEvent line 98
Called from openfl._legacy.display.DisplayObject::__dispatchEvent line 182
Called from openfl._legacy.display.DisplayObject::__broadcast line 161
Called from openfl._legacy.display.DisplayObjectContainer::__broadcast line 286
Called from openfl._legacy.display.Stage::__render line 1103
Called from openfl._legacy.display.Stage::__checkRender line 351
Called from openfl._legacy.display.Stage::__pollTimers line 1084
Called from openfl._legacy.display.Stage::__doProcessStageEvent line 430
Done(1)
Does anybody know what went wrong and why?
I always get a "System.Collections.Generic.KeyNotFoundException" that says "The given key was not present in the dictionary" whenever I try to use .Contains and the ToFuture() method in one query.
Imagine the DBObject contains a bunch of properties with one of them being an integer "ID"
List<int> test = new List<int>();
test.Add(1557);
test.Add(1558);
test.Add(1559);
IEnumerable<DBObject> test2 = getLinqQuerySomehow<DBObject>().Where(x => test.Contains(x.ID)).ToFuture();
List<DBObject> results = test2.ToList();
Can anyone reproduce this? Does anyone know of another way besides contains() to make Linq-to-Nhibernate use the SQL IN clause for the ints in my test list while also using ToFuture()?
Stacktrace:
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at NHibernate.Param.NamedParameterSpecification.SetEffectiveType(QueryParameters queryParameters) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Param\NamedParameterSpecification.cs:line 70
at NHibernate.Param.ParametersBackTrackExtensions.ResetEffectiveExpectedType(IEnumerable`1 parameterSpecs, QueryParameters queryParameters) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Param\ParametersBackTrackExtensions.cs:line 48
at NHibernate.Hql.Ast.ANTLR.Loader.QueryLoader.ResetEffectiveExpectedType(IEnumerable`1 parameterSpecs, QueryParameters queryParameters) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Hql\Ast\ANTLR\Loader\QueryLoader.cs:line 428
at NHibernate.Loader.Loader.CreateSqlCommand(QueryParameters queryParameters, ISessionImplementor session) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Loader\Loader.cs:line 1649
at NHibernate.Impl.MultiQueryImpl.AggregateQueriesInformation() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\MultiQueryImpl.cs:line 641
at NHibernate.Impl.MultiQueryImpl.get_Parameters() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\MultiQueryImpl.cs:line 774
at NHibernate.Impl.MultiQueryImpl.CreateCombinedQueryParameters() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\MultiQueryImpl.cs:line 754
at NHibernate.Impl.MultiQueryImpl.List() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\MultiQueryImpl.cs:line 400
at NHibernate.Impl.FutureQueryBatch.GetResultsFrom(IMultiQuery multiApproach) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\FutureQueryBatch.cs:line 24
at NHibernate.Impl.FutureBatch`2.GetResults() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\FutureBatch.cs:line 73
at NHibernate.Impl.FutureBatch`2.get_Results() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\FutureBatch.cs:line 29
at NHibernate.Impl.FutureBatch`2.GetCurrentResult[TResult](Int32 currentIndex) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\FutureBatch.cs:line 79
at NHibernate.Impl.FutureBatch`2.c__DisplayClass4`1.b__3() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\FutureBatch.cs:line 63
at NHibernate.Impl.DelayedEnumerator`1.d__0.MoveNext() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\DelayedEnumerator.cs:line 26
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at TestProject1.UnitTest1.TestMethod1() in C:\checkout\Library Projects\BaseSystemCore\TestProject1\UnitTest1.cs:line 94
This is a bug. I found it in the Nhibernate issue tracker:
https://nhibernate.jira.com/browse/NH-2897
Edit: Should be fixed in NH 4.0.
I am beta testing an application that includes a Firefox extension as one component. It was originally deployed when FF3.5.5 was the latest version, and survived 3.5.6 and 3.5.7. However on FF3.6 I'm getting the following in my error console:
Warning: reference to undefined property Components.interfaces.nsIProcess2
Source file: chrome://overthewall/content/otwhelper.js
Line: 55
Error: Component returned failure code: 0x80570018 (NS_ERROR_XPC_BAD_IID)
[nsIJSCID.createInstance]
Source file: chrome://overthewall/content/otwhelper.js
Line: 55
The function throwing the error is:
48 function otwRunHelper(cmd, aCallback) {
49 var file =
50 Components.classes["#mozilla.org/file/local;1"].
51 createInstance(Components.interfaces.nsILocalFile);
52 file.initWithPath(otwRegInstallDir+'otwhelper.exe');
53
54 otwProcess = Components.classes["#mozilla.org/process/util;1"]
55 .createInstance(Components.interfaces.nsIProcess2);
56
57 otwProcess.init(file);
58 var params = new Array();
59 params = cmd.split(' ');
60
61 otwNextCallback = aCallback;
62 otwObserver = new otwHelperProcess();
63 otwProcess.runAsync(params, params.length, otwObserver, false);
64 }
As you can see, all this function does is run an external EXE helper file (located by a registry key) with some command line parameters and sets up an Observer to asynchronously wait for a response and process the Exit code.
The offending line implies that Components.interfaces.nsIProcess2 is no longer defined in FF3.6. Where did it go? I can't find anything in the Mozilla documentation indicating that it has been changed in the latest release.
The method on nsIProcess2 was moved to nsIProcess. For your code to work in both versions, change this line:
otwProcess = Components.classes["#mozilla.org/process/util;1"]
.createInstance(Components.interfaces.nsIProcess2);
to this:
otwProcess = Components.classes["#mozilla.org/process/util;1"]
.createInstance(Components.interfaces.nsIProcess2 || Components.interfaces.nsIProcess);
You will still get the warning, but the error will go away, and your code will work just fine in both versions. You could also store the interface iid in a variable and use the variable:
let iid = ("nsIProcess2" in Components.interfaces) ?
Components.interfaces.nsIProcess2 :
Components.interfaces.nsIProcess;
otwProcess = Components.classes["#mozilla.org/process/util;1"]
.createInstance(iid);