Fatal Exception: NSGenericException *** Collection <__NSArrayM: 0x17165f620> was mutated while being enumerated - exception

I am getting Fatal Exception while retrieving items from MutableArray. App gets crashed on same.
Error:
Fatal Exception: NSGenericException
*** Collection <__NSArrayM: 0x17165f620> was mutated while being enumerated.
Raw Text
0 CoreFoundation __exceptionPreprocess
1 libobjc.A.dylib objc_exception_throw
2 CoreFoundation -[NSException name]
3 BroadCastApp GPBroadCastService.m line 624
-[GPBroadCastService getSubscribedItemFromBroadcastedGroup:]
Code:
- (id)getSubscribedItemFromBroadcastedGroup:(id)group
{
id item = nil;
NSArray *broadcastedGroupItems = [self getBroadcasetedGroupItems];//Returns MutableArray
for (item in [broadcastedGroupItems copy]) {
if ([[item valueForKey:#"groupId"] isEqualToString:group.groupId])
{
break;
}
}
return item;
}

Related

How do I make an individual Rocket tile asynchronous to the rest of the system

I have a multicore rocket-chip system. However I'd like one of those rocket tiles to be asynchronous from the rest.
We're trying to do that with the following:
class WithTilesCrossing extends Config((site, here, up) => {
case RocketCrossingKey => site(RocketTilesKey).head.hartId match {
case 2 => up(RocketCrossingKey) map { r =>
r.copy(crossingType = AsynchronousCrossing(),
master = TileMasterPortParams())}
case _ => up(RocketCrossingKey) map { r =>
r.copy(crossingType = SynchronousCrossing(BufferParams(1)),
master = TileMasterPortParams())}
}
})
So that is the hart with hartId = 2 should be async, the rest should be synchronous.
The above, when added to our config, doesn't appear to do anything.
However, if I use the WithAsynchronousRocketTiles from src/main/scala/subsystem/Config.scala then I get all of the tiles converted to async.
So, how would I do just a single tile?
Update based on Jack's suggestion:
Trying that code straight up gave:
[error] Config.scala:189:16: not found: value crossingType
[error] r.copy(crossingType = AsynchronousCrossing(),
[error] ^
[error] Config.scala:190:11: not found: value master
[error] master = TileMasterPortParams())
[error] ^
[error] Config.scala:192:16: not found: value crossingType
[error] r.copy(crossingType = SynchronousCrossing(BufferParams(1)),
[error] ^
[error] Config.scala:193:11: not found: value master
[error] master = TileMasterPortParams())
[error] ^
[error] four errors found
Which is surprising. So I thought I might need to do the up() thing and tried this:
case RocketCrossingKey => site(RocketTilesKey).map { r =>
r.hartId match {
case 2 => up(RocketCrossingKey) map { k => k.copy(crossingType = AsynchronousCrossing(), master = TileMasterPortParams()) }
case _ => up(RocketCrossingKey) map { k => k.copy(crossingType = SynchronousCrossing(BufferParams(1)), master = TileMasterPortParams()) }
}
}
However that results in an elab error:
[error] Caused by: java.lang.ClassCastException: scala.collection.immutable.$colon$colon cannot be cast to freechips.rocketchip.subsystem.RocketCrossingParams
[error] at freechips.rocketchip.subsystem.HasRocketTiles.$anonfun$rocketTiles$1(RocketSubsystem.scala:41)
[error] at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:234)
[error] at scala.collection.immutable.List.foreach(List.scala:389)
[error] at scala.collection.TraversableLike.map(TraversableLike.scala:234)
[error] at scala.collection.TraversableLike.map$(TraversableLike.scala:227)
[error] at scala.collection.immutable.List.map(List.scala:295)
[error] at freechips.rocketchip.subsystem.HasRocketTiles.$init$(RocketSubsystem.scala:41)
[error] at freechips.rocketchip.subsystem.RocketSubsystem.<init>(RocketSubsystem.scala:70)
So still stuck on how to modify this original RocketCrossingParams on a per-tile basis and return it.
Looking at the definition of RocketCrossingKey:
case object RocketCrossingKey extends Field[Seq[RocketCrossingParams]](List(RocketCrossingParams()))
You'll notice that the type is Seq[RocketCrossingParams]. This implies (although I may be wrong), that we have 1 RocketCrossingParams per tile. In your code snippet, you are only looking at the first of the this Seq (via .head) checking if it's hartId is equal to 2, and then if so, iterating on all of the RocketCrossingKeys and setting them to AsynchronousCrossing.
Try something like the following where we iterate on them and only replace the index for the one with hartId == 2:
case RocketCrossingKey => site(RocketTilesKey).map { r =>
if (r.hartId == 2) { // or you can match on it, whatever
r.copy(crossingType = AsynchronousCrossing(),
master = TileMasterPortParams())
} else {
r.copy(crossingType = SynchronousCrossing(BufferParams(1)),
master = TileMasterPortParams())
}
}
EDIT: I missed the fact that there is both RocketCrossingKey and RocketTilesKey
So the issue here is that there are two parallel Seqs of parameters:
RocketTilesKey which gives us RocketTileParams, 1 for each tile
RocketCrossingKey which gives us RocketCrossingParams, 1 for each tile OR if there's only 1, it applies to all
It's also possible that there is no RocketTileParams containing hartId == 2, so let's handle everything appropriately:
case RocketCrossingKey =>
val tileParams = site(RocketTilesKey)
val crossingParams = site(RocketCrossingKey)
// One might assume hartId 2 == index 2 but that may not be the case
// Also there may not even *be* a tile with hartId == 2
val indexOfHartId2: Option[Int] =
tileParams.zipWithIndex.collectFirst { case (r, idx) if r.hartId == 2 => idx }
indexOfHartId2.map { idx =>
// This duplicates logic from HasTiles.perTileOrGlobalSetting
// If there's only 1, it applies to all
val crossings = site(RocketCrossingKey) match {
case Seq(one) => List.fill(tileParams.size)(one)
case many => many
}
// Back to the original answer using the proper index for hartId == 2
crossings.zipWithIndex.map { case (c, i) =>
if (i == idx) { // or you can match on it, whatever
c.copy(crossingType = AsynchronousCrossing(),
master = TileMasterPortParams())
} else {
c.copy(crossingType = SynchronousCrossing(BufferParams(1)),
master = TileMasterPortParams())
}
}
}.getOrElse(crossingParams) // If we don't even have hardId == 2, return original value

Fatal error: Uncaught TypeError: Argument 1 passed to Mage_Core_Model_Design_Package::getPackageByUserAgent()

I was getting a 500 error once I moved my magento 1.9 install from an old server to a new server. The old server was running php5 and this one is on 7. I am now getting the following error and I know I have to change some of the code, but I am not sure what:
Fatal error: Uncaught TypeError: Argument 1 passed to Mage_Core_Model_Design_Package::getPackageByUserAgent() must be of the type array, object given, called in /home1/acapps/flagstuff.com/app/code/core/Mage/Core/Model/Design/Package.php on line 576 and defined in /home1/acapps/flagstuff.com/app/code/core/Mage/Core/Model/Design/Package.php:586 Stack trace: #0 /home1/acapps/flagstuff.com/app/code/core/Mage/Core/Model/Design/Package.php(576): Mage_Core_Model_Design_Package::getPackageByUserAgent(Object(Zend_Log), 'design/theme/te...') #1 /home1/acapps/flagstuff.com/app/code/core/Mage/Core/Model/Design/Package.php(262): Mage_Core_Model_Design_Package->_checkUserAgentAgainstRegexps('design/theme/te...') #2 /home1/acapps/flagstuff.com/app/code/core/Mage/Core/Model/Design/Package.php(287): Mage_Core_Model_Design_Package->getTheme('template') #3 /home1/acapps/flagstuff.com/app/code/core/Mage/Core/Model/Design/Package.php(420): Mage_Core_Model_Design_Package->updateParamDefaults(Array) #4 /home1/acapps/flagstuff.com/app/code/core in /home1/acapps/flagstuff.com/app/code/core/Mage/Core/Model/Design/Package.php on line 586
This is the code that starts on line 586 of Package.php
public static function getPackageByUserAgent(array $rules, $regexpsConfigPath = 'path_mock')
{
foreach ($rules as $rule) {
if (!empty(self::$_regexMatchCache[$rule['regexp']][$_SERVER['HTTP_USER_AGENT']])) {
self::$_customThemeTypeCache[$regexpsConfigPath] = $rule['value'];
return $rule['value'];
}
$regexp = '/' . trim($rule['regexp'], '/') . '/';
if (#preg_match($regexp, $_SERVER['HTTP_USER_AGENT'])) {
self::$_regexMatchCache[$rule['regexp']][$_SERVER['HTTP_USER_AGENT']] = true;
self::$_customThemeTypeCache[$regexpsConfigPath] = $rule['value'];
return $rule['value'];
}
}
return false;
}
Turns out I needed to change this:
public static function getPackageByUserAgent(array $rules, $regexpsConfigPath = 'path_mock')
to this
public static function getPackageByUserAgent($rules, $regexpsConfigPath = 'path_mock')
after that, it worked like a charm

java.utilNoSuchElementException: None.get for Vec

Perhaps I'm going about something the wrong way. I have a number of buffers that need to get locked and unlocked as part of the behavior of a state machine. I thought it would be perfect to use a Vec of Reg to store the state from clock to clock and use a var Vec of wires to accumulate the state as the state machine goes about locking and unlocking things. Here is code similar to the code I wrote that breaks in the same way:
import Chisel._
class testvec extends Module
{
val io = new Bundle
{
val addr = Vec( 5, UInt( INPUT, 4 ) )
val enable = Bool( INPUT )
val in = Vec( 5, UInt( INPUT, 16 ) )
val out = Vec( 16, UInt( OUTPUT, 16 ) )
}
val latch = Vec( 16, Reg( init=UInt(0,16) ) )
var temp = Vec( 16, UInt(0,16) )
for( i <- 0 until 16 )
{
temp(i) := latch(i)
}
for( i <- 0 until 5 )
{
temp(io.addr(i)) := io.in(i)
}
for( i <- 0 until 16 )
{
io.out(i) := temp(i)
}
when( io.enable )
{
for( i <- 0 until 16 )
{
latch(i) := temp(i)
}
}
}
class testvec_Tests(c: testvec) extends Tester(c)
{
step( 1 )
}
object mainStub
{
def main( args: Array[String] ): Unit =
{
chiselMainTest( Array[String]("--backend", "c", // "--backend", "v",
"--compile", "--test", "--genHarness"),
() => Module( new testvec() ) )
{
c => new testvec_Tests( c )
}
}
}
Note that although this code merely has a simple loop, I need to get my combinatorial lock state at various points during the execution of the state machine each clock cycle, so that's why this simplification has those combinatorial states as the final output rather than the registers.
Here's the full text of the error message:
[info] Set current project to chisel
[info] Running mainStub
[error] (run-main-0) java.util.NoSuchElementException: None.get
java.util.NoSuchElementException: None.get
at scala.None$.get(Option.scala:347)
at scala.None$.get(Option.scala:345)
at Chisel.ROMData$$anonfun$3.apply(ROM.scala:90)
at Chisel.ROMData$$anonfun$3.apply(ROM.scala:90)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
at scala.collection.Iterator$class.foreach(Iterator.scala:750)
at scala.collection.immutable.RedBlackTree$TreeIterator.foreach(RedBlackTree.scala:468)
at scala.collection.MapLike$DefaultValuesIterable.foreach(MapLike.scala:206)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
at scala.collection.AbstractTraversable.map(Traversable.scala:104)
at Chisel.ROMData.<init>(ROM.scala:90)
at Chisel.ROM.data$lzycompute(ROM.scala:72)
at Chisel.ROM.data(ROM.scala:72)
at Chisel.ROM.read(ROM.scala:77)
at Chisel.Vec.apply(Vec.scala:121)
at testvec$$anonfun$2.apply$mcVI$sp(testvec.scala:21)
at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:166)
at testvec.<init>(testvec.scala:19)
at mainStub$$anonfun$main$1$$anonfun$apply$1.apply(testvec.scala:47)
at mainStub$$anonfun$main$1$$anonfun$apply$1.apply(testvec.scala:47)
at Chisel.Module$.Chisel$Module$$init(Module.scala:65)
at Chisel.Module$.apply(Module.scala:50)
at mainStub$$anonfun$main$1.apply(testvec.scala:47)
at mainStub$$anonfun$main$1.apply(testvec.scala:47)
at Chisel.Driver$.execute(Driver.scala:101)
at Chisel.Driver$.apply(Driver.scala:41)
at Chisel.Driver$.apply(Driver.scala:64)
at Chisel.chiselMain$.apply(hcl.scala:63)
at Chisel.chiselMainTest$.apply(hcl.scala:76)
at mainStub$.main(testvec.scala:48)
at mainStub.main(testvec.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
[trace] Stack trace suppressed: run last compile:run for the full output.
java.lang.RuntimeException: Nonzero exit code: 1
at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) Nonzero exit code: 1
[error] Total time: 1 s, completed Mar 3, 2016 1:49:17 PM
Are you sure of your "Vec" declaration ?
According to documentation, Vec must be declared as following I think:
val io = new Bundle
{
val addr = Vec.fill(5) {UInt( INPUT, 4 )}
val enable = Bool( INPUT )
val in = Vec.fill( 5 ) {UInt( INPUT, 16 )}
val out = Vec.fill( 16 ) {UInt( OUTPUT, 16 )}
}

Parse.com Error 3840

I get this error when I try to retrieve items from Parse.com
In 10 attempts it failed around 6 times.
PFQuery *query = [PFQuery queryWithClassName:#"ServiceCatalogue"];
items = [[NSMutableArray alloc] init];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
NSLog(#"ServiceCatalogue retrieved");
} else {
// Log details of the failure
NSLog(#"Error: %# %#", error, [error userInfo]);
}
}];
And getting error:
"Error: Error Domain=NSCocoaErrorDomain Code=3840 "The operation
couldn’t be completed. (Cocoa error 3840.)" (JSON text did not start
with array or object and option to allow fragments not set.)
UserInfo=0x7fcfbaadc480 {NSDebugDescription=JSON text did not start
with array or object and option to allow fragments not set.} {
NSDebugDescription = "JSON text did not start with array or object and option to allow fragments not set.";
}"
As indicated in this status report from Parse, it looks like their servers were creating an elevated number of errors.
2nd October 2015 - Elevated Error Rates - Incident Report for Parse

Google Maps SDK Tutorial Crash

I am trying to get Google Maps set up in my iOS application, but am getting a crash on an InvalidArgumentException.
A few people have asked this same question already; however, they have either not gotten helpful responses, or the responses that were given did not solve the problem.
The code is copied directly from Google's Getting Started page:
#import "XXMapViewController.h"
#import <GoogleMaps/GoogleMaps.h>
#interface XXMapViewController ()
#end
#implementation XXMapViewController{
GMSMapView *mapView_;
}
- (void)viewDidLoad
{
[super viewDidLoad];
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
longitude:151.20
zoom:6];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
self.view = mapView_;
// Creates a marker in the center of the map.
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
marker.title = #"Sydney";
marker.snippet = #"Australia";
marker.map = mapView_;
// Do any additional setup after loading the view, typically from a nib.
}
#end
This is the line it crashes on, so I have determined it's not a problem with setting the view:
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
And here is the stack trace (app name is X'd out for anonymity's sake):
2014-04-17 14:24:19.909 XX App[28758:60b] -[GMSMapView animateToCameraPosition:]: unrecognized selector sent to instance 0x10ae45a80
2014-04-17 14:24:19.931 XX App[28758:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GMSMapView animateToCameraPosition:]: unrecognized selector sent to instance 0x10ae45a80'
*** First throw call stack:
(
0 CoreFoundation 0x0000000103b2b495 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010388a99e objc_exception_throw + 43
2 CoreFoundation 0x0000000103bbc65d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x0000000103b1cd8d ___forwarding___ + 973
4 CoreFoundation 0x0000000103b1c938 _CF_forwarding_prep_0 + 120
5 XX App 0x0000000100189323 -[GMSMapView setCamera:] + 161
6 XX App 0x0000000100187cc2 -[GMSMapView sharedInitWithServices:camera:] + 1440
7 XX App 0x00000001001870be -[GMSMapView initWithFrame:camera:] + 121
8 XX App 0x0000000100186f5f +[GMSMapView mapWithFrame:camera:] + 102
9 XX App 0x000000010000eeae -[XXMapViewController viewDidLoad] + 238
10 UIKit 0x000000010252d59e -[UIViewController loadViewIfRequired] + 562
11 UIKit 0x000000010252d777 -[UIViewController view] + 29
12 UIKit 0x00000001025442c5 -[UINavigationController _startCustomTransition:] + 628
13 UIKit 0x000000010254f6f5 -[UINavigationController _startDeferredTransitionIfNeeded:] + 401
14 UIKit 0x0000000102550238 -[UINavigationController __viewWillLayoutSubviews] + 43
15 UIKit 0x000000010266a895 -[UILayoutContainerView layoutSubviews] + 202
16 UIKit 0x0000000102497993 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 354
17 QuartzCore 0x0000000100e77802 -[CALayer layoutSublayers] + 151
18 QuartzCore 0x0000000100e6c369 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 363
19 QuartzCore 0x0000000100e6c1ea _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
20 QuartzCore 0x0000000100ddffb8 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 252
21 QuartzCore 0x0000000100de1030 _ZN2CA11Transaction6commitEv + 394
22 QuartzCore 0x0000000100de169d _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 89
23 CoreFoundation 0x0000000103af6dc7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
24 CoreFoundation 0x0000000103af6d37 __CFRunLoopDoObservers + 391
25 CoreFoundation 0x0000000103ad6522 __CFRunLoopRun + 946
26 CoreFoundation 0x0000000103ad5d83 CFRunLoopRunSpecific + 467
27 GraphicsServices 0x000000010491cf04 GSEventRunModal + 161
28 UIKit 0x0000000102437e33 UIApplicationMain + 1010
29 XX App 0x000000010000ed93 main + 115
30 libdyld.dylib 0x000000010434c5fd start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I have added the -ObjC flag to my project, and have tried adding it to the target as others have recommended; however, adding it to the target causes the build to fail. I created a new single view project as well, which worked fine when following the exact same instructions.I have the correct API key and Google Maps for iOS is enabled in my API console. This has been extraordinarily frustrating and a huge wall in the way of finishing my project. If anybody could point me in the right direction I would greatly appreciate it.
It was a conflict with Parse dependencies. The solution was to either eliminate the FB SDK dependencies or to just download the SDK. I chose the latter since I will inevitably be using it with my app.