Author: Rizwan Ansari

Oracle Replication through Oracle Data Guard

Author: | Categories: Database No Comments
This is a step by step guide to create Physical Standby database in Oracle using Oracle Data Guard. Force Logging on Primary Instance Set Force Logging on Primary database instance. alter database force logging; Verify by running below query. SELECT force_logging FROM v$database; Add standby redo log files ALTER DATABASE ADD STANDBY LOGFILE 'C:\ORACLE\ORADATA\ORCL\SREDO01.log' SIZE […]

Optimize WiFi signals with WiFi channel configuration

Author: | Categories: Networking One Comment
It is more likely that there are many WiFi networks in neighborhood and sometimes you’ve had problems with wireless connections dropping out or it is not fast enough. One way to fix this is to select optimum channel for your wireless network in wireless router setting. Figure out Right WiFi Channel You can use my […]

Connect two routers to create a single LAN

Author: | Categories: Networking No Comments
You have a router running in your network which is connected to internet. You want to connect second router/switch in your network thru Ethernet cable. And you want to access devices connected to both routers from any router then follow below steps. Setup steps Unplug the second router/switch from network. Connect computer to the router/switch […]

Import and Export MySQL Database

Author: | Categories: Database, Wordpress One Comment
There are many ways you can Export and then Import MySQL on other server like phpMyAdmin and MySQL WorkBench. But most efficient way (though not much user friendly) is command line option. This is helpful when you don’t have other option to transfer database but you have SSH access to the server and you want […]

Get APK from Android Device

Author: | Categories: Programming No Comments
Sometimes you need APK file from the Android device. Easiest way is to use ADB. You need to connect android device to computer and have the required drivers of Android device installed along with Android SDK tools. Run below command to display all the packages installed on your device. adb shell pm list packages Find […]

ASP.NET download big file using BinaryWrite

Author: | Categories: Programming No Comments
There are situation when you need to provide download option for a big file located somewhere on server or generated at runtime. Below function could be used to download files of any size. Sometimes downloading big file throws exception OutOfMemoryException showing “Insufficient memory to continue execution of the program”. So this function also handle this […]

RHEL CentOS set default editor to NANO

Author: | Categories: Linux No Comments
VI is a wonderful, full feature text editor. However, some might lack experience with VI and prefer a simpler text editor for quick configuration and other edits. Install nano yum -y install nano System Default Editor cat <<EOF >>/etc/profile.d/nano.sh export VISUAL="nano" export EDITOR="nano" EOF User Default Editor cat <<EOF >>~/.bash_profile export VISUAL="nano" export EDITOR="nano" EOF

Clone SQL Server database

Author: | Categories: Database One Comment
Option 1 Detach Original Database, copy its MDF and LDF files and create a new Database from copied files. USE master; GO EXEC sp_detach_db @dbname = N'OriginalDB'; GO copy "c:\\OriginalDB.mdf" "c:\\NewDB.mdf" copy "c:\\OriginalDB_log.ldf" "c:\\NewDB_log.ldf" USE master; GO CREATE DATABASE OriginalDB ON (FILENAME = 'C:\\OriginalDB.mdf'), (FILENAME = 'C:\\OriginalDB_log.ldf') FOR ATTACH; GO CREATE DATABASE NewDB ON (FILENAME […]

SQL Server format date

Author: | Categories: Database No Comments
Format Date in SQL Server by using a user defined functions. /* author: Rizwan Ansari */ create function dbo.fnFormatDate (@datetime datetime, @format varchar(35)) returns varchar(35) as begin declare @date varchar(35) set @date = @format if (charindex ('yyyy',@date) > 0) set @date = replace(@date, 'yyyy', datename(YY, @datetime)) else if (charindex ('yy',@date) > 0) set @date = […]

C# Create Instance of a Class from string

Author: | Categories: Programming No Comments
In C# You can create instance of any class dynamically using Activator.CreateInstance method public object GetInstance(string FullyQualifiedNameOfClass) { Type t = Type.GetType(FullyQualifiedNameOfClass); return Activator.CreateInstance(t); } If FullyQualifiedNameOfClass is in another assembly then loop through all assemblies and find the Type. For that use below code: public object GetInstance(string FullyQualifiedNameOfClass) { Type type = Type.GetType(FullyQualifiedNameOfClass); if […]