Archive

Archive for October, 2009

CDATA tag in javascript

October 24, 2009 Leave a comment

 

With HTML pages on the web you can just include the required Javascript between <script> and </script> tags. When you validate the HTML on your web page the Javascript content is considered to be CDATA (character data) that is therefore ignored by the validator. The same is not true if you follow the more recent XHTML standards in setting up your web page. With XHTML the code between the script tags is considered to be PCDATA (parsed character data) which is therefore processed by the validator.

Because of this, you can’t just include Javascript between the script tags on your page without ‘breaking’ your web page (at least as far as the validator is concerned).

To fix this problem we can do one of two things. The simplest way, particularly if the Javascript contains more than just one or two lines, is to make the Javascript external to the page resulting in their being nothing between the script tags to stop the page validating.

If it is just one or two lines then it is probably not worth making an external script so you will want to leave the content between the script tags and tell the validator that this is to be ignored. We do this by placing the Javascript code within a CDATA tag like this:

<script type="text/javascript">
<![CDATA[
// content of your Javascript goes here
]]>
</script>

Categories: SQL and .NET Blog

Artificial rain – (Save drought)

October 11, 2009 Leave a comment

 

The need to develop and improve rain-making techniques in terms of design, operation, monitoring and evaluation by giving them a more scientific character is today’s need.

This includes using computers to study cloud formations and help the rain-making operations achieve the goals of the project. The role of weather modification, or rain-making, is an important component in water resource management.

The process involved in artificial rain-making involves three easy-to-understand stages. The first stage is agitation. That is using chemicals to stimulate the air mass upwind of the target area to rise and form rain clouds.

The chemicals used during this stage are calcium chloride calcium carbide, calcium oxide, a compound of salt and urea, or a compound of urea and ammonium nitrate. These compounds are capable of absorbing water vapour from the air mass, thus stimulating the condensation process.

The second stage is called building-up stage. Here the cloud mass is built up using chemicals such as kitchen salt, the T.1 formula, urea, ammonium nitrate, dry ice, and occasionally also calcium chloride to increase nuclei which also increase the density of the clouds. In the third stage of bombardment chemicals such as super-cool agents: silver iodide and dry ice are used to reach the most unbalanced status which builds up large beads of water (Nuclei) and makes them fall down as raindrops.

In planning every stage a high degree of expertise and experience is required, in selecting the types and amounts of chemicals to be used, while taking into consideration weather conditions, topographical conditions, wind direction and velocity as well as the location or delimitation of the area for chemical seeding. Several other ideas are also involved in rain making. Rockets containing rain-making chemicals can be fired into the clouds either from the ground or from aircraft.

A jet of rain-making chemicals is shot from a highly pressurised cannister directly into the cloud base, so as to coerce clouds which normally hang above mountain tops to cluster up and rain on the mountain or their slopes.

Rain-making chemicals are added to super-cooled clouds, i.e., those at altitudes above 18,000 metres, to stimulate the formation of ice crystals in the cloud or cloud cluster.

Artificial rain is produced by spraying clouds with substances like Silver Iodide (costly) or cheaper ones like solid carbon dioxide (dry ice) or even finely powdered Sodium Chloride. The process is called seeding.

Often there are clouds, but no rain. This is because of a phenomenon called supercooling. The temperature of the cloud might be close to zero and there might even be crystals of ice in it.

The water vapour in the cloud does not condense to liquid water. The super cooling gets disturbed by spraying the cloud with the chemicals mentioned above, using a small airplane for the purpose.

The `super’ phenomena (cooling, heating, saturation etc.) are perverse in a sense. Very pure water when heated in a clean vessel, often does not start boiling when expected. Crystals of the photographer’s hypo (Sodium thiosulphate) easily dissolve in a little water when heated. But on cooling, crystals do not separate out.

If the vessel is shaken vigorously, or if a small crystal of hypo is freshly added, then crystallization starts immediately.

Making artificial rain is a similar way of intervening in the super cooling phenomenon.

This is the only option, that can save India in the future.

-Yuva

Categories: Science & Technology

How to create symbols with keyboard

October 10, 2009 Leave a comment

 

All you need to do is Hold down your "ALT" key and press another key on the keyboard to create a symbol. Here is a list of some you can make. Try out…

  • Alt + 0153….. ™… trademark symbol
  • Alt + 0169…. ©…. copyright symbol
  • Alt + 0174….. ®… .registered trademark symbol
  • Alt + 0176 …°……. .degree symbol
  • Alt + 0177 …± … .plus-or-minus sign
  • Alt + 0182 …¶……. paragraph mark
  • Alt + 0190 …¾…… fraction, three-fourths
  • Alt + 0215 …. ×….. multiplication sign
  • Alt + 0162… ¢…… the cent sign
  • Alt + 0161….. ¡…… upside down exclamation point
  • Alt + 0191….. ¿….. upside down question mark
  • Alt + 1………. ☺… smiley fsce
  • Alt + 2 ……… ☻… black smiley face
  • Alt + 15…….. ☼… sun
  • Alt + 12…….. ♀…. female sign
  • Alt + 11……. ♂…. male sign
  • Alt + 6……… �™ ….. spade sign
  • Alt + 5………. ♣…. Club symbol
  • Alt + 3………. ♥…. Heart
  • Alt + 4………. ♦….. Diamond
  • Alt + 13…….. ♪….. eighth note
  • Alt + 14…….. ♫…. beamed eighth note
  • Alt + 8721…. ∑…. N-ary summation (auto sum)
  • Alt + 251…… √….. square root check mark
  • Alt + 8236….. ∞…. infinity
  • Alt + 24…….. ↑….. up arrow
  • Alt + 25…….. ↓….. down arrow
  • Alt + 26…….. →… right pointing arrow
  • Alt + 27…….. ←… left arrow
  • Alt + 18…….. ↕….. up/down arrow
  • Alt + 29…….. ↔… left right arrow
Categories: Miscellaneous

Domain tools

October 10, 2009 Leave a comment

 

Find the domain information of any site

http://whois.domaintools.com/yuvahere.com
http://whois.domaintools.com/renjucool.com

Take the screen shot of any site

aviary.com/yuvahere.com

aviary.com/renjucool.com

Will update you more… 🙂

-Yuva

Categories: Miscellaneous

Nooks in SQL Server

October 10, 2009 Leave a comment

 

SQL server mirroring

Operating Modes of mirroring setting

High availability
High safety
High performance

Roles of mirroring

Principal role
Mirror role
Witness role

Different hash algorithms produce different hash values

DECLARE @HashValue varchar(100)
SELECT @HashValue = ‘SQL Server’
SELECT HashBytes(‘MD5’, @HashValue)
SELECT @HashValue = ‘SQL Server’
SELECT HashBytes(‘SHA1’, @HashValue)
GO

Hash values are case sensitive

DECLARE @HashValue varchar(100)
SELECT @HashValue = ‘sql’
SELECT HashBytes(‘SHA1’, @HashValue)
SELECT @HashValue = ‘SQL’
SELECT HashBytes(‘SHA1’, @HashValue)
GO

Symmetric keys

CREATE SYMMETRIC KEY MySymmetricKey WITH ALGORITHM = RC4
ENCRYPTION BY PASSWORD = ‘A1b2C3#$’
GO
SELECT * FROM sys.symmetric_keys
GO

CREATE TABLE SymmetricKeyDemo
(ID             int IDENTITY(1,1),
PlainText       varchar(30) NOT NULL,
EncryptedText   varbinary(80) NOT NULL)
GO

Symmetric key must be opened before being used

OPEN SYMMETRIC KEY MySymmetricKey DECRYPTION BY PASSWORD = ‘A1b2C3#$’
GO

INSERT INTO SymmetricKeyDemo
(PlainText, EncryptedText)
VALUES(‘SQL Server’, EncryptByKey(Key_GUID(‘MySymmetricKey’),’SQL Server’))
GO

SELECT ID, PlainText, EncryptedText, cast(DecryptByKey(EncryptedText) AS varchar(30))
FROM SymmetricKeyDemo
GO
CLOSE SYMMETRIC KEY MySymmetricKey
GO

Asymmetrics keys – public and private key tokens

Certificates

CREATE TABLE CertificateDemo
(ID             int IDENTITY(1,1),
PlainText       varchar(30) NOT NULL,
EncryptedText   varbinary(500) NOT NULL)
GO

CREATE CERTIFICATE MyCert AUTHORIZATION dbo
WITH SUBJECT = ‘Test certificate’
GO

SELECT * FROM sys.certificates
GO
INSERT INTO CertificateDemo
(PlainText, EncryptedText)
VALUES(‘SQL Server’,EncryptByCert(Cert_ID(‘MyCert’), ‘SQL Server’))
GO

SELECT ID, PlainText, EncryptedText, CAST(DecryptByCert(Cert_Id(‘MyCert’),
    EncryptedText) AS varchar(max))
FROM CertificateDemo
GO

Transparent data encryption

USE master
GO
CREATE MASTER KEY ENCRYPTION BY PASSWORD = ‘<InsertStrongPassword>’;
GO
CREATE CERTIFICATE MyServerCert WITH SUBJECT = ‘TDE Certificate’
GO

USE SQL2008SBS
GO
CREATE DATABASE ENCRYPTION KEY
WITH ALGORITHM = AES_128
ENCRYPTION BY SERVER CERTIFICATE MyServerCert
GO

ALTER DATABASE SQL2008SBS
SET ENCRYPTION ON
GO

——————————————————————–

To find the current identity value of any table

select IDENT_CURRENT(‘patient’)

To read the trace file and display in grid

select * from sys.fn_trace_gettable(‘\\dev-chen-pc1615\temp\test.trc’,-1)

To add custom eror message in SQL server

sp_addmessage 50002,16,’this is custom build message by Yuva’,NULL,NULL,NULL

RAISERROR (50002, 10,1) WITH LOG
RAISERROR (‘this is temp error %d and %s and %d’,16,3,12,’as’,13) WITH LOG

———————————————————————————–

To find the most time consuming stored procedure in a database

SELECT TOP 10
ProcedureName = tex.text,
ExecutionCount = sta.execution_count,
AvgExecutionTime = isnull( sta.total_elapsed_time / sta.execution_count, 0 ),
AvgWorkerTime = sta.total_worker_time / sta.execution_count,
TotalWorkerTime = sta.total_worker_time,
MaxLogicalReads = sta.max_logical_reads,
MaxLogicalWrites = sta.max_logical_writes,
CreationDateTime = sta.creation_time,
CallsPerSecond = isnull( sta.execution_count / datediff( second, sta.creation_time, getdate()), 0 )
FROM sys.dm_exec_query_stats sta
CROSS APPLY sys.dm_exec_sql_text( sta.sql_handle ) tex
— WHERE …
ORDER BY
— statotal_elapsed_time DESC
sta.execution_count desc

Will update more…

-Yuva

Categories: SQL and .NET Blog