Tuesday, June 23, 2009

Learn how to scale your application cache on multiple servers (really cool)

Developer now can scale there .NET application objects in cache from string to binary objects using "Velocity"

Overview: Microsoft project code named “Velocity” provides a highly scalable in-memory application cache for all kinds of data. By using cache, you can significantly improve application performance by avoiding unnecessary calls to the data source. Distributed cache enables your application to match increasing demand with increasing throughput by using a cache cluster that automatically manages the complexities of load balancing. When you use “Velocity,” you can retrieve data by using keys or other identifiers, named “tags.” “Velocity” supports optimistic and pessimistic concurrency models, high availability, and a variety of cache configurations. “Velocity” includes an ASP.NET session provider object that enables you to store ASP.NET session objects in the distributed cache without having to write to databases, which increases the performance and scalability of ASP.NET applications.
You can checkout this webcast for complete understanding:
http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032413050&EventCategory=5&culture=en-US&CountryCode=US

Saturday, June 6, 2009

Retrieve Images that are saved in your Oracle tables as Blog

Ok. If you have images that are saved in your blob field. You can download then into your code as shown below.

Please don't forget visit my website at: www.lendmyspace.com and www.lookfordeal.com

Public Function saveBlobImages() As Single
Dim sqlStr1 As String
Dim cmd As New OracleClient.OracleCommand
Dim oraDa As OracleDataAdapter
Dim conn As OracleConnection = Nothing
Dim ms As MemoryStream = Nothing
Dim dsImage As Data.DataSet = Nothing
Dim myBytes() As Byte = Nothing
Dim imgJPG As System.Drawing.Image = Nothing
Dim msOut As MemoryStream = Nothing

Try

sqlStr1 = "select Image_Name, image_ID, blob_image from image_table where rownum < 100"

' Initialize connection
oraDa = New OracleDataAdapter(sqlStr1, My.Settings.sConnectionString)
conn = oraDa.SelectCommand.Connection
dsImage = New Data.DataSet()
oraDa.Fill(dsImage, "ImageTifImages")

If dsImage.Tables(0).Rows.Count = 0 Then
Throw New Exception("No results returned for rows")
Else

For i As Integer = 0 To dsImage.Tables(0).Rows.Count - 1

myBytes = dsImage.Tables(0).Rows(i)("blob_image")
ms = New MemoryStream
ms.Write(myBytes, 0, myBytes.Length)
imgJPG = Image.FromStream(ms)

'Export to TIF Stream
msOut = New MemoryStream
imgJPG.Save(msOut, System.Drawing.Imaging.ImageFormat.Jpeg)
imgJPG.Dispose()
imgJPG = Nothing
ms.Write(myBytes, 0, myBytes.Length)
imgJPG = System.Drawing.Image.FromStream(ms)
Dim filename As String = dsImage.Tables(0).Rows(i)("Image_Name").ToString + "_" + dsImage.Tables(0).Rows(i)("Image_id").ToString
filename = filename.Replace(".txt", "")
imgJPG.Save(filename + ".Tif")
ms.Close()
Next
End If

Catch ex As Exception
Throw
End Try

End Function