Tuesday, August 7, 2012

MonoTouch Bare Bones


using System;
using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace myNameSpace
{
   public class Application
   {
      static void Main(string[] args)
      {
         UIApplication.Main(args, null, "AppController");
      }
   }


   [Register ("AppController")]
   public class AppController : UIApplicationDelegate 
   {
      UIWindow window;

      public override bool FinishedLaunching(UIApplication app, NSDictionary options)
      {
         // create the main view controller
         var vc = new MainViewController();

         // create main window and add main view controller as subclass
         window = new UIWindow(UIScreen.MainScreen.Bounds);
         window.AddSubview(vc.View);
         window.MakeKeyAndVisible();

         return( true );
      }

      public override void OnActivated(UIApplication application) 
      {
         //required override on iOS 3.0
      }
   }


   [Register]
   public class MainViewController : UIViewController 
   {
      public override void ViewDidLoad()
      {
         base.ViewDidLoad();

         //custom code can start here...
         Console.WriteLine("App Loaded");
      }
   }


}//myNameSpace

Thursday, August 2, 2012

iOS MonoTouch Developement

Will Need:

1. Mac running OSX 10

2. Install latest version of Apple's Developer Tools / Xcode
     https://developer.apple.com/technologies/tools/

3. Once installed, in Xcode go to "XCode"-->"Preferences"-->"Downloads" and install "Command Line Tools" (will need this if you want to "make" any bindings to additional Objective-C components).

4. Download and install MonoTouch.  This will include: 1) Mono, an open source .NET implementation; 2) MonoDevelop, an open source IDE similar to Visual Studio; and, 3) MonoTouch, the proprietary set of libraries that allow you to compile C# code into iOS apps.

5. Your now ready to do the first tutorials found here:
    http://docs.xamarin.com/ios

To this point you can write code and run it in the simulator.


To actually deploy it to a device you will need a licensed copy of Monotouch and one of the following:

Apple Developer Program ($99 a year) - provision ad-hoc deployment on up to 100 different devices for testing and distribute/sell apps via app store.

https://developer.apple.com/programs/ios/

Apple Enterprise Program ($299 a year) - deploy .ipa bundled apps to corporate owned or corporate employee owned devices.

https://developer.apple.com/programs/ios/enterprise/

Wednesday, July 18, 2012

Error creating database diagrams

Error: Cannot insert the value NULL into column 'diagram_id', table 'mydb.dbo.sysdiagrams'; column does not allow nulls. INSERT failes. The statement has been terminated. The 'sp_creatediagram' procedure attempted to return a status of NULL, which is not allowed. A status of 0 will be returned instead (.Net SqlClient Data Provider) Fix: Add the following trigger
CREATE TRIGGER tr_sysdiagrams_i ON dbo.sysdiagrams INSTEAD OF INSERT
AS 
BEGIN
   SET NOCOUNT ON;

   DECLARE @id int

          SELECT @id = max(A.diagram_id) + 1
            FROM dbo.sysdiagrams A

     INSERT INTO dbo.sysdiagrams 
               ( name
               , principal_id
               , diagram_id
               , [version]
               , [definition] )
          SELECT name
               , principal_id
               , @id
               , [version]
               , [definition]
            FROM inserted
END --tr_sysdiagrams_i
GO
Explanation: I seem to remeber getting this same error when I was using the SQL Server 2008 Management Studio (SSMS) on a SQL Server 2005 instance. I got this again using the SSMS 2012 on a 2008R2 instance. Either the diagram_id is supposed to be an identity, or the id should be generated by SSMS. In either case, just making the column allow NULLs leads to other problems. So either have to recreate the table with the column as an identity, or add this trigger.

Friday, June 29, 2012

How to find objects modified since a certain date


   SELECT *
     FROM sys.all_objects
    WHERE modify_date > '20120628 00:00:00'

Monday, June 25, 2012

Remote table-valued function calls are not allowed

Error: Remote table-valued function calls are not allowed

Fix: use "WITH (NOLOCK)" instead of just "(NOLOCK)


Explanation:  When issuing a select that has uses four part naming to address the table and the table has a (nolock) hint, the t-sql will fail to execute with the error "Remote table-valued function calls are not allowed."

If you execute the query with 3 or 2 part naming it runs without error.

To get the query to work using 4 part naming you have to put the "with" keyword before the (nolock).



http://connect.microsoft.com/SQLServer/feedback/details/126162/remote-table-valued-function-calls-are-not-allowed

Thursday, June 21, 2012

‘SERVERNAME’ is not configured for RPC

Error: Server ‘SERVERNAME’ is not configured for RPC
Code:
EXEC [LINKEDSERVERNAME].[DATABASENAME].dbo.[STOREDPROCNAME]
Problem: Attempting to execute a stored procedure across a SQL Server Linked Server

Fix: Enable "rpc out"
EXEC master.dbo.sp_serveroption 
     @server=N'LINKEDSERVERNAME'
   , @optname=N'rpc out'
   , @optvalue=N'true'

GO

Wednesday, May 9, 2012

Specifying SQL Server instance

Connecting to a SQL Server instance using jdbc drivers, you need to append ‘;instance=INSTNAME’ to the connection string like the following:

jdbc:jtds:sqlserver://<SQLServer>:<PORT>/<DBName>;instance=<SQLInstanceName>

Example:
jdbc:jtds:sqlserver://localhost:1433/mydb;instance=SQLEXPRESS