Archive for the ‘General’ CategoryFIX: Using an embedded SurveyGizmo Survey on a page with jQueryWednesday, September 9th, 2009We use SurveyGizmo (www.surveygizmo.com) with many of our clients to provide author generated forms and surveys. It has lots of great features, and one terribly annoying one. The main mechanism for deploying a form or survey is to use some JavaScript automatically generated by SurveyGizmo to download and embed the form or survey in the host page AJAX-style. Super cool, I hear you say. And I agree. But… Unfortunately SurveyGizmo use a JavaScript function “$” that is an internal system function. The astute amongst you have noticed the “$” function is used by many other JS frameworks, notably jQuery, becoming increasingly popular and soon to be embedded in Visual Studio 2010 (or so I am led to believe). The upshot is that all your jQuery defined after your survey is embedded on the page will break. That’s bad. I was advised by SG support to use the jQuery.noConflict() function, which makes SG work properly (that’s good) but it also means all your jQuery now uses a function called “jQuery” in place of “$” (that’s bad… again). We devised a workaround that lets everybody play nice and it seems to work for us so far – thusly:
Basically we keep a copy of the jQuery “$” function in a variable and restore it to its original value when the SG scripts have finished. I do this rather than using “var $ = function( selector, context ) { return new jQuery.fn.init( selector, context ); }” because jQuery may change their initialisation parameters at a later date and I prefer to not have to update my code.
Apple iPhone won’t display in Vista’s Windows ExplorerWednesday, May 13th, 2009A quick post that may help a few people whose iPhone has suddenly disappeared from Windows Explorer. I use Vista Ultimate but I suggest this technique will work for XP and other Vista variants as well. Normally the iPhone appears like a camera to Windows Vista (albeit with a cute iPhone icon) which allows access to the phone’s Camera Roll. I went looking to pull the photos off my iPhone this morning only to discover that it wasn’t showing up in Windows Explorer as a device anymore. Quite certain it worked at one point but what can you do. The drivers that make the iPhone appear as a USB device are usbaapl.sys and usbaaplrc.dll. If your installing you should look for usbaapl.inf which is in C:\Program Files\Common Files\Apple\Mobile Device Support\Drivers. More about this later. Connect your iPhone by USB, then open Windows Device Manager (right-click My Computer and select Manage). You may find your iPhone under “Universal Serial Bus Controllers”, where mine was, or possibly under “Portable Devices”. At any rate if your phone can sync with iTunes it will be in there somewhere. It should be called Apple Mobile Device USB Driver or something like that. When you find it, right-click and select “Uninstall” but don’t remove the files from the PC. There’s nothing wrong with the files (probably) it’s just the device registration that has become cactus. Once uninstalled disconnect the device and reconnect again. After a minute you should see the device registered correctly, iTunes fires up and Windows Explorer shows your iPhone as a camera again. Job done. My driver files were already in Windows\System32 directory cause that’s where drivers go, but the original files that ship from Apple can usually be found at C:\Program Files\Common Files\Apple\Mobile Device Support. If you deleted the files in the uninstall step when you shouldn’t have you can likely find them there, otherwise I would re-install iTunes cause I would guess they ship with the iTunes software though I can’t confirm that.
Microsoft Exchange 2003 Direct Push and the Apple iPhone 3GWednesday, July 16th, 2008Like any good technophile I picked up a new iPhone 3G on Friday the 11th and the very first thing I did when getting back to the office was to try to get my Exchange Server to do Direct Push. I have had some small frustrations from the wide distribution of documentation on the subject so hopefully this post will save someone some time. For the sake of simplicity this article will deal with the simple case of:
Frankly if your setup is more complicated than that you probably already know how to do this and aren’t reading this anyway. Moving right along… This is what you’ll need before you get started:
Background Direct Push works because the internet is slow. That’s the headline. Basically the iPhone will make an HTTPS connection to your Exchange Server’s “Microsoft-Server-ActiveSync” virtual folder (most likely on the default web site). It will hold each connection open as long as possible, or until some pre-configured timeouts occur. Should you receive an email during this open connection, Exchange will send notification down to the iPhone which will tell you that you have new mail. Simple as that. The reason it works is because the internet protocols were designed to not receive an instant response from the server when making a request (see “slow” above). Direct Push takes advantage of this extended open connection. To prevent your battery from draining in 25 minutes flat the chatter on the connection is kept to a minimum. It’s very clever. Before You Start If you have a Wi-Fi connection active on the phone it won’t work. Direct Push only works over the air (the 3G connection). This is because the Wi-Fi radio will kill your battery. With Wi-Fi enabled I believe the phone reverts to a pull model, based on observation, but I can’t confirm that. Setup Is your iPhone’s Wi-Fi off? Step 1. Router/Firewall Setup
Step 2. Domain Name Setup
Step 3. Exchange 2003 SP2 Setup
Step 4. Configure Your Users
Step 5. Configure IIS
Step 6. Test Your Server Setup
Step 7. Setup your iPhone
That’s it – should be up and running now. Send yourself an email and see. Troubleshooting In my brief time setting this up here are the places where you might come unstuck:
Helpful Links Some of the pages that helped me: Microsoft – Enterprise firewall configuration for Exchange ActiveSync Direct Push Technology Exchange Team Blog – Direct Push is just a heartbeat away Brian M Posey (Exchange MVP) – Microsoft Exchange Direct Push Technology (seems to be broken) Apple’s less that complete instructions (don’t worry, it’s Apple, it just works! Right?)
Microsoft Dynamics CRM 4.0 LicensingTuesday, June 17th, 2008With the release of Dynamics CRM 4.0 Microsoft has significantly changed their licensing model. The following information is a summary of the new facets as we currently understand them. Server LicensesThere are 3 flavours of Dynamics CRM 4.0 server as follows:
Client Access Licenses (CAL)The CAL situation has become somewhat more complicated with CRM 4.0. Not only are there the normal variations for per-Device and per-User but there are now 3 flavours of CAL:
Careful observation will reveal that a regular CAL is the same price as a Limited CAL + a Full-User CAL, so there is no penalty for starting with a read-only license and migrating to a read-write license at a later time. External Connector LicensesDynamics CRM 3.0 had 2 licensed elements: server and client, but Dynamics CRM 4.0 includes a new element – the external connector. An External Connector is needed when a number of users are going to connect to the CRM system to read or write data by way of another system. 5 Limes is often called upon to created SharePoint widgets and web pages that extract data from or deposit data into Dynamics CRM. In CRM 3.0 we would have used a single CAL to achieve this, but in 4.0 an External Connector license is required. At the time of writing the a read-write External Connector license is roughly 5 times the price of a single read-write CAL and the read-only External Connector is roughly 6.6 times the price of a single read-only CAL. So if you have 5 external users or fewer you are better off licensing them individually, but if you want to connect Dynamics CRM 4.0 to your web site you will need the External Connector. Server & CAL PacksThere is an option to buy Professional Server and 5 CALs at the same time, but there is really no difference in the price compared with buying them separately (at least there is negligible difference in the RRP). A note on Action Pack SubscriptionsThe version of Dynamics CRM that is made available through the Microsoft Action Pack is the Workgroup Edition. This edition is limited to 5 named users. In CRM 3.0 it was possible to purchase additional CALs when more users needed to access the system but in CRM 4.0 that is no longer possible. So if you are planning to deploy Workgroup Edition (through an Action Pack or otherwise) you should be aware that your 6th user is going to be expensive.
Microsoft Dynamics CRM 3.0 LicensingWednesday, April 30th, 2008A few pieces of interesting information regarding Microsoft Dynamics licensing that we have recently discovered:
Interestingly since Microsoft deems the “Action Pack” to be a subscription-based license you, as the client, do not actually “own” the license and therefore are not eligible for upgrade pricing either. When you hit the 6th/10th user (depending on your version) you will be up for the CRM Server license and as many CALs as you have users, since you cannot use the Action Pack CALs on a box product or volume license. This obviously makes the transition very expensive and while you can at least continue to use your Action Pack SQL Server it seems like this group have not been well catered to in the revised licensing model. By the way – Action Pack users are generally Microsoft partners – not the group I would have chosen to upset, but then they have more money than me… [UPDATE - With the recently released Microsoft CRM 4.0 there is all new confusion. See my new post on Microsoft Dynamics CRM 4.0 Licensing for more info.]
Public proxied access to SharePoint (WSS or MOSS)Wednesday, April 30th, 2008We use Microsoft Office SharePoint 2007 internally to manage all kinds of work and share documents. It’s a very effective tool. We also use it to manage our software registration database. To facilitate customer software registrations we have a public-facing web service that uses SharePoint APIs to communicate with our registration site. The configuration of SharePoint required some fiddling to make this work. The problem was that we had SharePoint configured with no anonymous access, and obviously the users of our software that would be registering would not have credentials for our network – we didn’t really want to enable anonymous access so a creative solution was required. In order to achieve this we used the web.config <identity /> element in our public-facing website to set the identity of the thread to a fixed user account created just for the task. The web service application pool is configured in IIS to run as “Network Service”. The SharePoint API seemed to pick up the user from the HttpContext.Current.User object, rather than from the thread which means that all our communications were failing with 401.5 errors. I was a little surprised to discover that despite the <identity userName=“user” password=“pass” impersonate=“true” /> in the web.config file, the HttpContext.Current.User was still anonymous. The two tricks that made it work were:
The Global.asax trick ensures that the context carries the same user account as the impersonated thread. The AllowUnsafeUpdates is required when impersonating.
Forms, Controls & the Forms DesignerMonday, April 14th, 2008I was just working on a Windows app that contains lots and lots of User Controls all of which inherit from a base User Control. When I opened the controls they displayed blank in the designer. After some digging I realised that two vital pieces were missing:
It seems the Forms Designer creates an instance of the control by calling the parameterless constructor (which seems obvious when you think about it I suppose). The giveaway on the InitializeComponent() call was the comment just above the call injected by default which reads “Required for Windows Form Designer support“. Anyways – hopefully this will save somebody some time.
Flash FLV over IISWednesday, April 4th, 2007Recently I was deploying a web site with Flash video on. The Flash SWF files and associated FLV files (these are the ones containing the video that is streamed back to the user) were all in the correct directories however the videos still would not play. Instead I simply saw a blank screen. Windows IIS only serves files for which a MIME type is configured. There are several levels you can configure these including for the whole server (right-click server > Properties > MIME types) for a particular site (right-click site > Properties > HTTP Headers > MIME Types) or even for a folder beneath the site. You will notice that the settings are inherited, so specifying the value for the server negates the need to specify it for each site, and so on. Set the MIME type as follows: Extension: .flv MIME Type: video/x-flv (other MIME type settings may also work) If you altered the MIME setting on the server you will need to restart with “iis_reset” but if you only altered the setting for a given site then simply stopping and starting that site is enough.
VS.NET2003, Windows Vista & Remote DebuggingThursday, March 22nd, 2007If you’re like me you will have a development machine that’s got a bit of power behind it. You might also be a bit keen on new technology. You may have even gone ahead and installed Windows Vista thinking – she’ll be right. If you’re still like me at this point you’ll be thinking “bugger”. Visual Studio.NET 2003 is not supported on Vista = but it does work for the most part. The big issue is web development. What has worked for me, and may well work for you, is installing Windows XP on Virtual PC 2007 (free). I put my web sites on the XP VPC and I can still run the IDE on Vista. While this is a little clunky everything seems to work pretty well. Then one day… bang! The debugger refused to attach. Checking the event logs I found a very unhelpful Event ID 10023: “The application-specific access security descriptor for the COM Server application C:\Program Files\Common Files\Microsoft Shared\VS7Debug\mdm.exe is invalid. It contains Access Control Entries with permissions that are invalid. The requested action was therefore not performed. The application set this security permission programmatically; to modify this security permission contact the application vendor.” I have no idea what happened from one minute to the next but it was properly busted. I tried a million things including every known remote debugging setup check. I even reinstalled VS.NET 2003 & VS2005. The thing that eventually did the trick was:
I suspect there was another issue, and in trying to solve it I had added domain accounts to the DCOM config of Machine Debug Manager in “Access Permissions”. Further testing has revealed that this is what has killed it. If you are having this problem now you know why
Debugging TipsWednesday, February 28th, 2007The number one problem I find when I help someone debug a problem is the assumptions that have been made. If you’re running a program and it doesn’t behave the way you expect it to what are you going to do? “Step through the code to see what’s going wrong” you say? Chances are that will only help you if you’ve done something obvious, like a typo or a missing bracket. Besides which there are lots of times when stepping through code is impractical or just not possible, such as when the problem is in a CSS style expression. Debugging these is a downright pain. The first thing you should do after the obvious leads are exhausted is to CHALLENGE YOUR ASSUMPTIONS! (Yes I’m shouting it.) I can’t stress this enough – back to the aforementioned CSS style, what kind of assumptions have we made:
Simple questions to answer but do ask them. A lot of the time you’ll notice that you aren’t where you think you are – which explains why you’re going the wrong way. Get used to using Debug.Assert()If you don’t use this gem of a method you’re only slowing yourself down. This comes right back to challenging your assumptions. The Assert() method allows you to add a test expression and a message into your code – when the test fails the message is displayed. The beautiful thing is you can leave them all over the place, because when you compile for Release the compiler leaves them all out. You should include one of these whenever you make an assumption in code – because we can’t always remember our own rules, and sometimes we’re not the only ones using our code. For example, I recently had a problem with a form’s progress meter not displaying properly – I never got any value from it. I added a Debug.Asset() to check the value of pb.Maximum – surely the maximum value was not set to 0 – it should be the record count from a record set I had just loaded. Oh no… turns out the call to set the maximum and the call to load the records were in the wrong order. The Assert pulled me right up. This gets even better when you’re programming in a multi-threaded environment, because the act of debugging interferes with the way the threads behave, since you artificially slow down the execution. Debugger.Launch() & Debugger.Break()Two more little gems, these. Quite often people ask on news groups and the like “how do I debug a Windows Process”? EASY! In your Start() method simply add: Debugger.Launch(); Debugger.Break(); When the run-time hits the first line it will pause processing and prompt you to attach a debugger. The second line is a programmatic break point (which you don’t officially need but the Launch() breaks you into the Dissassembler instead of the code). If you’re a web programmer you may already know about… Javascript: debuggerThis works the same way as Debugger.Launch() but for Javascript – perfect for debugging web pages! It is a statement, not a method, so to use it simply put in the line: debugger; and you’re done.
|
ArchivesTag Cloud |
