Tuesday, December 21, 2010

Simple Stopwatch built in VB.NET [Open Source]

Stopwatch is a tool used to measure the length of time spent in the activity. Among others, the timing of testing tools that require time to millisecond accuracy in the laboratory, as well as on race neighborhood.

It was originally built for personal use when testing a device that relate to my daily work, but this time I hope can be useful not only for myself personally, as well as for others in need

Thefollowing is a stopwatch application interface  which is built using VB.Net, developed using Visual 2005, by using a form as interface design and equipped with several buttons and layout of the output value of the split time.

Dim startTime As DateTime
Private Sub BtnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGo.Click
If (Timer.Enabled) Then
BtnGo.Text = "Start"
Timer.Stop()
Else
startTime = DateTime.Now()
BtnGo.Text = "Stop"
Timer.Start()
End If
End Sub


Private Sub Timer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer.Tick
Dim span As TimeSpan = DateTime.Now.Subtract(startTime)
LabelAngka.Text = extZero(span.Hours.ToString) & ":" & extZero(span.Minutes.ToString) & ":" & _
extZero(span.Seconds.ToString)
LabelMilisecond.Text = span.Milliseconds
End Sub


Function extZero(ByVal binNum As String)
Dim ext As String = "0"
Dim HexToBin As String = ""
If binNum.Length < 2 Then Dim k As Integer = 1 Dim len As Integer = 2 - (binNum.Length + 1) For k = 1 To len ext = ext & "0" Next k HexToBin = ext + binNum ElseIf binNum.Length = 2 Then HexToBin = binNum End If Return HexToBin End Function Private Sub BtnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnClear.Click Timer.Enabled = False LabelAngka.Text = "00:00:00" LabelMilisecond.Text = "000" BtnGo.Text = "Start" MemoEdit1.Text = "" End Sub Private Sub BtnSplit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSplit.Click Dim nil As String = LabelAngka.Text & "." & LabelMilisecond.Text Dim daftar As String = MemoEdit1.Text If daftar = "" Then daftar = nil ElseIf daftar.Length > 1 Then
daftar = daftar + vbNewLine + nil
End If
MemoEdit1.Text = daftar
End Sub

And above is the source code used in this application, there are several procedures and functions used in this application.
That's all from me, with hopes to be useful to others. Thank you:)


Friday, December 17, 2010

Secure and Password your "secret files" with Easy without Additional Applications

Confidential files is one of the properties worth in the form of data, for those who need high privacy in terms of security to prevent free access from others who are far away from the rights and interests,

Confidential files are always placed in a special place that is in the folder / drive tyertentu, kept away from public places for other people's hard to find the secret files.

However, the function "search" on the computer, will facilitate the confidential files was discovered, until he could be a dangerous thing.

But there is an easy way to secure the secret files, using a simple script, without any software or other additional applications. function of this script is to hide our secret files on the place we know and can only be accessed using a password that is only we who know.

Code:
Quote:
Quote: cls
@ECHO OFF
title Folder FolderAman
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST FolderAman goto MDLOCKER
:CONFIRM
echo Are you sure you want to lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren FolderAman "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to unlock folder
set/p "pass=>"
if NOT %pass%== KUNCI goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" FolderAman
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md FolderAman
echo FolderAman created successfully
goto End
:End

Create a file. TXT and copy the code above, save with the name "kunci.bat", to the password can be changed, by changing the script in red

The script above, can also be downloaded in the form of a file so,
HERE

Ways of working to secure confidential files is as follows,
1. when the script "kunci.bat" is executed, it will create a folder "FolderAman"
2. store or place your confidential files in the folder,
3. longer execution script "kunci.bat", then there will be a key confirmation Y / N, (Y for the key, N to ignore),

how to access the confidential files is as follows,
1. execution script "kunci.bat", then there will be a confirmation to enter your password,
2. then the folder "FolderAman" will appear, and your confidential files ready for use.

Explanation of the main procedure script,
1. script using "Control Panel. {21EC2020-3AEA-1069-A2DD-08002B30309D}" as a safe address on windows, that if the address is accessed, will lead to the control panel,
2. script will add the attribute on a folder (+ h + s), so the folder will disappear because the default settings on a computer folder options is "do not show hidden files"

May be useful for readers and writers. Thank you