RSS

PDB Files: What Every Developer Must Know

Wed, May 13, 2009

0 Comments

This is just a link post for the post below:

PDB Files: What Every Developer Must Know

This Morning Merill  twitted a link on his twitter, for this valuable post about PDB Files by John Robbins. honestly I didn’t know much about the importance of PDB files until I read this. 

I  think each .Net Developer must read the post here.

Thanks Jhon For the information, and merill for sharing this :) .

Popularity: 7% [?]

Continue reading...

AirTel Sri Lanka – HSDPA a Fake Promise

Thu, Apr 30, 2009

25 Comments

Well I just don’t want to write a review on a network provider in a blog dedicated for .net programming, but I think its a MUST to write, so that my readers, and friends are aware of the problem with Airtel HSDPA Data Connection.

Well here are the specs and packages for their data connection Airtel provided:

Package Details:

Limited: 1 GB for Rs.300 + Tax
3 GB for Rs.600 + Tax

Unlimited: for Rs.1499 + Tax

Tax rates:

VAT (Value Added Tax) = 16.67%
MSL (Mobile Subscriber Levy) = 11.11%
ECL (Environmental Subscriber Levy) = 2%
Total: 29.78%

Do they offer promised speed?

This a question that there is no direct answer, for the unlimited package they said they offer 3.2mbps (409.6KB/s) As far as I know, people experience around 100 – 250Kb/s!

Is there any limits like Fair User Policy?
No, Its 100% unlimited

I Purchased the Unlimited Package, and the much hyped First month the connectivity was ok, connecting around 320 KB/s , but from february 2009, the culprit shows its real face. the connection is as low as 13 KB/s (yeah i understand as slow as the dialup connections in old days). i called their customer care service and the only reply i got from them is this :

“I’m very sorry for the inconvenience caused sir, but we are doing some upgrade process these days, and it will be fixed very soon”

Poor me, believed them, and until this moment I’m writing this post, the connection wasn’t  fixed. i have called them with patience several times, and all the times I’ve got various responses from the customer care agents who had very less knowledge on the technology, which is irrelevant to the issue, and one of them were not at all caring what the customers problem was. most of the time the agents said their superior will call me back on the next morning, and non of the called me, and whatever the complaint numbers they give me is closed by them without resolution each time, whenever i call and ask about the complaint number. the above quoted text is the answer. one of them mentioned that the entire Internet is only 1MB/s and their connectivity is 3.2 MB/s . and the Internet is slow because its slower than their connectivity!?? . i hope non of you techies and geeks will agree with this (yeah can see some of you laugh ROFL) .

One Airtel agent mentioned that their ISP’s are full and needs time to upgrade, yeah its understandable, but is that a problem for a consumer who still pays the full amount for the service? we can bare with this for a week or two, but more than a month, ARE YOU KIDDING ME? . they should have planned well and done these to handle the amount of users, now their are doing their maintenance with the cost of many users money, and time.

Another thing i found with them is that a single connection through Internet download Manager was connecting around 13-20 KB/s , even to download a 10 MB file i had to wait more than 20 minutes, and also if i tried a concurrent download of 10 files at the same time, and each file was downloading in that speed, consuming a total bandwidth of 1MB or more. and non of the agents were able to explain me why is this happening.

And frustrated me, sent an email about this problem to 555@airtel.lk which is their customer care email, and is said that it will be responding within few days, responded after 14 days i sent the email, with the following reply. see how responsible Airtel is about their customer problems.

Capture

Yeah they sent an email on 23rd of April saying that the issue will be resolved on  17th of April 2009, as per to my knowledge 17th comes before 23rd not after right?, correct me if I’m wrong guys ROFL.  and when i just called them and asked about this, guess what again the reply was the above quoted text, and a silence (poor agents I’m sure its not their faults, but they are the person we can communicate to Airtel right), and again the issue was never solved!?.

I think if Airtel is willing to maintain the hype it made when it launched in Sri Lanka, and the Reputation of Airtel Organization, it needs to consider about waiving off the monthly charge they charged for the month cycles March, and April from their data package customers, Isn’t it unfair to charge the customer for their mistakes, and for a service which didn’t serve its promise???

Friends in Sri Lanka, think twice before you select this Data connection, it might look like wonder when you start using it initially, but its NOT!!!!. its just an ILLUSION. I’m just posting this because i don’t want any of you guys to waste your valuable time, and money with a bad service which i experienced.

I think i would rather upgrade my DSL line with the SLT, rather than wasting my time with Airtel Anymore. even though DSL was slower than 3.2 MB/s, it never failed its promised bandwidth!!.

And my Final verdict:

Airtel HSDPA Data Connection = a Fake Promise

P.S : oh yeahh i just found that they’ve (Airtel)  removed the data connection details from their website. ;)

Popularity: 15% [?]

Continue reading...

ASP.Net 3.5 ListView Control and Book Flip effect

Thu, Apr 16, 2009

3 Comments

one of the coolest control in ASP.Net 3.5 is its Listview Control. its too CSS friendly, and we can use it to achieve many great content presentations. if you go to scottgu’s blog you can find some good articles on how to use the listview control.

recently I did such an implementation. its using the javascript bookflip. a great work by Will (very kind of him to share this to the world). I used the his code, and ListView to achieve a dynamic bookflip.  apart from the javascript changes,  here is the change I did for the Listview markup.

 
 
 <asp:ListView id="ImageFlip" runat="server" ItemPlaceholderID="ItemContainer">
   <LayoutTemplate>
      <div id="myBook" style="width: <%# flipWidth*2 %>px; height:
 <%# flipHeight %>px; position: relative; z-index: 5;">
        <asp:PlaceHolder ID="ItemContainer"  runat="server" />
        <div style="border: 0px solid #ddd;
    text-align: center;
    padding-top: 100px;
    margin: 0px;
    height: 0px;
    text-align:inherit;
    background-color: #ffffff;
 color: #cf0000;vertical-align:bottom" Name="Back" > 
<img src="spongebob300/bk.jpg"  border="0" usemap="#Map" />
</div>

      </div >
   </LayoutTemplate>
   <ItemTemplate>

   <div style="background:#ffffff ;color:#ffffff;
 cursor:url(ajax/zoom-in.cur),auto; z-index:-<%#Eval("PAGENO") %>;" 
name="Page <%#Eval("PAGENO") %>" >
    <a href="Javascript:getFullImage(<%#Eval("ID") %>)" >
<img src="<%#Eval("FlipImage") %>" alt="Page <%#Eval("PAGENO") %>" 
  border="0" style="cursor:url(ajax/zoom-in.cur),auto;" /></a>
    </div>
   </ItemTemplate>
   </asp:ListView>
 

And the Data Retrieval is just as simple as the following 3 lines:

DataTable dt = db.getFlipPage(catid);
ImageFlip.DataSource = dt;
ImageFlip.DataBind();

 

And that’s all. very easy isn’t it. for the real implementation of this go to www.catalogues4u.com.au and click on a catalogue.In that site I have also implemented a carousel using Listview.  hope it helps.

 



kick it on DotNetKicks.com




Popularity: 14% [?]

Continue reading...

100 % CPU SQL Server 2005, Server crashes!

Sat, Apr 11, 2009

0 Comments

Ah back to my blog. well these days I’m on holidays for Sinhala/ Tamil New year in Sri Lanka. so anyway let met start with wishing all Sinhala  and Tamil Friends A HAPPY NEW YEAR.

Lets get back to business, its been a long time since my last post, as usual busy schedules (i know, i know i tell this often !), but all these days i had several bits and pieces on queue for my blog, and here i am with that.

Last week i had an early morning call from Administrators of  Catalogues4u.com.au. they said that the website is running very slow, and users are having connection timeouts in their browsers or poor performance, server logs are filled with SQLConnection Timeout. they have been receiving calls, complaints from their top management, and most of all server restarts. horrible isn’t it?  they have checked the server, and the CPU was running almost 100%, and the culprit which used the most of the CPU was SQL Server.

After spending time in logs, and SQL profiler runs, i found that one stored procedure was taking more time to execute than the others.

here is a part of that SP:

SELECT  DISTINCT c.ENDDATE,c.ID, c.NAME,c.THUMBNAILURL,c.CONTENSDESCRIPTION
INTO #temp
FROM GW_CATELOGUE c
 INNER JOIN dbo.GW_CATELOGUE_POSTCODES cp
  ON c.ID=cp.CATELOGUEID
 INNER JOIN dbo.GW_POSTCODES p ON p.Id=cp.POSTCODEID
WHERE  p.POSTCODE=@postcode
 AND (ENDDATE BETWEEN getDate() AND DATEADD(dd, 7, getDate()))
 AND (STARTDATE <= getDate())
 AND (ENDDATE >= getDate())
 AND c.APPROVED=1 ORDER BY c.ENDDATE

There were some other SP’s with same structure except the  below Date Filtering which were running perfectly alright:

AND (ENDDATE BETWEEN getDate() AND DATEADD(dd, 7, getDate()))
AND (STARTDATE <= getDate()) AND (ENDDATE >= getDate())

Well This made me thing something is fishy with the date. with confused mind, and help of MVP Dinesh Priyangara I Created 4 Non- Clustered Indexes on Catalogue_STARTDATE, Catalogue_ENDDATE and POSTCODE:

CREATE INDEX Catalogue_STARTDATE ON GW_CATELOGUE(STARTDATE)
CREATE INDEX Catalogue_ENDDATE ON GW_CATELOGUE(ENDDATE)
CREATE INDEX PostCodes_POSTCODE ON GW_POSTCODES(POSTCODE)

And Bang!! it worked. server  was back to normal, and everyone was happy. well this might not be a big deal, but still as somebody said, information is wealth!!.





Popularity: 10% [?]

Continue reading...

Uploading Binary files or Images using LINQ to SQL

Fri, Jan 16, 2009

7 Comments

Today I received an email from a friend, asking how to save a binary file in to the database using LINQ to SQL.  This was the second time a person had asked me the same question, So I thought of having a blog entry about it.

Assume that we need to upload a file  and save its name, and the file in the database table. so lets see how we do it.

This is my Table

CREATE TABLE [dbo].[Files2](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [FileName] [varchar](50) NOT NULL,
    [FileSource] [image] NOT NULL,
 )
GO
And The Following Stored Procedure is used to Insert the Value:
 
CREATE PROCEDURE [dbo].[ADDFILE]
(
    @FILENAME VARCHAR(50),
    @FILESOURCE image
)
AS
SET NOCOUNT ON

INSERT INTO Files([FileName],[FileSource])
VALUES(@FILENAME,@FILESOURCE)

And the following code is used to upload and save the file using web form with a text box for file name, and a file upload control to upload the file. on the click event of a button this code is called.

protected void Button1_Click(object sender, EventArgs e)
{

     if (FileUploader.HasFile && FileUploader.PostedFile.ContentLength > 0)
      {
          string filename = txtFileName.Text;
          //Read the file in to a byte Array.
          byte[] filebyte = FileUploader.FileBytes;

    System.Data.Linq.Binary fileBinary = new System.Data.Linq.Binary(filebyte);
          MyDataDataContext MyData = new MyDataDataContext();

          MyData.ADDFILE(filename, fileBinary);
          lblStatus.Text = "File Uploaded Successfully!";

        }
}
 
 

The Main thing to remember here is that we need to pass the FileUploader.FileBytes  to the constructor of System.Data.Linq.Binary.

To Learn more about LINQ to SQL Please visit Here.

 EDIT: Richie just showed another way to achieve this in his blog here.
 

Popularity: 44% [?]

Continue reading...

Compare and update XML File with the changes

Thu, Oct 30, 2008

0 Comments

Recently I had a requirement to compare 2 XML Files, which has the existing and new settings of an application stored in them. what I wanted to do is when a new XML file of settings is arrived, I had to compare and retain the existing settings, and add any new ones if there are any, remove any settings if they are removed in the new one. Mainly I needed to compare nodes as well as attributes.

Here are few suggestion I got from my friends and communities:

  1. XML Diff Patch – Couldn’t achieve what I wanted.
  2. Linq for XML -  I cannot use this as the application is developed under .net Framework 2.0

 

So after Several Discussions and Forum Posts I Decided to Write one on my own. I don’t know whether it is the best, but it servers for my purpose. so just thought of sharing it with you all, as I saw there were a lot with the same problem. I know  it needs some improvements such as comparing nested nodes and attributes. but  this would be a better kick start. "something is better than nothing" right!!!.

 

Here are two sample XML files which we can use for our comparison, and the output expected.

 

Existing Settings

<Properties xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
 xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <Property Name="PerformanceType1" ProID="1" Text="Gross"
 Type="ddlb" Values="On|Off">On</Property>
    <Property Name="Benchmark1" ProID="3" Text="Benchmark 1" Type="ddlb"
 Values="N/A|2nd Security Index">N/A</Property>
    <Property Name="Benchmark2" ProID="4" Text="Benchmark 2" Type="ddlb"
 Values="N/A|2nd Security Index">N/A</Property>
    <Property Name="Region1" ProID="7" Text="Column 1" Type="ddlb" 
Values="N/A|1 Month|2 Month|3">1 Month</Property>
    <Property Name="FromDate1" ProID="8" Text="Column 1 From" 
Type="Date">N/A</Property>
    <Property Name="FromDate9" ProID="24" Text="Column 9 From" 
Type="Date">N/A</Property>
</Properties>

 

New Settings

<Properties xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <Property Name="PerformanceType1" ProID="1" Text="Gross"
 Type="ddlb" Values="On|Off">On</Property>
    <Property Name="Benchmark1" ProID="3" Text="Benchmark 1" 
Type="ddlb" Values="N/A|2nd Security Index">changed</Property>
    <Property Name="Benchmark2" ProID="4" Text="Benchmark 2" 
Type="ddlb" Values="N/A|2nd Security Index">N/A</Property>
    <Property Name="Region1" ProID="9" Text="Changed" 
Type="ddlb" Values="N/A|1 Month|2 Month|3">1 Month</Property>
    <Property Name="NewData" ProID="29" Text="Column 9 From" 
Type="Date">NewlyAdded</Property>
    <Property Name="FromDate9" ProID="24" Text="Column 9 From" 
Type="Date">N/A</Property>
</Properties>
 
Expected Output
 
<Properties xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
 xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <Property Name="PerformanceType1" ProID="1" Text="Gross" 
Type="ddlb" Values="On|Off">On</Property>
    <Property Name="Benchmark1" ProID="3" Text="Benchmark 1"
 Type="ddlb" Values="N/A|2nd Security Index">N/A</Property>
    <Property Name="Benchmark2" ProID="4" Text="Benchmark 2"
 Type="ddlb" Values="N/A|2nd Security Index">N/A</Property>
    <Property Name="Region1" ProID="9" Text="Changed"
 Type="ddlb" Values="N/A|1 Month|2 Month|3">1 Month</Property>
    <Property Name="FromDate9" ProID="24" Text="Column 9 From"
 Type="Date">N/A</Property>
    <Property Name="NewData" ProID="29" Text="Column 9 From"
 Type="Date">NewlyAdded</Property>
</Properties>
 
 
 

And now Lets see how the code works:

 
string original = File.ReadAllText(@"<Original File path>");
string New = File.ReadAllText(@"<New File path>");
XmlCompare compare = new XmlCompare();
XmlDocument docs=compare.compare(original, New);
File.WriteAllText(@"<output path>", docs.OuterXml);
 
 

The Implementation of the code and its functionality is given in the below download file, with inline comments.

Please note few values are hard coded in this class, but can be altered to suit the requirements.

XMLCompare.cs

I hope it helps for a kick start!.

 

 

Popularity: 24% [?]

Continue reading...

The FILESTREAM Data Type in SQL Server 2008

Wed, Sep 24, 2008

0 Comments

Seriously, i’ve no time these days for blogging, busy with work as well as personal activities. but just wanted to share this valuable information for those who might have missed.

Well the current project which im working on is the ASSETTE Presentations. for more information on the project you can see the above link. but the project uses alot of binary data transfered back and forth to the server and the client thorugh our web services, and most of these binary files are stored in SQL Server 2005 Database. storing binary files inside the database really slows down retrieval of the files when we need them and there are several other desadvantages also. specially  rapidly growing size of the database,taking backups, and maintainance of the database. 

But now with SQL Server 2008 we have a new data type called FILESTREAM , to solve all the above issues.

 

What is FILESTREAM?

FILESTREAM is a new datatype in SQL SERVER 2008. To use FILESTREAM, a database needs to contain a FILESTREAM filegroup and a table which contains a varbinary(max) column with the FILESTREAM attribute set. This causes the Database Engine to store all data for that column in the file system, but not in the database file. A FILESTREAM filegroup is a special folder that contains file system directories known as data containers. These data containers are the interface between Database Engine storage and file system storage through which files in these data containers are maintained by Database Engine.

What FILESTREAM does?

By creating a FILESTREAM filegroup and setting a FILESTREAM attribute on the column of a table, a data container is created which will take care of DML statements.

FILESTREAM will use Windows API for streaming the files so that files can be accessed faster. Also instead of using SQL SERVER cache it will use Windows cache for caching the files accessed.

When you use FILESTREAM storage, consider the following:

  • When a table contains a FILESTREAM column, each row must have a unique row ID.
  • FILESTREAM data containers cannot be nested.
  • When you are using failover clustering, the FILESTREAM filegroups must be on shared disk resources.
  • FILESTREAM filegroups can be on compressed volumes.
For more information on how to use FILESTREAM and to have a in depth knowladge about it please refer the below article in SQLSERVERCENTRAL. its well written and gives you a clear idea on what it is.
The FILESTREAM Data Type in SQL Server 2008
By Deepa Gheewala, 2008/09/24
and here is another blog post on the same topic in MSDN Blogs.
Hope It helps!.

 

 

Popularity: 24% [?]

Continue reading...

44 Silverlight 2.0 Videos

Sat, Aug 2, 2008

2 Comments

Are you searching  for webcasts to learn about Microsoft Silverlight 2.0 ? well then, here is a good news for you all.Mike Taulty recently uploaded and amazing collection of Silverlight 2.0 screencasts on how Silverlight works, controls, File IO, networking, UI design,  data-binding, interacting with HTML pages, and more.if you want to have a good start on Silverlight, then go get them!. it will help you for sure.

silverlight

  1. Silverlight – Hello World
  2. Silverlight – Anatomy of an Application
  3. Silverlight – The VS Environment
  4. Silverlight – Content Controls
  5. Silverlight – Built-In Controls
  6. Silverlight – Width, Height, Margins, Padding, Alignment
  7. Silverlight – Using a GridSplitter
  8. Silverlight – Grid Layout
  9. Silverlight – StackPanel Layout
  10. Silverlight – Canvas Layout
  11. Silverlight – Databinding UI to .NET Classes
  12. Silverlight – Simple Styles
  13. Silverlight – Custom Types in XAML
  14. Silverlight – Binding with Conversion
  15. Silverlight – List Based Data Binding
  16. Silverlight – Simple User Control
  17. Silverlight – Templating a Button
  18. Silverlight – Resources from XAP/DLL/Site Of Origin
  19. Silverlight – Animations & Storyboards
  20. Silverlight – Uploads with WebClient
  21. Silverlight – Downloads with WebClient
  22. Silverlight – Calling HTTPS Web Services
  23. Silverlight – Calling Web Services
  24. Silverlight – Making Cross Domain Requests
  25. Silverlight – Using HttpWebRequest
  26. Silverlight – File Dialogs and User Files
  27. Silverlight – Using Sockets
  28. Silverlight – Using Isolated Storage
  29. Silverlight – .NET Code Modifying HTML
  30. Silverlight – Using Isolated Storage Quotas
  31. Silverlight – Calling JavaScript from .NET
  32. Silverlight – Evaluating JavaScript from .NET Code
  33. Silverlight – Handling HTML Events in .NET Code
  34. Silverlight – Handling .NET Events in JavaScript
  35. Silverlight – Calling .NET from JavaScript
  36. Silverlight – Displaying a Custom Splash Screen
  37. Silverlight – Passing Parameters from your Web Page
  38. Silverlight – Loading Media at Runtime
  39. Silverlight – Dynamically Loading Assemblies/Code
  40. Silverlight – Reading/Writing XML
  41. Silverlight – Multiple Threads with BackgroundWorker
  42. Silverlight – Insert/Update/Delete with the DataGrid
  43. Silverlight – Getting Started with the DataGrid
  44. Silverlight – Embedding Custom Fonts
    Thats it!. Have  a great weekend!!.

Popularity: 31% [?]

Continue reading...
Older Entries Newer Entries
Follow me