IPhone Dev Error: Program received signal: “EXC_BAD_ACCESS”. or “Failed to call designated initaializer on NSManagedObject class”

Symptoms: cryptic error message with a massive stack trace (65k+ stack frames)
This could be a memory leak, however, the cause in my case was i had named a property of a NSManagedObject object “description” in my Core Data data model. While “description” is a not technically a reserved keyword it is a method in NSObject which when used with Core Data causes problems.
Solution; rename the property to something else like desc.

see http://stackoverflow.com/questions/2222155/core-data-crashes-with-exc-bad-access-on-one-of-my-entities for more

Advertisements

IPhone Dev Error: “The model used to open the store is incompatible with the one used to create the store”;

You have probably changed the Core Data data model and are now trying to run your app in the simulator, however,, if you have already run it on the sim before then there will be data stored according to the old version of the data model. Quick solution: reset the simulator “IPhone Simulator > Reset Content and Settings” and try running your app again. Correct solution: look at versioning your data models.

Route traffic (smtp) through specific network interface

The problem; need to force connections to the gmail smtp servers through a mobile broadband modem rather than the main system NIC. The solution; use the route command to add a new persistent route to the IP routing tables for your machine;

route -p add 216.239.59.109 mask 255.255.255.255 XXX.XXX.XXX.XXX metric 1 if 14

where;

  • 216.239.59.109 is the gmail smtp server
  • XXX.XXX.XXX.XXX is the default gatway for the connection you want to route the traffic through
  • if 14 is the id of the NIC you want to use

See this article for more details  http://www.windowsnetworking.com/articles_tutorials/Making-Sense-Windows-Routing-Tables.html

SQL server management studio “locate backup” default path – when an unfinished feature becomes a bug

Any of you that use SQL server management studio will probably, at one time or another, have had reason to attempt to restore a database from a backup file. This relatively simple operation is made irritatingly difficult by the management studio user interface. While there are many things wrong about the UI for this particular task (principally too many clicks before you do anything useful) the biggest problem is that it does not save the path of the backup file you choose. When you open the locate backup dialogue it defaults to a directory within the SQL server install dir, to select the file you want to restore you have to navigate to wherever in your file system that file resides, you can’t type in the path you have to scroll and click your way there. This is just painful but the pain is compounded by the fact that (if you don’t just give up and go home but actually find the file that you want to restore) the next time you wish to restore a backup you are forced to navigate through the directory structure again. I think this is due to an unfinished feature in the management studio, the UI of the specify backup dialogue looks as if it should save the locations of backup files you have previously restored, unfortunately it does not so instead this unfinished feature results in a usability bug in the locate backup dialogue.

The solution (or a kind of solution I should say) is to edit the registry entry that records the path the locate backup file dialogue defaults to;

My Computer\HKEY_LOCAL-MACHINE\SOFTWARE\Microsoft\\Microsoft SQL Server\MSSQL.1\MSSQLServer\BackupDirectory

Done.

Dell Latitude On Reader Password Problem

Just a few quick notes on the Dell Latitude On Reader program that Dell is now shipping with its Latitude range. First there is a significant difference between “Latitude On Reader” and “Latitude On”. Latitude On Reader is a software download you can get from the dell support site. Install it and, run the setup program that is installed (note this these are separate steps for some reason) and then if you have the Latitude On button in your laptop when you press the button you will be booted into the Latitude On Reader mini OS. Latitude On, however, appears to be a hardware component (a system on a chip) which when released by Dell will allow access to not just the email, calendar and contacts that you get with the Reader but also web browsing and some other goodies. Anyway enough about poor naming of Dells products and more about the title of the post. When you setup Latitude On Reader (and presumably Latitude On) you are asked to enter a password. Unfortunately you do this in the setup program which you run from windows using the keyboard configuration of the windows install. Can anybody see where this is going ;) The Latitude On Reader when asking for the password appears to ignore the keyboard layout of the main windows install and instead offers only the US keyboard layout which is a slight problem if you used another keyboard layout to enter the password and used (as everybody should) some special characters to make the password more secure. There may be some way to configure the correct keyboard layout in the Latitude On Reader however my limited searches have not turned up anything yet.

Visual studio generating health monitoring events

Had a real Homer Simpson moment this morning, when I started getting a whole load of health monitoring email messages from my web server saying the an application was shutting down, that we had a compile error and generally the web application was falling apart. After racing to load the site in my browser I was relieved but confused that the site was live and everything seemed ok. Then I looked at the health monitoring messages only to find that they were originating not from the IIS web server but from a colleagues development machine. What was happening was that we had setup the web.config file for the application in question to send health monitoring emails from an account on the web server. What I had not realised is that the web server included with visual studio is also capable of sending these health monitoring events, so when my colleague started working on the application visual studios web server started sending me emails about what my colleague was doing. This is not a major problem except that it can cause a few panic attacks and might lead to a real health monitoring message being ignored. The solution is to deactivate health monitoring when developing a site and only enable when deploying to the server.

ProfileCommon could not be found

Ran into this little one today, when trying to specify additional properties in an ASP.net profile. I had the following in my web.config file for testing before adding additional properties.

 

<profile
enabled=“true“>

<properties>

</properties>

</profile>

I was then getting a missing reference error when i tried to do;

 

ProfileCommon p = (ProfileCommon) ProfileCommon.Create(CreateUserWizard1.UserName, true);

 

The problem is that ProfileCommon is a generated class, compiled only after you insert the <profile> section into your web.config file. However, the class is only compiled if you specify and additional property in the properties section, if you do not then the class is not compiled. The correct entry for web.config is;

<profile
enabled=“true“>

<properties>

<add
name=“dob“
type=“string“/>

</properties>

</profile>

Check out http://msdn.microsoft.com/en-us/library/ms998317.aspx and http://weblogs.asp.net/scottgu/archive/2005/10/18/427754.aspx for more info on forms authentication and asp.net profiles.

Importing or linking an Access 2007 db to a SQL Server 2005 database over a network

  1. First make sure the database is setup to use SQL auth as above (note NT auth will work also but requires client to use user name and password of server)
  2. In access create a new db and import data from an ODBC db
  3. Create a “Machine DSN” not a FILE DSN (File DSN is the default) see http://support.microsoft.com/kb/327268
  4. Select the tables you want to import or link to
  5. If access cannot identify a key field in the tables it will offer you the opportunity to create one (not necessary)
  6. Note foreign key relationships between tables will not be imported and must be manually re-entered, but can be saved without affecting the SQL server if using linked tables (good news is the relationships remain even after a refresh of the linked tables)

(a tip if you want to use linked table so that users can see up to the minute data without having to import but don’t want the users to modify the underlying SQL server db then when creating the SQL server login about and applying user mapping, choose to only allow the user to read the specific database and not to have write privileges)

Access 2007 – reports and sub reports

Got this error when trying to place a sub report in a main report “Error: the expression is typed incorrectly or it is too complex to be evaluated” This only occurred when trying to create a sub report, sub report works on its own fine but when launched within the main report the above error pops up multiple times.

Identified by a process of elimination that there was a field in the table on which the sub report was based which had the same name as a field in the table on which the main report was based.

Further this common field name was being used as the key field to create the parent child relationship; the error is thus probably due to a naming conflict.

The solution is to rename the conflicting field in the sub report, by editing the SQL statement for the sub report and replacing the conflicting field name with table.conflictname as newnonconflcitingname

e.g. select field1, field2, field3 as myfield3, field4 from table (Note in this example field3 is the conflicting field)

ASP.net Date Validation and Cultures

Small one this time but annoying. When using a CompareValidator to implement some simple date format checking with Operator=”DataTypeCheck” and Type=”Date. The CompareValidator is reliant on the active culture settings to validate the given string. The active culture if not specified by the asp.net application is taken from the clients region settings. This can result in the CompareValidator not validating or validating strings as dates depending on the clients settings. If you want to specify a single date format (and culture) you can do so either application wide (through setting the globalization culture tag of the web.config file e.g.
) or on a page by page basis by setting the UICulture and Culture attributes of the page e.g. <%@ Page UICulture=”en” Culture=”en-IE” %>. The different culture codes can be found here More info is provide by microsoft here.

%d bloggers like this: