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: , , , , , ,

     

links for 2010-05-14

Technorati Tags:

     

Compare Two SQL tables or Views

One of the things my company does on SQL that is kinda different from other companies and different than i’d do it is when someone isn’t a member of the website any longer, that member is deleted instead of set to inactive or suspended. This has worked for years and years, until now. We’ve started to work with a 3rd party vendor that will handle much of our web content. One of the problems we’ve run into is the 3rd party software needs to know when someone has been deleted or updated on our system. Updated is easy, we have a last updated column, but when you delete a member along with all their records, there isn’t any data saying that person even existed.

So I had to come up with an off the wall way to find deleted members. My first thought was to use triggers, but we are using a view to combine all the members info from different tables and the triggers will not work with a view (someone will probably prove me wrong, oh well). What I decided to do was do a nightly copy of the view to a table, say 10pm. Then in 24 hours (or close) I run a program that grabs a view that checks for a difference in the live up to date view against the table of last nights data. This will show me anyone that has been deleted. I also look at the up to date view for changed or new from 24 hours ago using the last updated column.

SQL code to compare the view and table, with a union to check date on the up to date view..

SELECT     *, 'Deleted' AS Changed
FROM         tblYesterdaysdata
WHERE     (NOT EXISTS
(SELECT     * FROM          [UpToDateView]
WHERE      [UpToDateView].Individualid = tblYesterdaysdata.Individualid AND
[UpToDateView].IndividualEmailAddr = tblYesterdaysdata.IndividualEmailAddr AND
[UpToDateView].Community = tblYesterdaysdata.Community))
UNION
SELECT     *, 'New or Changed' AS Changed
FROM         [UpToDateView]
WHERE     LastUpdated = (CAST(FLOOR(CAST(GETDATE() AS FLOAT)) AS DATETIME) - 1)

Technorati Tags: ,

     

links for 2010-05-13

Technorati Tags: , , ,

     

CVent and ID’s

Cvents system finds every user and event by their own id, before you can do anything with an event or a user, you must first do a search and find their/it’s id.

Getting and Events id by it’s event name

Public Function GetEventIdsByTitle(ByVal eventTitle As String, ByVal fieldVal As String) As String()
        'Array of EventIds
        Dim ids As String()
        'Create Cvent search object
        Dim thesearch As New com.cvent.api.CvSearch()

        'Create Cvent search filter object array
        'Create a one-row array of Filter objects
        'Create larger array if searching on multiple fields/filters
        thesearch.Filter = New com.cvent.api.Filter(0) {}
        thesearch.Filter(0) = New com.cvent.api.Filter()
        'Search by Event Title field and provided search criteria
        'EventTitle is a “searchable” attribute of the Event object
        'any searchable attribute can be added as a search filter

        thesearch.Filter(0).Field = eventTitle
        thesearch.Filter(0).Value = fieldVal
        'Search for all Event Titles that “start with” provided criteria
        thesearch.Filter(0).Operator = com.cvent.api.CvSearchOperatorType.Equals
        'Specify if the search filters should be used to build an “And” or “Or” search
        'search.SearchType = com.cvent.api1.CvSearchType.OrSearch
        'Perform search for event ids that match the search criteria
        'Note: Use same technique to search for other Cvent objects including
        'Contacts, Invitees, Registrations, Surveys, etc
        ids = _ws.Search(com.cvent.api.CvObjectType.[Event], thesearch)

        'Return string array of event ids
        DisplayEventsByIds(ids)
        Return (ids)
    End Function

The same type of search works for finding a user. CVent looks at the “sourceID” and the users email address to make sure they don’t have dupes, so these are the easiest fields to search for a user by. The sourceID is anything that your current system may use to identify users.

Public Function GetcontactIdsBysourceid(ByVal IndividualID As String) As String()
        Dim i As Integer = 0
        'Array of EventIds
        Dim ids As String()
        'Create Cvent search object
        Dim thesearch As New com.cvent.api.CvSearch()

        'Create Cvent search filter object array
        'Create a one-row array of Filter objects
        'Create larger array if searching on multiple fields/filters
        thesearch.Filter = New com.cvent.api.Filter(0) {}
        thesearch.Filter(0) = New com.cvent.api.Filter()
        'Search by Event Title field and provided search criteria
        'EventTitle is a “searchable” attribute of the Event object
        'any searchable attribute can be added as a search filter

        thesearch.Filter(0).Field = "SourceID"
        thesearch.Filter(0).Value = IndividualID
        'Search for all Event Titles that “start with” provided criteria
        thesearch.Filter(0).Operator = com.cvent.api.CvSearchOperatorType.Equals
        'Specify if the search filters should be used to build an “And” or “Or” search
        'search.SearchType = com.cvent.api1.CvSearchType.OrSearch
        'Perform search for event ids that match the search criteria
        'Note: Use same technique to search for other Cvent objects including
        'Contacts, Invitees, Registrations, Surveys, etc
        ids = _ws.Search(com.cvent.api.CvObjectType.[Contact], thesearch)

        'Return string array of event ids
        Return (ids)
    End Function

Technorati Tags: , ,

     

Knee Deep in CVent API, Logging in

Image representing Cvent as depicted in CrunchBase
Image via CrunchBase

I have to admit, I’ve never worked with an API before, ok I’ve pulled an image from flickr or the twitter feed on the side bar with API but someone else showed me how to do that. For work I had to write vb.net code to work with CVent’s API. So over the next few post, I’ll be adding code that may help others (Since I could find any for the API newbie!), I will also admit that this isn’t the prettiest or even the most logical code but it works for how we’re doing things and will give you a beginning point to work with.
There are many spots in the code that the API uses arrays and as you’ll see I’ve created my loops to add only a single element into the array. I know, I know but when you’re on a tight schedule and you’re just figuring out the API, if something works, you go with it.. and if you use my code and actually change it to work correctly, please send me your examples so I can share with everyone. (richard(@)curbob.com).

Lets start at the beginning.. adding the API to VisualStudio
You have to have an API account with Cvent to even access the API, so untill all contracts are signed, don’t even try. I thought for a day I was doing something wrong.. nope, no access.
To connect VS2005/2008 to CVent API, right click the project in solution explorer and choose “Add Web Reference”. The URL is https://api.cvent.com/soap/V200611.asmx?WSDL. After adding this URL I was bombarded with 4 popup boxes asking about letting this secure page show, click yes on all of them and also unblock the activeX content. Then Click Add Reference.

Private _ws As New com.cvent.api.V200611()

Lets login into CVent API

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Login("account Number", "UserName", "Password") = True Then
            Label1.Text = "Login worked"
        Else
            Label1.Text = "Login failed"
        End If
    End Sub
Public Function Login(ByVal Acct As [String], ByVal userName As [String], ByVal pwd As [String]) As [Boolean]

        Dim loginResult As com.cvent.api.LoginResult = _ws.Login(Acct, userName, pwd)
        _ws.CventSessionHeaderValue = New com.cvent.api.CventSessionHeader()
        _ws.CventSessionHeaderValue.CventSessionValue = loginResult.CventSessionHeader

        Return (loginResult.LoginSuccess)
    End Function

Technorati Tags: , ,

     

IIS and redirecting a page with a Query String

Microsoft has added to the redirect function in IIS to allow for Query Strings.

Example:
In the Redirect to box, enter the domain you wish to move to (no trailing slash), plus $S$Q – for example, http://www.tek-works.com$S$Q

What does this $S$Q do? These are tags that IIS will automatically replace – $S will be replaced with the subdirectory location (such as /shopping/cart.aspx) and $Q will be replaced with the querystring (such as ?id=Blue).

$P Passes parameters that were passed to the URL to the new URL. If the request contains parameters such as http://www.oldsite.com/cart.asp?id=Blue , then $P would represent all the values after the question mark in the URL, example $P would equal id=Blue (no question mark).

$Q Passes the parameters including the question mark. This is the same as $P but includes the question mark or query string. So $P would equal ?id=Blue

$S Passes the matching suffix of the URL to the new URL. If the request is for http://www.oldsite.com/shopping/cart.asp, then $S represents /cart.asp. If the request was for http://www.oldsite.com/shopping then the value of $S would be /shopping

$V Removes the server name from the original request. If the request is for http://www.oldsite.com/shopping/cart.asp then $V would contain everything after the server name, eg: /shopping/cart.asp.

* Wildcard symbol used for replacement. Let’s say you want to redirect all requests for html pages to a single asp page – you could do so in the following way: *;*.htm;page.asp

Technorati Tags: ,

     

What if SQL DataSource returns null or nothing

I had a SQLDataSource and wanted to show a message that nothing matches the search if the source didn’t return any rows of data.

here’s how..
add to the sqldatasource

<asp:SqlDataSource ID="SqlDataSource1" OnSelected="SqlDataSource1_Selected" ...

and then in the code behind.

Protected Sub SqlDataSource1_Selected(ByVal sender As Object, ByVal e As SqlDataSourceStatusEventArgs)
        If e.AffectedRows < 1 Then
            lblnonefound.Text = "No matches found, Please try again"
            lblnonefound.Visible = True
        Else
            lblnonefound.Text = ""
            lblnonefound.Visible = False
        End If
    End Sub

Technorati Tags: , ,