Saturday, December 20, 2008

Ben 10 Alien Force Ep 1 Megaviedo

independent data access provider to automatically associate

Hola

Algo que aunque no siempre sea aplicable a la realidad, todos deseamos, es poder tener un programa al cual le podamos cambiar de BD y que todo siga funcionando de forma automática sin mayores traumas en el código fuente, sin mucha charla les comento que desde el framework 2.0 esto es posible con ado.net a través de las clases que se encuentran en el espacio de nombre System.Data.Common

Como es el procedimiento?

  • Recuperar el proveedor de data and the connection string from somewhere and create a DbProviderFactory
  • Use that to create DataAdapters provider through DbProviderFactory.CreateDataAdapter ()
  • use
  • DataAdapters

Creating the connection I'll be
too simplistic just to bring some order and structure code depends on where you put the strings that return the following methods

Public Shared GetProvider Function ( ) As String
Return "System.Data.SqlClient"
End Function

Public Shared Function GetCnnString() As String
Return "Data Source=MiSQLsrv;Initial Catalog=MiBD;Integrated Security = True "
End Function

above functions should be making access to app.config or a text file which the channels recovered up the show as constants

We'll use them, creating a connection from the supplier, so that the connection is indicated for the supplier whose description is obtained GetProvider function () Dim

sProv As String = GetProvider()
Dim sCnn As String = GetCnnString()

Dim

oCnn As DbConnection = nothing

Dim f As DbProviderFactory = DbProviderFactories.GetFactory(sProv)
oCnn= f.CreateConnection()
oCnn.ConnectionString = sCnn

Now that we have the connection we must generate the commands to run a select query.

Dim cmd As DbCommand = oCnn.CreateCommand ()

cmd.CommandText = "Select * from myTable where id = 1" cmd
. CommandType = CommandType.Text

oCnn.Open ()

Dim dr As DbDataReader = cmd.ExecuteReader
Dim ID As Integer=0
Dim sNombres As String=""

If dr.HasRows Then

dr.Read()
dim ID as integer = dr(
"Id" )
sNombres = dr(
"Nombres" )

End If

dr.Close()
oCnn.Close()

As you saw the connection used to generate a command, which will depend on the supplier, then I give the text of the query and then get a datareader from which to download the data to variables finally close the DataReader and connection

You see the issue of vendor independence is not as otherworldly as if not more it is really easy. In another article (which I guess will be this year) will show you how to use DataAdapters to record data in a structure similar to this.

I hope this helps someone you

soon and Happy Holidays! Salu2


Sergio

Wednesday, November 5, 2008

Funforbrainplayground

Error aspnet_wp.exe process

Hi That error

more cumbersome but as usually happens rather chaotic error is easy to solve, because each time I am more convinced that the little mistakes, those that are after the , s of months that the system is operating, are the hardest to find and fix probably, well back to the case

The error message occurs when you give the F5 running in debug mode to VS 2003, and ends well compila is to lift the IE get a message box that says Unable to start debugging and the Message box VS get the following Error

automatically attach aspnet_wp.exe process on the computer XXXX Error Code 0x8013134b.

Well the solution to this mess is very simple, will see the properties the IIS application (virtual directory), choose the palette and change the ASP.NET version & # 243; n the framework of ASP.NET 1.1, it turns out that when the Framework 2.0 is installed on the machine that is being assumed as a default framework and that's when the VS2003 does not know where fire and therefore can not be associated with the process aspnet_wp, I pass there a pic of where to change the framework version in IIS

ASPNET

Well that's it, easy right? Salu2


Sergio

Friday, October 31, 2008

Rules Of Frustration The Card Game

pages Eliminating Cache

Hello

After some time I put something on the blog, well this is a result of that I'm "socket" Working ... either case, rather than on the remainder.

turns out that recently I've been having the problem that IE pages showing out of the cache, this is a disaster because some of them need to have them always updated from the server, good to Following this I found an html tag that solves half the problem, but you must make a little extra trick, which is the story now

The label is:

\u0026lt;META HTTP-EQUIV = "PRAGMA" CONTENT = " NO-CACHE ">

should be placed in the section of the page

\u0026lt;head>

But there is an interesting bug on this issue, that the interpretation of the pages is from top to bottom and is also the pages are not "cached" until it reaches load 32K, so as always placed the sticker on the head of the page, 32K can not be achieved and therefore the page is not cached and therefore the label is without effect, to fix this you have to do is place the bottom of the page and before the \u0026lt;/ HTML> tags as another group of this

\u0026lt;HEAD>
\u0026lt;META HTTP-EQUIV = "PRAGMA" CONTENT = "NO-CACHE">
\u0026lt;/ HEAD>

That should be avoided

caching pages and I hope they serve salu2 Sergio

Tuesday, September 30, 2008

Regal Kitchen Pro Collection Parts

Chau hi VSS TFS News from SQL2008

Well apparently everything with Microsoft, the VSS has evolved into a new tool called the Team Foundation Server that already has a version for VS2005, but in the new version of Visual Studio is released with much more power. Even

I have no chance to use it, because the truth I'm in so much work to even stop writing this blog for a couple of months, good as I've been reading about the subject and apparently is great, I pass some links so you can read more detail out there and tell me if they have experience with it, touch me soon to change to take advantage of VS2008 and from lego ; to switch to TFS.

These links can be very useful to know to migrate from TFS and VSS faithful

Why migrate on Microsoft Team Foundation Server

FS Preparation for migration to

Migrating from Visual Source Safe to Team Foundation Server

Another migration over

Versio to download for VS2005 TFS n

Well until Salu2

soon
Sergio

Friday, July 4, 2008

Free Katesplayground.com

This summary is not available. Please click here to view the post.

Friday, June 20, 2008

Hydrochlorothiazide With Adderall

Collections searches. What is the best way?

few days ago I felt the need to implement research about generic collections and began to find some method that allows me to search a generic collection type List (of T) to what I found the find method, but with very little help on him, and I turned & # 237; the ever useful newsgroup in which I received the help they need from one of the friends that there are always willing to help.

Well in short after seeing that was difficult but a bit scratched the method to implement the find command in the collection because it uses pointers to functions and global variables to the form, I use another class that is the SortedList (Of TKey, TValue) that vendríaa be ordered as a generic collection whose main feature is its easy and clean implementation. He also had the option of using the old for a sequential search for the collection, but this seemed somewhat outdated and inelegant , and was therefore to begin my research into search forms in a collection.

After testing with 1000000 of objects in a collection list (of T) and another SortedList (Of TKey, TValue) that the best way to work with many the old object is for or for each, if though I believe so, it turns out that although the SortedList (Of TKey, TValue) is much faster when do the search, is extremely inefficient in the time of loading, in my case, the uploaded million objects en 12 minutos!!! si, 12 minutos, mientras que la carga en una colección list(of T) tardó 3 segundos!!! increíble la diferencia no?. Eso si la búsqueda en el sortedlist no llegaba a un milisegundo mientras que en la list(of T) tardaba 80milisegundos con los for y entre 900 y 1100 milisegundos con el método find, la verdad que me sorprendió el resultado. Las pruebas las hice en una notebook pIV  de2.4Ghz con 512MB de memoria, me aseguré de buscar el último elemento de la colección.

Todos son muy fáciles de comprender, tal vez el mas "vuelteado" is using the find method because it uses global variables to form predicate and an object becomes a kind of pointer to the search function.

Well I spend my code that did the testing if you will see the implementation of these search methods

We call it a Winform frmColeccionesGenericas in which they placed 4 buttons each with a label below to show results (leave names by default), Each button is a type of load-search in a collection & # 243; n. Then go the codebehind and copied it, the following list is the full form

Public Class frmColeccionesGenericas

'global variable form to be used with the method , all find
Dim s_NombreABuscar As String

'global variable' Issue of items in the collection
Private nElementos As Integer = 1000000

'with the find method
Private Sub Button1_Click ( ByVal sender As System.Object, ByVal As and System.EventArgs) Handles Button1.Click Dim

ini As Date Dim
order As Date Dim
diff As TimeSpan

'---------------------carga la coleccion

ini = Now

Dim l As New List( Of cPersona)
For i As Integer = 1 To nElementos

        l.Add(

New cPersona(i, "John" & i, "321" & i)) Next

order = Now

fin.Subtract diff = (ini)

I . Label1.Text = "Time Charge" & diff.Minutes & ":" & diff.Seconds & " " & diff.Milliseconds

Load the collection
'---------------------
'Create a Predicate object that points to the role fBuscador
Dim

fBuscador As New Predicate (Of cPersona) (AddressOf Search)

'form variable
s_NombreABuscar = " , John " & nElementos

'----
search
ini = Now
Dim p As cPersona = l.Find (fBuscador) end = Now

fin.Subtract diff = (ini)

I . Label1.Text & = vbCrLf & "Time Search" & diff.Minutes & ":" & diff.Seconds & ":" & diff.
Milliseconds End Sub

Private

Function Search (ByVal person As cPersona) As Boolean

If persona.Nombre.ToLower = s_NombreABuscar. ToLower Then

Return True

Else

Return False

End If

End Function

'with
SortedList Private Sub
Button2_Click ( ByVal sender As System.Object, ByVal and As System.EventArgs) Handles Button2.Click

Dim ini As Date
Dim end The
Date Dim diff The TimeSpan

'--- load Justice ordered

Dim the The New SortedList (Of String , CPerson)
Dim p The CPerson
ini = Now
For and The Integer = 1 To nElementos

p =

New cPersona (i, "John" & i, "321" & i)

l.Add (p.Nombre, p)

Next

order = Now
fin.Subtract diff = (ini)

I . Label2.Text = "Duration:" & diff.Minutes & ":" & diff.Seconds & ":" & diff.Milliseconds

---
collection searches

ini = Now
p = l (

"John" & nElementos) end = Now

diff = fin.Subtract (ini)
I . Label2.Text & = vbCrLf & " ; Time Search: " & diff.Minutes & ":" & diff.Seconds & ":" & diff.Milliseconds

End Sub

'with a
for
Private Sub Button3_Click ( ByVal sender As System.Object, ByVal and As System . EventArgs) Handles Button3.Click

Dim ini The Date
Dim end The
Date Dim diff The TimeSpan

' ---- Justice load

Dim the The New List (Of CPerson)
Dim p The CPerson
ini = Now
For

i As Integer = 1 To nElementos

p =

New cPersona (i, "John" & i, "321" & i)
l.Add (p)

Next

order = Now
fin.Subtract diff = (ini)

I . Label3.Text = "Load Time" & diff.Minutes & ":" & diff.Seconds & ":" & diff.Milliseconds

'--- busca elements
being
= Now Dim s As String = "John" & nElementos
For to As Integer = 1 To nElementos

p = l(i)

If p.Nombre = s Then

      Exit For

End If

Next

fin = Now
diff = fin.Subtract(ini)

Me .Label3.Text &= vbCrLf & "Time Search" & diff.Minutes & ":" & diff.Seconds & ":" & diff. Milliseconds

End Sub

'with a' for each
Private Sub Button4_Click ( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

Dim ini As Date
Dim fin As Date
Dim diff As TimeSpan
Dim l As New List( Of cPersona)
Dim p As cPersona
ini = Now For
i As Integer = 1 To nElementos

p =

New cPersona (i, "John" & i, "321" & i)
l.Add (p)

Next

order = Now
fin.Subtract diff = (ini)

I . Label4.Text = "Time de Carga " & diff.Minutes &" "& diff.Seconds &" "& diff.Milliseconds

ini = Now

Dim s As String = "Juan" & nElementos
For Each p In l

If p.Nombre = s Then

Exit For End
If

Next

order = Now
fin.Subtract diff = (ini)

I . Label4.Text & = vbCrLf & "Time Search" & diff.Minutes & ":" & diff.Seconds & ":" & diff.Milliseconds

End Sub

'Class to fill the collection
Class cPersona

Private nCode As Integer
Private sname As String
Private sTelefono As String

Public Property Cod() As Integer
Get

Return nCod

End Get
Set ( ByVal value As Integer )

nCod = value

End Set
End Property

Public Property Nombre() As String
Get

Return sNombre

End Get
Set ( ByVal value As String )

sNombre = value

End Set
End Property

Public Property Telefono() As String
Get

Return sTelefono

End Get
Set ( ByVal value As String )

sTelefono = value

End Set
End Property

Public Sub New ( ByVal n_Cod As Integer , ByVal s_Nombre As String , ByVal s_Telefono As String )

nCod = n_Cod
sTelefono = s_Telefono Sname = s_Nombre

End Sub

End Class

End Class

Well that's it for today

Salu2
Sergio

Wednesday, June 18, 2008

Movies Salieri On Line

localhost does not work but if the ip 127.0.0.1

Hello

few days ago I had a problem and that almost makes me reinstall the computer, but thanks to friends the aspnet newsgroup (microsoft.public.es.dotnet.aspnet) I managed to correct the problem. It turns out that without knowing how IIS awoke one morning with no desire to work, any address placed in the IE as http://localhost/loQueSea not getting anywhere and after & # 233; s expect a lot of time left a message saying the site was unavailable or the address did not exist, not even a html page or the default site that brings the iis, nothing, nothing! I happened to try the ip 127.0.0.1 instead of localhost and it worked, it worked but with the mentioned ip or the ip did my dhcp. Well after more than 2 days of searching the Internet how to fix this I answered in the newsgroup with the solution, which was to run the following commands

first open a command window and in the folder C: \\ Inetpub \\ AdminScripts, do the following

cscript adsutil.vbs set w3svc/1/serverbindings "127.0.0.1:80: localhost"

then the folder the framework, C: \\ WINDOWS \\ Microsoft.NET \\ Framework \\ v2.0.50727 have to run the following commands


aspnet_regiis-u aspnet_regiis-i aspnet_regiis-ga
NombreDeTuComputadora \\ ASPNET

Summarizing all previous commands was to re-associate the ip to localhost aspnet 2.0 then uninstall then reinstall and third place you permissions to aspnet user machine

here are some Linsker explaining step commands

Adsutil.vbs Using the Administration Script (IIS 6.0)

Description Adsutil and MetaEdit tools used to modify the Metabas

and in relation to other command

Well I hope you like my
help
Salu2
SergioT

Wednesday, June 4, 2008

Fluttering Lower Stomach Implantation

ContextSwitchDeadLock Error debuging

Hello

That errorcito scrub it, do not know if they ever came out but I did lose several hours, before wandering into what it means for truth is an issue I comment a bit thick "solution"

must turn off a checkbox that corresponds to MDA (managed debugging assistant) of ContextSwitchDeadLock name.

Debug / Exceptions / Managed debuging assistants.

Turn off the check box corresponding ContextSwitchDeadLock

By default option does not appear in the submenu Debug Exceptions, if that is the case añadanlo by:

Go to View / Toolbars / Customize

Once there

in the left pane and select Debug from the options on the right will be exceptions, take the option and drag to the debug menu

Well now a small & # 241; to explain this, is that the MDA are assistants and aids used in the debug in coordination with the CLR, they generate informational messages run-time events and from what I understand the error that occurs in this case is that the debugger throws this exception and finding threads in the Implementation n being debugged that appear to be hung and not return any message, and the MDA, not knowing the state generates this exception. On the other hand I read it a problem in a COM component that the application is doing burreras hehe Early · Solutions · put them in quotes because if you actually realize the problem is not solved but if it prevents the Debug throw the error, the problem is most likely due to a COM component that is not communicating properly with the MDA and thus it throws the exception. Well

finally here's a few links in case you want to read more about this error, which is a rarity and if anyone thinks confused over this and wants to leave me a comment, will be welcome

http://msdn.microsoft.com/es-es/library/d21c150d (VS.80). aspx

http://msdn.microsoft.com/es-es/library/ms172233 (VS.80 ). aspx

Salu2
SergioT

Monday, June 2, 2008

Soul Silver Chaining Shiney

2005

Hello

Here I send a link to the cumulative update of VSS, it will solve several problems of which one happened to me is the fact of the timeout in the download and update sources via HTTP when the files are relatively large

Well there is the link

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=8a1a68d8-db11-417c-91ad-02aab484776b

In this other link can more details regarding the source control

http://blogs.msdn.com/richardb/archive/2007/12/11/sourcesafe-2005-update-is-available-for-download.aspx


salu2 Sergio

Sunday, June 1, 2008

Fibrids Back And Foot Pain

VSS Update for Internet via HTTP

Hello

The 2005 version of Visual SourceSafe has the option to access a database from anywhere in the world via HTTP so easy and simple, then I will describe how to configure VSS to share a DB to allow access via Iinternet.

to use the following scenario a server 2003 in which BD is the VSS and we will be an XP machine, both must have the VSS installed. There are 2 ways to configure Internet access from one is using SSL (secure socket layer) and the other without using SSL, the latter is easier to configure but also less secure because the information is transferred as plain text and is therefore susceptible to theft.

For both types of access should be installed, configured and published on IIS on a computer

Let

access without SSL

  • First of all must share the folder in which it was created BD SourceSafe, for this just open a browser windows and folder sharing, you have to take into account the access permissions to that folder via LAN for users who will have access to the database. Suppose that our database is in the folder D: \\ ss \\ mydb
  • Now that we have shared the DB on the LAN administrator open up the VSS (SSAdmin) and open the database but with UNC address \\ \\ mymachine \\ mydb
  • Once we open the database with management the option is enabled UNC Server \\ Settings No, let's go to that opcióny Check to "Enable SourceSafe for this computer" and also "Enable SourceSafe Internet for this database "then place the IP or DNS name of the team's web server, which is supposed to have IIS up and running.
  • VSShttp1
  • Pressing accept elsiguiente receive warning
  • VSShttp2
  • Press NO to continue working without SSL
  • That would be everything you need, now let's try if all is well we test access from the Internet by opening an IE and putting the IP of the site indicated inthe Settings, call the webservice that is automatically configured on our IIS, something similar to the following:
    http://205.150.152.001/SourceSafe/VssService.asmx


  • If all is well see a window asking for a valid user on the server, there must give the name and password of a valid user of the server that has access to the shared folder count is the BD server, you must have read / write permissions. One very important thing to understand here is that if we do not use SSL, the WAS (Web Service) VSS uses impersonation which means that the user provided when the Explorer we requested must have read / write permissions to the folder of the BD and it MUST be created as user in the VSS database, finally you must activate the option & # 243; n "Use network name for the user's Session start automatically" is at Tools / Options / General, this is set up well by default. Well if this is true will fail WAS but one in which we see that actually is responding, we realize that this error is entitled as follows: "Error application server in '/ SourceSafe'. "

Well now that you have everything properly configured on the server, go to the remote machine that seeks access to the database. Well this is the most simple and consists of the following: Open the

  • VS2005, go to Tools / Options / Source Control / Selection of complement and there ; selects Microsoft Visual SourceSafe (internet) and in the following figure
  • VSShttp3
  • Now go to Tools / Options / Source Control / Configuration complement, place the name of the user who has access to the database and the server, then click Advanced and destickee the option to use SSL, as inthe following figure:
  • VSShttp4

Well that's it for configuration, now we only tested for example by opening a solution that we already have in the database. For this there is a procedure "Special" is the comment below: Let us open

  • VS2005 Let
  • Open Project and then set to "SourceSafe (Internet)"
  • 's select "Add SourceSafe database, a wizard that will ask the IP or domain name (in my example http://205.150.152.001 ) and folder shared ( \\ \\ mymachine \\ mydb ), to give the following, if the connection does ask for a username and password on the target machine, the user must provide, if properly authenticate us ask us to give a name to the conexióny ready.
  • Now only select the project you want to open in the BD and ready brazen VS2005 project will start in our project default folder which is set to (tools / options / projects and solutions / general / VS projects location)

I commented that I use this way and it really works well is f & # 225; easy to use and its configuration is not no big deal, just be careful with permissions to the folders in the database and make sure your domain users using the BD est & # 225, n created as users of the BD

Well that's all for now, I hope to guide them up soon!, I describe another access via SSL

salu2 SergioT

Thursday, May 22, 2008

Draft A Letter For Short-term Traineeship

VSS VB.net and the decimal point in the textbox

Hello

The temita Eastern cultural references and combined with what he says the truth locale that is more than a headache for At least for me I'm no guru on this. One of the few things I miss the dbase was the picture command with a simple model very easily limited data entries above the numbers. Here in vb.net give us the "easy" to program for different cultures so that the result can be much more friendly to the end user and the system will behave according to what he says the locale of the computer, the Burrera is that programming is very complicated, well ... either case.

Here is an recetita to handle the textbox with numbers so as to use the dot "." decimal separator regardless of what you set on the control panel, Assume that the machine has to eat, "as the decimal point and thousands separator (as is usually in Latin America) Place a

textbox, a button in a winform and paste the following code in the codebehind

Private Sub Form1_Load ( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase .
Load Dim x As Decimal
x = 25,356 'Look how the assignment is to point
I . TextBox1 . Text = x
End Sub Private

Sub Button1_Click (ByVal sender As System.Object, ByVal and As System.EventArgs) Handles
Button1.Click Dim x As Decimal
x = I . TextBox1.Text 'From here comes with coma and almost automatically becomes
MsgBox (x)
End Sub

So far everything works very well as placing a number with a decimal point textbox becomes comatose as says the locale and then passing a textbox to a number become the comma point.

Well now assume that the user has the "silly idea" to use for a decimal point. that it is a "complacent" who wants to enter numbers with speed and comfort using the keypad on your keyboard. make the attempt in the textbox we already have on the screen and type " 25,356 ", then press and see that they get: "25356 " what happened?? it turns out that the very intelligent VB thought that we are using the thousands separator "." and discarded. Well

to give the user the convenience of using your numeric keypad can build a user control and monitor each press of keys to bind or set point using the events of textbox to do the same or we can make a simpler validation in time to retrieve and assign values \u200b\u200bof textbox to numbers and vice versa. While the latter to extend a textbox and a button on the winform and replace the previous code as follows:

Private Sub Form1_Load ( ByVal sender As System.Object, ByVal and As System.EventArgs) Handles MyBase .

Load

Dim x As Decimal
x = 25,356 'Look how the assignment is to point
I . TextBox1.Text = x
I . TextBox2.Text = x.ToString (System.Globalization.CultureInfo.InvariantCulture)

End Sub

Private

Sub Button1_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles

Button1.Click Dim x As Decimal

x = I . TextBox1.Text 'From here comes to eat and almost automatically becomes

If x.ToString \u0026lt;> I . TextBox1.Text Then

MsgBox (

"Not a valid number, use the decimal point" , MsgBoxStyle.Critical)
Return

End If
MsgBox(x)
End Sub

Private Sub Button2_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Dim x As Decimal = Decimal .Parse( Me . TextBox2.Text, System.Globalization.CultureInfo.InvariantCulture)

If x.ToString (System.Globalization.CultureInfo.InvariantCulture) \u0026lt;> I . TextBox2.Text . Trim
Then MsgBox

(

"Not a valid number, be sure to use decimal point" , MsgBoxStyle.Critical)
Return


End If
MsgBox (x)
End Sub

Well now I will explain the changes I made to the form: let's look at the load event the following statement:

I . TextBox2.Text = x.ToString (System.Globalization.CultureInfo.InvariantCulture)

This operation it does is get a reference to "cultural body of all languages" which is based on English culture, as you know runs the point like a decimal point, and therefore what we are accomplishing is ignore the locale!! For this reason you will see that on the screen (textbox2) appears as a number with a decimal point, just what I wanted to achieve.

Now we will see the representative of buuton2 where we recover the value of the textbox and place it in the numeric variable

Dim x As Decimal = Decimal . Parse ( Me . TextBox2.Text, System.Globalization.CultureInfo.InvariantCulture)

In this line of textbox convert the string through Decimal Parse method of repeating the request for the independent of the locale, this is because we assume that the text is decimal separator. Finally

analyze validation that ensures we are using the dot as thousands

If x.ToString (System.Globalization.CultureInfo.InvariantCulture) \u0026lt;> I . TextBox2.Text.Trim Then

MsgBox (

"Not a valid number, be sure to use decimal point" , MsgBoxStyle.Critical)

Return

End If

Validation is as simple as comparing the string obtained from the variable x against the text stored in which we did textbox2 conversion. If they are different is that the user used the comma if they are equal is that the user used the point and everything is fine.

This example will you put the 2 options that are driving around with regional settings (managed by textbox1 and button1) and management with point as decimal separator (managed by textbox2 and button2)

I hope they can

Salu2
SergioT

Thursday, May 15, 2008

Cubefield Armour Games

Variables postbacks persistent sources

One problem that we face as we program in asp.net is the fact that the variables declared in a webform "die" after the first postback to save variables between postbacks there are several alternatives, the use of Session, Application or ViewState, which is used depends on what you want to do, very simple I detail when to use each of the 3 options Session

  • : You must use if you want to store variables and objects throughout the session, a session means a connection to the web server from a browser. The variables placed in Session live while the explorer is opened and interacted with the site. to put variables here just to do the following: dim

    xVar
    as integer = 199 Session ("myvariable") = xVar

    and to recover

    dim z as integer = session ("myvariable")
  • Application: Variables stored here while living application live on the web server, usually are placed here and Obet variables to be used by all users using the application, So yes, if one changes the value of the variable stored in application, this change is reflected to all connected users (all sessions). To save variables or objects becomes:

    xVar dim as integer = 199
    Application ("myvariable") = xVar

    and retrieve

    dim z as integer = Application ("myvariable") ViewState
  • : The variables or stored objects that live here live a webform, and ViewState is ASP.Net mechanism to save web control values \u200b\u200bin postbacks, it is actually a hidden variable that the customer comes and goes with the values \u200b\u200bof WebForm controls. What makes this mechanism usually take the opportunity here to save themselves the form variables are important only in the webform, it is therefore not advisable to store them in Session or Application. ViewSat To do it:


    dim as integer = 199 xVar
    Me.ViewState ("myvariable") = xVar

    and retrieve

    dim z as integer = Me.ViewState ("myvariable")

In either the 3 mechanisms have to be careful not to try to retrieve a nonexistent variable that can cause a runtime error and returned the 3 mechanisms are nothing if not variable

For the next installment I'll show you how to save their own objects in these using the serialization mechanisms, something very basic and easy to use. Salu2


Sergio

Thursday, March 27, 2008

How Long Germs On Chapstick



Hello

a few years ago I use the VSS (Visual SourceSafe) to administer programs and no single source of VB but also other languages \u200b\u200blike Clipper and C, the interesting thing about this tool is that it allows multiple people working on a software project so that each one has a local copy of the software (or part thereof) so that you can build, change, delete or add programs and new resources. The local copies are disposable because the sources are stored in a database managed by the VSS Below we describe the basic functions and how to start using the assumption that what we will do maintain the source of a project from VS 2005.

  1. After installing the VSS which is in the VS 2005 Team Edition, will be created 2 shortcuts to VSS is an "Administration Visual SourceSafe "and the other is" Microsoft Visual SourceSafe. " The first allows you to create databases, users, permissions and publishing via the Web, the second serves to work with files stored on the projects they are stored in the VSS database.
  2. first thing to do is create a new database, give it a name ubicacióny. This is done from the administrator of the VSS by a very clear and easy wizard. Then users should be created, preferably with the domain user name, that this is justified when we see the web access (in a future post) With the BD
  3. created and get into the VS and open the application you want to store in VSS. In Solution Explorer, right click on the solucióny select the "Add Project to Source Control", began an assistant with the following steps:
    1. Ask & # 225; the VSS user will create and design and database to which you want to add the project and which is registered in the user name.
    2. If the user and the database exist, a dialog box asking a name for the root project suggesting something like "MiSolucion.root" I prefer to delete that name and leave the box blank, one field is the ubicacióny appear with the value "$" which indicates the Following the BD, I prefer to leave it unchanged, After this operation, the solution will be stored in the database
VSS_1

r

After the solution stored in the database will have the VSS source control and will appear in the VS project with a new property next to each file will see a padlock, which means that the file is saved in the database and available for modification, in the jargon this is known as VSS "protected file."

Now the right click on any file in the Solution Explorer displays the following menu

VSS_2

previous menu options are for the following:

"Out for Edit" enables the file so it can be editable and you mark it in the database, so that no other user can modify the duration of our Edition. This is true if the database was created with the model "Lock-Modify-Unlock" which does not allow competition in the amendments, there is another model that is "Copy-Modify-Merge" which allows concurrence in the amendments and that was the only model supported by the previous version of VSS. To "check out" (check out) the file goes from ReadOnly to ReadAndWrite

"Get Latest Version" Bring the database the latest version the selected file.

"Compare" to compare the version of the file is on your machine against the one stored in the database and displays the differences in case they exist.

"View History" to view the file change history, who made them when and what were the changes made, plus the ability to compare versions or compare a version with the local copy. Well

this as an introduction to the VSS think that may be useful

Salu2


Sergio

Friday, March 7, 2008

Oil Of Oregano Vs Colloidal Silver

managing Visual SourceSafe VS2003 and SQL Server 2005

Hello

After a good holiday back to write here this time going back in time with VS 2003, I tell my case, I have VS2003 and VS2005 systems and SQL 2005 and SQL 2000 and as I have only one development machine so there I have the VS 2003, VS2005 and indeed is there no problem, also I have the SQL Server Express 2005 and I restored a database sql 2000, the truth without any problems I started working with these 3 tools, that was true until I tried to create classes DataAdapters components through VS 2003, it was impossible not generate SPs the solution to this issue was very easy and the comment, have only to install the SP1 of VS 2003 and ready. About

Use SQL2005 to handle BD that were created with the SQL2000 I have a few comments that I put here:

  1. restore the database from a backup data, not previously create the SQL2005, ie direct vayqn restore, do not try to create first and restore later.
  2. Keep in mind that they can no longer restore a SQL2005 backup made in the sql 2000, at least I found how to do it.

Well this was a short delivery and without code but I think very useful for those who no longer want to use the SQL2000 and SQL2005 to jump into, at least in their development machine

Salu2


Sergio

Saturday, January 5, 2008

Best Sheer Foundation?

Hiding in TabPage Images

Hello

Starting the new year with some simple but useful code ...

As TabControl will see the WinForm has a collection of TabPage controls, the issue is that TabPage controls, who knows why they do not have the Visible property so they can not hide directly and must resort to a little trick I tell them then

Let

following:

1. Place a TabControl with 2 TabPages in a winform

2.Place a checkBox

in winform

3.Click 2 clicks on the checkbox to go to the code and there Propramme the delegate for the event chechkedChanged, that reads:

Private Sub CheckBox1_CheckedChanged ( ByVal sender As System.Object, ByVal and As System.EventArgs) Handles CheckBox1.CheckedChanged
If

I . CheckBox1.Checked Then
Me . TabControl1.TabPages.Remove ( Me . TabPage2)
Else
& # 160;
Me . TabControl1.TabPages.Add ( Me . TabPage2)
End If

End Sub

4. Executives la aplicacióny vacationers al mark the second tab chekBox disappears and reappears uncheck

well, that's all they have a happy and prosperous New Year

Salu2


Sergio