Remotely debug your web-site in Android phone

There was a light at the end of the tunnel. I have discovered something magical today. You can have you mobile web-site open on your phone, but debug it from your desktop.

It’s just pure magic!

Here is how to do it:

  1. Install Android SDK. Add  <sdk>/platform-tools/ to your PATH
  2. In Mobile Crome enable USB Debugging in Settings and connect your phone via usb to your PC
  3. In console run adb devices to check if you can see your device.
  4. In console run adb forward tcp:9222 localabstract:chrome_devtools_remote
  5. In your Desktop Chrome open http://localhost:9222
  6. Select the open tab from your mobile Chrome.
  7. Debug as normal.
  8. Profit!

via https://developers.google.com/chrome/mobile/docs/debugging

Alternatively you can create a create a bat file with the following:

adb forward tcp:9222 localabstract:chrome_devtools_remote
start http://localhost:9222

And run this bat every time you connect your phone to your PC. For ease of use you can set up this as AutoPlay action in Windows 7 (if you know how to do that).

Hint: Autoplay handlers are located in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers But I have not managed to find out how to add the handler.

Generate T4MVC templates

Everybody is talking how good the T4 templates, but nobody tells you how to generates the bloody things.

In VS2012 if you open command window (View-> Other Windows -> Command Window) and execute
TextTransformation.TransformAllTemplates – that should do the trick.

If you would like a button for that – add Build Toolbar Panel and it should contain “Transform All Templates” button.

Or you can install Chirpy and configure it to do T4MVC for you on every build:

How to replace system files in WinXp

Sometimes you need to replace damaged system files with correct ones. I’m talking about files in C:\windows\system32\…

There are 2 ways of doing this:

Use sfc command: insert distribution disk with correct version of Windows, execute sfc /purgecache to clean out the cache of drivers/files. Then execute sfc /scannow. This will check all the system files and replace damaged.

Another way is to replace files one by one. Again, insert your distribution disk, then run command:

expand D:\i386\ndis.sy_ C:\windows\system32\drivers\ndis.sys

This unpacks compressed files from the CD archive.