Sync you Google Calendar with your iPhone

So I have an iPhone and have been using it for a while with my GMail account, but had to do my Contacts and Calendar in two separate places.  This was starting to get a bit of a pain. So I looked around for something, there must be a iPhone App that will sort this out. Well they do sell an application called MobileMe that costs money, why can’t this be free.

One day while looking at my Google Calendar I saw a tip that read “Sync Google Calendar with you iPhone. Learn more” so I followed the link.  This is great, you not only get your Email, but all your contacts and calendar functions.  It’s FREE too!!!

You will need to setup your GMail account differently, if you’ve already got it installed on your iPhone, but it’s easy. Follow these instructions: Click Here

You will then need to follow these instructions to get you Calendar & Contacts to sync with you iPhone. Follow these instructions: Click Here

Advertisements

Installing Windows 7 on my HP HDX X16-1005EA Premium Notebook PC

image So I bought this Notebook back in Feb-2009 with Vista on it. It’s been a great little machine. Not too small or either too big, since most Notebook/Laptop bags seem to have been designed for 17” machines.  Anyway I thought it was time to load Windows 7 on it. So I purchased a copy of Home Premium with the intention of loading the 64-bit version. Next I thought, let’s head to HP’s website and see what drivers, if any, they have for my Notebook and Windows 7. Well, HP and really on the ball. They’ve got a whole section with download’s for Windows 7 for my Notebook.

so about 1 hour passed and I had all my drivers and software updates needed from HP for my Notebook for Windows 7. Next I had to backup any files I had. This was easy as I already had an Iomega 250GB external HDD which I connect via USB 2.0.  At this point though I was not sure that Win7 would be able to read my Vista backups. So I just simply did Folder copies from my Notebook across to the USB drive.

Now I was ready to install Windows 7.  I inserted the Windows 7 DVD and booted up my Notebook. At the BIOS screen I made sure that I booted from the DVD Rom and not the HDD and started the installation.  Once into the configure screen I deleted the old partition and did a clean install onto the fresh disk. After about 50mins it was all installed and the system rebooted.

Once I had logged in and I then went about installing the HP drivers that I had previously downloaded. These went on without really too much of a fuss. The only thing that you have to remember is that some of the applications are going to need a reboot after they’ve been installed. I only had to reboot my Notebook about 3 or 4 times in total so not too bad. Everything works great, except the HP Assistant. I’ve still had issues making this work, but it’s not a big issue as I can check the HP website for updates manually.

My Windows Experience Index (WEI) scores are as follows:

Delete Confirmation on a ASP.NET GridView

So I want something a little more than just the Default Delete option that you get with the GridView control. When you click this Delete button, your record just disappears and you’re left for a few moments thinking to yourself, “did I really want to delete that?”.  Well I thought I needed to find a method of being able to prompt the user for a confirmation before actually deleting the record.

After searching the web I came across a version that worked really well and was simple to implement, so I thought I would share it here.

      <asp:GridView
        ID="GridView1"
        DataSourceID="DataSource1"
        DataKeyNames="ID"
        AutoGenerateColumns="false"
        runat="server">
        <Columns>
        <asp:BoundField
          HeaderText="Record ID"
          DataField="ID"
          ReadOnly="true" />
        <asp:BoundField
          HeaderText="Movie Title"
          DataField="MOVIE" />
        <asp:CommandField
          HeaderText="Edit?"
          ButtonType="Button"
          ShowSelectButton="true"
          SelectText="Select" />
        <asp:TemplateField>
          <HeaderTemplate>
            Delete?
          </HeaderTemplate>
          <ItemTemplate>
            <asp:Button
              ID="btnDelete"
              OnClientClick="return confirm('Are you sure you want to delete this record?');"
              CommandName="Delete"
              Text="Delete"
              runat="server" />
          </ItemTemplate>
        </asp:TemplateField>
        </Columns>
      </asp:GridView>

Technorati Tags: ,,

How to Refresh GridView after Update on DetailsView

When using a master GridView with a details DetailView and an Insert or Update is performed at the DetailsView level the GridView does not refresh with the new values.  This one was bugging me for a while, but I finally found the answer. I knew that is was to do with the DataBind() on the GridView, but where and when did it need to be called.  The answer is to put the DataBind() on the DetailView’s  ItemUpdated  event.

  Private Sub DetailsView1_ItemUpdate(ByVal sender As Object, _
                                      ByVal e As DetailsViewUpdatedEventArgs) Handles DetailsView1.ItemUpdated
    GridView1.DataBind()
  End Sub

Technorati Tags: ,,

How do you Delete files Older than a given date?

So I got asked if I knew a way of deleting files from a folder that were older than a given date.  I knew this could be done with the Windows OS, bust just how. The Delete command itself is not good enough for the job, so it was time to write a batch file to do the job. I also thought why re-invent the wheel as someone else must have tried this so a quick search on the Internet and I found some information and put it all together. Here is my Batch file, just copy and paste into Notepad.exe and save as DELOLD.bat

   1: @ECHO OFF
   2: SET OLDERTHAN=%1
   3: IF NOT DEFINED OLDERTHAN GOTO SYNTAX
   4:  
   5: echo. >> ~~~FILES_TO_KEEP.TXT~
   6: for /f "tokens=*" %%a IN ('xcopy *.* /d:%1 /L /I null') do if exist %%~nxa echo %%~nxa >> ~~~FILES_TO_KEEP.TXT~
   7: for /f "tokens=*" %%a IN ('xcopy *.* /L /I /EXCLUDE:~~~FILES_TO_KEEP.TXT~ null') do if exist "%%~nxa" del "%%~nxa"
   8: del ~~~FILES_TO_KEEP.TXT~
   9:  
  10: GOTO END
  11:  
  12: :SYNTAX
  13: ECHO.
  14: ECHO USAGE:
  15: ECHO DELOLD mm-dd-yyyy
  16: ECHO   Where mm-dd-yyyy is the date prior to which you want to delete files.
  17: ECHO.
  18: ECHO EX: "DELOLD 10-17-2008" Deletes files older than October, 17 2008.
  19: GOTO END
  20:  
  21: :END

You need to enter the date in the given format of mm-dd-yyyy as the XCOPY command needs it this way. Place the batch file in the folder that you need to delete the files from and execute the batch file.

List Data Providers

Here is a small application that I wrote to check your OS for Data Providers currently Installed.  Download and UnZip, and then run the Setup.exe program. This should create a new folder called List Data Providers in your All Programs folder from your Start Bar. Click on the program and it should open up.

image

Click on the button labelled Providers and it will quickly check what you’ve got configured/installed on your OS. It should come back with a list that looks like this:

image

ASP.NET 2.0 Oracle Connection

So I wanted to create a connection to my Oracle Database 10g using Visual Studio 2008 in Visual Basic. I was not sure how to go about this to start with as I’ve been teaching myself the .NET framework with some nice books ordered from Amazon.  My problem was that the books would detail nicely how to make connections to MS SQL, but tell you in a small paragraph that you can connect to other database’s such as Oracle or My SQL, just not how to actually do it.

So after a bit of searching on the Web, reading material from Oracle and trying to match up the methods that were used in my books for the MS SQL connection I finally got it working. This is what I did.

First I needed to download the ODP.NET provider from Oracle. Head to the Oracle site and download Oracle 11g ODAC 11.1.0.7.20 with Oracle Developer Tools for Visual Studio.  Oracle always say that the client software needs to be at the same level or higher than the database, so using 11g Client on a 10g database is fine.  Once downloaded, you’ll need to unzip and run the Setup.exe which will launch the Universal Installer (which does need to be in Administrator mode if running on Vista).

Once installed go to All Programs, Oracle – OraClient11g_home1, Configuration and Migration Tools, and launch Net Configuration Assistant.  Now configure a Listener for your selected protocol (normally TCP and default Port number).  Of course if you have different values then make sure you key in the correct values before saving. Once complete exit from the program.

Now you should be able to start up Visual Studio 2008. Once loaded you create a new ASP.NET Website. Next you’ll need to add a Reference to the Oracle Provider. Click on Website from the menu and then Add Reference. Once the box has loaded, look under the .NET tab for Oracle.DataAccess, highlight and press OK.

Now for some code. First let me tell you about the table within Oracle that I did my testing on.  It’s a simple table called STORE with two columns:

NO NAME
10 Oxford
20 London
30 Leeds
40 Aberdeen
50 Manchester

 

Now I created a Web Form called readOrcTable.aspx with the following code:

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="head1" runat="server">
    <title>Show Store Details</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
      <asp:GridView 
        ID="grdStores"
        DataSourceId="srcStores"
        Runat="server" />
        
      <asp:ObjectDataSource 
        ID="srcStores"
        TypeName="Stores1"
        SelectMethod="GetAll"
        Runat="server" />
        
    </div>
    </form>
</body>
</html>

 

Next I created a VB Class called OracleSQL.vb with the following code:

Imports Microsoft.VisualBasic
Imports System
Imports System.Data
Imports Oracle.DataAccess.Client
Imports System.Collections.Generic

Public Class Stores1

    Private Shared ReadOnly _connectionString As String
    Private _Number As String
    Private _Name As String

    Public Property Number() As String
        Get
            Return _Number
        End Get
        Set(ByVal value As String)
            _Number = value
        End Set
    End Property

    Public Property Name() As String
        Get
            Return _Name
        End Get
        Set(ByVal value As String)
            _Name = value
        End Set
    End Property

    Public Function GetAll() As List(Of Stores1)
        Dim results As New List(Of Stores1)
        Dim con As New OracleConnection(_connectionString)
        Dim cmd As New OracleCommand("SELECT NO,NAME FROM STORE ORDER BY NO", con)

        Using con
            con.Open()
            Dim reader As OracleDataReader = cmd.ExecuteReader()

            While reader.Read()
                Dim NewStore As New Stores1()
                NewStore.Number = CType(reader("NO"), String)
                NewStore.Name = CType(reader("NAME"), String)
                results.add(NewStore)
            End While

        End Using

        Return results

    End Function

    Shared Sub New()
        _connectionString = "User Id=LoginID;Password=LoginPwd;Data Source=ORACLE;"
    End Sub

End Class

I’ve removed my User Id and Password, which you will have to swap for your own.  And that is all that there is too it.