Ads 468x60px

Pages

Tampilkan postingan dengan label vs. Tampilkan semua postingan
Tampilkan postingan dengan label vs. Tampilkan semua postingan

Jumat, 07 Februari 2014

ByVal vs ByRef

ByVal vs ByRef


ByRef means that the code will manipulate the value. ByVal will manipulate a copy of the value. It is that simple as that. Check or try the sample I just made:


<summary>
This is a sample: show you the difference between byVal and ByRef
</summary>
<remarks>Check Technologies ltée 2012</remarks>
Public Class Form1

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        TextBox1.Text = 2
        Button1.Text = "addByVal"
        Button2.Text = "addByRef"
    End Sub

    Private Function addByVal(ByVal x) As Integer
        x = x * 2
        addByVal = x
    End Function
    Private Function addByRef(ByRef x) As Integer
        x = x * 2
        addByRef = x
    End Function

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Label1.Text = addByVal(TextBox1.Text)
    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        Label1.Text = addByRef(TextBox1.Text)
    End Sub
End Class



This is what Visual Studio 2010 looks like, a form with 2 buttons, 1 label and 1 TextBox:

When you run the code Button1 call the function addByVal while the other button calls addByRef. Inside both function, they are identical. Only the way you send the variable in the argument changes.
For your information, if you don’t put anything (byVal or ByRef) by default, is ByVal..


There are exceptions over exceptions if you are dealing with Arrays, Collections and others objects. You better check to make sure. And what is true in one language isn’t true in another language.

I am surprised that MSDN haven’t put more information.


ByVal (Visual Basic) : that an argument is passed in such a way that the called procedure or property cannot change the value of a variable underlying the argument in the calling code


 ByRef (Visual Basic) : Specifies that an argument is passed in such a way that the called procedure can change the value of a variable underlying the argument in the calling code.

References:



The program I love to use, buy it: Visual Studio 2010 Professional (Old Version)




Read More..

Kamis, 01 Agustus 2013

NVidia 210 VS ATI Radeon 4350

It’s the battle of the wimpy kids. Actually I already had an ATI 4350 laying around and I bought an Nvidia 210 to use in my Office PC because the board I had planned to use was built on an Nvidia chipset and I don’t care to mix Nvidia and ATI.
In the end I didn’t end up keeping the board and went back to the ATI card so now I have a useless 210 card kicking around, well I did get to pit them up against each other which is something I’m sure you wont find anywhere else since they are low budget, nobody cares, video cards.
So first I started out with the ATI Radeon 4350 card from ASUS using the latest ATI Catalyst drivers and built in Overclocking functions. I maxed out the core rather quickly while the memory kept giving more and more. I was surprised at how high I could take the memory settings before getting any artifacts or experiencing any major heat issues.
(Numbers to be updated)
Next was the Nvidia 210 card from MSI using the latest Nvidia drivers and built in Overclocking functions. I started with a nice bump on the core and went for a huge jump on the memory but was quickly halted when the PC locked up, I kept scaling back but couldn’t stop the PC from locking up so instead I worked from the bottom up and was only able to achieve a small memory overclock. While I couldn’t get much out of the memory at all I was actually able to really crank the core speed but this didn’t prove very useful in the benchmarks. Another thing I noticed is that the built in Nvidia Overclocking tools didn’t allow too much headroom for Overclocking (not like the card was capable).
(Numbers to be updated)
Towards the end of my Nvidia testing I checked the temp on the Nvidia card and thought I would run the tests again with fans directly on the cards since they were both passively cooled, Before I could even get a solid reading the board smoked at the PCI-E slot while the Nvidia card was still Overclocking and I lost the board + video card. Luckily the card was still under Newegg warranty so I sent it back but by the time I got the new one and decided I didn’t want it anyway it was too late and I was stuck with the new one.
Read More..