Wednesday, March 1, 2017

Setting listener.ora in Linux

To set up listener.ora file in linux follow these steps:

  • change directory to oracle folder then network and admin folders consequtively: 
    • cd /u01/oracle/product/11.2.0.4/db_1
    • cd network
    • cd admin
  • run su command enter password (needed to edit listener.ora). open listener.ora to edit in your favorite editor. I used gedit:
    • su
    • gedit listener.ora
  • configure listener.ora file (you need to set up HOST, PORT, ORACLE_HOME, SERVICE_NAME), here is a sample file configured for my needs:
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.201)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))    
    )
  )

SID_LIST_LISTENER = 
(SID_LIST = 
 (SID_DESC = 
(ORACLE_HOME = /u01/oracle/product/11.2.0.4/db_1/)
(SID_NAME = ORACLEVM)
(SERVICE_NAME = ORACLEVM)
(GLOBAL_NAME = ORACLEVM)
 ) 
) 

ADR_BASE_LISTENER = /u01/oracle


  • stop ans start listener by using these commands:
    • lsnrctl stop
    • lsnrctl start

Accessing a VMware Player (Workstation 12) machine from network

To be able to access a VMware Workstation 12 Player machine (to receive a ping request at least) follow these steps:
  • Open virtual machine settings from player -> manage -> virtual machine settings and click network adapter tab


Setting a Static IP for Red Hat Enterprise Linux Server

  To set a static Ip in Red Hat Enterprise Linux Server follow the steps below:

  • Open a terminal 
  • run this command to change directory to list network interfaces
    • cd /etc/sysconfig/network-scripts/
    • ls

  • We need to edit the network interface file starting with ifcfg-enolxxxx. To be able to edit the file, first we need to run su. Run these commands:
    • su
    • gedit ifcfg-eno16777736


  • Change these parts accordingly and save it:
        IPADDR=192.168.1.201
        GATEWAY=192.168.1.1
        DNS1=192.168.1.227



Friday, August 26, 2016

Revert strip in Hg Mercurial

So you are using Mercurial version control system and Tortoise Hg as its windows GUI tool. And after you made changes you accidentally clicked "Modify History -> Strip",



So strip command  removed all your changes! Don't worry, there is a way to recover from this action and bring those changes back. Follow these steps:

1. For every strip action, the changes are backed up automatically to the "REPO/.hg/strip-backup". Open the backup folder and copy the latest modified file name.



2. Open Hg terminal by clicking Repository->Terminal.



3. Run this command: hg pull $(hg root)/.hg/strip-backup/$(backup file name)


    Voila! Here comes the changes back:








Friday, April 8, 2016

How To Clear Wifi Password






If you have trouble with changing wifi password and cannot find and option to forget or clear an old wifi password on windows 8, here is a simple solution:

1. Open command prompt screen by pressing windows + r and type "cmd" enter.
2. run this command (profilename is the name of the wifi):
    netsh wlan delete profile name='profilename'

Thats all! Now when you try to connect it will ask your key again.

Sunday, August 3, 2014

How To Host Your Domain in Azure VPS

Let's say we have a domain name www.damaturk.com and we want to host it in Azure VPS (Virtual Private Server). The steps are as follows:

1. Remote desktop to the Azure VPS.
Navigate to https://manage.windowsazure.com click Virtual Machines, click connect.



2. Open IIS Manager. Assuming that your web site related files are copied under C:\inetpub\wwwroot, add your web site under sites.


3. Right click on your site and click edit bindings.
Click Add, enter your domain name and choose the internal ip from the combo box, at the end you should have two rows one with www prefix and one without.


4. Open Azure management portal again, click your virtual machine and click Endpoints. Add a new end point with port 80.


5. Go to your domain registrar site, open Manage DNS or something similar to add or change A record.
Enter (A) records as seen below:



Thursday, June 21, 2012

T-SQL Reading Image Type into Varchar From Database


declare @hexbin varbinary(max);
declare @vbin varbinary(max);
declare @hexstring1 varchar(8000)


-- convert varbinary to hexstring
select @hexbin = Data1 from Table1;
select @hexstring1 = '0x' + cast('' as xml).value('xs:hexBinary(sql:variable("@hexbin") )', 'varchar(max)');

-- replace '000' to '0' three '0's mean enter character
select @hexstring1 = replace(@hexstring1, '000', '0')

-- convert hexstring to varbinary
select @vbin = cast('' as xml).value('xs:hexBinary( substring(sql:variable("@hexstring1"), sql:column("t.pos")) )', 'varbinary(max)')
from (select case substring(@hexstring1, 1, 2) when '0x' then 3 else 0 end) as t(pos)

-- cast varbinary as varchar
print cast(@vbin as varchar)