Installing Visual Studio 2005 on Windows 7

Today I received a new computer at work, while that’s great news, the bad news is I now need to move everything from 4 years at this company to the new PC (including things that were on the PC before I started). We have some legacy programs that still are using Visual Studio 2005 (yeah i know, you don’t have to say update them!) My new computer is running Windows 7 and while installing VS 2005 I ran into a few problems that took me most the day to figure out.

Installing VS 2005 on Win 7

When you first put in the VS 2005 CD the install will begin, you are suddenly startled with a popup window telling you that there are known problems with VS 2005 and Win 7 and that you need to install “Visual Studio 2005 Service Pack 1 Update for Windows Vista”, this is misleading because you haven’t even installed VS 2005 yet so running the file they are pushing at you will not help. Instead, go ahead and install VS 2005 normaly from CD (or file). Next I had forgot that when VS 2005 was released, it didn’t support Web Applications and there was an update for that, so my next step is to install VS 2005 SP1 (this took me forever to find the correct download) http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=5553 after installing SP1 you will then install the “for Vista update” located at http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=7524 and yes this is for Windows 7, even though it also says Vista.

One other thing I did install between the full version and SP1 was http://www.microsoft.com/download/en/details.aspx?id=6071 Microsoft Visual Studio 2005 – Update to Support Web Application Projects. The reason I left it out of the above list is beacuse I’m not sure if you need it, the Web Application updates maybe in SP1, but if you run into problems try installing this also.

Oh, and don’t forget to go to C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\ right click on devenv.exe and choose run as administrator.

Technorati Tags: , , , ,

     

Finding Network MAC Addresses with Advanced IP Scanner 2.0

Tek-Works was asked awhile back to review Advanced IP Scanner 2.0, not wanting to just review something with out actually needing it, would be useless for our readers, so I put it off till today. Today at work, my task was to add a wireless router to our network and to make it as secure as possible.

Locking Down the Router

The D-Link Router I chose had the option to restrict access by MAC address. This means that I can give the router a list of MAC addresses within our company and the router will only allow them to connect to the network and as an added layer of protection they also needed to have a 10 character password. So you ask what is a MAC Address?

Media Access Control address (MAC address) is a unique identifier assigned to network interfaces for communications on the physical network segment. The standard format for printing MAC  addresses in human-friendly form is six groups of two hexadecimal digits, separated by hyphens (-) or colons (:)  (e.g. 01-23-45-67-89-ab   or   01:23:45:67:89:ab )

So my problem was how do I quickly and easily get a list of MAC Addresses for the router?

Finding MAC Addresses with Advanced IP Scanner 2.0

Advanced IP Scanner 2.0 (Download here) was the exact software I needed, it took seconds to download and install and I was ready to scan the network. I’ll walk through the steps so those of you wanting to lock down your home wireless router can easily do so.

The first thing Advanced IP Scanner 2.0 wants to know is what ip addresses it should scan. The default is 192.168.1.1 – 192.168.1.254 but to make sure you’re network is using these IP’s try this:

Click the start button and find RUN (on XP you click the RUN to start it, on Win7 you just start typing in the open text box). Once you have a box to type in, type CMD and hit enter. A Command Prompt will open up, it doesn’t matter what is on the line behind the > just type ipconfig and hit enter

For most networks (specially home networks) you can take the first 3 sections of  ”IP Address” and use them to create your scan IP’s. So we take 192.168.1 and start with .1 and end with .254 (Don’t ask about why 254.. just do it lol) If your IP Address was 10.10.0.134, your scan range would be 10.10.0.1 – 10.10.0.254

So we’ve got our range of IP Addresses to scan, so hit Scan..

Advanced IP Scanner 2.0 has now scanned my network and you see a list of names of computers/laptops on your network, their IP Address and their MAC Address. With this list I was then able to add the MAC addresses to my Router and secure our wireless network even more than just passwords.

Other uses for Advanced IP Scanner 2.0

While playing around with Advanced IP Scanner 2.0 for this post I wanted to see what else I could do with it. One of the cool features is if you click on the + for each computer you’ll see that computers shares, and even copy the path (\\192.168.1.136\Temp-folder) to that share, this makes for a simple way to add the share to your Mapped Network Drives.  Advanced IP Scanner 2.0 will also work with Radmin 3.4 which will allow you you access and control each computer remotely.

For a quick and simple scan of your network, that not only shows MAC & IP Address but gives you quick access to each computer on your network (including Shares,HTTP, HTTPs and FTP) Advanced IP Scanner 2.0 is the best product you’re going to find that is Freeware.

Technorati Tags: , , , , , ,

     

Adding Content to Accordion Pane in Code Behind

Adding Content to Accordion Pane in code behind and Creating an Accordion Control in Code Behind

Today I had to create an app the had a menu of countries and states but I only wanted countries or states that our company had businesses in. I’d pull them from the SQL server and have an accordion panel as the menu, one menu item States and when you clicked on it all the states would list below it as LinkButtons, The same setup was created for the Countries also. Using LinkButtons I would then open panels to the right depending on their menu choice.

There are 2 options for creating the Accordion and it’s Panels. You can either create them in the aspx page by dragging them onto the page and then add data to them from the code behind page like this:

Adding to an already created Accordion from Code Behind

<br>  'used to center code on blog

   Dim stateslink As New LinkButton
   stateslink.ID = "States" & dr("Country") 'set Linkbutton ID
   stateslink.Text = dr("Country") 'set Linkbutton text
   stateslink.CssClass = "LinkButtonSideindent" 'set Linkbutton CSS
   AddHandler stateslink.Click, AddressOf lnk_Click 'once clicked do what?
   AccordionPane0.ContentContainer.Controls.Add(stateslink) 'add to AccordionPane0

<br>

In the above code, AccordionPane0 was in the accordion we created by dragging and dropping.
But what if you wanted to create the entire accordion in the code behind?

Creating an Accordion in Code Behind

First on your aspx page you need to tell the code behind where this accordion is going to go. Add this to your aspx page:

<br/>

<asp:Panel ID="AccordionPanel" runat="server">

</asp:Panel>

<br/>

Then create the accordion in code behind

<br> 'to center on blog

Dim Accordion2 As Accordion = New Accordion
        Accordion2.ID = "States"
        'Accordion2.AutoSize = none
        Accordion2.ContentCssClass = "LinkButtonSideindent2"

        Accordion2.HeaderCssClass = "LinkButtonSide"
        Accordion2.HeaderSelectedCssClass = "LinkButtonSideactive"
        Accordion2.FadeTransitions = "True"
        Accordion2.SelectedIndex = "-1"
        Accordion2.RequireOpenedPane = "false"
        Accordion2.FramesPerSecond = 40
        Accordion2.TransitionDuration = 250
        Accordion2.RequireOpenedPane = False
        Accordion2.Panes.Add(newPaneStates("State / Province"))

        AccordionPanel.Controls.Add(Accordion2)

<br>

The above code creates an accordion named Accordion2 with an ID of States and a pane called State / Province. After creating the accordion we need to add content to it, just like above except this time we’ll create the pane and point the data to our new accordion

<br/> ' centering code for blog

Dim aPane As AccordionPane = New AccordionPane ' creates new pane
aPane.HeaderContainer.Controls.Add(New LiteralControl(header)) 'creates header, set from above code State/provinces

...Get data from sql...
...Push data into the accordion pane..

    Dim stateslink As New LinkButton
    stateslink.ID = "States" & dr("Country")
    stateslink.Text = dr("Country")
    stateslink.CssClass = "LinkButtonSideindent"
    AddHandler stateslink.Click, AddressOf lnk_Click
    AccordionPane0.ContentContainer.Controls.Add(stateslink)

<br/>

Last, if one of the linkButtons is clicked we need to create a function that will tell the page what to do:

<br/>

Protected Sub lnk_Click(ByVal sender As Object, ByVal e As EventArgs)
        ClientScript.RegisterClientScriptBlock(Me.[GetType](), "lnk", _
        "<script type = 'text/javascript'>alert('LinkButton Clicked');</script>")
    End Sub

<br/>

Technorati Tags: , , ,

     

.NET Regular Expression in Code Behind

Most the time when we’re using regular expressions we’re doing it with in our aspx page checking against a text box or some other control.

example

'

<asp:RegularExpressionValidator ID="regfirstName"
 runat="server" ErrorMessage="This expression does not validate."
  ControlToValidate="txtFirstName"
ValidationExpression="^[a-zA-Z0-9'.\s]{1,40}$" />

'

When working with Query Strings you’ll need to compare the QueryString against a regular expression in the code behine, this is done by using the regex class from the System.Text.RegularExpressions namespace.

example

'

If Regex.IsMatch(Request.QueryString("region"), "^[a-zA-Z0-9\s\-]+$") Then

                Else

                End If

'

btw great site to help and/or get commonly user regular expressions is regexlib.com

Technorati Tags: , , , , ,

     

SQL Case Sensitive Select Query

Today I ran into a problem where I needed to search for the term “PROfile” in my SQL database. the problem was, my queries kept also showing “profile” without the caps. From reading many sites, I guess that depending on how your SQL server was setup, you’ll either have case sensitive or insensitive searches. to change this (not server wide but just for your current query):

For case sensitive:
WHERE body like ‘PROfile’ COLLATE SQL_Latin1_General_CP1_CS_AS

For case insensitive:
WHERE body like ‘profile’ COLLATE SQL_Latin1_General_CP1_CI_AS

(notice the CS for case sensitive and CI for insensitive)

     

Replace Data in SQL

update tablename set columnName = REPLACE(ColumnName, ‘OriginalData’, ‘NewData’)

This is mostly for myself but always good info. This will replace all the originaldata with the NewData for every row in the table.

Update: I’ve noticed that in SQL2000 this will not work if the column is ntext, so a work around is: (if your data isn’t to long)

update tablename set columnName = REPLACE(cast(columnName as nvarchar(1000)), ‘OriginalData’, ‘NewData’)

Technorati Tags:

     

Notepad++ Replace Something with Line Break

Quick how to..

To replace anything in Notepad++ with a Line break or Line Feed, the easiest way to do it is:

In the lower left hand corner of the Replace box, you’ll see a section called “Search Mode”. Just select the “Extended (\n, \r, \t, \0, \x…)” choice and you can enter in \r as the replace variable and it will put the line break in.

(found on Alex Blog)

     

Transferring Video from Sony Handycam to PC via USB

This is a copy of a page from Google cache, the page it was originaly on is no longer there and I’m posting it because it helped me today and I’d hate for it to be lost.

Steps to transfer video from Sony HC40E Handycam and Sony HC42 to an Windows XP PC:

Make sure that you have installed the USB driver for the handycam. You can download the drivers from this link: Sony Asia Pacific Support Website–Download Page for HC40E USB Driver for Windows.

Connect the handycam to the AC adaptor (the same as putting it on charge).
Set the handycam to USB stream mode. (Press P-menu, press MENU, Press EDIT/PLAY, Press USB-PLY/EDT MODE, Press USB Stream.)

Set the tape at the point from where you want to start capturing in PC.

Connect the handycam and the PC with the USB cable. (USB-Mode appears on the handycam LCD / viewfinder.)

Start Windows Movie Maker. Click on the ‘Capture..’ link to start the wizard.

Select the Sony Digital Imaging Device. Click Next.

Specify the file name and path for the capture video. Click Next.

Select the desired capture format and Click Next. (Leave it to recommended setting if you are not sure.)

The dialog box now displays the Start Capture and End Capture buttons on the left and preview window on the right.

Play the tape on the handycam. The video from handycam should appear in the preview window of WMM.

Click the Start Capture button to start capturing the video. Click End Capture to pause or stop recording.

Click the Finish button. The .wmv file will be saved in the path specified in step 7.

Technorati Tags: , , , , ,

     

Deleting or Hiding the Sidebar in WordPress

Image representing WordPress as depicted in Cr...

Image via CrunchBase

Many times you’ll add a plugin to your WordPress blog that has to be placed on it’s own page. While most these plugins have the instructions on how to create the extra page to place the plugin on, they don’t give you any extra help. I recently helped a friend that had one such plugin and thought it would look great if it had a larger area to be seen, so he wanted to delete his right sidebar from just that page.

Here’s how to delete your sidebar from an extra page on your WordPress blog:
When creating the new page there’s a dropdown on the right hand side asking you which page template you’d like to use, problem is if your site uses sidebars the templates probably have sidebars also. So lets create our own WordPress template.

Either using FTP or the original download of your current theme, download or copy the page.php file to another directory. Open the copy of page.php (notepad will work), on the very first line hit enter to drop down the code that’s there a couple lines and add this piece of code:

<?php
/*
Template Name: MyTemplate
*/
?>

You can name the template (Template Name: MyTemplate) anything you’d like. Then scroll down toward the bottom of the page and look for something along the lines of:

<?php get_sidebar(); ?>

It may actually say something like rightsidebar or something, just look for sidebar in the name and delete the entire line (like the line shown above).

Now “save as” and name the file anything you’d like (MyTemplate.php) always end it in .php Now upload it to your theme directory, this has to be the directory that you are currently using as your theme (i.e. /wp-content/themes/{theme name}). once it’s uploaded go back to either the page you already created or create a new page, on the right sidebar under Attributes -> Template use the dropdown list to choose the template that you just created. Save and preview. Your sidebar should be hidden.

Technorati Tags: , , , , ,

     

WordPress & Eval(base64_decode

A good friend of mine sent me an email today asking me if a free theme he was looking into had a virus or some sort of spam code in it. The code he was referring to was a couple strings of code that started out with..

eval(base64_decode('

the code went on to show what seem to be a random string of letters, numbers and symbols. I explained to him that this was the theme creators way of hidding code, so the wordpress owner could not own it.

The easiest way to read the code is to copy all the random (stuff) between the single quotes and paste it into this page Base64 decoder and hit the decode from base64. This will enable you to read the code and make sure that the theme doesn’t have any evil code.

If I’ve downloaded a free theme, I always leave the theme’s author and weblink at the bottom of my blog, but I don’t think that the authors should put more or less spam messages at the bottom of the blog. Someone new to themes usually won’t know enough to delete all the code, the authors have even added code that if the footer was changed, the theme wouldn’t work correctly.

How To Delete the Eval(base64_decode lines

Most the code has been hidden in the footer.php but I’ve also found it in the header.php looking for the other code in other files, so our safest bet is to search through all the files for the code. While you could look through each file and all the directories and sub-directories, there’s an easier way.

Download the free application: Notepad++ and install it. Notepad++ is handy for alot of things but one of the best parts of it is you can search for a tern within an entire directory. Open Notepad++ and from the top menu choose “Search” and “Find in Files”. In the find waht field type eval(base and in the directory field click the … button to choose the directory you’ve unzipped the theme. Make sure the “In all sub-folders” check is checked and hit find all. At the bottom of the screen a list will show all the lines when the search term has showed up and which file they’re in. By clicking on the line number, the top of the page will open that file and to that spot in the code. Delete every line that starts with the eval(base64_decode (including the ; after it) and if it’s in the middle of a line, delete from the space in front of it to the space after the ; following it. Save this file as {filename}2.php. I then go back to the directory and rename the orginal as {filename}-old.php and rename the new file to what the original was named, this allows us a backup. Now upload and test your theme, all should work. Remember if you’ve downloaded this theme for free, leave the author and hir or her link, but kill the spam links in your footer.php.

Technorati Tags: , , , , , ,