moopoo.net
Fishing, technology and anything else

Using the Rive Hooktyer

January 21st, 2008 by Matt

The Rive hooktyer is a great system for getting your hooklengths the perfect length every time, but it can be tricky to get going with, especially with the instruction supplied in French and the diagrams not particularly helpful. Well fear not, this guide will help you.

Firstly tie set the length bar on the tyer to the length you require. To speed up the process and reduce line wastage I tie as many loops on the line as I require enabling me to quickly cut off the line above the loop when I need to tie the next hook. Remember to leave enough extra line between each loop for tying.

 

Insert the brass pin through the hole and put the hook in with the shank at the bottom.

Attach the loop to the end of the tyer and and wrap the line around the far side of the pin and beginning whipping the line around the hook, making sure the the line comes off the front of the shank as you tie.

Whip down the shank for as many turns as are required then pass the line between the flat side of the brass pin and the bent pin.

Photograph of hook ready for the tag to be trimmed

Keeping the line under tension, remove the brass pin pulling through the line with it, again making sure you keep tension on as the line comes through the other side.

Moisten the knot and slowly pull from the top side to tighten the knot.

The finished hook

Job done. Once you have tighened the knot, trim the tag to size and the hooklength is the the perfect length.

After a bit of practice you should be able to tie many hooklengths in no time at all.

Posted in Fishing | 1 Comment »

Backing out a webpart

November 14th, 2007 by Matt

Backing out a webpart is a relatively straight forward process using the following command.

stsadm -o deletewppack -name simplewebpartcab.cab -url http://mossurl

Posted in Sharepoint, Web Development | No Comments »

Deploying WebParts

November 13th, 2007 by Matt

This is a tutorial for deploying webparts to Sharepoint MOSS 2007 by creating a solution package and deploying using stsadm.

Assembly Info

Create your webpart in the normal way then add the following line to the AssemblyInfo.cs file

[assembly: System.Security.AllowPartiallyTrustedCallers()]

Web Part

Next, add the following above the class declaration in your web part:

[XmlRoot(Namespace = "MyWebParts")]

The value of the Namespace attribute should match the namespace of your project. Below is an example of what your web part should look like.

using System;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Serialization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
 
// namespace must be different from classname
namespace MyWebParts
{
    [Guid("b6e6a8fb-78f2-4561-bd6f-cfbc55f07e56")]
    [XmlRoot(Namespace = "MyWebParts")] // same as namespace   
    public class SimpleWebPart : Microsoft.SharePoint.WebPartPages.WebPart
    {
        protected override void Render(HtmlTextWriter writer)
        {
            // TODO: add custom rendering code here.
            writer.Write("Output HTML");
        }
    }
}

Next we add two extra files to the project; a “dwp” file (web part definition file) and a manifest.xml file. Both these should be in the root directory of your project.

Web Part Definition file

Add an xml file to your project and name it whatever your project name is, in this example it would be SimpleWebPart. Give it the extension dwp. So, the final filename would be SimpleWebPart.dwp. Enter the following data into the dwp file:

<?xml version="1.0" encoding="utf-8"?>
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2" >
	<Title>Simple Web Part</Title>
	<Description>a Test</Description>
	<Assembly>SimpleWebPart, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5c87de9a2116ae0a</Assembly>
	<TypeName>MyWebParts.SimpleWebPart</TypeName>
</WebPart>

The Assembly element contains the classname and the TypeName element contains the namespace, classname.
Make sure the assembly is signed before compilation then use reflector to get the public key token and then correct the token in the dwp file – then compile again.
You will need to create one dwp file for each web part that exists in your project.

Manifest.xml

<?xml version="1.0"?>
<!-- You need only one manifest per CAB project for Web Part Deployment.-->
<!-- This manifest file can have multiple assembly nodes.-->
<WebPartManifest xmlns="http://schemas.microsoft.com/WebPart/v2/Manifest">
    <Assemblies>
        <Assembly FileName="SimpleWebPart.dll">
            <!-- Use the <ClassResource> tag to specify resources like 
            image files or Microsoft JScript files that your Web Parts use. -->
            <!-- Note that you must use relative paths when specifying resource files. -->
            <ClassResources></ClassResources>
            <SafeControls>
                <!-- TypeName=ClassName. One for each webpart in the solution -->
                <SafeControl Namespace="MyWebParts" TypeName="SimpleWebPart" />
            </SafeControls>
        </Assembly>
    </Assemblies>
    <DwpFiles>
        <!—- create one for each webpart --> 
        <DwpFile FileName="SimpleWebPart.dwp" />
    </DwpFiles>
</WebPartManifest>

You need to create one SafeControl element for each webpart in your solution. Similarly, you will need to create a DwpFile element for each dwp you have in you project.

IMPORTANT! Make sure the project is signed, rebuild, then use reflector to get the public key token and then correct the token in the dwp file – then compile again.

CAB File project

Next create a CAB file project in the same solution as your webpart.

Right click the CAB file project and choose Add > Project Output. From the list choose Primary output. Do the same again and add Content Files. Right click Add > Files and browse to add each of the dwp files from you project.

Now build the solution.

Deploying the webpart

Now deploy the package using stsadm (which can usually be found in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN).

First open a new command prompt window and navigate to the directory, which contains the cab file you created, then run the following command

stsadm -o addwppack -filename simplewebpartcab.cab -url http://urltomoss -globalinstall –force

Finally restart IIS

That should be it! You should now be able to add your webpart to your Sharepoint pages.
Tip: Once the webpart has been deployed, you can actually copy your compiled dll into either GAC or your sharepoint bin. You can read more on the post MOSS 2007 Web Part Deployment using Visual Studio Extensions

Thanks to David Bowden for producing the initial version of the document

Posted in Sharepoint, Web Development | No Comments »

Windows Live Writer

October 28th, 2007 by Matt

After seeing that the new WordPress 2.3.1 release had tagging support in for Windows Live Writer, I was curious as to what Live Writer actually was. Turns out it is a desktop application for authoring blog posts that can be published to a variety of different blogs, including WordPress.

I thought I’d download it and give it a go. So I’ve been using it for, well, since I started writing this post.

If you allow it, it will take a look at the theme you are using so you can author your posts and view them styles as they would appear on the blog. You can also view in a plain layout, view the html source, or preview the post how it’s going to look in you blog, as mentioned above.
Just on a side note about the HTML, Microsoft don’t tend to have a good history of creating HTML editors that actually put out good code. It seems they’re learning from their past mistakes, for now at least, the code produced here is pretty good.

Tags are added as Keywords in the properties box of a post as well as choosing the categories and other settings for the post.

Publishing is straight forward using the aptly titled Publish button on the toolbar. This will send the post off to your blog and publish it. You also have options for saving the draft locally or publishing the post as draft to your blog.

First impressions are good, I don’t totally see the reasons yet for having something like this, unless you have multiple blogs in which case it would save time logging into different blogs to post. I’m sure I’ll see other benefits after I’ve used it a while.

Posted in Technology | No Comments »

Importing CSV data into Oracle

October 25th, 2007 by Matt

Loading data into Oracle table requires the use of the sqlldr executable. To load data I create two files, one a CSV file containing the data to import and a control (.ctl) file containing the command information to pass to sqlldr.exe.

The Control File

load data
infile 'addresses.csv'
 
INTO TABLE myschema.mytable fields terminated BY "," 
         optionally enclosed BY '"'
(
    NAME
    ,TELEPHONE
    ,ADDRESS
    ,LAST_UPDT DATE 'dd-Mon-yyyy HH:MI:SS PM'
)

Notice that I’ve put a format on the date, I’ve had problems with dates if I don’t give the format for the date when importing. Save this file locally as addresses.ctl

The Data File

"Matt","3094785","55 My Street","25-Oct-07"
"Ricardo","354102","12 Easy Road","10-Mar-06"
........

Save this file as addresses.csv as declared in the control file. The file should be sve in the same directory as the control file.

To import the data, open a command prompt window and type the following:

c:\path\to\oracle\bin\sqlldr  username@oracleservername 
                        control=\path\to\addresses.ctl

That should import all the data into oracle. A relevant log file will be created as well as a bad file for rows that could not be imported. I tend to create a batch file to execute so I don’t have to remember the syntax for sqlldr.

If things go wrong

As stated above, I’ve had problems with date formatting before when importing. I’ve also come across issues with field terminations. By default CSV exports tend to be terminated by a comma (,) but I tend to use a semi colon (;) I’ve had less problems using this method.

Posted in Oracle | No Comments »

Exporting Crystal Reports from the web.

October 23rd, 2007 by Matt

Exporting Crystal Reports from a report displayed in the browser can be a pain, not least because it’s long winded, but also that I primarily use Firefox and the report rendering in anything other than IE is a joke.

For a while I have been trying to work out how I could export Crystal Reports in various formats such as Excel and PDF without having to render the report in the web browser first. Some of our customers wanted the data to put into their spreadsheet application so they could manipulate the data to their hearts content and I wanted to still use the power of Crystal Reports as it meant that the people who are good at writing the reports could do it and save me the work.

I’d seen it done in Crystal 8 but had not seen anything that pulled it all together in XI. I think I was looking a little too hard, the solution was in fact pretty straight forward.

The method employed is pretty similar to the post I made on displaying Crystal Reports in the browser, with only a couple of exceptions.

Firstly, you don’t need to employ the ReportViewer control as the report is not being rendered to the browser.

// Declare variables
private ReportDocument document1 = new ReportDocument();
private TableLogOnInfos infos1 = new TableLogOnInfos();
private TableLogOnInfo info2 = new TableLogOnInfo();
private ConnectionInfo info1 = new ConnectionInfo();
 
//  default export type
ExportFormatType expFormat = new ExportFormatType();
expFormat = ExportFormatType.PortableDocFormat;
 
// load the report
document1.Load(Request.PhysicalApplicationPath + “myReport.rpt);
 
// Add the parameters
document1.SetParameterValue(“param1″, “value1″);
document1.SetParameterValue(“param2″, “value2″);
 
//Set the login info for the database
info1.ServerName = ConfigurationSettings.AppSettings[“server_name”];
info1.DatabaseName = ConfigurationSettings.AppSettings[“database_name”];
info1.UserID = ConfigurationSettings.AppSettings[“user_id”];
info1.Password = ConfigurationSettings.AppSettings[“password”];
Tables tables1 = document1.Database.Tables;
 
//Apply login info to the report
foreach (CrystalDecisions.CrystalReports.Engine.Table table1 in tables1)
{
    info2 = table1.LogOnInfo;
    info2.ConnectionInfo = info1;
    table1.ApplyLogOnInfo(info2);
}
 
// Export the document
HttpResponse Response = HttpContext.Current.Response;
document1.ExportToHttpResponse(expFormat,Response,true,”Exported Report”);
document1.Close();

Posted in Web Development | No Comments »

Displaying Crystal Reports in a Web Browser

October 23rd, 2007 by Matt

Having tried for a while to find the right information for displaying Crystal Reports properly inside a web page using Crystal Report Viewer I finally managed to pull the information together into a solution that works; well for me anyway.

It’s worth mentioning that I don’t use the Crystal Reports extensions for Visual Studio, I have Crystal Server running on the box. I can’t see how this method wouldn’t work through the Visual Studio extensions.

Code Infront

Register the assembly in the top of your aspx page

<%@ Register TagPrefix="cr" Namespace="CrystalDecisions.Web" 
Assembly="CrystalDecisions.Web, Version=11.0.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" %>

Place the control where you want it to appear in the page.

<cr:crystalreportviewer id="crReport1" runat="server" hasviewlist="False"
    hastogglegrouptreebutton="False" hassearchbutton="False"
    hasgotopagebutton="False" hasdrillupbutton="False" hascrystallogo="False"
    autodatabind="true" width="350px" displaygrouptree="False"
    height="50px" hyperlinktarget="_blank">

Code Behind

// declare the variables
protected CrystalReportViewer crReport1;
private ReportDocument document1 = new ReportDocument();
private TableLogOnInfos infos1 = new TableLogOnInfos();
private TableLogOnInfo info2 = new TableLogOnInfo();
private ConnectionInfo info1 = new ConnectionInfo();
 
// load the report
document1.Load(Request.PhysicalApplicationPath + "myReport.rpt");
 
// Add the parameters
document1.SetParameterValue("param1", "value1");
document1.SetParameterValue("param2", "value2");
 
//Set the login info for the database
info1.ServerName = ConfigurationSettings.AppSettings["server_name"];
info1.DatabaseName = ConfigurationSettings.AppSettings["database_name"];
info1.UserID = ConfigurationSettings.AppSettings["user_id"];
info1.Password = ConfigurationSettings.AppSettings["password"];
Tables tables1 = document1.Database.Tables;
 
//Apply login info to the report
foreach (CrystalDecisions.CrystalReports.Engine.Table table1 in tables1)
{
    info2 = table1.LogOnInfo;
    info2.ConnectionInfo = info1;
    table1.ApplyLogOnInfo(info2);
}
 
// Bind the report
crReport1.ReportSource = document1;
crReport1.DataBind();

You also need to remember to close the document after it has been rendered to free up memory. This should ideally be done in the Page_Unload method. See this post on MSDN for more information on why it should be placed in Page_Unload.

Posted in Web Development | No Comments »

Subversion Server Installation on Windows

October 13th, 2007 by Matt

Update: While I was copying this post across from the original document I had it in, I was searching for the links to the files and I came across a post on THECRUMB.COM which states from subversion 1.4 whereby you can install the service without the need for a wrapper. You can bypass those steps if you like.

I’ve used Subversion for years and didn’t really want to move to Visual SourceSafe. Subversion does everything I need it to and I’ve never felt the need to move and be locked in to anything else. Unfortunately running windows meant I needed to find a way of installing Subversion on a windows box and running it as a server, I didn’t want to run Apache just for the sake of it. So here it is, my install technique for installing, running and managing repositories on Windows. One point to make, is that this guide uses Tortoise SVN to manage the repository. I could probably have done it just as easily from the command line but I have Tortoise installed so why make life hard.

  1. Download and install the latest version of SVN setup.
  2. Create a directory on the c: drive to hold the repository (i.e c:\svnrepo)
  3. Extract SVNService.exe to the same directory as svnserve.exe
  4. Install SVNService as a service using the following command SVNService -install -d -r c:\svnrepo
  5. Start the service from Windows Manage Computer

Creating a repository

  1. Create folder inside your SVN Repository (c:\svnrepo) in this example we’ll create folder called test.
  2. Create a temporary drive locally containing 3 folders; trunk, branches, tags
  3. Right click on the parent folder and got to TortoiseSVN > Import
  4. In the URL box at the top enter the path to the repository, i.e. svn://<server>/test
  5. This will import the 3 folders into the chosen repository.

Adding a Project to a repository

If you already have some files for a project that you have started that you wish to import into your new repository, please follow these steps.

  1. Browse to the parent folder of the files you wish to install.
  2. Right click this folder and choose TortoiseSVN > Import.
  3. This time we want to import the file into the main trunk, so the path to the repository will be svn://<server>/test/trunk

Checking out the repository.

Now we have the project imported into SVN we need to check out a local copy to work on.

  1. Browse to the parent directory of where you want to checkout the project to.
  2. Right click and choose SVN Checkout
  3. This will bring up the Checkout window. Enter the URL of the Repository in the top box (remember we want to checkout the trunk so this needs to go at the end). The checkout directory will default to the directory we clicked in 2, add the name of the subdirectory you wish to check the files out to at the end.
  4. Click OK, if the directory you specified does not exist you will be prompted to create the directory, do so.
  5. All the files will be checked out into the folder you specified. There will also be hidden folders beginning with .svn created in the directories, DO NOT delete these as they are used by Subversion. You can now work on your local copy.

Posted in Technology, Web Development | No Comments »

MOSS 2007 Web Part Deployment using Visual Studio Extensions

October 5th, 2007 by Matt

I started having problems when deploying web parts from Visual Studio to a test environment. Visual Studio was sat on the Sharepoint server but and Web Parts had been deploying fine forever and a day. One day however, I kept getting deployment errors. The solution built fine but when I tried to deploy I kept getting the error “Object reference not set to an instance of an object.”

I eventually found the solution on Mark Arend’s MSDN blog.

It works, it’s a pain in the backside but it works. I still haven’t found anywhere that describes what causes the problem, although I do recall seeing somewhere which said it was a problem with Visual Studio rather than Sharepoint.

Update: 02/11/2007

I actually found an easier was of updating the webparts once deployed. I was looking through some Microsoft docs for something else and came across the following paragraph in one of the Sharepoint tutorials.

After you install a Web Part to either the global assembly cache or a virtual server’s bin folder, you can usually install new versions simply by dragging the .dll file into the same folder as its predecessor. However, this won’t work if you’ve changed the file’s name, version number, or strong key signature.

You have to use something like mscorcfg.msc if you have deployed the webparts to GAC but once the dll has been copied across, restart IIS and it works fine.

I’m not sure I’d advocate the use of this method in a production environment but it seems to work fine for development.

Posted in Sharepoint | No Comments »

Shotting Calculator

August 28th, 2007 by Matt

Instructions:

  • Use the tabs to navigate across the different shot types.
  • The up/down arrows will increment/decrement the amount of each type.
  • Totals will be displayed at the bottom.
  • Use the reset button to reset all amount to zero

The new Preston Stotz weigh roughly the same as normal shot in their respective sizes.

Styl Leads

incrementdecrement
incrementdecrement
incrementdecrement
incrementdecrement
incrementdecrement
incrementdecrement
incrementdecrement
incrementdecrement
incrementdecrement
incrementdecrement

Shot 1

incrementdecrement
incrementdecrement
incrementdecrement
incrementdecrement
incrementdecrement
incrementdecrement

Shot 2

incrementdecrement
incrementdecrement
incrementdecrement
incrementdecrement
incrementdecrement
incrementdecrement

Total Weight (gr):
reset

Pocket PC version

I created a Pocket PC version originally so I could use it on my Orange M500. I’ve since used it on devices running Windows Mobile 5 & 6 and it works fine. Please feel free to download and use as you wish. I originally posted a reference to this on my fishing blog.

I would welcome any feedback, especially any recommendations for future developments.

Download

Download Pocket PC version exe. To install, copy the the exe file to your phone and run.

CAB Install File. To Install, copy the cab file to your phone and install.

Posted in Fishing | 12 Comments »

« Previous Entries