Thursday, July 11, 2013

Online Learning

Online Education is booming (literally)
Lots of good (really-really good) online learning portals, few of my favorite are :-

www.courseera.org
https://www.udacity.com/
www.khanacademy.org
http://www.codecademy.com/

I am attending one of the course from Stanford University professor at Course-Era.
I have done few javascript courses at codecademy.com
Udacity also has tons of very good learning courses, following few on my TODO list


Explore above portals. Time Worth spent.

Further more TED blogs on MOOC

http://blog.ted.com/12-great-free-online-courses/
http://blog.ted.com/10-places-where-anyone-can-learn-to-code/

Saturday, June 29, 2013

My Favorite blog posts on Startups

Recently I came across very useful blog posts written for start-up links, I would like to copy here so that I don't forget to revisit these again & again :-

OnStartup.com  from Dharmesh Shah is my all time favourite. 
And blogger of above site, write post based on one of my favourite movie "Moneyball" :-

And my favourite point from above post is :-
5. Your goal shouldn't be to buy players, your goal should be to buy wins.
I'm going to illustrate this point with a quick paraphrasing with a conversation I had with an entrepreneur last year. It went roughly like this:
Me: What do you need?
Them: We need to build a management team.
Me: No, what do you actually need right now?
Them: Well, right now we need a VP Engineering.
Me. What for?
Them: Well, we need head up our product development effort.
Me. No, you actually need to write code and release a product. You need to respond to customer issues. You need to iterate quickly so you can learn quickly. You don't need a VP of anything, you need a doer of stuff that needs to get done. Don't think about buying titles — think about buying outcomes.  Think about plugging gaping holes in the company.  Signing up customers so fast that you can't respond to all the support emails?  Don't hire a head of support, hire someone that helps you tackle the support issue.  Someone that's maniacally committed to customer happiness.  They can become your head of support some day.

 Another post from Dharmesh Shah is:-

 

Thursday, June 20, 2013

Hiring in technological company


http://www.nytimes.com/2013/06/20/business/in-head-hunting-big-data-may-not-be-such-a-big-deal.html?_r=0

My notes and excerpts from above interview :-

Coming from SVP of People operations at Google:-
 "We looked at tens of thousands of interviews, and everyone who had done the interviews and what they scored the candidate, and how that person ultimately performed in their job. We found zero relationship. It’s a complete random mess"


some data is essentially worthless in assessing job candidates:

* G.P.A.'s. for instance, except for recent college graduates, and test scores.
* we found that brainteasers are a complete waste of time.

"We’ve actually made it harder to be a bad manager."

"...academic environments are artificial environments. People who succeed there are sort of finely trained, they’re conditioned to succeed in that environment. One of my own frustrations when I was in college and grad school is that you knew the professor was looking for a specific answer. You could figure that out, but it’s much more interesting to solve problems where there isn’t an obvious answer. You want people who like figuring out stuff where there is no obvious answer."

Tuesday, June 18, 2013

Learning JavaScript Step by Step

The Principle of Least Power

"any application that canbe written in JavaScript, will eventually be written in JavaScript."


  1. Finish Course in www.Codecademy.com (free)
  2. Finish first 12 chapters of JavaScript Definitive guide
  3. Read A re-introduction to JavaScript (JS Tutorial)
  4. Revise it with JavaScript Garden
  5. Introduction to Object-Oriented JavaScript
  6. At this point, you might want to revise some of the chapters in Definitive guide, which you read in step 2.
  7. Douglas Crockford Videos - Refer the second answer for links to all his videos
  8. Refer Mozilla Developer Network home page for detail learning and refer it during usual programming.
Came across following Useful SO thread

http://stackoverflow.com/questions/2628672/what-should-every-javascript-programmer-know

The first highest voted answer has one point, where I am also spending my years :)

How constructor functions, the prototype property and the new operator really work; methods of exploiting this to create the normal class/subclass/instance system you actually wanted; when you might want to use closure-based objects instead of prototyping. (Most JS tutorial material is absolutely terrible on this; it took me years to get it straight in my head.) 

Then I came across this article
Where it emphasis on fact that JavaScript need not be Object Oriented, (Avoid inheritance), instead object based is sufficient.

http://davidwalsh.name/javascript-objects

http://davidwalsh.name/javascript-objects-deconstruction
By far above is my most favorite article series to approach JavaScript

I like the way Eloquent JavaScript starts its chapter on Object Oriented Programming talking about OO.

Instead of deciphering best way to implement Inheritance, more energy should be devoted to learn functional aspects of JavaScript, hence, I found Chapter on Functional Programming, more interesting.  Here are two more links on Functional aspect of JavaScript :-


Other Useful Resources :-

http://net.tutsplus.com/tutorials/javascript-ajax/24-javascript-best-practices-for-beginners/
Google JavaScript Guidelines
Notable books (as mentioned by Addy Osmani in his Design Pattern book)

  • JavaScript: The Definitive Guide by David Flanagan
  • Eloquent JavaScript by Marijn Haverbeke
  • JavaScript Patterns by Stoyan Stefanov
  • Writing Maintainable JavaScript by Nicholas Zakas
  • JavaScript: The Good Parts by Douglas Crockford


Apart from learning Core JavaScript with the help of above links, I guess only two more area left to focus on :-

1. TDD in JavaScript
2. Async Programming in JavaScript (Callback Vs Promises)

I will have separate blog post about above two.

Thursday, January 6, 2011

Wednesday, December 8, 2010

SQL Server, Finding dependent tables recursively

Wanted to export few tables to new db. For this I needed to find out the tables on which given table 'X' depends, and then tables on which those tables depends...(problem sound recursive)

Step 1. Create view:- REFERENTIAL_CONSTRAINTS_COLUMN_USAGE as described here:-

Step2. Write CTE Query to recurse through tree of all tables related to given table 'X'

WITH FindTableTree (TableName,HLevel)
AS
(
SELECT UNIQUE_TABLE_NAME, 0 AS HLevel from dbo.REFERENTIAL_CONSTRAINTS_COLUMN_USAGE rc
WHERE rc.TABLE_NAME = 'X'

union all

SELECT UNIQUE_TABLE_NAME, HLevel +1 from FindTableTree, dbo.REFERENTIAL_CONSTRAINTS_COLUMN_USAGE rc
WHERE rc.TABLE_NAME = FindTableTree.TableName

)

SELECT DISTINCT TableName
FROM FindTableTree

GO
=============================================================
For some odd SQL server R2 i could not create any new view in inofmration_schema. Please use following looong query for same purpose.
WITH FindTableTree (TableName,HLevel)
AS
(
SELECT
KCU2.TABLE_NAME AS UNIQUE_TABLE_NAME
, 0 AS HLevel
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC
JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU1
ON KCU1.CONSTRAINT_CATALOG = RC.CONSTRAINT_CATALOG
AND KCU1.CONSTRAINT_SCHEMA =
RC.CONSTRAINT_SCHEMA
AND KCU1.CONSTRAINT_NAME = RC.CONSTRAINT_NAME
JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU2
ON KCU2.CONSTRAINT_CATALOG =
RC.UNIQUE_CONSTRAINT_CATALOG
AND KCU2.CONSTRAINT_SCHEMA =
RC.UNIQUE_CONSTRAINT_SCHEMA
AND KCU2.CONSTRAINT_NAME =
RC.UNIQUE_CONSTRAINT_NAME
WHERE KCU1.ORDINAL_POSITION = KCU2.ORDINAL_POSITION
AND KCU1.TABLE_NAME = 'CustomerDetail'

union all

SELECT KCU2.TABLE_NAME, HLevel +1 FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC
JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU1
ON KCU1.CONSTRAINT_CATALOG = RC.CONSTRAINT_CATALOG
AND KCU1.CONSTRAINT_SCHEMA =
RC.CONSTRAINT_SCHEMA
AND KCU1.CONSTRAINT_NAME = RC.CONSTRAINT_NAME
JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU2
ON KCU2.CONSTRAINT_CATALOG =
RC.UNIQUE_CONSTRAINT_CATALOG
AND KCU2.CONSTRAINT_SCHEMA =
RC.UNIQUE_CONSTRAINT_SCHEMA
AND KCU2.CONSTRAINT_NAME =
RC.UNIQUE_CONSTRAINT_NAME inner join FindTableTree on
KCU1.TABLE_NAME = FindTableTree.TableName
)

SELECT DISTINCT TableName,HLevel
FROM FindTableTree

GO

Following can also help:-

DECLARE @masterTableName varchar(1000)

SET @masterTableName = 'Companies'

 

DECLARE @ScannedTables TABLE( Level int, Name varchar(1000) collate Latin1_General_CI_AS )

 

DECLARE @currentTableCount INT

DECLARE @previousTableCount INT

DECLARE @level INT

 

SET @currentTableCount = 0

SET @previousTableCount = -1

SET @level = 0

 

INSERT INTO @ScannedTables VALUES ( @level, @masterTableName )

 

WHILE @previousTableCount <> @currentTableCount

BEGIN

 

    SET @previousTableCount = @currentTableCount

 

    INSERT INTO @ScannedTables

 

        SELECT DISTINCT

            @level + 1, TC.Table_Name COLLATE Latin1_General_CI_AS

 

        FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS TC

        LEFT JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC ON TC.Constraint_Name = RC.Constraint_Name

        LEFT JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS FTC ON RC.Unique_Constraint_Name = FTC.Constraint_Name

 

        WHERE TC.CONSTRAINT_TYPE = 'FOREIGN KEY'

 

        AND FTC.TABLE_NAME COLLATE Latin1_General_CI_AS IN ( SELECT Name FROM @ScannedTables WHERE Level = @level )

        AND TC.Table_Name COLLATE Latin1_General_CI_AS NOT IN ( SELECT Name FROM @ScannedTables )

 

    SET @level = @level + 1

 

    SELECT @currentTableCount = COUNT(*) FROM @ScannedTables  

END

 

SELECT [Level], 'DELETE * FROM ' + Name FROM @ScannedTables ORDER BY [Level] DESC

 
From http://stackoverflow.com/questions/3441251/how-to-get-list-of-child-tables-for-a-database-table