Sunday, August 9, 2015

Problem with NodeJs - node --debug server.js:72 - throw er; // Unhandled 'error' event


When playing around with debugging NodeJs and entering the following:

$ node --debug server.js

I got this error:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: listen EADDRINUSE
    at errnoException (net.js:905:11)
    at Server._listen2 (net.js:1043:14)

    at listen (net.js:1065:10)

This is caused by starting and stopping these debug processes, but leaving one running.


Run the following to identify the running process and then kill it.


Johns-MBP:server john$ ps aux | grep node

This will present something like this:
john      2799   0.0  0.3  3129308  52852   ??  S    11:38AM   0:01.30 /usr/local/Cellar/nvm/0.18.0/v0.10.33/bin/node --debug-brk=49961 --nolazy server.js
john      3023   0.0  0.0  2432772    660 s002  S+    2:37PM   0:00.00 grep node

This has told us the processId to kill. So run kill -9 [the process id]
eg

Johns-MBP:server johnroberts$ kill -9 2799






Sunday, June 14, 2015

A great slice of Steve Jobs history in video





A quite historic talk from Steve Jobs from 1980

If you're lucky enough to now this time in history, what Steve says and his vision is quite legendary.





Just hear the ovation when Steve Jobs returns to Apple, January 7 1997

Steve joins the stage at around 7:25 into the video.


January 7, 1997

also, August 1997 at the Boston Macworld Expo


Quite a searing analysis of the state Apple was in.


Steve Jobs presenting to Cupertino City Council, June 7 2011


Steve presents his proposal for the new campus.




The great Jonathan Ive giving a tribute to Steve Jobs




He believed there was a gravity,  almost a civic responsibility to care way beyond any functional imperative. He cared the most. He worried the most.


An amazing insight to the quality at the heart of Steve's work

Keith Yamashita worked for Steve Jobs at Next.







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