What's up!

Pyaarey Allah!

Monday, October 14, 2013

Husool ka pehla usool

0 comments

Husool ka pehla usool be-nyazi hai

Sunday, October 6, 2013

Got a new PC

0 comments

I got a new desktop PC with
Intel 4th Gen Processor Intel Core i7 4770-k 3.5GHZ
Asus Z87-Pro MotherBoard
2 x 8GB-1600 Corsair Memory sticks
2 x Samsung SSDs(540 mbps) Raid0 for Windows, 250GB Each
2 x 1TB WD Black Disks for critical data storage raid-1 SATA III
1 x 1TB WD SATA 1 for media files
CoolerMaster Casing
H100i Extreme performance Liquid Cooling unit
Ex 2 Extreme 650Watts Power Supply
Nvidia Gforce 650Ti Boost Graphics Card 2GB DDR5

Sunday, September 1, 2013

Include jqeury bookmarklet

0 comments




    (function() {
      var el=document.createElement('div'),
          b=document.getElementsByTagName('body')[0],
          otherlib=false,
          msg='';
      el.style.position='fixed';
      el.style.height='32px';
      el.style.width='220px';
      el.style.marginLeft='-110px';
      el.style.top='0';
      el.style.left='50%';
      el.style.padding='5px 10px';
      el.style.zIndex = 1001;
      el.style.fontSize='12px';
      el.style.color='#222';
      el.style.backgroundColor='#f99';
     
      if(typeof jQuery!='undefined') {
        msg='This page already using jQuery v'+jQuery.fn.jquery;
        return showMsg();
      } else if (typeof $=='function') {
        otherlib=true;
      }
     
      // more or less stolen form jquery core and adapted by paul irish
      function getScript(url,success){
        var script=document.createElement('script');
        script.src=url;
        var head=document.getElementsByTagName('head')[0],
            done=false;
        // Attach handlers for all browsers
        script.onload=script.onreadystatechange = function(){
          if ( !done && (!this.readyState
               || this.readyState == 'loaded'
               || this.readyState == 'complete') ) {
            done=true;
            success();
            script.onload = script.onreadystatechange = null;
            head.removeChild(script);
          }
        };
        head.appendChild(script);
      }
      getScript('http://code.jquery.com/jquery.min.js',function() {
        if (typeof jQuery=='undefined') {
          msg='Sorry, but jQuery wasn\'t able to load';
        } else {
          msg='This page is now jQuerified with v' + jQuery.fn.jquery;
          if (otherlib) {msg+=' and noConflict(). Use $jq(), not $().';}
        }
        return showMsg();
      });
      function showMsg() {
        el.innerHTML=msg;
        b.appendChild(el);
        window.setTimeout(function() {
          if (typeof jQuery=='undefined') {
            b.removeChild(el);
          } else {
            jQuery(el).fadeOut('slow',function() {
              jQuery(this).remove();
            });
            if (otherlib) {
              $jq=jQuery.noConflict();
            }
          }
        } ,2500);
      }
    })();



Wednesday, August 7, 2013

SQL Lookup logged in users

0 comments


exec sp_who2


select d.name, d.dbid, spid, login_time, nt_domain, nt_username, loginame
  from sysprocesses p inner join sysdatabases d on p.dbid = d.dbid
 where d.name = 'DBNAME'

SQL Free up busy database resources

0 comments

use master
ALTER DATABASE im_test_restore SET SINGLE_USER WITH ROLLBACK IMMEDIATE
  
use im_test_restore;
go
 
checkpoint;
go
 
use master;

go
  
ALTER DATABASE im_test_restore SET MULTI_USER

Friday, August 2, 2013

Rename a busy database in SQL Server

0 comments

use master
ALTER DATABASE YourDBName SET SINGLE_USER WITH ROLLBACK IMMEDIATE
 
use YourDBName;
go

checkpoint;
go

use master;
go

alter database YourDBName modify name = YourDBNameNewName;
go
 
ALTER DATABASE YourDBName SET MULTI_USER

Thursday, July 4, 2013

Topper of the class

0 comments

The most intelligent student of the class is not the topper because He scores highest only in his favorite subjects. He simply cannot give equal rights to everything like Social Studies or Anything he HATES. That's completely fair in my world. That shows too many good signs like loyalty, mastership and attitude..... Where the topper of the class doesn't have any choice any attitude and any loyalty to studies. You cannot love more than 2-3 people; You cannot serve more than few(1-2) jobs. You cannot love everyone equally. So see how stupid the topper is. The topper one day will be sitting on a job and taking highest salary and the intelligent guy will be paying him handsome enough to not let the dog switch the master.

Sunday, June 30, 2013

SQL Server force identity insert for autoseed pk

0 comments

  use InspectionManager
  GO
  set identity_insert dbo.report ON 
  go
  insert into Report(ReportID, InspectionID, Name, DateCreated) values(124842,161815, 'wa report', '2013-07-01 20:59:09.297')
  set identity_insert report OFF
  go

Tuesday, June 25, 2013

MS SQL Shrink DB Log File

1 comments


USE [master]
GO
ALTER DATABASE YourDBName SET RECOVERY SIMPLE WITH NO_WAIT

USE YourDBName;
GO
DBCC SHRINKFILE (YourDBName_Log_File_Logial_Name, 1024);
GO

USE [master]
GO
ALTER DATABASE YourDBName SET RECOVERY FULL WITH NO_WAIT
GO

Thursday, June 20, 2013

SQL Server - Release database connections

0 comments

use master
ALTER DATABASE YourDBName SET SINGLE_USER WITH ROLLBACK IMMEDIATE

--do you stuff here

ALTER DATABASE YourDBName SET MULTI_USER

Friday, June 14, 2013

Backup the important stuff before installing Windows

0 comments



This is too important for us to backup our configurations and files from C Drive before re-installing Windows. It really looks so easy to just copy your documents and start installing Windows. Well if we think it is that easy we are wrong! Here is the list of items we should backup. This post should be too helpful for developers specially. If you are not a developer you can simply ignore what you don't understand.

Backup Root
Create a folder E(or D):\Windows backups\yyyy-mm-dd-Windows version
This is backup root
Example of my backup root:
E:\Windows backups\2013-06-15-windows 7-toshiba-pc\

Copy data from following locations from all users
-Desktop
-Pictures
-Documents
-Downloads
-Videos
-Music

Credentials
Go to this location
Control Panel\All Control Panel Items\Credential Manager
Click Backup Vault
Follow the instructions to create a file such as Backup root\Credentials.crd

Create db backups
I opened all instances of SQL Server and created .bak file one by one. For every single DB. I did know that some databases were useless still I created .bak for them. This was safer way.
examples:
  1. SqlExpress
  2. Sql 2008
  3. Sql 2012


Export Visual studio settings like this
vs2012\Exported-2013-06-15.vssettings

IIS Websites
I ran this command you can modify according to your needs
C:\Windows\System32>%windir%\system32\inetsrv\appcmd.exe add backup "IIS-7-2013-06-15-Toshiba-Notebook"
I copied the folder to my backup root
C:\Windows\System32\inetsrv\backup\IIS-7-2013-06-15-Toshiba-Notebook

After installing clean windows, I will have to paste the backup folder to same location in C directory and then run this command:
%windir%\system32\inetsrv\appcmd.exe restore backup "IIS-7-2013-06-15-Toshiba-Notebook"



Flash Fxp backup by right clicking on FlashFxpSites from F4 popup window(Site manager)
save here
\FlashFxp\sites.ftp


Create Misc Folder
backup [hosts] file from here:
C:\Windows\System32\drivers\etc

And asp.net config files from two locations
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config
(If you use Version 2 then take backups from version 2 too)
Files to backup are web.config and machine.config


Create fonts folder and backup fonts


Environment variables to
\Environment variables\vars.txt
Control Panel\All Control Panel Items\System\Environment Variables
Examples:
PATH
ANDROID


Take screenshot of Favorite Folders and save on Fav\fav.png
such as


For remote desktop i use Multidesk free software. i save this here
E:\tools\multidesk_2_4_4\MultiDesk\MultiDesk64.exe
so no need to backup its connections.
If you use default Remote Desktop tool then open that and expand from Options button. Click [Save As...] And save .rdp file for every connection.


Better to take a look at your Recycle Bin and delete items you don’t want one by one, so that you don’t accidently delete data which you might need to recover.


Skype backup
Copy this folder to backup root
C:\Users\[your user]\AppData\Roaming\Skype

FireFox Profile
I copied this folder to backup root
C:\Users\[your user]\AppData\Roaming\Mozilla\Firefox
See here for how to restore this folder on new windows
http://support.mozilla.org/en-US/kb/back-and-restore-information-firefox-profiles#w_backing-up-your-profile

Other things to consider if you keep them on C drive
  • PHP folder
  • Mongo DB folder
  • Inetpub folder
Finally my folder looks like this:


Do You think this was too simple? :D