Wednesday 14 September 2011

Query to find all the dependent tables in Oracle

I was trying to find a easy query to get the list of tables that are dependent on a given table. I developed a query, that will give the chain of dependencies.
SELECT ac2.table_name,
  Ac1.Table_Name AS Referenced_Table,
  ac2.u_level
FROM all_constraints ac1,
  (SELECT Constraint_Name,
    Table_Name,
    R_Constraint_Name,
    level AS u_level
  FROM All_Constraints
  WHERE Constraint_Type              = 'R'
    START WITH Table_Name            = :r_table_name
    CONNECT BY Prior Constraint_Name = R_Constraint_Name
  ) Ac2
WHERE Ac1.Constraint_Name = Ac2.R_Constraint_Name
ORDER BY u_level,
  ac2.table_name,
  ac1.table_name

Thursday 4 August 2011

ASPX page continuously asks for credentials.

I came across the error The type initializer for 'System.Management.Automation.Runspaces.InitialSessionState' threw an exception. when trying to compile the c# in ASP.NET code using Visual Studio.

Solved
Open Control Panel > Install / Uninstall Programs > .NET 3.5 SP1 > Repair

Monday 11 July 2011

Microsoft Windows 7 : Screen Savers dropdown disabled (or grayed)

I wanted to edit the screensaver on my machine. I have windows 7 installed. I navigated to Control Panel > Appearance and Personalization > Personalization > Change Screen Saver
The 'Screen Saver' dropdown appeared to be disabled (or grayed) with 'None' selected.

Solved:
  1. Open regedit.exe
  2. Go to HKEY_CURRENT_USER > Software > Policies > Microsoft > Windows > Control Panel > Desktop
  3. Right-click SCRNSAVE.EXE and select Delete.

Friday 8 July 2011

An error occured in avast! engine: Invalid argument

I recently installed Avast4Workstation in my laptop running Ubuntu 10.10. The avast engine was able to do a complete scan of my system. After that I decided to fetch latest updates for avast and clicked 'Update database' in the GUI. After the update happened, the avast will not open, but shows the error message

An error occurred in avast! engine: Invalid argument

Solved:
In older kernels the maximum size of SHM block was limited to a certain number of bytes, that is being exceeded by the database. We need to increase the size of the SHM block to accommodate the large database
The command to be executed in the terminal is as follows. When executing the command it will ask for the root password.
sudo sysctl -w kernel.shmmax=128000000
The above command provided me with a temporary solution to the problem I was facing. After I restarted my machine, if I wanted to open avast, I had to type the command again. To get away with this, there is another way.

Add the line kernel.shmmax = 128000000 to the bottom of the sysctl.conf text file.
How to update the sysctl.conf file:
  1. Go to 'etc' folder, select sysctl.conf file
  2. With the sysctl.conf file selected, press Alt + F2. This will open the 'Run application' dialog
    1. Type gksu gedit
    2. Add kernel.shmmax = 128000000 to the file and save

Tuesday 5 July 2011

Get assembly fully qualified name

While doing development it has occurred to me many times how to get the assembly name easily of a dll(that is strong named). The normal approach is to create it manually from the properties of the dll file.

I would like to share with you a very eazy way to get the fully qualified assembly name using Visual Studio. It uses the external tools feature of Visual Studio.

  1. Open Visual Studio
  2. Go to Tools –> External Tools
  3. Click on "Add" to add a tool, and put in the following values:
    1. Title: Get Qualified Assembly Name
    2. Command: Powershell.exe
    3. Arguments: -command "[System.Reflection.AssemblyName]::GetAssemblyName(\"$(TargetPath)\").FullName"
    4. Check "Use Output Window". All other checkboxes should be unchecked
The new tool appears under Tools –> Get Qualified Assembly Name.

When this menu item is selected, the assembly name is given in the output window.
It should look like HelloWorld, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b2135059549c7590

Wednesday 29 June 2011

Backup a file using powershell script

Some critical files that I modify each day had to be backed up to a secure location, in case the file gets corrupted I can go to the archive and get the most recent backup.

I created a powershell script to do this. The script is pasted below.
#file name backup.ps1
$PathToGoalsSheet="C:\preformancereports\Akshay"
$FileToBeBackedUp="Goals.xlsx"
$BackupPath="D:\myComany\Dept\Backup"
$TodaysDateFormatted = Get-Date -format dd.MM.yyyy.HH.mm.ss
$BackupFolderName=[string]::Format("{0}.backup",$TodaysDateFormatted)
#Write($BackupFolderName)
if(Test-Path $PathToGoalsSheet)
{
if(Test-Path $PathToGoalsSheet\$FileToBeBackedUp)
{
Write("Creating folder ["+$BackupFolderName+"]...")
New-Item $PathToGoalsSheet\$BackupFolderName -type directory
Write("Copying File ["+ $FileToBeBackedUp +"] into ["+$BackupFolderName+"]...")
Copy-Item "$PathToGoalsSheet\$FileToBeBackedUp" "$BackupPath\$BackupFolderName"
}
else
{
Write("Could not find file ["+ "$PathToGoalsSheet\$FileToBeBackedUp" +"]!")
}
}
else
{
Write("The path ["+$PathToGoalsSheet+"] does not exist!")
}

The command to run this script file, I typed in a batch file (.bat), so I can run the powershell file (or schedule a task to run the batch file on a daily basis). The code in the batch file is as given below.

rem file name backup.bat
@echo off
set scriptHomePath=C:\PowerShell Scripts\
set backupFileScript=%scriptHomePath%backup.ps1
powershell -NoLogo -File "%backupFileScript%"

Thursday 23 June 2011

Calendar Active Exchange Sync on Android : Client/server conversion error

I happened to edit one of the occurences of a recurring meeting, in my mobile's calendar. My mobile is having Android Froyo (Android 2.2). After editing, I connected my phone to wifi and tried to sync the calendar. But when I tried to sync, the calendar will not successfully sync, but shows the error "Client/server conversion error".

This is how I solved the problem:
  1. In my phone, I navigated to Settings > Applications > Manage Applications. Selected 'All' tab which shows all the applications.
  2. After that I scrolled to Calendar in the list I did the following
    1. Seleted and opened the Calendar from the list.
    2. Clicked on 'Clear Data'.
  3. I repeated steps above 2(a) and 2(b) for 'Calendar Storage', 'Calendar Sync Adapter' & 'Calendar Widget' in the list of applications, that I had opened in step 1.
  4. I clicked the 'Home' button on my phone to go to the home screen. Then again navigated to Settings > Accounts & Sync > Exchange ActiveSync.
    1. Unchecked 'Sync calendar'
    2. Clicked 'Sync now' (synced Mail & Contacts only)
    3. Checked 'Sync calendar'
    4. Clicked 'Sync now' again. (synced Mail, Calendar & Contacts)
The error has never come back again.

But not sure why a calendar item if I modify in my phone cannot be synced to the calendar in the exchange server.

Thursday 16 June 2011

Adverts display products related to my recent views - Or "Ad that follow me"

I was initially surprised to see that the adverts displayed in some of the pages were related to products I had searched previously in some retail websites. I wondered how the ad could show the exact product I had viewed a few days ago. Sooner I noticed a small 'i' symbol in the right bottom corner which showed the message 'Would you like to learn more about why you are seeing this ad?'. I followed the link and finally disabled the ads that follow me. :-)

It was nice of criteo to provide a guide to disable the feature. Here is the link to disable the feature.

https://extranet.criteo.com/resources/docs/Process to block Criteo banner via Browser Options.pdf

Tuesday 24 May 2011

VM Player - Disk space - Shrinked

The disk files created for the Virtual machine in my PC constantly grew in size until the whole of the host drive was used up.

I could not possibly find what would have gone wrong, because inside the virtual machine, the disk space utilized was not compensating to the usage of the host disk space usage.

Things I have done to get the disk space usage within limit.
  1. Open VM Player, select the virtual machine, Click Edit Virtual Machine Properties.
    • Select the disk drive and from the utilities dropdown list select "Defragment Disk"
  2. After starting the virtual machine, open the VM tools and go to "Shrink", select the disks to shrink and shrink.
    • Problem I faced while shrinking was, there should be enough space available in the host drive for the shrink to happen.

Sunday 22 May 2011

Video/Audio Problem - Google Talk

I was not aware about how to change the camera/microphone options in google talk. Because of this, even if I plug-in my USB webcam in my laptop, I wasn't able to use it, but google talk was only detecting the integrated laptop webcam.

Recently I found in google support forum, that the settings can be changed to configure the camera and microphone.

How I did it is, in gmail go to Settings > Chat.

Make necessary changes in the set of available devices and click Save.

Bingo!

Tuesday 17 May 2011

VM Player - Freeze Intermittently - Problem

For the past couple of days the VM player that I am using was getting frozen for 15-20 seconds. This occurred at a frequency of 1 Hr everyday. I did not have any idea what had gone wrong, until I noticed the previous week the LAN configuration at my work had changed. It gave me a clue that the problem is due to the network, but why is my VM player in need of a network connection, when all I need to access resources locally.

I started troubleshooting the issue, around the clue that the VM player needs network access, but what for I was not clear. Some of the candidates that were considered for further investigation were
Local Folder Map
Internet Access

The local folder map was stroked off from the list as I found it did not have anything to do with the recent LAN change.

The next candidate was Internet Access, and it was the right candidate to put my effort to find the root cause of the problem. In the preferences of the VM Player, I had opted for software updates. I unchecked the checkboxes that made the VM player to check for updates and finally the VM player performance problem was fixed.

Ubuntu 11.04 - Slower like Windows

I have been using Ubuntu 10.10 for a while and literally never logged into the other OS installed on my laptop(windows Vista) for quite some time. Ubuntu 10.10 was very pleasing in terms of speed, stability and UI.

When the beta release of Ubuntu 11.04 was available I could not stop myself from upgrading. I had to downgrade the OS within a few days to Ubuntu 10.10 because of the performance problems in WiFi connection. I am looking forward for the Ubuntu 11.04 to be stable and faster, to upgrade the OS on my laptop.

The UI changes in the latest release is a very good improvement from the previous version. That is the feature I liked the most in Ubuntu 11.04.

Friday 15 April 2011

Proxy id password save in mozilla solved

1. Start Firefox
2. In Address bar write "about:config"
3. In filter write network.auth.use-sspi
4. Double click on "true" and it should become "false"