Tuesday, May 19, 2015

Visual studio project fails to build when using Entity Framework Package manager console

Trying to run Entity Framework commands from the Package Manager Console resulted in "compile errors". This was driving me insane. Sometimes it built, but most of the time it didn't.
I was using Visual Studio 2010 so perhaps it's fixed in other version but I found that if you suspend ReSharper the problem goes away.

How to Suspend ReSharper: Tools - Options - Resharper - General.

Happy now.

Saturday, May 16, 2015

How to find slow Sql Server queries

We can run the queries
EXEC dbo.sp_who 
or 
EXEC dbo.sp_who2
These are the typical commands where who2 is a newer version that gives us some more info.

who2 tells us the SPID of any blocking process and we can then run,
 DBCC INPUTBUFFER(put SPID here)
to tell us what it was doing.

But better than that...

A cool free command written by Adam Mechanic called sp_WhoIsActive

It has some parameters you can switch on but be careful about running this with all execution plans being returned on a busy server.

Tuesday, April 28, 2015

Where does Xcode put compiled C++ executable

I needed to make a quick C++ console app the other day and thought I'd use Xcode. It worked fine but I wondered where the file was placed and it is miles away!

The program was called traindata

In fact, it is here:


/Users/johnr/Library/Developer/Xcode/DerivedData/traindata-frnrpuzfjjiemzhbqbxvjomrwamj/Build/Products/Debug

Sunday, March 22, 2015

Changing the Technicolor tg582n router to use OpenDNS

OpenDNS - the free and ever so handy service that enables us to protect our home networks from the worst of the Internet.

http://www.opendns.com

How does Open DNS work? Essentially, it replaces the DNS lookups that the  Internet Service Provider (ISP) gives us so that when we request a Website, OpenDNS can decide if it we want it blocked or not. To do this we point our router and the lookup servers provided by OpenDNS and not to the servers provided by our ISP.

I recently changed my router provided by my Internet Service Provider (ISP) and for some reason imagined that OpenDNS was still configured. Of course it wasn't. I checked the control panel of the router and found I was using the ISP's DNS servers and found no way to change them. So the solution is to use Telnet.

First, check you are using OpenDNS.
Goto, https://www.opendns.com/welcome/
You should see a big tick if you are already configured.
If you see the tick - all is good. Ignore this blog post.

I needed the Username and password for the router,
and the OpenDNS ip addresses. These are they:
  • 208.67.222.222
  • 208.67.220.220
On a Mac you simply  open Terminal, (CMD-Space then type terminal is one way to open it.).
Not sure what Telnet client you'd use on Windows.

I am assuming the IP address of the router is 192.168.1.254, if not, use the correct one instead.
type: Telnet 192.168.1.254

JMBP:~ jr$ Telnet 192.168.1.254


Enter the Administrator's user name and password and you should see something like this:


------------------------------------------------------------------------

                             ______  Technicolor TG582n
                         ___/_____/\ 
                        /         /\\  8.4.4.J.AS
                  _____/__       /  \\ 
                _/       /\_____/___ \  Copyright (c) 1999-2011, Technicolor
               //       /  \       /\ \
       _______//_______/    \     / _\/______ 
      /      / \       \    /    / /        /\
   __/      /   \       \  /    / /        / _\__ 
  / /      /     \_______\/    / /        / /   /\
 /_/______/___________________/ /________/ /___/  \ 
 \ \      \    ___________    \ \        \ \   \  /
  \_\      \  /          /\    \ \        \ \___\/
     \      \/          /  \    \ \        \  /
      \_____/          /    \    \ \________\/
           /__________/      \    \  /
           \   _____  \      /_____\/
            \ /    /\  \    /___\/
             /____/  \  \  /
             \    \  /___\/
              \____\/

------------------------------------------------------------------------

Command prompt,
You will see the following prompt, type commands after the prompt.
{Administrator}=>

Look at the list of DNS servers you currently have. Mine are for ZEN. 
Typing, dns server route list
{Administrator}=>dns server route list

will list your current server list.
{Administrator}=>dns server route list

DNS Server Entries:
  DNS Server     Source                Label              Metric Intf         State  Domain            
D 212.23.6.100                                            10     Internet      UP      *             
D 212.23.3.100                                            10     Internet      UP      *   

Flush the list, thus:
{Administrator}=>dns server route flush

Now add the two Open DNS server addresses:
{Administrator}=>dns server route add dns=208.67.222.222 metric=10 intf=Internet
{Administrator}=>dns server route add dns=208.67.220.220 metric=10 intf=Internet

Now list them to see if they are there:
{Administrator}=>:dns server route list  

And we see:
DNS Server Entries:
  DNS Server     Source                Label              Metric Intf         State  Domain            
S 208.67.222.222                                          10     Internet      UP      *             
S 208.67.220.220                                          10     Internet      UP      *    


Now Save and exit:
{Administrator}=>saveall
{Administrator}=>exit

Worked for me. Good luck.


Saturday, March 21, 2015

GIT - pushing and pulling in an easy to understand image

Drawn by Oliver Steele, this helps when moving to GIT from SVN.
SVN has two ends: the workplace and the Repo. GIT has four. The idea of staging.
Brilliant idea.


Saturday, March 7, 2015

Show all files in OS X

Want to see all hidden files in Finder.


Show them:
defaults write com.apple.finder AppleShowAllFiles 1 && killall Finder



Hide them:

 defaults write com.apple.finder AppleShowAllFiles 0 && killall Finder


Saturday, January 10, 2015

How to get the # (hash) key in Windows, using VMWare Fusion on a Mac from a UK keyboard

There is no key for the # in a Mac UK keyboard so when I need it in Mac application I use Alt - 3. This is fine but not when running a Windows Virtual on the Mac via VMware Fusion. For that I use, Cmd - \ (Command backslash) 

Saturday, December 13, 2014

Powershell help - The three most important commands in the Windows PowerShell

Just starting out with the Windows PowerShell and I think the most important command are:

  • Get-help - first line support, what do I do?
  • Get-command - found the command, How do I use it?
  • Get-member - What does this do? List it's members.

Get-Help


It accepts wildcards and is not case-sesitive.
So,
get-help *service* 
will list all topics that have object in the topic.


You can find more info about the topic by asking for help on the name of the specific.
e.g.
get-help start-service
This help text is very useful but there's even more.

The full help can be found by using the verbose parameter, full
get-help start-service -full

Get-Command

get-command -noun service 
This will list all the commands with the word service in the name.

You can also look for a verb, e.g.
get-command -verb get


Get-member

To use this we need to use the pipeline command which is:
|
Basically, without explaining pipelining, the output from the first command is filtered into the second.

So. I have found that the command I am interested in is get-service.
I want to find the members of that service. So I pipe the command into the get-member command.
get-service | get-member
 Running the above we find the Properties and Methods for the command get-service


And one other thing:

-WhatIf

If you're unsure what a command will do, then add the -whatif parameter and let PowerShell tell you what will happen.

stop-process -name * -whatif 





Sunday, November 2, 2014

Use iBooks to read Kindle books on a Mac

Amazon has a lot more computer books than the iBook store so I've ended up with quite a few in Kindle over the years. I don't have a Kindle device, just the app for the Mac.
I don't like it. I never have liked it. It just irritates me. For a long time we had to use it because Apple in their infinite wisdom thought iBooks should only exist on the iOS devices but that changed a couple of years back so why am I not reading my Kindle books in iBooks?
Answer Digital Rights Management - DRM. The things that prevents copying even if you're coping it for yourself.

But there's a way around it.

1. Install Calibre http://calibre-ebook.com/download

This is an open source e-book management thing. It has the power to export e-books to other formats but it won't cope with DRM. We need to get rid of the DRM.

We need to add a free and open source plugin to Calibre but we install it in a slightly different way. For me it worked very easily and quickly.

2. Go to Apprentice Alf's page to download the tool. You'll need the Tools not the Alternative tools.

To download, be sure to press the Grey button and un-tick the tick box.




3. Ok now unzip the file somewhere.

4. Start Calibre.

5. Add the plug in.

  1. Select Preferences from the menu-bar.
  2. Select Change Calibre behaviour from the dropdown.
  3. Choose Plugins from the panel.
  4. Select the button: Load plug-in from file.
  5. Navigate the the unzipped files you downloaded.
  6. Open the DeDRM_calibre_plugin.
  7. Select the DeDRM_plugin.zip file.
  8. Choose Add etc and that's it.
No Add books into Calibre and will be DRM free. You can export to Epub and then add to your iBooks library.





The plugin is made by Apprentice Alf I think and there are all sorts of posts on the blog about this

Saturday, October 18, 2014

How to use special character in a Mac like umlaut, acute, tilde and circumflex


The Grave characters: À È Ì Ò Ù à è ì ò ù

Press the following two keys:  option ` and then the character we want.

The Acute characters: Á É Í Ó Ú á é í ó ú

Press the following two keys: option e and then the character we want.

The Circumflex: Â Ê Î Ô Û â ê î ô û

Press the following two keys: option i and then the character we want.

The Tilde: Ã Ñ Õ ã ñ õ

Press the following two keys: option n and then the character we need.

The Umlaut: Ä Ë Ï Ö Ü Ÿ ä ë ï ö ü ÿ

Press the following two keys: option u , and then the character we need.