Sunday, June 19, 2011
Today tried a sample to fetch Area and perimeter of a surface using ArcGIS API with Google maps. It is easy to use, we just need to join the points for the respective surface for which we need to find the Area & perimeter and double click. I always like Central park in Newyork, Thought let us try the tool there... It works perfect... please find the link & screen shot below.
Live Sample: http://www.kuwaitfresh.com/find_area.html
Saturday, June 18, 2011
Tried installing the Terrain Profile plug-in for ArcGIS explorer. Found it interesting because, I came to know that Terrain analysis & calculations are done through ArcGIS web-servers in real-time. The location striked on my Mind was Mt. Everest from Himalayas. Just searched for Mt. Everest and landed in the location. I just enabled Terrain Analysis, drew a straight line and double clicked in order to start calculation. In few seconds it was done! The values are almost close... Its fun working with this tool & much more to explore...
Friday, May 27, 2011
Today, i thought we need to find the distance we walk in the salmiya garden situated in 10th Block. We usually go for two rounds and some times more, based on the energy level :). Thanks to ArcGIS explorer which made our quest simple. its easy to do as well... Please see the screen shot below which shows a clear picture.
Answer: 1.048 Kms
Sunday, May 22, 2011
I have created a Geo location finder page using ArcGIS api. It is a test page to display the current location of the browser. I am sending to friends across the globe to evaluate. Please try from your end and reply whether it works fine or not & your browser version. mostly it is supported in all latest versions.
Live Sample : http://www.kuwaitfresh.com/WhereAmI.htm
We have used the following web-service in this sample:
Observation as on 1 July: For some friends in IE 8 it didn't work. Rest for Firefox version greater than 3.5,Chrome, IE9, It worked once the user allowed "share my location" option. and we have also tested in Iphone which is upgraded with version 4.3.
About the Sample, it helps us to fetch exactly the current Latitude and longitude on mouse click on the respective position. Please click the link below to navigate to the live sample. Thanks
Thursday, May 19, 2011
Created a sample Map from API viewer in ArcGIS to display some cities in kuwait. Embedded the code in a page in my website as well... click the image below to view the page below.
Got a chance to explore ArcGIS online tools. Came across this map which clearly explains the oil spill scenes in a slide show. Click the image to view the presentation.
Wednesday, May 11, 2011
There was a requirement to search for a text in the whole SQL database. found this Stored procedure very useful. though it is worth sharing...
-- SearchAllTables ''
CREATE PROC SearchAllTables
CREATE TABLE #Results (ColumnName nvarchar(370), ColumnValue nvarchar(3630))
SET NOCOUNT ON
DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)
SET @TableName = ''
SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''')
WHILE @TableName IS NOT NULL
SET @ColumnName = ''
SET @TableName =
SELECT MIN(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME))
WHERE TABLE_TYPE = 'BASE TABLE'
AND QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) > @TableName
WHILE (@TableName IS NOT NULL) AND (@ColumnName IS NOT NULL)
SET @ColumnName =
WHERE TABLE_SCHEMA = PARSENAME(@TableName, 2)
AND TABLE_NAME = PARSENAME(@TableName, 1)
AND DATA_TYPE IN ('char', 'varchar', 'nchar', 'nvarchar')
AND QUOTENAME(COLUMN_NAME) > @ColumnName
IF @ColumnName IS NOT NULL
INSERT INTO #Results
'SELECT ''' + @TableName + '.' + @ColumnName + ''', LEFT(' + @ColumnName + ', 3630)
FROM ' + @TableName + ' (NOLOCK) ' +
' WHERE ' + @ColumnName + ' LIKE ' + @SearchStr2
SELECT ColumnName, ColumnValue FROM #ResultsEND
Thursday, April 14, 2011
I had a requirment to create a local copy of a MS SQL Database hosted on remote environment(Godaddy Hosting). With the help for Import Data option in SQL Server Managment studio, I was able to replicate both the Tables & their respective Data. Since there no option to import Stored procedures. I was looking in google to generate SQL script for all the stored procedures from a Database.
List All Stored Procedure in Database: select * from sys.procedures
Fortunate to find this post: http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/how-to-script-all-stored-procedures-in-a
set nocount on
DECLARE @Test TABLE (Id INT IDENTITY(1,1), Code varchar(max))
INSERT INTO @Test (Code)
SELECT 'IF object_ID(N''[' + schema_name(schema_id) + '].[' + Name + ']'') IS NOT NULL
DROP PROCEDURE ['+ schema_name(schema_id) +' ].[' + Name + ']' + char(13) + char(10) + 'GO' +
OBJECT_DEFINITION(OBJECT_ID) + char(13) +char(10) + 'GO' + char(13) + char(10)
where is_ms_shipped = 0
DECLARE @lnCurrent int, @lnMax int
DECLARE @LongName varchar(max)
SELECT @lnMax = MAX(Id) FROM @Test
SET @lnCurrent = 1
WHILE @lnCurrent <= @lnMax BEGIN SELECT @LongName = Code FROM @Test WHERE Id = @lnCurrent WHILE @LongName <> ''
SET @LongName = SUBSTRING(@LongName, 8001, LEN(@LongName))
SET @lnCurrent = @lnCurrent + 1
Hope it Helps
Tuesday, February 8, 2011
We had a FTP location where our vendors place a ZIP file. The idea is to process file once it is placed through a listner application. So we need to unzip the placed file through an application. The API: ICSharpCode.SharpZipLib.Zip was very much helpful to achieve the same.
Sample source code is below:
static void Main(string args)
UnZipFiles("C:\\TEST\\SharpZipLib_0860_Bin.zip", "C:\\TEST\\", "", false);
public static void UnZipFiles(string zipPathAndFile, string outputFolder, string password, bool deleteZipFile)
ZipInputStream s = new ZipInputStream(File.OpenRead(zipPathAndFile));
if (password != null && password != String.Empty)
s.Password = password;
string tmpEntry = String.Empty;
while ((theEntry = s.GetNextEntry()) != null)
string directoryName = outputFolder;
string fileName = Path.GetFileName(theEntry.Name);
// create directory
if (directoryName != "")
if (fileName != String.Empty)
if (theEntry.Name.IndexOf(".ini") < fullpath =" directoryName" fullpath =" fullPath.Replace(" fulldirpath =" Path.GetDirectoryName(fullPath);" streamwriter =" File.Create(fullPath);" size =" 2048;" data =" new" size =" s.Read(data,"> 0)
streamWriter.Write(data, 0, size);
Hope it Helpz...
Sunday, January 9, 2011
Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=126.96.36.199, Culture=neutral, PublicKeyToken=b77a5c561
We had a requirement to generate a PDF report in a table with all items for the selected vendor with their respective images. Thanks to ItextSharp for the wonderful utility to generate PDF's. Since we embed image in run time, while executing the part,
"Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=188.8.131.52, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
Googled for the message and found that the solution is that we need to set trust level as full in web.config. Since it is an internal application for us it is not a big deal in our case. Any ways planning to encrypt the PDFs as password protected.
Solution: trust level="Full" in web.config
Hope It Helps :)