Sunday, January 20, 2013

DBHelper Class

Lately, I've been busy doing some of the codes for the system that we're working with my team at the office. I just wanted to share this VB.NET class that I made and is being used as the SQL Connection Helper Class for the project that I am into. Enjoy!., comments are welcome.. :)


Imports System.Data
Imports System.Data.Sql
Imports System.Data.SqlClient
''' <summary>
''' DBHelper Class
''' </summary>
''' <remarks></remarks>
Public Class DBHelper
    Implements IDisposable
    
    Private _SQLConnectionString As New SqlConnectionStringBuilder
    Private _SQLConnection As New SqlConnection
    Private _SQLCommand As SqlCommand
    Private _DataAdapter As SqlDataAdapter
    Private _DataSet As DataSet
    Private _SQLParameters As SqlParameterCollection = New SqlCommand().Parameters
    Private _AffectedRows As Integer

    ''' <summary>

    ''' SQL Connection string builder for an instance of this class
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public ReadOnly Property ConnectionStringBuilder() As SqlConnectionStringBuilder
        Get
            Return _SQLConnectionString
        End Get
    End Property

    ''' <summary>

    ''' Row count of affected rows from executing an SQL query
    ''' </summary>
    ''' <value></value>
    ''' <returns>returns an integer value</returns>
    ''' <remarks></remarks>
    Public ReadOnly Property AffectedRows() As Integer
        Get
            Return _AffectedRows
        End Get
    End Property

    ''' <summary>

    ''' Result dataset from a query
    ''' </summary>
    ''' <value></value>
    ''' <returns>returns DataSet object</returns>
    ''' <remarks></remarks>
    Public ReadOnly Property ReturnedDataSet() As DataSet
        Get
            Return _DataSet
        End Get
    End Property

    ''' <summary>

    ''' DBHelper Constructor
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub New()
        With _SQLConnectionString
            .DataSource = "(local)\sqlexpress"
            .InitialCatalog = "PacificPOS_db_yhan"
            .UserID = "sa"
            .Password = "password01"
        End With
        _SQLConnection.ConnectionString = _SQLConnectionString.ConnectionString
    End Sub

    ''' <summary>

    ''' DBHelper Constructor
    ''' </summary>
    ''' <param name="connectionString">SQL Connection String</param>
    ''' <remarks></remarks>
    Public Sub New(ByVal connectionString As String)
        _SQLConnection.ConnectionString = connectionString
    End Sub

    ''' <summary>

    ''' Method for adding SQL Parameters
    ''' </summary>
    ''' <param name="parameterName"></param>
    ''' <param name="value"></param>
    ''' <remarks></remarks>
    Public Sub AddParameter(ByVal parameterName As String, ByVal value As Object)
        _SQLParameters.AddWithValue(parameterName, value)
    End Sub

    ''' <summary>

    ''' Method for exectution of SQL Queries
    ''' </summary>
    ''' <param name="query">SQL query string</param>
    ''' <param name="hasResult">if this method will have a DataSet result</param>
    ''' <param name="sqlCommandType">type of sql command</param>
    ''' <remarks></remarks>
    Public Sub ExecuteQuery(ByVal query As String, _
                                 ByVal hasResult As GlobalDeclaration.HasDSResult, _
                                 ByVal sqlCommandType As CommandType)
        Try
            _SQLConnection.Open()

            _SQLCommand = New SqlCommand

            _SQLCommand.Connection = _SQLConnection
            _SQLCommand.CommandType = sqlCommandType
            _SQLCommand.CommandText = query

            For Each sqlParam As SqlParameter In _SQLParameters

                _SQLCommand.Parameters.AddWithValue(sqlParam.ParameterName, sqlParam.Value)
            Next

            If hasResult = GlobalDeclaration.HasDSResult.Yes Then

                _DataAdapter = New SqlDataAdapter(_SQLCommand)
                _DataSet = New DataSet
                _DataAdapter.Fill(_DataSet)
            Else
                _AffectedRows = _SQLCommand.ExecuteNonQuery()
            End If

            'Reset parameters

            _SQLParameters = Nothing
            _SQLParameters = New SqlCommand().Parameters

            _SQLConnection.Close()

        Catch ex As Exception
            'Reset parameters
            If _SQLParameters IsNot Nothing Then
                _SQLParameters = Nothing
                _SQLParameters = New SqlCommand().Parameters
            End If

            _SQLConnection.Close()

            Throw
        End Try
    End Sub

    Public Shared ReadOnly Property GetDataSources() As DataTable

        Get
            Return SqlDataSourceEnumerator.Instance.GetDataSources
        End Get
    End Property

    ' IDisposable

    Protected Overridable Sub Dispose(ByVal disposing As Boolean)
        Dispose()
        Me._SQLCommand.Dispose()
        Me._SQLConnection.Dispose()
        Me._DataAdapter.Dispose()
        Me._DataSet.Dispose()
    End Sub

#Region " IDisposable Support "

    ' This code added by Visual Basic to correctly implement the disposable pattern.
    Public Sub Dispose() Implements IDisposable.Dispose
        ' Do not change this code.  Put cleanup code in Dispose(ByVal disposing As Boolean) above.
        Dispose(True)
        GC.SuppressFinalize(Me)
    End Sub
#End Region

End Class


Saturday, October 13, 2012

Busy with my First Job

Lately, I haven't been posting here in my blog account. I have been busy with my first job being a VB.NET Developer. As of now I am working with a consolidator and Head Office application project for a Points-of-Sales System. Maybe next time I will be posting code snippets of what I am into... :)

Saturday, October 22, 2011

Client-Server Class E-Commerce Site

This is a website made for our client-server course. The design was made by my partner Ed Garcillanosa and the coding part was made by me.
HERE'S THE LINK >> http://khian545.xtreemhost.com/page.php?action=home

Monday, October 17, 2011

MY FIRST FLASH-BASED PORTFOLIO


Lately, I was able to upload my first ever flash-based portfolio on the net. Well, the portfolio is still in progress. I think it's on its 10% as of now. So i'm looking forward into finishing this project. Here's the link if you want to take a look at my unfinished portfolio >> http://khian545.xtreemhost.com/flashportfolio/

Tuesday, September 6, 2011

Nothing to do, then try Gaming

 Now, I'm into this game... I find it awesome because of its strategic gameplay...
I've been into this game the past few days. Just for pass time purposes. It's actually for stress relief. It's my way of saying relax and enjoy!














Exploring Android App Development

Recently, I've been into java coding again. I've watched some video tutorials for me to be able to cope up with the android dev environment. If I would be lucky with my exploration of the android application development, I'd be posting some of my works.

Wednesday, June 15, 2011

FORGOT TO POST MY PORTFOLIO

Well, i recently have this online portfolio which was personally coded and designed by me. It just so happened that I haven't updated this blog lately. So now here's the time... This post is all about my online portfolio, I've used some of the scripting languages and frameworks that I know such as javascript and jquery in order for this portfolio to be functional. For now I'm still learning and studying some innovations to further improve this.... ^_^ http://khianzxq.zxq.net/

Wednesday, June 1, 2011

BLOG WALK

when i was in middle of searching for computer blogs, i just noticed this site and thought of a subject of mine. It was my subject in my 3rd year at the University of Nueva Caceres, the subject was Structured Programming Languages. So what with the site that I've found lately?... yah right.. it was a blog for computer languages evolution and was taught to us when we were in our 3rd year class. I just wanted to share this site for future reference..... ^_^ http://www.rackspace.com/cloud/blog/2011/05/17/infographic-evolution-of-computer-languages/

Sunday, January 30, 2011

FLASH ATM



Update:
I've already finished and submitted my exercise... but still it is subject to errors and modifications... i've provided a link for the finish exercise and is now available for download... DOWNLOAD

Update:
I've been thinking of the transactions that I will incorporate to the simulator and I'm still thinking if I will animate the releasing of bills.

Been working for this project... actually this is not a project, it's just an exercise... after I finish working with this... i'll upload the source code...

Friday, September 10, 2010

How to Delete An Undeletable File


Click the Start Button.
Click All Programs followed by Accessories.
In the Accessories drop down menu click Command Prompt.
The Command Prompt window will now open.
Close all other programs that are running with the exception of the Command Prompt.
Now click Start and then Run.
In the Run dialog box type: taskmgr.exe.
In the Task Manager window click on the Processes tab.
From the processes list highlight Explorer.exe and then click the End Process button.
Don't close the Task Manager window, leave it open. You should have the Command Prompt and the Task Manager window open.
Now return to the Command Prompt window and change the directory to the directory that contains the file(s) you wish to delete.
At the Command Prompt type: del (filename) (where the (filename) is the name of the file you want to delete).
Press Enter to delete the file.
Now go back to the Task Manager window.
Click File>New Task.
In the New task dialog box type: explorer.exe.
The Explorer User Interface (GUI) should now start.
Finally close the Task Manager Window and the Command Prompt Window.

Thursday, September 2, 2010

God did not create the universe, says Hawking

LONDON (Reuters) – God did not create the universe and the "Big Bang" was an inevitable consequence of the laws of physics, the eminent British theoretical physicist Stephen Hawking argues in a new book.
In "The Grand Design," co-authored with U.S. physicist Leonard Mlodinow, Hawking says a new series of theories made a creator of the universe redundant, according to the Times newspaper which published extracts on Thursday.
"Because there is a law such as gravity, the universe can and will create itself from nothing. Spontaneous creation is the reason there is something rather than nothing, why the universe exists, why we exist," Hawking writes.
"It is not necessary to invoke God to light the blue touch paper and set the universe going."
Hawking, 68, who won global recognition with his 1988 book "A Brief History of Time," an account of the origins of the universe, is renowned for his work on black holes, cosmology and quantum gravity.
Since 1974, the scientist has worked on marrying the two cornerstones of modern physics -- Albert Einstein's General Theory of Relativity, which concerns gravity and large-scale phenomena, and quantum theory, which covers subatomic particles.
His latest comments suggest he has broken away from previous views he has expressed on religion. Previously, he wrote that the laws of physics meant it was simply not necessary to believe that God had intervened in the Big Bang.
He wrote in A Brief History ... "If we discover a complete theory, it would be the ultimate triumph of human reason -- for then we should know the mind of God."
In his latest book, he said the 1992 discovery of a planet orbiting another star other than the Sun helped deconstruct the view of the father of physics Isaac Newton that the universe could not have arisen out of chaos but was created by God.
"That makes the coincidences of our planetary conditions -- the single Sun, the lucky combination of Earth-Sun distance and solar mass, far less remarkable, and far less compelling evidence that the Earth was carefully designed just to please us human beings," he writes.
Hawking, who is only able to speak through a computer-generated voice synthesizer, has a neuro muscular dystrophy that has progressed over the years and left him almost completely paralyzed.
He began suffering the disease in his early 20s but went on to establish himself as one of the world's leading scientific authorities, and has also made guest appearances in "Star Trek" and the cartoons "Futurama" and "The Simpsons."
Last year he announced he was stepping down as Cambridge University's Lucasian Professor of Mathematics, a position once held by Newton and one he had held since 1979.
"The Grand Design" is due to go on sale next week.
(Editing by Steve Addison)
More here>>

Turn off Indexing to speed up XP

Windows XP keeps a record of all files on the hard disk so when you do a search on the hard drive it is faster. There is a downside to this and because the computer has to index all files, it will slow down normal file commands like open, close, etc. If you do not do a whole lot of searches on your hard drive then I suggest turning this feature off:
Control Panel
Administrative Tools
Services
Disable Indexing Services

Remove Shortcut arrow from Desktop icons

Here's how you can remove those shortcut arrows from your desktop icons in Windows XP. Start regedit. Navigate
to HKEY_CLASSES_ROOTlnkfile Delete the IsShortcut registry value. You may need to restart Windows XP
.

Create a Lock Computer Shortcut Icon

1. Right click on the desktop, select New > Shortcut.
2. Enter rundll32.exe user32.dll,LockWorkStation as the shortcut.
3. Name it Lock Computer.
4. Right click and choose Properties.
5. Click on "Change Icon"
6. Search through shell32.dll in the System32 directory and find an appropriate lock icon.
NOTE: This effectively dumps you back to the "Welcome" log on screen. Of course this will only work if you have entered a password for your profile.
ADDENDUM: If you want added security, go to the Control Panel and click on "User Accounts". Click "Change the way users log on or off", and deselect the "Use the Welcome Screen" option.This will switch Windows back to the classic log in box.

Brand your copy of Windows XP in the Start Menu

Have you used someone's new Hewlett Packard with their OEM version of Windows XP? You've seen that HP has their own icon in the Start Menu, underneath Run, that goes to their Help Site. Now, you can have your icon that does anything you want (website, program, etc) and says anything you want. Basically, you are "branding" Windows XP (Home or Pro), great for if you are a computer builder and sell them, or you just want to make Windows XP your own. It involves Regedit.
NOTE: You should NOT install this over a FACTORY BRAND. (UNLESS YOU EXPORT THE FILE FIRST)
1. Start up Notepad and create a new registry file (*.reg) and copy and paste the following into it:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\CLSID\{2559a1f6-21d7-11d4-bdaf-00c04f60b9f0}]
@=
"YOUR TITLE HERE"
[HKEY_CLASSES_ROOT\CLSID\{2559a1f6-21d7-11d4-bdaf-00c04f60b9f0}\DefaultIcon]
@=
"YOUR ICON HERE"
00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,68,00,70,00,6c,00,69,00,\
6e,00,6b,00,2e,00,69,00,63,00,6f,00,00,00

[HKEY_CLASSES_ROOT\CLSID\{2559a1f6-21d7-11d4-bdaf-00c04f60b9f0}\InProcServer32]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,73,00,68,00,\
64,00,6f,00,63,00,76,00,77,00,2e,00,64,00,6c,00,6c,00,00,00
"ThreadingModel"="Apartment"

[HKEY_CLASSES_ROOT\CLSID\{2559a1f6-21d7-11d4-bdaf-00c04f60b9f0}\Instance]
"CLSID"="{3f454f0e-42ae-4d7c-8ea3-328250d6e272}"

[HKEY_CLASSES_ROOT\CLSID\{2559a1f6-21d7-11d4-bdaf-00c04f60b9f0}\Instance\InitPropertyBag]
"CLSID"="{13709620-C279-11CE-A49E-444553540000}"
"method"="ShellExecute"

"Command"="YOUR TITLE HERE"
"Param1"="YOUR FUNCTION HERE"
[HKEY_CLASSES_ROOT\CLSID\{2559a1f6-21d7-11d4-bdaf-00c04f60b9f0}\shellex]
[HKEY_CLASSES_ROOT\CLSID\{2559a1f6-21d7-11d4-bdaf-00c04f60b9f0}\shellex\ContextMenuHandlers]
[HKEY_CLASSES_ROOT\CLSID\{2559a1f6-21d7-11d4-bdaf-00c04f60b9f0}\shellex\ContextMenuHandlers\{2559a1f6-21d7-11d4-bdaf-00c04f60b9f0}]
@=""

[HKEY_CLASSES_ROOT\CLSID\{2559a1f6-21d7-11d4-bdaf-00c04f60b9f0}\shellex\MayChangeDefaultMenu]
@=""

[HKEY_CLASSES_ROOT\CLSID\{2559a1f6-21d7-11d4-bdaf-00c04f60b9f0}\ShellFolder]
"Attributes"=dword:00000000

2. Edit where it says YOUR ICON HERE to a path to an icon (ex. c:\\icon.ico), it must be 24x24 pixels and in .ico format.
3. Edit both places where it says YOUR TITLE HERE to what you want it to say in the
Start Menu (ex. Elranzer Homepage).

4. Edit where it says YOUR FUNCTION here to what you want it to do when you click it, it
can be anything... your website, a local HTML document, a program, a Windows function, whatever your imagination can provide
(ex. http://www.elranzer.com).
5. Save this file as brand.reg, double-click it to enter in your information, and refresh Explorer (log off/on)to see it in the Start Menu!! This works in both Home and Professional.

Speed Up Browsing

When you connect to a web site your computer sends information back and forth. Some of this information deals with resolving the site name to an IP address, the stuff that TCP/IP really deals with, not words. This is DNS information and is used so that you will not need to ask for the site location each and every time you visit the site. Although Windows XP and Windows XP have a pretty efficient DNS cache, you can increase its overall performance by increasing its size. You can do this with the registry entries below:

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters]
"CacheHashTableBucketSize"=dword:00000001
"CacheHashTableSize"=dword:00000180
"MaxCacheEntryTtlLimit"=dword:0000fa00
"MaxSOACacheEntryTtlLimit"=dword:0000012d

Make a new text file and rename it to dnscache.reg. Then copy and paste the above into it and save it. Merge it into the registry.

Speed up your browsing of Windows 2000 & XP machines

Here's a great tip to speed up your browsing of Windows XP machines. Its actually a fix to a bug installed as default in Windows 2000 that scans shared files for Scheduled Tasks. And it turns out that you can experience a delay as long as 30 seconds when you try to view shared files across a network because Windows 2000 is using the extra time to search the remote computer for any Scheduled Tasks. Note that though the fix is originally intended for only those affected, Windows 2000 users will experience that the actual browsing speed of both the Internet & Windows Explorers improve significantly after applying it since it doesn't search for Scheduled Tasks anymore. Here's how :

Open up the Registry and go to :

HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/Current Version/Explorer/RemoteComputer/NameSpace

Under that branch, select the key :

{D6277990-4C6A-11CF-8D87-00AA0060F5BF}

and delete it.

This is key that instructs Windows to search for Scheduled Tasks. If you like you may want to export the exact branch so that you can restore the key if necessary.

This fix is so effective that it doesn't require a reboot and you can almost immediately determine yourself how much it speeds up your browsing processes.

800+ Photoshop brushes MEGA SET

We all know how hard it can get when you need to find inspiration, to speed up the process of creation when deadlines are knocking on your door and you just need to get something done, and you need to get it done now.
Well, that’s exactly where Photoshop brushes come in. They speed up the production time while still allowing you to be creative.
They are designers best friend in times of creative drought, or artist’s block as we call it. More>>

Wednesday, September 1, 2010

Freelance Jobs