Fix crackling audio on your iPhone

1 Comment

If you find that music on your iPhone crackles when you listen through your headphones, try cleaning the headphone jack.

Because your iPhone lives in your pocket, pocket lint can accumulate inside your iPhone’s headphone jack.

I had 3 years of accumulated pocket lint inside my headphone jack, without knowing about it. For months I thought the iPhone was dead and I’d need to replace the headphone jack which is very difficult.

The solution – just get a bent paperclip and scrape it all out. Voila! No more crackling music!

Running a Win 7 VM on a Macbook Air (2011)

4 Comments

A few days ago I bought a new Macbook Air. I went for the fully pimped one which comes with an i7 and a 256Gb SSD. With the VMware Fusion demo I was able to bring my old laptop over and run it as a VM inside the Mac.

A few notes:

1. VMware’s Migration Assistant wanted to create a VM of my entire laptop, with both C: and D: disks. I didn’t want to bring over the 200Gb D: and the Migration Assistant didn’t have any options to prevent that from happening. So on my old laptop, I installed VMware’s free VMware converter. That had many more options including the option to exclude D:

2. It looks like I don’t need to buy a new Windows license. So far my VM hasn’t phoned home to Microsoft – maybe it will?

3. For networking, although I’m connected on WiFi to my flat’s network on the Mac, the VM sees it as an ethernet connection. Initially I couldn’t connect to the network on the VM because it was complaining that there were no ethernet drivers installed. I had to edit the .vmx file and add a line ethernet0.virtualDEV = “e1000″.

4. Visual Studio is completely red and unusable! I haven’t figured that one out yet.

Update (Dec 2011)

The Visual Studio red problem I had was with VMWare Fusion 3 and Parallels 6, but it seems to be fixed in VMWare Fusion 4 and Parallels 7. Having said that, I don’t use virtualisation and reboot and run Win7 in Boot Camp.

Improve ASP.NET page performance using Database Engine Tuning Advisor

Leave a comment

I was recently working on a legacy ASP.NET application which was taking like 30 seconds to load a simple page with a Gridview.

The culprit was Linq to SQL lazy-loading combined with an inefficient architecture. By tidying that up I was able to get the page load time down to about one a second.

I could have stopped there but I thought it would be nice to see if the SQL performance could be improved further.

Step 1. Profile

Start SQL Server Profiler and create a new trace. Choose the "Tuning" profile.

If your database server has more than one active database on it, you will want to choose to filter activity to your database only.

Once the trace starts recording, go to your website and hit the page you are trying to improve. In my case it was a page listing Help Requests, so I hit that page and did a couple of searches. Stop recording the trace and save it. I called mine “help requests.trc”.

Step 2. Analyse

Start SQL Server’s Database Engine Tuning Advisor. It will automatically start a new Tuning session when you connect to your database.

Choose your trace file that you’ve just recorded (1), choose your database (2), tick your database again (3), and finally hit Start Analysis (4).

Results:

Oops, that’s not quite right. It’s reporting errors, "SHOWPLAN permission denied in database ‘DBTest’"

At first this didn’t make sense, because I’m a dbo so I have permission to do everything. But remember – we’re running a trace we recorded earlier. IIS’s application pool for the website is setup to use a specific account – COMPANYDOMAIN\IIS_APPUSER, and this account doesn’t have SHOWPLAN permission. So grant it:

GRANT SHOWPLAN TO [COMPANYDOMAIN\IIS_APPUSER]

Now run the trace again, and you should see the recommendations screen.

Step 3. Tune

As you can hopefully see, SQL Server recommends creating 4 indexes and a bunch of statistics, and estimates a whopping 92% speed improvement! Press the Save recommendations button in the toolbar to save those recommendations to a SQL script which you can review and tweak, and then run that script against your database.

Done!

Lost intellisense squiggles after Resharper 5.1 uninstall

1 Comment

I had another play with Resharper at work recently. There’s lots I like about it, for example the code suggestions, and the way it grays out unused functions and unused branches in methods. It’s really good for tidying up legacy code. And “Go To Implementation” is a massive time saver.

There’s a few things I don’t like about it. I don’t think it’s Refactoring options are much better than those built into Visual Studio – I only ever use Extract Method anyway. And I don’t like its “Find All References”.

Anyway, when the trial ran out and I uninstalled it, I found I’d lost my Intellisense squiggles (under Syntax errors and the like).

To turn them back on, it’s under Tools –> Options –> C# –> Advanced. Check “Underline errors in the editor” and “Show live semantic errors”.

resharper

Windows XP: password has expired, but you do not have permission to change the password

1 Comment

Since I work in IT, I’m occasionally asked to do tech support for family and ex-girlfriends, even though that’s not my area of expertise. Yesterday a friend had a problem I’d never seen before.

After bootup, she would be presented with the standard Windows XP login screen, with only one user account available for login. She clicks her name, enters her password, and then gets a message “your password has expired, you must enter a new one” or however the exact text goes.

So she enters a new password but then gets “You do not have permission to change your password”, which prevents her from logging in and takes her back to the login screen.

After trying a few different things to no avail, I tried googling the problem on my iPhone. But I couldn’t even find anyone with the same problem, let alone a solution.

Safe mode to the rescue

I tried booting Win XP into safe mode, and luckily at the login prompt I could now choose to login as Administrator (with no password!). Once inside I checked the account my friend was trying to login as, and sure enough the “User cannot change password” box was checked, and the “Password never expires” box was unchecked.

I restored the settings back to how they should be – password never expires and user can change the password. So that fixed the problem, but I was still wondering how those settings got set like that. My friend sheepishly admitted that she’d been playing around with those settings a while ago when she had password problems with her ISP. D’oh!

Make yourself an admin in SQL Server 2008

Leave a comment

The same colleague I was helping with their SQL install yesterday made another mistake. She mustn’t have set herself to be the db admin, because we’d get “Access denied” messages when she’d try to connect to her local db using SQL Server Management Studio.

Fortunately she found this script by Ward Beattie which fixes the problem. She only had to enter MSSQLSERVER as the SQL instance name.

SQL Server 2008 install requires Visual Studio 2008 SP1

2 Comments

I was helping a colleague setup their new Windows 7 developer box today, and we couldn’t install SQL Server 2008. SQL Server’s installation would complain:

A previous release of Microsoft Visual Studio 2008 is installed on this computer. Upgrade Microsoft Visual Studio 2008 to the SP1 before installing SQL Server 2008.

Well, we’d already installed Visual Studio 2008 and Visual Studio 2008 SP1 so why wasn’t it working? Even after a reboot Visual Studio 2008 was reporting that SP1 was already installed.

In the end we had to install VS 2008 SP1 a second time, and after that the SQL Server install worked fine.

What went wrong? The developer had started to install SQL Server 2008 while VS 2008 SP1 was still being installed.

Speeding up my Wi-Fi b/g network at home

Leave a comment

I was trying to watch recorded HD content from my HTPC on my laptop, but it would stutter and be unwatchable. I quickly realised that my wireless network was too slow.

So to diagnose the problem I tried copying a large (2 Gb) file across my wireless network and see what sort of speeds I was getting. Only around 700Kb/second! Hmm, that seems awfully slow.

I opened up my router’s config page (Linksys WRT54GL using the patched tomato firmware) and tried the usual suspects – 1. changing to a different channel; 2. moving the router away from possible sources of interference; 3. trying a USB wireless network adaptor I had lying around instead of my laptop’s built in wireless, all to no avail. I was still only getting around 700Kb/sec.

I went into the router’s Advanced settings page and had a look at the options in there. Hmm, let’s try disabling this Afterburner setting. Boom! Once that was disabled the file copy went up to 2Mb/sec. That setting is disabled by default, but I had enabled it when I first setup my router (a year ago) thinking it would probably make things faster. Well that wasn’t the case, it was slowing things down.

I then tinkered with a few other settings, and I found that enabling Frame Burst sped things up a little bit, to around 2.5Mb/sec.

So yay, now I can watch recorded shows over my Wi-Fi g network! I don’t need to buy a 802.11n router and USB adaptor :-)

Moral of the story, which applies to all technology really - stick with the default settings to begin with, and once you know your baseline then tinker.

Follow

Get every new post delivered to your Inbox.