Monday, May 26, 2008

How to store and retrieve cookie C#

cookie["Name"] = "Kiko Salva"
cookie.Expires = DateTime.Now.AddYears(1);

// To retrieve

lblName.Text = "Cookie Created.";
lblName.Text += "New Customer: " + cookie["Name"];

Tuesday, May 13, 2008

How to split in c#

private void SplitNo()
// string seperated by colons ';'
string items = "1--->;2--->;3--->;4--->;5--->";
string[] collection = new string[4];
// define which character is seperating fields
collection = items.Split(';');

for (int x = 0; x < collection.Length; x++) { Response.Write(collection[x] + "
Sample Output:


REPLACE (Transact-SQL)

Replaces all occurrences of a specified string value with another string value.


Url Value = "http://www.samplewebsite.com/left/right/getch/"

I want to remove the http://www.samplewebsite.com/ and change it to http://www.minewebsite.com/

Query Sample :

update tbl_URLs set url = replace(url,'http://www.samplewebsite.com/','http://www.minewebsite.com/')

the output must be:

Hope this will help.

Move Image to new destination in vb.net

The System.IO namespace contains types that allow synchronous and asynchronous reading and writing on data streams and files.
// First you need to declare this on first
Imports System.IO

// I created a function called CopyFile
// Source = "c:/images/1.jpg"
destination = "c:/move/1.jpg"

Private Sub CopyFile(ByVal source As String, ByVal destination As String)
My.Computer.FileSystem.CopyFile(source, destination, False)
End Sub
Hope this help. Thank you.

Debugging Javacript on Firefox

Tips on debugging HTML, CSS, and JavaScript in Mozilla Firefox. It cover a number of concept such as using the console, Interactive debugger and timer features of the firefug extension for firefox.
Click here