Showing posts from 2012

File upload without refreshing the page - Ajax File Upload

When we use file upload control in web pages, it required to post the page to get the file uploaded. Below I describe how to upload a file without refreshing the page with better looking upload control. Supported Browseres : Chrome, IE (6,7,8,9), Firefox, Safari Demo :  Upload without page refresh Ajax Uploader Script :   uploader.js Our control will look like HTML Markup This is our div control that will be converted to a upload control. <div id="fileUploaderContainer" class="fileuploadcontainer"></div> Need a button to upload selected files. <input id="uploadbtn" type="button" value="upload" /> Page Load Script We need to add following script to be called when page is loaded. So that it will wire up required events for the file upload and generate controls dynamically in side the given control ("fileUploaderContainer").     $(document).ready(function () {         $("#fileU

Get SQL Server free disk information without admin privileges

Following script will get the free disk space in database server. To run this script following permissions are required. " NO sysadmin " privileges are required. Permissions Required GRANT execute on sp_OAGetErrorInfo to UuerUser GRANT execute on sp_OAGetProperty to UuerUser GRANT execute on sp_OACreate to UuerUser GRANT execute on sp_OADestroy to UuerUser Script declare @RunLocal bit = 1; DECLARE @DiskSpaceStats TABLE ( DriveLetter char(1), TotalSize decimal(20,0), AvailableBytes decimal(20,0), DriveType char(10), PercentFree decimal(18,3), Report_Date datetime default getdate() ) DECLARE @DiskSpace TABLE ( RowID int Identity Primary Key, DriveLetter char(1), TotalSize decimal(20,0), AvailableBytes decimal(20,0), DriveType char(10), PercentFree decimal(18,3) ) DECLARE @counter int DECLARE @FSOobject int DECLARE @RecordCount int DECLARE @count int DECLARE @string  char(35) DECLARE @DriveLetter char(1) DECLARE @Tota

SQL Server Data Compression Prediction

Following script will generate prediction for data compression in 3 different levels (Database level, Table level, Index level). DECLARE @estimation table(ObjectName nvarchar(100),SchemaName nvarchar(10),IndexId int, PartitionId int, CurrentSize bigint, NewSize bigint, SampleCurrentSize bigint, SampleNewSize bigint, CompressionMode nvarchar(10) null); DECLARE @TableName nvarchar(100); DECLARE  TABLE_CURSOR cursor for SELECT name FROM sys.objects where type = 'U' OPEN TABLE_CURSOR FETCH NEXT FROM TABLE_CURSOR into @TableName; WHILE(@@FETCH_STATUS = 0) BEGIN INSERT INTO @estimation (ObjectName,SchemaName,IndexId,PartitionId,CurrentSize,NewSize,SampleCurrentSize,SampleNewSize) EXEC sp_estimate_data_compression_savings 'dbo',@TableName,NULL,NULL,ROW; UPDATE @estimation SET CompressionMode = 'ROW' WHERE CompressionMode IS NULL; INSERT into @estimation (ObjectName,SchemaName,IndexId,PartitionId,CurrentSize,NewSize,SampleCurrentSize,SampleNewSize) EX

Jquery - Close opened dialog box

Following javascript can be used to close any open dialog. function CloseCurrentPopup() {     var diag = $(".ui-dialog");     var close = $(".ui-icon-closethick", diag);;     $(".ui-dialog").dialog("close"); }

How to run an application as a windows service

You may want sometime to run your windows app or a console application even you log off the machine. In order to work even the windows is log off, you need to run your application as a windows service. So, how to run an application as a windows service ? Here is the solution. 1) Please install windows resource kit (both xp or windows 2003) from here 2) Start windows command prompt 3) Execute > cd "your windows resource kit path" ex: CD "C:\Program Files\Windows Resource Kits\Tools" 4) Execute > Instsrv.exe YourServiceName "C:\Program Files\Windows Resource Kits\Tools\Srvany.exe" 5) Open regedit > go to> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\YourServiceName 6) add following KEY : Parameters 7) Add value to the above key :  Value = Application, Type : REG_SZ, Value : "path to your exe" 8) Close the reg edit 9) Go to Control Panel > Service > Edit your Service properties > Change settings as you wish

How to get the site map of your blog in blogger

Someone may need to know where the site map of the blog is saved. This is how you can find it. 1) Get the robots.txt file 2) Once you open this file you will see as follows User-agent: Mediapartners-Google Disallow: User-agent: * Disallow: /search Allow: / Sitemap: 3) Last line says where to find your blog site map

Taxi - Cab services in Colombo - Sri Lanka

This is the list of cab / taxi services operating in Colombo - Sri Lanka. KangarooCabs Address: 91 1/6, Galle Road, Colombo 4 Contact Number: 2501501 / 2588588 / 2502888 Radiant Cabs Address: 455, Galle Road, Colombo3 Contact Number: 2556556 City Cabs Address: 422, Galle Road, Colombo 6 Contact Number: 2552222 Colombo Cabs Address: 326, Hospital Road, Kalubowila, Dehiwala Contact Number: 4203303 Excel Cabs Address: 831 1.2 Kotte Road,Ethul Kotte Contact Number: 2889889 Yellow Radio Cabs Address : 315 St Clair, Wattala, Wattala Contact Number:: 2942942 ACE Cabs Address: 298-1/1. Colombo Road, Pepiliyana Contact Number: 2818818 Airport Express Address: 65/6, Kirula Road, Colombo 5 Contact Number: 5555050 Airport Link Address: 73/28, Temple Road, Colombo 5 Contact Number:5336666 A R S Cab service Address: 46, Sri Siddhartha Road, Colombo 6 Contact Number: 5054153 Create Tours Address: 3, Wijeyaba Mawatha, Nawala Contact Number: 5377677 GNTC

Permission to Service Broker - Query Notification

To enable service broker and use it with .net application for Query Notification, the db user required following user permissions. This is the minimum permission that required by the DB User. -- enable service broker ALTER DATABASE [yourdatabasename] SET ENABLE_BROKER; -- create the queue CREATE QUEUE [yourqueuename]; CREATE SERVICE [yourservicename]   ON QUEUE [yourqueuename] ([]); --Database level permissions GRANT CREATE PROCEDURE to [yourusername]; GRANT CREATE QUEUE to [yourusername]; GRANT CREATE SERVICE to [yourusername]; GRANT SUBSCRIBE QUERY NOTIFICATIONS TO  [yourusername] GRANT VIEW DEFINITION TO [yourusername]; --Service Broker permissions GRANT REFERENCES on CONTRACT::[] to [yourusername] GRANT RECEIVE ON [yourqueuename] TO [yourusername] GRANT SEND ON SERVICE::[yourservicename] TO [yourusername] GRANT RECEIVE ON

Best GTalk IM for Iphone : Beejive IM GT

I was looking for a better Iphone app to use with GTalk. I tried several apps in istore. Finally I came to conclusion that Beegive IM GT is the best GTalk app for IPhone. It is totally free and only limitation is every 7 days, you have re login. :) . This is running in background and alert through push notifications. Also once disconnect it will automatically connect to google server so that it will keep the loged in session for 7 days. Please find the application here in App Store.

Visa inc drops Global Payments after data breach affects 1.5 million cardholders

Visa Inc. has dropped "Global Payment" the card processor involved in mass data breach from its registry of providers that meet data security standards. Global Payments CEO Paul Garcia noted that the company continues to process Visa transactions, but that being dropped from the registry “could give our partners some pause that they’re doing business with someone who experienced a breach.” Garcia said he expects Global Payments to be reinstated once it has been issued a new report of compliance. But he declined to specify when that might be. He said the situation is “absolutely contained” but that the investigation is continuing and that parts of it still need to be resolved. Global Payments says the data breach may affect less than 1.5 million credit cards from various issuers in North America. The company said that credit card data may have been stolen, but that cardholder names, addresses and Social Security numbers were not obtained. Aside from the U.S., Global P

Budget Airline - Tiger Airways in Sri Lanka

Tiger Airways has started a budget airline between Sri Lanka and Singapore. It is going to be cheap tickets compared to other airlines operated between Sri Lanka and Singapore. Useful Links

Free Photo Editing Tool - Paint.Net

I was searching for a free photo editing tool. I tried several tools and finally I selected  . This has several good features like Layers, Select Tools, History tool and some more. It does not have hundreds of features which are in commercial tool like Photoshop. But with this free tool we can do day today photo editing  requirements easily. This application has set of image editing tools which are very useful to general users. Also this is very light weight application and it loading very fast. I recommend this tool as a one of the best option as a replacement for Photoshop if we looking for free Photo Editing tool. Paint.Net can be downloaded here .

How to find when HTML content is loaded - without using onload in Javascript

When you use onload event, your script will be executed when the whole page is completely loaded. If your page has iframes, then onload will be executed after even iframe content also loaded. In some cases you may need to do something when the page html is loaded. Following sample demonstrate how to achieve this. <html xmlns=""> <head>     <title>Test Page</title> </head> <body onload="alert('this is page load event')">     <div>         <!-- Your page content here -->         <iframe id="frm" src="" width="400px" height="400px"></iframe>         <span id="lastCtrl">this is last text</span>     </div>     <script type="text/javascript">         //write your script here         //script white here will be called just after the page htm

Solution for : Cannot Create WEB-API controller in converted MVC4 Project

When you right click on your controller folder > create controller , then MVC4 WEB-API controller option should be available. If not do following to fix it. In Solution Explorer, right-click the project name and then select Unload Project. Then right-click the name again and select Edit ProjectName.csproj. Locate the ProjectTypeGuids element and replace {E53F8FEA-EAE0-44A6-8774-FFD645390401} with {E3E379DF-F4C6-4180-9B81-6769533ABE47}. Save the changes, close the project (.csproj) file you were editing, right-click the project, and then select Reload Project. This is applicable to the projects converted from MVC3 to MVC4

Manually Upgrade MVC3 Project to MVC4

To manually upgrade an existing ASP.NET MVC 3 application to version 4, do the following: In all Web.config files in the project (there is one in the root of the project, one in the Views folder, and one in the Views folder for each area in your project), replace every instance of the following text: System . Web . Mvc , Version = 3.0 . 0.0 System . Web . WebPages , Version = 1.0 . 0.0 System . Web . Helpers , Version = 1.0 . 0.0 System . Web . WebPages . Razor , Version = 1.0 . 0.0 with the following corresponding text: System . Web . Mvc , Version = 4.0 . 0.0 System . Web . WebPages , Version = 2.0 . 0.0 System . Web . Helpers , Version = 2.0 . 0.0 ,   System . Web . WebPages . Razor , Version = 2.0 . 0.0 , In the root Web.config file, update the   webPages:Version   element to "" and add a new PreserveLoginUrl   key that has the value "true": <appSettings> <add key = "webpages