Wednesday, January 5, 2011

Check for File Uploading using vb.net

Hi,

Public Function chk_FileExtension(ByVal str As String) As Boolean
Dim extension As String = str
Dim MIMEType As String = Nothing
Select Case extension
Case ".jpeg"
Return True
Case ".jpg"
Return True
Case ".gif"
Return True
Case ".png"
Return True
Case ".bmp"
Return True
'Case ".pdf"
' Return True
Case Else
Return False
'return;
Exit Select
End Select
End Function

-----------------------------------------------------------
If flpSwatchImage.FileName = Nothing Then
Call objFunction.setMessage("INFO", "Please Provide any Image.", False)
Exit Sub
Else
If chk_FileExtension(Path.GetExtension(flpSwatchImage.FileName).ToLower()) = True Then
objColors.colorSwatch = flpSwatchImage.FileName
Else
Call objFunction.setMessage("INFO", "The Extension of the file Provided is not Allowed.", False)
Exit Sub
End If
End If

Tuesday, September 1, 2009

COM and DCOM objects

Hi guys

There are lots of disscusions you must have done related to COM and DCOM objects in .Net.Here is the complete details which will satisfy you.

The dot net frameworks allow you to build serviced components that can use com+ services. These components of dot net framework runs in the manages execution environment of dot net framework that is share their content with com+ application.

Now the question arise what com+ and what is doing how is its comes in existence. Before com+ comes into existence. COM (Component Object Model) is first programming model that provide component based approach to software development. This component based approach of com allowed us to develop small, logical reusable and stand alone modules that integrates into a single application. But these components could not be display on over network.

So these drawback produce another model that is DCOM (distributes COM). DCOM programming model enabled you to display com components over network and distribute application easily across platforms. DCOM components also help in two-tier client/server applications. These models also have some drawback that helps to development of COM+ approach. What these drawbacks are…

These two-tier architecture helps us to sharing of resources and data but these approach have some drawbacks that are as follows.

The DCOM approach overburdened client computer with the responsibility of performing all processing functions while the server merely acted as traffic controller, helps movement of data to and from the client and server components. So availability of resources was therefore, always a problem and the performance of application suffered. Multiple request of data cause to network traffic. So performance of application decreases.
COM objects require installation on the machine from where it is being used and DCOM requires installation somewhere on the same network.
Any COM object may participate in DCOM transactions. DCOM introduced several improvements/optimizations for distributed environment such as MULTI_QI (multiple QueryInterface()) security contexts etc.
DCOM demonstrated importance of surrogate process (you cannot run in-proc server on a remote machine. You need a surrogate process to do that.)DCOM introduced a load balancing.
The fact is dotnet has not replace the COM/DCOM instead it has extended the functionality by introducing new featurs to it.
        
hopes you enjoyed this topic and satisfied with this.

Abstract class Vs Interfaces

Hi Guys 
 These are few difference's that will be sufficient to understand what exactly abstact class and interface is and what is the difference between them
  1. Abstract class defines few or none of the methods,but interface defines all the methods.
  2. Abstract classes should have subclasses else that will be useless.Interfaces must have implementations by other classes else that will be useless.
  3. only an interface can extend another interface, but any class can extend an abstract class.
  4. All variable in interfaces are final by default.