Monday, November 28, 2011

Update

Below you will find example of database coding (VBA) Feel free to comment and ask questions

ETL Extract/Transform/Load

Example with 2 Dimension tables: Product Dimension, Seminar Dimension tables
Dim rsProduct As ADODB.Recordset
Dim rsSeminar As ADODB.Recordset
1. Extract Information From Tables using select Statement

Private Sub cmbExtract_Click

Dim cn As New ADODB.Connection
cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & CurrentProject.Path & "\NameofDatabaseBackEnd.accdb;"


Set rsProduct = New ADODB.Recordset
With rsProduct
    Set .ActiveConnection = cn
    .Source = "Select * From Product"
    .CursorType = adOpenStatic
    .Open
End With

Set rsSeminar = New ADODB.Recordset
With rsSeminar
    Set .ActiveConnection = cn
        .Source = "Select * from Seminar"
        .CursorType = adOpenStatic
        .Open
End With

Set cn = Nothing

End Sub

2. Transform the data (if need be/any) Then load the data into the new Data Warehouse:
(Set the connection to the Warehouse!!!)
Private Sub cmbTransform_Click()
Dim cnwh As New ADODB.Connection
cnwh.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & CurrentProject.Path & "\NameofDataWarehouse.accdb;"

Dim rsProductwh As ADODB.Recordset
Set rsProductwh = New ADODB.Recordset

    Set rsProductwh.ActiveConnection = cnwh
    
Dim strInsert2 As String
rsProduct.MoveFirst
Do While Not rsProduct.EOF
    strInsert2 = "insert into ProductDim (ProductNumber, Description, UnitPrice)" & _
 " values ('" & rsProduct!ProductNumber & "','" & rsProduct!Description & "','" & rsProduct!Unitprice & "')"
    
    rsProductwh.Open strInsert2
    
    rsProduct.MoveNext
Loop

Set rsProductwh = Nothing

Dim rsSeminarwh As ADODB.Recordset
Set rsSeminarwh = New ADODB.Recordset
    Set rsSeminarwh.ActiveConnection = cnwh

Dim strInsert3 As String
rsSeminar.MoveFirst
Do While Not rsSeminar.EOF
    strInsert3 = "insert into SeminarDim (SeminarDate, SeminarTime, Location, Title)" & _
" values ('" & rsSeminar!SeminarDate & "','" & rsSeminar!SeminarTime & "','" & rsSeminar!Location & "','" & rsSeminar!SeminarTitle & "')"
    
    rsSeminarwh.Open strInsert3
    rsSeminar.MoveNext
Loop

Set cnwh = Nothing ' close the connection
Set rsSeminarwh = Nothing

End Sub

VBA (Visual Basic) Coding for Databases

Posting of Database Coding Review
Set connection to Back end database:


Dim cn As New ADODB.Connection
cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & CurrentProject.Path & "\NameofDatabase.accdb;"

Write the Select Statement to get data:
Dim rsName As ADODB.Recordset ' put this at top

Set rsName = New ADODB.Recordset
With rsName
    Set .ActiveConnection = cn
    .Source = "Select * From TableName"
    .LockType = adLockOptimistic
    .CursorType = adOpenStatic
    .Open
End With

Fill text boxes on Form with data retrieved:
With rsName
    If Not (.EOF) Then
        .Find strcriteria
        Me.txtTransactionID = !transactionid
        Me.txtDateAcquired = !DateAcquired
        Me.txtAcquisitionPrice = !AcquisitionPrice
                
        Me.txtAskingPrice = !AskingPrice
        Me.txtDateSold = !datesold
        Me.txtSalesPrice = !salesprice
    End If
End With

Example of Form Load where lsTransaction (Listbox) is filled with transaction ID, Date Acquired and artwork ID:
Dim rsTransactions As ADODB.Recordset
Private Sub Form_Load()
Dim cn As New ADODB.Connection

cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & CurrentProject.Path & "\VRG+Art+BE.accdb;"

Set rsTransactions = New ADODB.Recordset

With rsTransactions
    Set .ActiveConnection = cn
    .Source = "Select * from GalleryTransactions"
    .LockType = adLockOptimistic
    .CursorType = adOpenStatic
    .Open
End With

Do While (Not rsTransactions.EOF)
Me.lsTransactions.AddItem rsTransactions![transactionid] & ", " & rsTransactions![DateAcquired] & ", " & rsTransactions![artworkid]
rsTransactions.MoveNext
Loop
rsTransactions.MoveFirst

Set cn = Nothing

End Sub

Friday, January 29, 2010

Update!!!

Well as you can all see I have not had the time to post here, since I am a dedicated World of Warcraft player, if anyone plays my name is Badunkadunk on the Bladefist Server. I am a Shadow/Disc Priest on the Alliance side, I'm the night elf.

With this upcoming update I'd like to post some guides and tips on leveling characters and making gold.

Tuesday, November 10, 2009

Increase Blog Traffic (No Problem)

Over the past couple of days, I've noticed that my blog has been viewed considerably more. Yes I have done some Google sleuthing and discovered websites that give tips on increasing blog traffic. Its as simple and takes little to nothing at all to setup.
  1. Do a Google search on "Increase Blog Traffic"
  2. Read what they offer and muse over if some of the options are available to you.
  3. Follow up and actually do what they say because:
    • they have done this from experience
    • they know what they are doing, obviously since the link was found on Google's first page search
Ok, sounds simple right? Yes and No. Beware of scamming. In other words just follow some of the steps that I did.
  1. Noticed how other blogs are setup, some have rss feeds and other promoting blog websites, hint look at mine ------->
  2. Blogtoplist sign up there and you will definitely get hits to your blog
  3. Search out other blog promo sites, such as technorati, buzzerhut.com
  4. Sign up with StumbleUpon, Reddit, or Digg and submit your site
  5. Lastly sign up with Sitemeter, this will tell you how many people visit your blog
Ok alright now your ready, and hopefully getting increased traffic to your blog.
Additional steps, such as linking, correctly labeling and creating a title that increases search traffic.

Tuesday, November 3, 2009

Gimp Update

Well after many frustrating breaks, going from Photoshop to GIMP was not an easy task, tools were relatively the same with a few difficulties here and there, such as the scale tool and gradient tool. Layers behaved similarly to Photoshop as well. Setup was a breeze and was fast with no problems, although at first finding where to download the program took a little time. Program design was a bit impressive compared to Photoshop, as all the tools are displayed and there respective calibrations shown when clicked on. As far as availability of tools, I have yet to explore them all and have to remove it from the ratings list.
As Far the ratings goes like this:
  1. A Rating for Ease of Install and Initial Setup - 9/10
  2. A Rating for Overall program design in terms of layout of tools (easy to difficult) - Medium (Some Frustration) 7/10
  3. A Rating for Amount of tools available for photo manipulation - N/A (Still need to Explore and Tryout)
Next is the test banner that I have put together using GIMP.



There it is, I thought I have done a wonderful job in creating this banner with 0 experience using GIMP.
The image comes from a Desktop Background with the color taken out of it, originally blue on white background that has been desaturated and colors inverted to white and black. The text is the font Scriptina, which can be downloaded Here, however the gradient color is from a background color, with an overlay blend mode and transparency set to around 62%.
Put all this together and Voila the image is made.

As a side note to all, read the manual before using, it will help greatly in figuring out how to use the program better and more efficiently.

Gimp

Today, I decided to download GIMP and see what everyone has been talking about. I am very familiar with Photoshop and as far love the program, however as seeing as the laptop is the only computer that is available to me, I have opted to get GIMP and look at the comparision to Photoshop. I will post and update with my ratings on 3 subjects.
The 3 areas of rating will be:
  1. A Rating for Ease of Install and Initial Setup
  2. A Rating for Overall program design in terms of layout of tools (easy to difficult)
  3. A Rating for Amount of tools available for photo manipulation
For this test I will create a proper banner for packetstealer