Tuesday, June 17, 2014

OSS and BSS

All fixed and mobile telecommunications service providers have physical equipment with embedded software that enable them to offer services. Beyond this embedded network software, there are two other kinds of software that are critical to a service provider's day-to-day business: business support systems and operations support systems.

BSS (Business Support System) software applications are used by operations, customer care, and other functional groups to manage business operations focusing on external business such as billing, rating, sales management, customer-service management and customer databases.

OSS (Operations Support System) software applications allow operations and IT personnel to administer the operational processes focusing on the network and services, including service quality monitoring, network and server performance, logical and physical resources management (also referred to as element and network management), and provisioning.

OSS and BSS are the foundation of a service provider's business. They enable telecom service providers to manage their networks, their business and their customer relations. Furthermore, they are a key part of the Service Delivery Environment (SDE), enabling service providers to deploy advanced IMS, IPTV, Web or "blended" services to their customers.

Friday, January 17, 2014

“This SqlTransaction has completed; it is no longer usable.”

Look for possible areas where the transaction is being committed twice (or rolled back twice, or rolled back and committed, etc.). Does the .Net code commit the transaction after the SP has already committed it? Does the .Net code roll it back on encountering an error, then attempt to roll it back again in a catch (or finally) clause?
It's possible an error condition was never being hit on the old server, and thus the faulty "double rollback" code was never hit. Maybe now you have a situation where there is some configuration error on the new server, and now the faulty code is getting hit via exception handling.

The following example creates a SqlConnection and a SqlTransaction. It also demonstrates how to use the BeginTransaction, Commit, and Rollback methods. The transaction is rolled back on any error. Try/Catch error handling is used to handle any errors when attempting to commit or roll back the transaction.
private static void ExecuteSqlTransaction(string connectionString)
{
    using (SqlConnection connection = new SqlConnection(connectionString))
    {
        connection.Open();

        SqlCommand command = connection.CreateCommand();
        SqlTransaction transaction;

        // Start a local transaction.
        transaction = connection.BeginTransaction("SampleTransaction");

        // Must assign both transaction object and connection 
        // to Command object for a pending local transaction
        command.Connection = connection;
        command.Transaction = transaction;

        try
        {
            command.CommandText =
            "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')";
            command.ExecuteNonQuery();
            command.CommandText =
            "Insert into Region (RegionID, RegionDescription) VALUES (101, 'Description')";
            command.ExecuteNonQuery();

            // Attempt to commit the transaction.
            transaction.Commit();
            Console.WriteLine("Both records are written to database.");
        }
        catch (Exception ex)
        {
            Console.WriteLine("Commit Exception Type: {0}", ex.GetType());
            Console.WriteLine("  Message: {0}", ex.Message);

            // Attempt to roll back the transaction. 
            try
            {
                transaction.Rollback();
            }
            catch (Exception ex2)
            {
                // This catch block will handle any errors that may have occurred 
                // on the server that would cause the rollback to fail, such as 
                // a closed connection.
                Console.WriteLine("Rollback Exception Type: {0}", ex2.GetType());
                Console.WriteLine("  Message: {0}", ex2.Message);
            }
        }
    }
}

Wednesday, January 8, 2014

How to limit the text in a label using asp.net c#

Lets say we are having label as below.
<asp:Label CssClass="ShortDesc" Text='<%# Eval("NewsDescription")%">' runat="server""></asp:Label">
By Using CSS
.ShortDesc{ height:50px; Overflow:hidden; }
OR restrict to 100 or N characters
<asp:Label CssClass="ShortDesc" Text='<%# Eval("NewsDescription").ToString().SubString(0,Math.Min(100,Eval("NewsDescription").ToString().Length)) %">' runat="server""></asp:Label">
OR return a Short Desc from your DB SELECT substring(NewsDescription,1,100)+'...' AS ShortNewsDescription, NewsDescription From Jobs
And use that in your repeater <asp:Label CssClass="ShortDesc" Text='<%# Eval("ShortNewsDescription")%">' runat="server""></asp:Label">

Sunday, February 26, 2012

ASP .Net Form Authentication mode setting in Webconfig

<authentication mode="Forms"&gt
<forms defaultUrl="Default.aspx" loginUrl="Login.aspx" protection="All" timeout="180"&gt</forms&gt
</authentication&gt
<authorization&gt
<deny users="?"/&gt


</authorization&gt

Saturday, August 13, 2011

Regional settings IIS6 and ASP.Net 2

Issue
1. {0:c} returning too many decimals in gridview
2. {0:d dd/MM/yyyy} returning date with time values
Ex: 12/12/2012 00:00:00

Solution
I solved this problem by installing service pack 2 of ASP.Net 2.0 - after the reboot, the grid worked fine with {0:C} and {0:d}
This problem would have fixed itself in the production environment as it will be set to update automatically. Recently I got the new machine and the firewall seems to be restricting the updates.


Lesson learned: always make sure that all your server software is up to date!


Saturday, June 25, 2011

Compute the total and display it in GridView footer.

There are various way to calculate total in tht GridView Footer. But this method is for simple and easiest way to calculate.

<%@ Page Language="C#"%>
<%@ Import Namespace="System.Collections.Generic"%>
<script runat="server">

private decimal amountSum;

protectedvoid Page_Load(object sender, EventArgs e)
{
List<account> data =new List<account>();
data.Add(new Account("Tom",12002));
data.Add(new Account("Sam", 8900));
data.Add(new Account("Harry", 15558));

gridView.DataSource = data;
gridView.DataBind();
}

string incrementSum(decimal amount)
{
amountSum += amount;
return"";
}

public class Account
{

public Account(string name,decimal amount)
{
this.name = name;
this.amount = amount;
}

privatestring name;
private decimal amount;

public decimal Amount
{
get { return amount; }
set { amount = value; }
}

publicstring Name
{
get { return name; }
set { name = value; }
}

}

</script>
<html>
<head id="Head1" runat="server">
<title>GridView Summary</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView runat="server" ID="gridView"
AutoGenerateColumns="false" ShowFooter="True">
<Columns>
<asp:TemplateField HeaderText="#">
<ItemTemplate>
<%# Container.DataItemIndex + 1 %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<%# Eval("Name") %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Amount">
<ItemTemplate>
<%# Eval("Amount","{0:c0}") %>
<%# incrementSum((decimal)Eval("Amount")) %>
</ItemTemplate>
<FooterTemplate>
<%# amountSum.ToString("c0") %>
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>


Wednesday, June 22, 2011

Export a DataTable to Excel in ASP.NET

All spreadsheet applications (Excel, Calc etc.) understand semicolon separated files natively, so everyone can use this method – you don’t even have to use Excel for it to work.

public static void ExportToSpreadsheet(DataTable table, string name)
{
HttpContext context = HttpContext.Current;
context.Response.Clear();

foreach (DataColumn column in table.Columns)
{
context.Response.Write(column.ColumnName + ",");
}
context.Response.Write(Environment.NewLine);

foreach (DataRow row in table.Rows)
{
for (int i = 0; i < table.Columns.Count; i++)
{
context.Response.Write(row[i].ToString().Replace(",", string.Empty) + ",");
}
context.Response.Write(Environment.NewLine);
}

context.Response.ContentType = "text/csv";
context.Response.AppendHeader("Content-Disposition", "attachment; filename=" + name + ".csv");
context.Response.End();
}

Then just call this method and pass the DataTable and the filename as parameters.

ExportToSpreadsheet(table, "products");

The method is static so you can use it anywhere in a web application. Put it on a page, a HTTP Handler, add it to the App_Code folder or stick it in a separate assembly. As long as you call it from a web application it will work.

Tuesday, June 21, 2011

Get current page name from URL

This function can be used to retrieve the current page name from the URL:
name, i.e default.aspx, hello.aspx or whatever.

public string GetCurrentPageName()
{
string sPath = System.Web.HttpContext.Current.Request.Url.AbsolutePath;
System.IO.FileInfo oInfo = new System.IO.FileInfo(sPath);
string sRet = oInfo.Name;
return sRet;
}

By going through System.Web.HttpContext.Current object we are able to have this function in a generic dll or class - and not in each and every page needing to call it.


Tuesday, June 7, 2011

Microsoft Internet Information Services versions 4.0 to 6.0

Open Internet Service Manager or Internet Information Services (IIS) Manager.
If necessary, expand the Web server that you want, and then expand Web Sites.
Right-click the Web site that you want to change.
Click Properties.
Click the Web Site tab.
Change the TCP Port Number in the TCP Port edit box (or click Advanced for multiple Port settings).
Click OK to save the changes.

Microsoft Internet Information Services 7.0

Open Internet Information Services (IIS) Manager.
Select the Web site that you wish to configure.
In the Action pane, click Bindings.
Click Add to add a new site binding, or click Edit to change an existing binding.

Click OK to apply the changes.

Tuesday, May 31, 2011

Make IE7 open pop-ups in a new tab

Tabs are one of the best new features in Internet Explorer 7. I like them because they keep my task bar clean of extra Internet Explorer instances. The only problem I have is with pop-ups that are on my allow list such as when I write a new message in Outlook Web Access.

Follow these steps to configure Internet Explorer 7 to always open up pop-ups in a new tab instead of a new browser window:

1.While IE7 is running, click on Tools and select Internet Options.
2.On the General tab under the Tabs section hit Settings.
3.Under the When a pop-up is encountered section, select Always open pop-ups in a new tab. I also like using the Let Internet Explorer decide how pop-ups should open option because of some web sites I visit.
4.Hit OK and you are finished.


Display Images with IIS7 in Vista or Windows 2008

So, this may seem simple, but for an hour I wrestled with displaying images on IIS7 with vista. ASP.NET worked fine, but no static files, css, jpg’s, gif’s or anything. Just unformatted text.

Turns out when I added the web server in vista, I forgot to check the Static Content checkbox under World Wide Web Services / Common Http Features.

Hope this finds you if you are having the same problem.



















For other non-Vista users, here’s how you find that dialog:

Click Start -> Control Panel -> Programs and Features -> Turn Windows features on or off

Then drill down into IIS as shown in the image above.


Error code 2869 with Vista and Windows 2008

These are the steps to solve the above mentioned problems:

1) Copy the .MSI file to the root directory of your main hard drive (i.e. C:\).
2) Open Windows Notepad.
3) Copy this text into windows notepad:
msiexec /i C:\program_name.msi
(You can write the total path of your .msi file in the system, after msiexec /i.)
4) Replace the text "program_name" in the code that you copied with the actual name of the .MSI file.
5) Click File -> Save As...
Instead of saving it as a .txt file, change the file name to installer.bat.
Save the file to your desktop.
6) On your desktop, right click on the file and select Run as Administrator.


This will run the .msi file properly to install the application in the system.

Sunday, May 29, 2011

Gridview fixed header

<%@ Page Language="VB" AutoEventWireup="False"
EnableSessionState="true" EnableViewState="False" %&gt
<%@ Import Namespace="System.Data" %&gt
<%@ Import Namespace="System.Data.Odbc" %&gt
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt
<script language ="vbscript" runat ="server" &gt
</script&gt
<html xmlns="http://www.w3.org/1999/xhtml" &gt
<head runat="server"&gt
<title&gtUntitled Page</title&gt
<style type ="text/css" &gt
.gridHeader
{
POSITION: relative;
/*IE5+ only*/
top: expression(parentNode.parentNode.parentNode.parentNode.scrollTop-2);
left:expression(parentNode.parentNode.parentNode.parentNode.scrollLeft);
z-index: 99;
}
</style&gt
</head&gt
<body&gt
<form id="form1" runat="server"&gt
<div&gt
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionStringcountrystate %&gt"
ProviderName="<%$ ConnectionStrings:ConnectionStringcountrystate.ProviderName %&gt"
SelectCommand="select * from gd_master"&gt</asp:SqlDataSource&gt
<asp:Panel ID="Panel1" runat="server" Height="280px" Style="z-index: 100; left: -82px;
overflow: auto; position: absolute; top: 54px" Width="1537px"&gt
<asp:GridView ID="GridView2" runat="server" BackColor="#CCCCCC" BorderColor="#999999"
BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2"
DataSourceID="SqlDataSource1" ForeColor="Black" Height="210px"
Style="z-index: 135; left: 80px; position: absolute; top: -3px" Width="279px"&gt
<FooterStyle BackColor="#CCCCCC" /&gt
<Columns&gt
<asp:CommandField ShowSelectButton="True" /&gt
</Columns&gt
<RowStyle BackColor="White" /&gt
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" /&gt
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" /&gt
<HeaderStyle BackColor="Black" CssClass="gridHeader" Font-Bold="True" ForeColor="White" /&gt
</asp:GridView&gt
</asp:Panel&gt
</div&gt
</form&gt
</body&gt

</html&gt

Saturday, April 23, 2011

IE 8: X-UA-Compatible doesn´t work?

Add the following line as a
first child of your HEAD element.

< meta http-equiv="X-UA-Compatible" content="IE=7" />


Monday, March 15, 2010

50 Worst of the Worst (and Most Common) Job Interview Mistakes

You may have heard the horror stories--job hunters who take phone calls or text during an interview, or bring out a sandwich and start chomping, or brush their hair, or worse. You wouldn't do any of those things, would you? Of course not.

But there are tons of other job interview no-no's you may not have thought of. Or that you've forgotten. The job hunting trail is long and arduous, and a little refresher course can't hurt. So for your edification and enjoyment, here are 50 of the worst and most common job interview mistakes:

1. Arriving late.
2. Arriving too early.
3. Lighting up a cigarette, or smelling like a cigarette.
4. Bad-mouthing your last boss.
5. Lying about your skills/experience/knowledge.
6. Wearing the wrong (for this workplace!) clothes.
7. Forgetting the name of the person you're interviewing with.
8. Wearing a ton of perfume or aftershave.
9. Wearing sunglasses.
10. Wearing a Bluetooth earpiece.
11. Failing to research the employer in advance.
12. Failing to demonstrate enthusiasm.
13. Inquiring about benefits too soon.
14. Talking about salary requirements too soon.
15. Being unable to explain how your strengths and abilities apply to the job in question.
16. Failing to make a strong case for why you are the best person for this job.
17. Forgetting to bring a copy of your resume and/or portfolio.
18. Failing to remember what you wrote on your own resume.
19. Asking too many questions.
20. Asking no questions at all.
21. Being unprepared to answer the standard questions.
22. Failing to listen carefully to what the interviewer is saying.
23. Talking more than half the time.
24. Interrupting your interviewer.
25. Neglecting to match the communication style of your interviewer.
26. Yawning.
27. Slouching.
28. Bringing along a friend, or your mother.
29. Chewing gum, tobacco, your pen, your hair.
30. Laughing, giggling, whistling, humming, lip-smacking.
31. Saying "you know," "like," "I guess," and "um."
32. Name-dropping or bragging or sounding like a know-it-all.
33. Asking to use the bathroom.
34. Being falsely or exaggeratedly modest.
35. Shaking hands too weakly, or too firmly.
36. Failing to make eye contact (or making continuous eye contact).
37. Taking a seat before your interviewer does.
38. Becoming angry or defensive.
39. Complaining that you were kept waiting.
40. Complaining about anything!
41. Speaking rudely to the receptionist.
42. Letting your nervousness show.
43. Overexplaining why you lost your last job.
44. Being too familiar and jokey.
45. Sounding desperate.
46. Checking the time.
47. Oversharing.
48. Sounding rehearsed.
49. Leaving your cell phone on.
50. Failing to ask for the job.

Monday, February 22, 2010

Redirecting an HTTP Request to HTTPS

Navigating between the public and restricted areas of your site (that is, between HTTP and HTTPS pages) is an issue because a redirect always uses the protocol (HTTPS or HTTP) of the current page, not the target page.

After a user logs on and browses pages in a directory that is secured with SSL, relative links such as "..\publicpage.aspx" or redirects to HTTP pages result in the pages being served using the HTTPS protocol, which incurs an unnecessary performance overhead. To avoid this, use absolute links such as "http://servername/appname/publicpage.aspx" when redirecting from an HTTPS page to an HTTP page.

Similarly, when you redirect to a secure page (for example, the logon page) from a public area of your site, you must use an absolute HTTPS path, such as "https://servername/appname/secure/login.aspx" instead of a relative path, such as "restricted/login.aspx." For example, if your Web page provides a logon button, use the following code to redirect to the secure login page.

Copy Code
private void btnLogon_Click( object sender, System.EventArgs e )
{
// Form an absolute path using the server name and v-dir name
string serverName =
HttpUtility.UrlEncode(Request.ServerVariables["SERVER_NAME"]);
string vdirName = Request.ApplicationPath;
Response.Redirect("https://" + serverName + vdirName +
"/Restricted/Login.aspx");

}

Sunday, February 21, 2010

Usb flash drive icon changes into folder icon

This issue may have resulted from a virus infection on the machine the drive was plugged into.

You’ll need to delete the file autoruns.inf located on your flash drive.

By default, Windows hides this file, so before you can delete it you must make a couple of changes (you may reverse these after you’ve finished):

Open My Computer
Tools
Folder Options…
Click on the View tab
Under “Hidden files and folder” choose “Show hidden files and folders”
Remove the tick from “Hide protected operating system files (Recommended)
OK

Go back to My Computer and click on your flash drive. If you can’t open it that way, try right clicking on it and choose “Explore.”

Find the autoruns.inf file, right click on it and choose “Delete.” Confirm “Yes.”

Unplug and re-plug the drive in. You should be back to normal.


Hope that helps.

Thursday, December 24, 2009

How to update an xml file with XmlDocument

Used Classes
XmlDocument
XmlNodeList

Before running the code our xml looks like this:

<?xml version="1.0" encoding="utf-8"?>
<CategoryList>
<Category ID="01">
<MainCategory>XML</MainCategory>
<Description>This is a list my XML articles.</Description>
<Active>true</Active>
</Category>
</CategoryList>

After running the code our xml becomes this:

<?xml version="1.0" encoding="utf-8"?>
<CategoryList>
<Category ID="01">
<MainCategory>ASP.NET</MainCategory>
<Description>This is now my ASP.NET list.</Description>
<Active>false</Active>
</Category>
</CategoryList>

The code which does that looks like this:

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Xml" %>
<%@ Page Language="C#" Debug="true" %>

<script runat="server">
void Page_Load(object sender, System.EventArgs e){
if(!Page.IsPostBack){
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(Server.MapPath("categories.xml"));

XmlNodeList nodeList = xmlDoc.SelectNodes("/CategoryList/Category[@ID='01']");

// update MainCategory
nodeList[0].ChildNodes[0].InnerText = "ASP.NET";
// update Description
nodeList[0].ChildNodes[1].InnerText = "This is now my ASP.NET list.";
// update Active
nodeList[0].ChildNodes[2].InnerText = "false";

// Don't forget to save the file
xmlDoc.Save(Server.MapPath("categories.xml"));
Response.Write("XML File updated!");
}
}

</script>