uninstall nodejs completely and install old lagacy version 0.8.23 script on nodejs

  1. which node
  2. # should output /usr/bin/node
  3. cd /usr/bin
  4. rm -rf bin/node bin/node-waf include/node lib/node lib/pkgconfig/nodejs.pc share/man/man1/node.1
  5. rm -f /usr/bin/node
  6. #remove npm
  7. npm rm npm -g
  8. rm -rf ~/.npm
  9. cd /opt/
  10. #download nodejs version 0.8.23
  11. wget http://nodejs.org/dist/v0.8.23/node-v0.8.23.tar.gz
  12. #extract
  13. tar -xvf node-v0.8.23.tar.gz
  14. rm -f node-v0.8.23.tar.gz
  15. cd node-v0.8.23
  16. ./configure
  17. #build and install
  18. make
  19. make install
  20. #create symlinks
  21. ln -s /usr/local/bin/node /usr/bin/node
  22. #check version
  23. node -v

React : Bootstrap List/Grid Toggle





Demo code Download .

Please make sure running this demo with firefox locally.
With chrome you may get this error message with default configuration:

XMLHttpRequest cannot load file:///.../js/app.js. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
Uncaught NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'file://...//js/app.js'.

With chrome try using the --disable-web-security command line param to make it work.

References:
https://facebook.github.io/react/docs/tutorial.html
https://github.com/facebook/react
http://www.programming-free.com/2013/12/fading-list-grid-view-switch-jquery.html
https://github.com/facebook/react/tree/master/examples/jquery-bootstrap

ReactJS : Bootstrap List Example














Demo Code Download .

Javascript/JSX(app.js):

  1. 'use strict';
  2. // lets populate list with this JSON array dynamically
  3. var data = [
  4. {author: "Pete Hunt", text: "This is one comment"},
  5. {author: "Jordan Walke", text: "This is *another* comment"},
  6. {author: "Pete Hunt", text: "This is second comment"}
  7. ];
  8. var Comment = React.createClass({
  9. render: function() {
  10. return (
  11. <li className="list-group-item">
  12. <b>{this.props.text}</b> : by - <span className="author-look">{this.props.author}</span>
  13. </li>
  14. );
  15. }
  16. });
  17. var CommentList = React.createClass({
  18. render: function() {
  19. var commentNodes = this.props.data.map(function (comment) {
  20. return (
  21. <Comment author={comment.author} text={comment.text}></Comment>
  22. );
  23. });
  24. return (
  25. <ul className="list-group list-look">
  26. {commentNodes}
  27. </ul>
  28. );
  29. }
  30. });
  31. ReactDOM.render(<CommentList data={data}/>, document.getElementById('myListDiv'));

Simplest index.html to get us started :)

  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  6. <title>jQuery Integration</title>
  7. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css" type="text/css" />
  8. <link rel="stylesheet" href="css/example.css" type="text/css" />
  9. </head>
  10. <body>
  11. <div id="myListDiv"></div>
  12. <script src="https://cdn.jsdelivr.net/react/0.14.0-rc1/react.min.js"></script>
  13. <script src="https://cdn.jsdelivr.net/react/0.14.0-rc1/react-dom.min.js"></script>
  14. <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.min.js"></script>
  15. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js" charset="utf-8"></script>
  16. <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.min.js" charset="utf-8"></script>
  17. <script type="text/babel" src="js/app.js"></script>
  18. </body>
  19. </html>




References:
https://facebook.github.io/react/docs/tutorial.html#hook-up-the-data-model

Browsing MS SQL Server db backup (.bak) file in linux locally without SSMS or SQLCMD or without online tools

Untitled

Imagine you only have a copy of MS SQL Server database backup (*.bak) file with no other tools for accessing it like SSMS(SQL Server Management Studio),SQLCMD,SQL-Server etc preinstalled on your machine and you would like to browse the content of the file without these tools now.

  • Because installing and setting all of them up would cost a lot of time and energy, and
  • You certainly don’t want to give out these DATA with potential bussiness value to a third party websites like rebasedata.com etc etc and
  • Even online tools have file size limitations, which should require extra dollars to work on huge files(>10MB).

Well there is a hack, a way to achieve this if you are looking to browse only db schema and no data.

Simply open the backup(*.bak) file with vim or any other plain text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@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@

But don’t panic. Search words like “Create”, “Table”, “Procedure”, “Trigger” (incase-sensitive).

And you will find texts like:


 `CREATE PROCEDURE [dbo].[FL_GetLoanDetails]     ^M  
 -- Add the parameters for the stored procedure   
 -- here    ^M  
  @TraceNo int,    ^M  
  @LoanStatus int,    ^M  
  @MPLID nvarchar(100),    ^M  
  @StopLoan int, ^M  
  @LoanCatId int,^M  
  @LoanTypeId int^M  
      ^M  
AS    ^M  
BEGIN    ^M  
 -- SET NOCOUNT ON added to prevent extra result sets  
 -- from    ^M  
     ^M  
-- FL_GetLoanDetails 0,2,'',2, 0, 0    ^M  
     ^M  
    declare @PStartDate nvarchar(20)= null^M  
    declare @PEndDate nvarchar(20)= null^M` 

It’s normal you may find lots of ^M’s at the end of every line.
It indicates the file had been taken backup on windows machine and they denote DOS encoding new line endings.
Copy and paste the whole code snippet into a new plain text editor window and these ^M’s should be gone.

Resulting in a full readable sql code snippet.