Tuesday, August 13, 2013

SQL Server 2008: enable login to sa user

  1. Login using Windows Authentication and ".\SQLExpress" as Server Name
  2. Change server authentication mode - Right click on root, choose Properties, from Security tab select "SQL Server and Windows Authentication mode", click OK 
  3. Set sa password - Navigate to Security > Logins > sa, right click on it, choose Properties, from General tab set the Password (don't close the window) 
  4. Grant permission - Go to Status tab, make sure the Grant and Enabled radiobuttons are chosen, click OK 
  5. Restart SQLEXPRESS service from your local services
Source:

Monday, August 12, 2013

IIS8: Unable to star debugging on the web server

I was getting the followong error:

Unable to start debugging on the web server. The web server could not find the requested resource.

I solved the issue enabling ASP in the IIS:
1. Go to "Start" > "control panel" > "programs" > "Turn windows features on or off"
2. Wait while it loads
3. Enable the option : "Internet Information Services" > "world wide services" > "application development features" > "asp"
4. click "ok"

Sunday, August 4, 2013

Java: Simple sample of socket server using InetAddress

public static void main(String[] args) {
        // TODO code application logic here
        String hostIP = "127.0.0.1";
        InetAddress bindAddr; 
        try {
            bindAddr = InetAddress.getByName(hostIP);
            launchServerSocket(4567, 4568, bindAddr );
        } catch (UnknownHostException e) {
            System.out.println("Unknown Host: " + hostIP);
            e.printStackTrace(); 
        }                
    }
 
    public static void launchServerSocket(int portNumber, int backlog, InetAddress bindAddr ){
        try {
            ServerSocket serverSocket = new ServerSocket(portNumber, backlog, bindAddr);
            System.in.read();// prevent console to be closed
        } 
        catch (IOException e) {
            System.out.println("Could not listen on port: " + portNumber);
            e.printStackTrace();            
        }
    }

OAuth V 2.0 resources

Thursday, July 25, 2013

Javascript: Disable backspace key in browsers

Use:

 $(document).keydown(function (e) {
        var nodeName = e.target.nodeName.toLowerCase();

        if (e.which === 8) {
            if (((nodeName === 'input' && (e.target.type === 'text' || e.target.type === 'email')) ||
            nodeName === 'textarea') && e.target.readOnly == false) {
                // do nothing
            } else {
                e.preventDefault();
            }
        }
    });

Reference:
http://stackoverflow.com/questions/6309693/disabling-backspace-key-works-in-all-browsers-but-ie

OAuth Intro

There are the links of a great and simple intro video to understand OAuth:

 - Part1: http://www.youtube.com/watch?v=LRNg4tDtrkE
 - Part2: http://www.youtube.com/watch?v=2KG05SnAYlE
 - Part3: http://www.youtube.com/watch?v=qPHLsLlQ7Rw
 - Part4: http://www.youtube.com/watch?v=0PvQcLzVGF0

Here is the url with a nice explanation about how auth works:

http://hueniverse.com/oauth/guide/workflow/

Wednesday, July 24, 2013

HTML5: Prevent browser form autofill

You hace to use autocomplete="off" in your form tag:

<form name="form1" id="form1" method="post" autocomplete="off"
      action="http://www.example.com/form.cgi">
      Name: <input type="text" name="text1" /><br/>
      Address: <input type="text" name="text2" /><br/>
      Phone: <input type="text" name="text3" /><br/>
      Password: <input type="password" name="password" /><br/>
     <input type="Submit" name="Submit" value="Submit" />
</form>

Reference:
https://developer.mozilla.org/en-US/docs/Mozilla/How_to_Turn_Off_Form_Autocompletion