Wednesday, February 28, 2007

Install multiple versions of IE on your PC

Ever wanted to test your website in various versions of Internet Explorer?

It is possible to run Internet Explorer in standalone mode without having to over-write previous versions thanks to Joe Maddalone who came up with a way of achieving that in November 2003. Basically, Internet Explorer is run by exploiting a known workaround to DLL hell - which was introduced in Windows 2000 and later versions - called DLL redirection.

Manfred Staudinger perfected the standalone versions by adding IE version numbers to the title bar of the standalone browser window. Moreover, by removing the "IE" key in the registry subkey [HKLM\SOFTWARE\Microsoft\Internet Explorer\Version Vector] Internet Explore defaulted to respecting conditional comments based on the version number prebuilt in the program.

It is not difficult to follow the instructions and get any version of IE running in standalone along side other versions. Most of you probably know of evolt's archive of Internet Explorer which has them readily packaged in ZIP files. Now suppose you want to download them all. An installer that would conveniently automate the whole process would be great. Thanks to this comment for the idea.

Here is the installation which contains the versions 4, 5, 5.5 and 6/...besides the 7 running on my machine...

Link to multiple installer !!!

Yeyey!! the world is a democracy once again !!

Changing password on DRAC

I am trying to change a password on a DRAC using racadm and all I can come up with is the following command which works but only for the root id:

racadm config -g cfgUserAdmin -o cfgUserAdminPassword -i 1 password

Problem is I want/need to change about 2000 servers but it isn't the root ID's password that I need to change.

Lets say the ID was named testid how would you change it through the command line? Is it even possiable?

We delete the root ID for security purposes and if the root id is gone I get the following error:

racadm config: Transport: ERROR: objectIdSet. RC=15

Any ideas? When I find a command that works then my plans is simply to script it for the other 1999 servers

Thanks for any all help!


Figured it out and WOW I am unhappy that it seems you can only do it by the number assoicated to the ID in when it was created.

So basically if it is ID 2 then you use the following:

racadm config -g cfgUserAdmin -o cfgUserAdminPassword -i 2 mypassword

But the catch is with as many servers as I have I have no idea if #2 ID is the ID I need/want to change since some servers have more than 1 ID

Wish we could change it via the DRAC username instead of number and if there is a way to do it let me know

racadm getconfig -u

...will return the index number (-i #, in your command line above)

Tuesday, February 27, 2007

V for Vendetta effect

I just was changing the mcafee rules to make sure that the machine was more secure...and Volah..Learned two important things...

1. McAfee by default comes to lock down the port 25 for email...Ask people from my last office how much pain this has been for them...spent hours and hours pouring over php.ini to get the mails to go..when all along it was McAfee playing smartalec

2. You cannot and i repeat Cannot block downloads from world wide web unless you have a SUS set up in your network..WIndows update uses SVG to download the updates on your machine !!!

The windows security guide

Have you ever thought about living in a town full of bandits where the only protection between them and you was this one door...if the door breaks, the bandits gain control of your house and misuse it in every possible way.....

Scary ...aint it ?

Well...I have been having same feelings since the time I found out that I have to deploy this Windows 2003 server with only the Windows 2003 Firewall between this super beefy machine (7 73 Gig harddrives in RAID) and all the "evils" of the world !!!

So, I am going to do what every sensible person ever does...am going to finally sit down and read windows 2003 security guide by microsoft...Cover to cover and jot down the major points... this is a thick book and am NOT looking forward to reading it...

Microsoft is one of the most boring book publishers...

But then, they are also the most informative book publishers...

SO, here goes nothing !!!

Monday, February 26, 2007

If ASP.NET was a little eazier !!!!

ACL error ACL error...No where to go !!!

Uhmm I had these ACL errors continously...couldnt fix them at all

Got errors in the following order :-

1. ACL permissions - Checked all the permissions...For the hack of it, added ASPNET user to the administrators...But just wont work !!
2. "Failed to execute request because the App-Domain could not be created. Error: 0x80131902" - Reregistered .net framework 2.0
3. System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll' could not be found - Now wat !!!

Got no clue wat this file was...so, uninstalled the new framework by microsoft...thanks but no thanks..Billy !!!

And wolah !! the app seems to work !!

The issue the entire time was that NETWORK SERVICE account did not have write and modify access on the Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files folder...

Now, I can have a nice night of resting !! Finally !!!!

Registering ASP.NET in IIS

I've tripped over this issue a couple of times so I figure I'd offload it to my blog to free up some space in my head.


The short story:

If you've just installed a new web application to your IIS server and it uses ASP.NET and you're unable to view the web page (specifically you may instead be asked to save a file) then it may be because you need to (re)register ASP.NET with IIS.

You do so like this:

1. With a command window, get to the latest version of .net under
2. C:\Windows\Microsoft.Net\Framework\
3. Now run the following command: "net stop w3svc" to stop web services.
4. Then use "aspnet_regiis.exe -ua" to uninstall all instances of ASP.NET from IIS.
5. Follow with "aspnet_regiis.exe -i" to install ASP.NET into IIS.
6. Now restart web services with "net start w3svc".


You install the .NET Framework version x.y. However you didn't have IIS installed in Windows. Then you install a web application to your IIS server . Viewing the web app pages confusingly just doesn't work, dammit! Then you remember the magical register command and voila, birds start singing, sun beams out from behind the clouds and the world is a happy place once more. :)

MS have also documented the issue.

Friday, February 16, 2007

Sending Automated Job Email Notifications in SQL Server 2005 with SMTP

Sending Automated Job Email Notifications in SQL Server 2005 with SMTP




When you have automated backup jobs running on your database server, sometimes
you forget that they are even running. Then you forget to check to see if
they are running successfully, and don’t realize until your database
crashes and you can’t restore it since you don’t have a current
backup.


That’s where email notifications come in, so you can see the job status every
morning when you are sipping your coffee and pretending you are working.


SQL Server provides a built-in method of sending emails, but unfortunately
it requires you to have Outlook and a profile installed on the server, which
isn’t necessarily the ideal way to send an email. Thankfully there is
another method, that involves installing a stored procedure on your server
that will allow you to send email via SMTP.


Download
the sp_SQLNotify Stored Procedure here
.


You will want to edit one line in the stored procedure to put the IP address
of your SMTP server:



EXEC @hr = sp_OASetProperty @iMsg, ‘Configuration.fields(”http://schemas.microsoft.com/cdo/configuration/smtpserver”).Value’,
‘10.1.1.10′



Install the stored procedure into the master database, so it can be easily
used from wherever needed.


Open up the SQL Server Agent \ Jobs list, and select the properties for the
job you are trying to create a notification for:




Click on the Steps tab, and you should see a screen that looks like this:




Click the New button to create a new job step. We will use this step to send
the email notification on success.


Step Name: Email Notification Success


Enter this SQL into the Command window as seen below. You will want to customize
the email addresses and message subject to match your environment:



exec master.dbo.sp_SQLNotify ’server@localserver.com’,'admin@localserver.com’,'Backup
Job Success’,'The Backup Job completed successfully’




Click OK and then click the New button again to create another step. This
will be the failure notification step.


Step Name: Email Notification Failure


SQL:



exec master.dbo.sp_SQLNotify ’server@localserver.com’,'admin@localserver.com’,'Backup
Job Failure,’The Backup Job failed’



Now the idea is to make the items follow a specific workflow. First click
Edit on step 1, and set the properties as shown here:




What we are saying is that on success, go to the success step, and on failure,
go to the failure step. Pretty simple stuff.


Now edit the second step, the one labled “Email Notification Success”,
and set the properties as seen here:




We are saying that if the notification job is successful, then just quit
the job without running step 3. If we don’t specify this, then we will
end up getting two emails, one with success and one with failure.


Now edit the third step, the one labled “Email notification failure”,
and set the properties as seen here:


 


Now your job steps should look like this:




You should now have email notifications in your inbox for either success
or failure.


 


Note: The stored procedure used in this article was found here,
although that may not be the original source.


Download
the sp_SQLNotify Stored Procedure here
.


Friday, February 9, 2007

Entering data into a database

To enter data for a continent, change the code as follows:
using System;
using System.Data.SqlClient;

namespace CountriesStatistics
{
class Countries
{
static int Main()
{
string strContinent = null;
string strArea = null;
string strPopulation = null;

Console.Write("Enter the name of the continent: ");
strContinent = Console.ReadLine();
Console.Write("Enter the area of the continent: ");
strArea = Console.ReadLine();
Console.Write("Enter the population of the continent: ");
strPopulation = Console.ReadLine();

string strInsert = "INSERT INTO Continents VALUES('" +
strContinent +
"', '" + strArea +
"', '" + strPopulation + "');";
SqlConnection conDatabase = new
SqlConnection("Data Source=(local);Database='Countries3';Integrated Security=yes");
SqlCommand cmdDatabase = new SqlCommand(strInsert, conDatabase);

conDatabase.Open();

cmdDatabase.ExecuteNonQuery();
conDatabase.Close();

return 0;
}
}
}

Binding a datagrid to a two dimensional array

//
// 1. Create two dimensional array
//
const int dim = 1000;

double[,] array = new double[dim,dim];

Random ran = new Random();
for(int r = 0; r < dim; r++)
{
for(int c = 0; c < dim; c++)
{
array[r,c] = (ran.Next(dim)); // fill it with random numbers.
}
}

// 2. Create ArrayDataView class in which
// constructor you pass the array
// and assign it to DataSource property of DataGrid.

dataGrid1.DataSource = new ArrayDataView(array);

Exploding a string in C#

float val = 3.5f;
string strVal = val.ToString();
System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(@"\.");
string[] exploded = r.Split(strVal);

Netdrive troubles

Well I just found out that NetDrive is not a freeware regardless of how freely its available...

So, began the hunt for a NetDrive equivalent....Tried a lot of freewares and then, Woolah...out of blues came WebDrive...

Thats the software on which NetDrive is based !!!

Yuppie ...joy to the world...

Data Reader

The following sample code is called a DataReader. A foward-only, fast and efficient means of retrieving data.

<%@ Page language="c#" %>

<%@ Import Namespace="System.Data" %>

<%@ Import Namespace="System.Data.SqlClient" %>

<%@ Import Namespace="System.Configuration" %>

<SCRIPT language=C# runat="server">

void Page_Load(Object sender, EventArgs e)

{



SqlConnection myConnection;

SqlCommand myCommand;

SqlDataReader myDataReader;



myConnection = new SqlConnection(ConfigurationSettings.AppSettings["strConn"]);

myConnection.Open();


//prepare sql statements

myCommand = new SqlCommand("SELECT TOP 10 * FROM EMPLOYEE", myConnection);

myDataReader = myCommand.ExecuteReader();





while (myDataReader.Read())

{



Response.Write(myDataReader["fname"]);



//Spacing

Response.Write(" ");



Response.Write(myDataReader["minit"]);



//Spacing

Response.Write(" ");



Response.Write(myDataReader["lname"]);



//New Line

Response.Write("<br>");



}



//cleanup objects

myDataReader.Close();

myConnection.Close();





}




</SCRIPT>




Friday, February 2, 2007

tere bin saanu soniya...koi hor nayo labna

"Tere Bin" Lyrics

I had desperately been wanting the lyrics of Tere Bin by Rabbi Shergill .After Bulla ki jana, this is another beautiful song by Rabbi, written by himself.
Rabbi You Rock!
:)
So here go the Lyrics with The Translation:


tere bin / besides you
sanu sohnia / my love
koi hor nahio labhna / i shan't find another
jo dave / who'll give
ruh nu sakun / peace to my soul
chukke jo nakhra mera / and indulge me
ve main sare ghumm ke vekhia / i have gone and seen it all
amrika , roos, malaysia / america, russia, malaysiana
kittey vi koi fark si / there wasn't any difference
har kise di koi shart si / they all had some condition
koi mangda mera si sama / some asked for my time
koi hunda surat te fida / some were fascinated with my face
koi mangda meri si vafa / some demanded my fidelity
na koi mangda merian bala / none wanted my demons
tere bin / besides you
hor na kise / no one else
mangni merian bala / wanted my demons
tere bin / besides you
hor na kise / no one else
karni dhup vich chhan / shall shade me in the sun
jiven rukia / (the) way you paused
si tun zara / slightly
nahion bhulna / i shan't forget
main sari umar / all my life
jiven akhia si akhan chura / you said, looking away
"rovenga sanu yad kar" / "you shall weep in my memory"
hasia si main hasa ajeeb / i laughed a strange laugh
(par) tu nahi si hasia / but you didn't
dil vich tera jo raaz si / you had a secret in your heart
mainu tu kyon ni dasia / why didn't you tell me
tere bin / besides you
sanu eh raz / none shall tell this
kise hor nahion dasna / secret to me
tere bin / besides you
peerh da ilaaj / what druid
kis vaid kolon labhna / has the cure to my ills
milia si ajj mainu / i found today
tera ik patra / a note of yours
likhia si jis 'te / on which you had scribbeled
tun shayr varey shah da / a varis shah couplet
park ke si osnu / upon reading which
hanjnu ik duliya / a teardrop fell
akhan 'ch band si / what was locked in the eye
seh raaz ajj khulia / was revealed today
ki tere bin / that other than you
eh mere hanjnu / these tears of mine
kise hor / won't be kissed by
nahio chumna / none else
ki tere bin / that other than you
eh mere hanjhu / these tears of mine
mitti vich rulnha / will wither in the dust

Well, people it is for everyone who wanted this song, enjoy , its an amazing track!